1
0
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:
Dan 2018-06-04 15:50:52 -02:30
parent ffd42c59da
commit ada59054c9

View File

@ -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