diff --git a/src/ui/views/SendToken/index.tsx b/src/ui/views/SendToken/index.tsx index 1af6e9a0309..5fae49896d0 100644 --- a/src/ui/views/SendToken/index.tsx +++ b/src/ui/views/SendToken/index.tsx @@ -18,8 +18,6 @@ import { KEYRING_CLASS, MINIMUM_GAS_LIMIT, CAN_ESTIMATE_L1_FEE_CHAINS, - ARB_LIKE_L2_CHAINS, - L2_ENUMS, } from 'consts'; import { useRabbyDispatch, useRabbySelector, connectStore } from 'ui/store'; import { Account, ChainGas } from 'background/service/preference'; @@ -579,9 +577,6 @@ const SendToken = () => { } params.value = `0x${sendValue.toString(16)}`; - const noEstimateGasRequired = - !ARB_LIKE_L2_CHAINS.includes(chain.enum) && - !L2_ENUMS.includes(chain.enum); try { const code = await wallet.requestETHRpc( @@ -591,23 +586,18 @@ const SendToken = () => { }, chain.serverId ); + const isContract = !!code && !(code === '0x' || code === '0x0'); /** * we dont' need always fetch estimateGas, if no `params.gas` set below, * `params.gas` would be filled on Tx Page. */ - if (chain.needEstimateGas && estimateGas > 0) { + if (estimateGas > 0 && (chain.needEstimateGas || isContract)) { params.gas = intToHex(estimateGas); - } else if ( - code && - (code === '0x' || code === '0x0') && - noEstimateGasRequired - ) { + } else if (!isContract) { params.gas = intToHex(21000); // L2 has extra validation fee so can not set gasLimit as 21000 when send native token } } catch (e) { - if (noEstimateGasRequired) { - params.gas = intToHex(21000); // L2 has extra validation fee so can not set gasLimit as 21000 when send native token - } + params.gas = intToHex(21000); } if ( isShowMessageDataForToken &&