use bignumber, previously in pullrequest #1174

pull/1269/head^2
yann300 4 years ago committed by Liana Husikyan
parent 174dcb4cea
commit 1ba72b05a6
  1. 12
      libs/remix-lib/src/execution/txRunnerVM.ts

@ -60,7 +60,17 @@ export class TxRunnerVM {
this.getVMObject().stateManager.getAccount(Address.fromString(from)).then((res) => { this.getVMObject().stateManager.getAccount(Address.fromString(from)).then((res) => {
// See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor // See https://github.com/ethereumjs/ethereumjs-tx/blob/master/docs/classes/transaction.md#constructor
// for initialization fields and their types // for initialization fields and their types
value = value ? parseInt(value) : 0 if (!value) value = 0
if (typeof value === 'string') {
if (value.startsWith('0x')) value = new BN(value.replace('0x', ''), 'hex')
else {
try {
value = new BN(value, 10)
} catch (e) {
return callback('Unable to parse the value ' + e.message)
}
}
}
const tx = Transaction.fromTxData({ const tx = Transaction.fromTxData({
nonce: new BN(res.nonce), nonce: new BN(res.nonce),
gasPrice: '0x1', gasPrice: '0x1',

Loading…
Cancel
Save