diff options
author | kumavis <kumavis@users.noreply.github.com> | 2018-04-03 01:47:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-03 01:47:24 +0800 |
commit | 6d5f1392a529c5c809d416aaebc6e3424ee55ae1 (patch) | |
tree | 7feb008f31933a579a4a9bdeb42e22c99d78597a /app/scripts/controllers | |
parent | 812a06ffcd9cea39453e8a59563bf1d12e17c065 (diff) | |
parent | 69a867b4a420acd4b4354aab2cc4051736a778cb (diff) | |
download | tangerine-wallet-browser-6d5f1392a529c5c809d416aaebc6e3424ee55ae1.tar tangerine-wallet-browser-6d5f1392a529c5c809d416aaebc6e3424ee55ae1.tar.gz tangerine-wallet-browser-6d5f1392a529c5c809d416aaebc6e3424ee55ae1.tar.bz2 tangerine-wallet-browser-6d5f1392a529c5c809d416aaebc6e3424ee55ae1.tar.lz tangerine-wallet-browser-6d5f1392a529c5c809d416aaebc6e3424ee55ae1.tar.xz tangerine-wallet-browser-6d5f1392a529c5c809d416aaebc6e3424ee55ae1.tar.zst tangerine-wallet-browser-6d5f1392a529c5c809d416aaebc6e3424ee55ae1.zip |
Merge branch 'master' into i18n-helper
Diffstat (limited to 'app/scripts/controllers')
-rw-r--r-- | app/scripts/controllers/currency.js | 2 | ||||
-rw-r--r-- | app/scripts/controllers/transactions.js | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/app/scripts/controllers/currency.js b/app/scripts/controllers/currency.js index 25a7a942e..930fc52e8 100644 --- a/app/scripts/controllers/currency.js +++ b/app/scripts/controllers/currency.js @@ -52,7 +52,7 @@ class CurrencyController { this.setConversionDate(Number(parsedResponse.timestamp)) }).catch((err) => { if (err) { - console.warn('MetaMask - Failed to query currency conversion.') + console.warn(`MetaMask - Failed to query currency conversion:`, currentCurrency, err) this.setConversionRate(0) this.setConversionDate('N/A') } diff --git a/app/scripts/controllers/transactions.js b/app/scripts/controllers/transactions.js index 3e3909361..a18a2d2e2 100644 --- a/app/scripts/controllers/transactions.js +++ b/app/scripts/controllers/transactions.js @@ -161,9 +161,11 @@ module.exports = class TransactionController extends EventEmitter { this.emit(`${txMeta.id}:unapproved`, txMeta) } - async newUnapprovedTransaction (txParams) { + async newUnapprovedTransaction (txParams, opts = {}) { log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`) const initialTxMeta = await this.addUnapprovedTransaction(txParams) + initialTxMeta.origin = opts.origin + this.txStateManager.updateTx(initialTxMeta, '#newUnapprovedTransaction - adding the origin') // listen for tx completion (success, fail) return new Promise((resolve, reject) => { this.txStateManager.once(`${initialTxMeta.id}:finished`, (finishedTxMeta) => { @@ -250,7 +252,7 @@ module.exports = class TransactionController extends EventEmitter { // wait for a nonce nonceLock = await this.nonceTracker.getNonceLock(fromAddress) // add nonce to txParams - // if txMeta has lastGasPrice then it is a retry at same nonce with higher + // if txMeta has lastGasPrice then it is a retry at same nonce with higher // gas price transaction and their for the nonce should not be calculated const nonce = txMeta.lastGasPrice ? txMeta.txParams.nonce : nonceLock.nextNonce txMeta.txParams.nonce = ethUtil.addHexPrefix(nonce.toString(16)) @@ -273,12 +275,14 @@ module.exports = class TransactionController extends EventEmitter { async signTransaction (txId) { const txMeta = this.txStateManager.getTx(txId) - const txParams = txMeta.txParams - const fromAddress = txParams.from // add network/chain id - txParams.chainId = ethUtil.addHexPrefix(this.getChainId().toString(16)) + const chainId = this.getChainId() + const txParams = Object.assign({}, txMeta.txParams, { chainId }) + // sign tx + const fromAddress = txParams.from const ethTx = new Transaction(txParams) await this.signEthTx(ethTx, fromAddress) + // set state to signed this.txStateManager.setTxStatusSigned(txMeta.id) const rawTx = ethUtil.bufferToHex(ethTx.serialize()) return rawTx |