diff --git a/packages/boba/gateway/src/actions/createAction.js b/packages/boba/gateway/src/actions/createAction.js index 64f626585a..6b7780e0bc 100644 --- a/packages/boba/gateway/src/actions/createAction.js +++ b/packages/boba/gateway/src/actions/createAction.js @@ -28,7 +28,7 @@ export function createAction (key, asyncAction) { return false } - if(response && typeof(response) === 'string' && response.includes('execution reverted: ERC20Permit')) { + if(response && typeof(response) === 'string' && response?.includes('execution reverted: ERC20Permit')) { let errorMessage = JSON.parse(response) dispatch({ type: `UI/ERROR/UPDATE`, payload: errorMessage.error.message }) dispatch({ type: `${key}/ERROR` }) @@ -36,7 +36,7 @@ export function createAction (key, asyncAction) { return false } - if(response && typeof(response) === 'string' && response.includes('Insufficient balance')) { + if(response && typeof(response) === 'string' && response?.includes('Insufficient balance')) { //let errorMessage = JSON.parse(response) dispatch({ type: `UI/ERROR/UPDATE`, payload: "Insufficient BOBA balance for emergency swap" }) dispatch({ type: `${key}/ERROR` }) @@ -59,24 +59,24 @@ export function createAction (key, asyncAction) { errorMessage = 'MetaMask: Transaction was rejected by user - signature denied' } // No internet case - throw up a banner - else if(response.hasOwnProperty('reason') && response.reason.includes('could not detect network')) { + else if(response.hasOwnProperty('reason') && response?.reason?.includes('could not detect network')) { console.log("Gateway error: No network") errorMessage = 'Gateway: No internet' } // ethers error - else if(response.hasOwnProperty('reason') && response.reason.includes('missing revert data in call exception')) { + else if(response.hasOwnProperty('reason') && response.reason?.includes('missing revert data in call exception')) { console.log("Slow network or rate throttling - code 1") // intercept error return false } // ethers error - else if(response.hasOwnProperty('reason') && response.reason.includes('resolver or addr is not configured for ENS name')) { + else if(response.hasOwnProperty('reason') && response.reason?.includes('resolver or addr is not configured for ENS name')) { console.log("Slow network or rate throttling - code 2") // intercept error return false } // ethers error - else if(response.hasOwnProperty('reason') && response.reason.includes('missing response')) { + else if(response.hasOwnProperty('reason') && response.reason?.includes('missing response')) { console.log("Slow network or rate throttling - code 3") // intercept error return false @@ -92,7 +92,8 @@ export function createAction (key, asyncAction) { return response || true } catch (error) { - console.log("Unhandled error RAW:", {error, key, asyncAction}) + console.log("Unhandled error RAW:", { error, key, asyncAction }) + Sentry.captureException(error); return false } diff --git a/packages/boba/gateway/src/components/mainMenu/gasSwitcher/GasSwitcher.js b/packages/boba/gateway/src/components/mainMenu/gasSwitcher/GasSwitcher.js index 58854b0d61..223c15690b 100644 --- a/packages/boba/gateway/src/components/mainMenu/gasSwitcher/GasSwitcher.js +++ b/packages/boba/gateway/src/components/mainMenu/gasSwitcher/GasSwitcher.js @@ -36,14 +36,18 @@ function GasSwitcher() { useEffect(() => { if (baseEnabled) { dispatch(fetchGas()) - dispatch(fetchVerifierStatus()) + if(networkService.networkGateway === NETWORK.ETHEREUM) { + dispatch(fetchVerifierStatus()) + } } }, [ networkName, baseEnabled , dispatch]) useInterval(() => { if (baseEnabled) { dispatch(fetchGas()) - dispatch(fetchVerifierStatus()) + if(networkService.networkGateway === NETWORK.ETHEREUM) { + dispatch(fetchVerifierStatus()) + } } }, GAS_POLL_INTERVAL) diff --git a/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js b/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js index a535d35768..9fb474e92a 100644 --- a/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js +++ b/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js @@ -52,7 +52,7 @@ import truncate from 'truncate-middle' import { setEnableAccount, setWalletAddress } from 'actions/setupAction' -import { fetchTransactions, fetchBalances } from 'actions/networkAction' +import { fetchTransactions } from 'actions/networkAction' import { closeModal, openModal } from 'actions/uiAction' import Button from 'components/button/Button.js' @@ -113,7 +113,6 @@ function LayerSwitcher({ visisble = true, isButton = false }) { dispatch(setEnableAccount(true)) dispatch(setWalletAddress(networkService.account)) dispatch(fetchTransactions()) - dispatch(fetchBalances()) return true } else { return false diff --git a/packages/boba/gateway/src/containers/devtools/TxBuilder.js b/packages/boba/gateway/src/containers/devtools/TxBuilder.js index 11b44a80b1..e78d23a01d 100644 --- a/packages/boba/gateway/src/containers/devtools/TxBuilder.js +++ b/packages/boba/gateway/src/containers/devtools/TxBuilder.js @@ -23,7 +23,6 @@ const TxBuilder = () => { const TxBuilderResult = useSelector(selectTxBuilder, shallowEqual) const networkLayer = useSelector(selectLayer()) - const blockExplorerUrl = networkService.networkConfig.L2.blockExplorer const [ contractAddress, setContractAddress ] = useState('') const [ contractABI, setContractABI ] = useState('') const [ contractMethos, setContractMethods ] = useState([]) @@ -86,6 +85,12 @@ const TxBuilder = () => { dispatch(resetTxBuilder()) } + const viewTx = (txResult) => { + const blockExplorerUrl = networkService.networkConfig['L2'].blockExplorer + const url = `${blockExplorerUrl}tx/${txResult.transactionHash}` + window.open(url, '_blank', 'noopener,noreferrer') + } + const submitTx = async (methodIndex) => { const method = contractMethos[methodIndex] const methodName = method.key @@ -119,10 +124,6 @@ const TxBuilder = () => { dispatch(submitTxBuilder(contract, methodIndex, methodName, inputs)) } - const openInNewTab = url => { - window.open(url, '_blank', 'noopener,noreferrer'); - }; - return ( @@ -209,7 +210,7 @@ const TxBuilder = () => { Succeeded!