mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Simplify recipient code check in send.utils estimateGas
This commit is contained in:
parent
ffd42c59da
commit
ada59054c9
@ -176,10 +176,11 @@ async function estimateGas ({ selectedAddress, selectedToken, blockGasLimit, to,
|
||||
|
||||
// if recipient has no code, gas is 21k max:
|
||||
const hasRecipient = Boolean(to)
|
||||
let code
|
||||
if (hasRecipient) code = await global.eth.getCode(to)
|
||||
if (hasRecipient && (!code || code === '0x') && !selectedToken) {
|
||||
return SIMPLE_GAS_COST
|
||||
if (hasRecipient && !selectedToken) {
|
||||
const code = await global.eth.getCode(to)
|
||||
if (!code || code === '0x') {
|
||||
return SIMPLE_GAS_COST
|
||||
}
|
||||
}
|
||||
|
||||
paramsForGasEstimate.to = selectedToken ? selectedToken.address : to
|
||||
|
Loading…
Reference in New Issue
Block a user