diff --git a/packages/boba/gateway/src/actions/createAction.js b/packages/boba/gateway/src/actions/createAction.js index 1dac17d62b..dd536424c3 100644 --- a/packages/boba/gateway/src/actions/createAction.js +++ b/packages/boba/gateway/src/actions/createAction.js @@ -33,6 +33,13 @@ export function createAction (key, asyncAction) { return false } + 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` }) + return false + } + //deal with metamask errors - they will have a 'code' field so we can detect those if(response && response.hasOwnProperty('message') && response.hasOwnProperty('code')) { diff --git a/packages/boba/gateway/src/containers/wallet/Wallet.js b/packages/boba/gateway/src/containers/wallet/Wallet.js index 6e45020ac0..5ca6773ba6 100644 --- a/packages/boba/gateway/src/containers/wallet/Wallet.js +++ b/packages/boba/gateway/src/containers/wallet/Wallet.js @@ -115,6 +115,7 @@ function Wallet() { async function emergencySwap () { const res = await dispatch(getETHMetaTransaction()) + console.log("emergencySwap - res:",res) if (res) dispatch(openAlert('Emergency Swap submitted')) } @@ -129,7 +130,7 @@ function Wallet() { /> {layer === 'L2' && tooSmallETH && - +