Add hex-prefix to gas estimate result

feature/default_network_editable
Alexander Tseung 7 years ago
parent 299abee666
commit 1b9ed23752
  1. 4
      ui/app/components/send_/send.utils.js
  2. 4
      ui/app/components/send_/tests/send-utils.test.js

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

@ -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 () => {

Loading…
Cancel
Save