mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
commit
57f6fce6b2
@ -40,7 +40,7 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
this.pendingTxTracker = new PendingTransactionTracker({
|
this.pendingTxTracker = new PendingTransactionTracker({
|
||||||
provider: this.provider,
|
provider: this.provider,
|
||||||
nonceTracker: this.nonceTracker,
|
nonceTracker: this.nonceTracker,
|
||||||
getBalance: async (address) => {
|
getBalance: (address) => {
|
||||||
const account = this.ethStore.getState().accounts[address]
|
const account = this.ethStore.getState().accounts[address]
|
||||||
if (!account) return
|
if (!account) return
|
||||||
return account.balance
|
return account.balance
|
||||||
@ -382,9 +382,12 @@ module.exports = class TransactionController extends EventEmitter {
|
|||||||
this._setTxStatus(txId, 'confirmed')
|
this._setTxStatus(txId, 'confirmed')
|
||||||
}
|
}
|
||||||
|
|
||||||
setTxStatusFailed (txId, reason) {
|
setTxStatusFailed (txId, err) {
|
||||||
const txMeta = this.getTx(txId)
|
const txMeta = this.getTx(txId)
|
||||||
txMeta.err = reason
|
txMeta.err = {
|
||||||
|
message: err.toString(),
|
||||||
|
stack: err.stack,
|
||||||
|
}
|
||||||
this.updateTx(txMeta)
|
this.updateTx(txMeta)
|
||||||
this._setTxStatus(txId, 'failed')
|
this._setTxStatus(txId, 'failed')
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const ethUtil = require('ethereumjs-util')
|
const ethUtil = require('ethereumjs-util')
|
||||||
const BN = ethUtil.BN
|
const assert = require('assert')
|
||||||
|
const BN = require('bn.js')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getStack,
|
getStack,
|
||||||
@ -15,6 +16,10 @@ function getStack () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sufficientBalance (txParams, hexBalance) {
|
function sufficientBalance (txParams, hexBalance) {
|
||||||
|
// validate hexBalance is a hex string
|
||||||
|
assert.equal(typeof hexBalance, 'string', 'sufficientBalance - hexBalance is not a hex string')
|
||||||
|
assert.equal(hexBalance.slice(0, 2), '0x', 'sufficientBalance - hexBalance is not a hex string')
|
||||||
|
|
||||||
const balance = hexToBn(hexBalance)
|
const balance = hexToBn(hexBalance)
|
||||||
const value = hexToBn(txParams.value)
|
const value = hexToBn(txParams.value)
|
||||||
const gasLimit = hexToBn(txParams.gas)
|
const gasLimit = hexToBn(txParams.gas)
|
||||||
|
Loading…
Reference in New Issue
Block a user