diff options
Merge branch 'develop' of github.com:MetaMask/metamask-extension into network-controller-remove-setNetworkEndpoints
Diffstat (limited to 'app/scripts')
-rw-r--r-- | app/scripts/contentscript.js | 1 | ||||
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 15 | ||||
-rw-r--r-- | app/scripts/controllers/transactions/tx-state-manager.js | 2 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 1 |
4 files changed, 18 insertions, 1 deletions
diff --git a/app/scripts/contentscript.js b/app/scripts/contentscript.js index dbf1c6d4c..ddf1a9432 100644 --- a/app/scripts/contentscript.js +++ b/app/scripts/contentscript.js @@ -174,6 +174,7 @@ function blacklistedDomainCheck () { 'uscourts.gov', 'dropbox.com', 'webbyawards.com', + 'cdn.shopify.com/s/javascripts/tricorder/xtld-read-only-frame.html', ] var currentUrl = window.location.href var currentRegex diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 541f1db73..3886db104 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -112,6 +112,21 @@ 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 diff --git a/app/scripts/controllers/transactions/tx-state-manager.js b/app/scripts/controllers/transactions/tx-state-manager.js index 53428c333..380214c1d 100644 --- a/app/scripts/controllers/transactions/tx-state-manager.js +++ b/app/scripts/controllers/transactions/tx-state-manager.js @@ -262,7 +262,7 @@ class TransactionStateManager extends EventEmitter { */ getTxsByMetaData (key, value, txList = this.getTxList()) { return txList.filter((txMeta) => { - if (txMeta.txParams[key]) { + if (key in txMeta.txParams) { return txMeta.txParams[key] === value } else { return txMeta[key] === value diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 67d257fea..a6b5d3453 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -381,6 +381,7 @@ module.exports = class MetamaskController extends EventEmitter { updateTransaction: nodeify(txController.updateTransaction, txController), updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController), retryTransaction: nodeify(this.retryTransaction, this), + isNonceTaken: nodeify(txController.isNonceTaken, txController), // messageManager signMessage: nodeify(this.signMessage, this), |