Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/boba/gateway/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
REACT_APP_INFURA_ID=
REACT_APP_ETHERSCAN_API=
REACT_APP_POLL_INTERVAL=15000
REACT_APP_GAS_POLL_INTERVAL=30000
SKIP_PREFLIGHT_CHECK=true
REACT_APP_WALLET_VERSION=1.0.10
REACT_APP_ENV=dev
Expand Down
1 change: 1 addition & 0 deletions packages/boba/gateway/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ gateway.boba.betwork.
| REACT_APP_GA4_MEASUREMENT_ID | Yes | N/A | Google analytics api key |
| REACT_APP_SENTRY_DSN | Yes | N/A | Sentry DSN url to catch the error on frontend |
| REACT_APP_ENABLE_LOCK_PAGE | No | N/A | to enable the lock page on gateway menu |
| REACT_APP_GAS_POLL_INTERVAL | Yes | 30000 | Poll interval to fetch the gas price and verifier status |
Original file line number Diff line number Diff line change
@@ -1,19 +1,38 @@

import React, { useEffect, useState } from 'react'
import { useDispatch, useSelector } from 'react-redux'

import { useSelector } from 'react-redux'
import * as S from './GasSwitcher.styles.js'

import { selectGas } from 'selectors/balanceSelector'
import { selectVerifierStatus } from 'selectors/verifierSelector'
import { selectBaseEnabled } from 'selectors/setupSelector.js'

import { fetchGas } from 'actions/networkAction.js'
import { fetchVerifierStatus } from 'actions/verifierAction.js'

import networkService from 'services/networkService.js'

function GasSwitcher({ isMobile }) {
import useInterval from 'hooks/useInterval.js'

import { GAS_POLL_INTERVAL } from 'util/constant.js'

function GasSwitcher() {
const dispatch = useDispatch()

const baseEnabled = useSelector(selectBaseEnabled())
const gas = useSelector(selectGas)
const verifierStatus = useSelector(selectVerifierStatus)

const [ savings, setSavings ] = useState(0)

useInterval(() => {
if (baseEnabled) {
dispatch(fetchGas())
dispatch(fetchVerifierStatus())
}
}, GAS_POLL_INTERVAL)

useEffect(() => {
async function getGasSavings() {
if (networkService.networkGateway === 'mainnet') {
Expand All @@ -31,7 +50,6 @@ function GasSwitcher({ isMobile }) {
getGasSavings()
}, [ gas ])

const verifierStatus = useSelector(selectVerifierStatus)

return (
<S.Menu>
Expand Down
7 changes: 1 addition & 6 deletions packages/boba/gateway/src/containers/home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ import {
import { checkVersion } from 'actions/serviceAction'
import { closeAlert, closeError } from 'actions/uiAction'
import { getFS_Saves, getFS_Info } from 'actions/fixedAction'
import { fetchVerifierStatus } from 'actions/verifierAction'

import {
fetchBalances,
fetchGas,
addTokenList,
fetchExits
} from 'actions/networkAction'
Expand Down Expand Up @@ -189,8 +188,6 @@ function Home() {
dispatch(getMonsterInfo()) // account specific
}
if(baseEnabled /*== we only have have Base L1 and L2 providers*/) {
dispatch(fetchGas())
dispatch(fetchVerifierStatus())
dispatch(getProposalThreshold())
dispatch(fetchDaoProposals())
}
Expand All @@ -200,8 +197,6 @@ function Home() {
if (maintenance) return
// load the following functions when the home page is open
checkVersion()
dispatch(fetchGas())
dispatch(fetchVerifierStatus())
dispatch(getProposalThreshold())
}, [ dispatch, maintenance ])

Expand Down
31 changes: 0 additions & 31 deletions packages/boba/gateway/src/reducers/gasReducer.js

This file was deleted.

2 changes: 0 additions & 2 deletions packages/boba/gateway/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import queueReducer from './queueReducer'
import tokenReducer from './tokenReducer'
import nftReducer from './nftReducer'
import feeReducer from './feeReducer'
import gasReducer from './gasReducer'
import uiReducer from './uiReducer'
import setupReducer from './setupReducer'
import notificationReducer from './notificationReducer'
Expand All @@ -53,7 +52,6 @@ const rootReducer = combineReducers({
tokenList: tokenReducer,
nft: nftReducer,
fees: feeReducer,
gas: gasReducer,
ui: uiReducer,
setup: setupReducer,
notification: notificationReducer,
Expand Down
18 changes: 0 additions & 18 deletions packages/boba/gateway/src/selectors/gasSelector.js

This file was deleted.

1 change: 1 addition & 0 deletions packages/boba/gateway/src/util/constant.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import moment from 'moment'
require('dotenv').config()

export const POLL_INTERVAL = process.env.REACT_APP_POLL_INTERVAL || 20000
export const GAS_POLL_INTERVAL = process.env.REACT_APP_GAS_POLL_INTERVAL || 40000
export const GA4_MEASUREMENT_ID = process.env.REACT_APP_GA4_MEASUREMENT_ID || null
export const APP_ENV = process.env.REACT_APP_ENV || 'dev'
export const APP_CHAIN = process.env.REACT_APP_CHAIN
Expand Down