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:
|
// if recipient has no code, gas is 21k max:
|
||||||
const hasRecipient = Boolean(to)
|
const hasRecipient = Boolean(to)
|
||||||
let code
|
if (hasRecipient && !selectedToken) {
|
||||||
if (hasRecipient) code = await global.eth.getCode(to)
|
const code = await global.eth.getCode(to)
|
||||||
if (hasRecipient && (!code || code === '0x') && !selectedToken) {
|
if (!code || code === '0x') {
|
||||||
return SIMPLE_GAS_COST
|
return SIMPLE_GAS_COST
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
paramsForGasEstimate.to = selectedToken ? selectedToken.address : to
|
paramsForGasEstimate.to = selectedToken ? selectedToken.address : to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user