1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Add hex-prefix to gas estimate result

This commit is contained in:
Alexander Tseung 2018-06-14 14:04:14 -07:00
parent 299abee666
commit 1b9ed23752
2 changed files with 4 additions and 4 deletions

View File

@ -201,12 +201,12 @@ async function estimateGas ({ selectedAddress, selectedToken, blockGasLimit, to,
err.message.includes('gas required exceeds allowance or always failing transaction')
)
if (simulationFailed) {
return resolve(paramsForGasEstimate.gas)
return resolve(ethUtil.addHexPrefix(paramsForGasEstimate.gas))
} else {
return reject(err)
}
}
return resolve(estimatedGas.toString(16))
return resolve(ethUtil.addHexPrefix(estimatedGas.toString(16)))
})
})
}

View File

@ -285,7 +285,7 @@ describe('send utils', () => {
baseMockParams.estimateGasMethod.getCall(0).args[0],
Object.assign({ gasPrice: undefined, value: undefined }, baseExpectedCall)
)
assert.equal(result, 'mockToString:16')
assert.equal(result, '0xmockToString:16')
})
it('should call ethQuery.estimateGas with a value of 0x0 and the expected data and to if passed a selectedToken', async () => {
@ -300,7 +300,7 @@ describe('send utils', () => {
to: 'mockAddress',
})
)
assert.equal(result, 'mockToString:16')
assert.equal(result, '0xmockToString:16')
})
it(`should return ${SIMPLE_GAS_COST} if ethQuery.getCode does not return '0x'`, async () => {