aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/index.js
diff options
context:
space:
mode:
authorBruno <brunobar79@gmail.com>2018-05-31 10:27:33 +0800
committerBruno <brunobar79@gmail.com>2018-05-31 10:27:33 +0800
commitde9672726833e26ea96d198c0d9f1464015614f5 (patch)
tree5a213d4ff8269fe52c9e561fe8da6fefb4e03d09 /app/scripts/controllers/transactions/index.js
parent3dd58463caef98c2cc1f068931624795a43912db (diff)
parent39d22a4ddb4ba0f4ad456009c86486a433c6724e (diff)
downloadtangerine-wallet-browser-de9672726833e26ea96d198c0d9f1464015614f5.tar.gz
tangerine-wallet-browser-de9672726833e26ea96d198c0d9f1464015614f5.tar.zst
tangerine-wallet-browser-de9672726833e26ea96d198c0d9f1464015614f5.zip
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'app/scripts/controllers/transactions/index.js')
-rw-r--r--app/scripts/controllers/transactions/index.js23
1 files changed, 5 insertions, 18 deletions
diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js
index 3886db104..aff5db984 100644
--- a/app/scripts/controllers/transactions/index.js
+++ b/app/scripts/controllers/transactions/index.js
@@ -8,6 +8,7 @@ const TxGasUtil = require('./tx-gas-utils')
const PendingTransactionTracker = require('./pending-tx-tracker')
const NonceTracker = require('./nonce-tracker')
const txUtils = require('./lib/util')
+const cleanErrorStack = require('../../lib/cleanErrorStack')
const log = require('loglevel')
/**
@@ -112,27 +113,13 @@ class TransactionController extends EventEmitter {
}
/**
- Check if a txMeta in the list with the same nonce has been confirmed in a block
- if the txParams dont have a nonce will return false
- @returns {boolean} whether the nonce has been used in a transaction confirmed in a block
- @param {object} txMeta - the txMeta object
- */
- async isNonceTaken (txMeta) {
- const { from, nonce } = txMeta.txParams
- if ('nonce' in txMeta.txParams) {
- const sameNonceTxList = this.txStateManager.getFilteredTxList({from, nonce, status: 'confirmed'})
- return (sameNonceTxList.length >= 1)
- }
- return false
- }
-
- /**
add a new unapproved transaction to the pipeline
@returns {Promise<string>} the hash of the transaction after being submitted to the network
@param txParams {object} - txParams for the transaction
@param opts {object} - with the key origin to put the origin on the txMeta
*/
+
async newUnapprovedTransaction (txParams, opts = {}) {
log.debug(`MetaMaskController newUnapprovedTransaction ${JSON.stringify(txParams)}`)
const initialTxMeta = await this.addUnapprovedTransaction(txParams)
@@ -145,11 +132,11 @@ class TransactionController extends EventEmitter {
case 'submitted':
return resolve(finishedTxMeta.hash)
case 'rejected':
- return reject(new Error('MetaMask Tx Signature: User denied transaction signature.'))
+ return reject(cleanErrorStack(new Error('MetaMask Tx Signature: User denied transaction signature.')))
case 'failed':
- return reject(new Error(finishedTxMeta.err.message))
+ return reject(cleanErrorStack(new Error(finishedTxMeta.err.message)))
default:
- return reject(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`))
+ return reject(cleanErrorStack(new Error(`MetaMask Tx Signature: Unknown problem: ${JSON.stringify(finishedTxMeta.txParams)}`)))
}
})
})