|
|
@ -128,7 +128,7 @@ module.exports = class TransactionManager extends EventEmitter { |
|
|
|
|
|
|
|
|
|
|
|
approveTransaction (txId, cb = warn) { |
|
|
|
approveTransaction (txId, cb = warn) { |
|
|
|
this.setTxStatusSigned(txId) |
|
|
|
this.setTxStatusSigned(txId) |
|
|
|
cb() |
|
|
|
this.once(`${txId}:signingComplete`, cb) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
cancelTransaction (txId, cb = warn) { |
|
|
|
cancelTransaction (txId, cb = warn) { |
|
|
@ -137,7 +137,7 @@ module.exports = class TransactionManager extends EventEmitter { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// formats txParams so the keyringController can sign it
|
|
|
|
// formats txParams so the keyringController can sign it
|
|
|
|
formatTxForSigining (txParams, cb) { |
|
|
|
formatTxForSigining (txParams) { |
|
|
|
var address = txParams.from |
|
|
|
var address = txParams.from |
|
|
|
var metaTx = this.getTx(txParams.metamaskId) |
|
|
|
var metaTx = this.getTx(txParams.metamaskId) |
|
|
|
var gasMultiplier = metaTx.gasMultiplier |
|
|
|
var gasMultiplier = metaTx.gasMultiplier |
|
|
@ -153,9 +153,8 @@ module.exports = class TransactionManager extends EventEmitter { |
|
|
|
txParams.gasLimit = normalize(txParams.gasLimit || txParams.gas) |
|
|
|
txParams.gasLimit = normalize(txParams.gasLimit || txParams.gas) |
|
|
|
txParams.nonce = normalize(txParams.nonce) |
|
|
|
txParams.nonce = normalize(txParams.nonce) |
|
|
|
const ethTx = new Transaction(txParams) |
|
|
|
const ethTx = new Transaction(txParams) |
|
|
|
|
|
|
|
var txId = txParams.metamaskId |
|
|
|
// listener is assigned in metamaskController
|
|
|
|
return Promise.resolve({ethTx, address, txId}) |
|
|
|
this.emit(`${txParams.metamaskId}:formatted`, ethTx, address, txParams.metamaskId, cb) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// receives a signed tx object and updates the tx hash
|
|
|
|
// receives a signed tx object and updates the tx hash
|
|
|
@ -167,7 +166,8 @@ module.exports = class TransactionManager extends EventEmitter { |
|
|
|
metaTx.hash = txHash |
|
|
|
metaTx.hash = txHash |
|
|
|
this.updateTx(metaTx) |
|
|
|
this.updateTx(metaTx) |
|
|
|
var rawTx = ethUtil.bufferToHex(tx.serialize()) |
|
|
|
var rawTx = ethUtil.bufferToHex(tx.serialize()) |
|
|
|
cb(null, rawTx) |
|
|
|
return Promise.resolve(rawTx) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
/* |
|
|
|