diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/_locales/en/messages.json | 57 | ||||
-rw-r--r-- | app/scripts/controllers/transactions/index.js | 23 | ||||
-rw-r--r-- | app/scripts/metamask-controller.js | 7 |
3 files changed, 87 insertions, 0 deletions
diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index 0fe8e81cd..d23de5fa0 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -65,6 +65,9 @@ "address": { "message": "Address" }, + "advancedOptions": { + "message": "Advanced Options" + }, "addCustomToken": { "message": "Add custom token" }, @@ -80,12 +83,18 @@ "addAcquiredTokens": { "message": "Add the tokens you've acquired using MetaMask" }, + "advanced": { + "message": "Advanced" + }, "amount": { "message": "Amount" }, "amountPlusGas": { "message": "Amount + Gas" }, + "amountPlusTxFee": { + "message": "Amount + TX Fee" + }, "appDescription": { "message": "Ethereum Browser Extension", "description": "The description of the application" @@ -115,6 +124,9 @@ "available": { "message": "Available" }, + "average": { + "message": "Average" + }, "back": { "message": "Back" }, @@ -127,6 +139,9 @@ "balanceIsInsufficientGas": { "message": "Insufficient balance for current gas total" }, + "basic": { + "message": "Basic" + }, "beta": { "message": "BETA" }, @@ -303,6 +318,9 @@ "customGas": { "message": "Customize Gas" }, + "customGasSubTitle": { + "message": "Increasing fee may decrease processing times, but it is not guaranteed." + }, "customToken": { "message": "Custom Token" }, @@ -427,6 +445,15 @@ "failed": { "message": "Failed" }, + "fast": { + "message": "Fast" + }, + "fastest": { + "message": "Fastest" + }, + "feeChartTitle": { + "message": "Live Transaction Fee Predictions" + }, "fiat": { "message": "Fiat", "description": "Exchange type" @@ -481,6 +508,9 @@ "gasPrice": { "message": "Gas Price (GWEI)" }, + "gasPriceNoDenom": { + "message": "Gas Price" + }, "gasPriceCalculation": { "message": "We calculate the suggested gas prices based on network success rates." }, @@ -689,6 +719,9 @@ "missingYourTokens": { "message": "Don't see your tokens?" }, + "minutesShorthand": { + "message": "Min" + }, "myAccounts": { "message": "My Accounts" }, @@ -755,6 +788,12 @@ "optionalNickname": { "message": "Nickname (optional)" }, + "newTotal": { + "message": "New Total" + }, + "newTransactionFee": { + "message": "New Transaction Fee" + }, "next": { "message": "Next" }, @@ -820,6 +859,9 @@ "parameters": { "message": "Parameters" }, + "originalTotal": { + "message": "Original Total" + }, "password": { "message": "Password" }, @@ -993,6 +1035,9 @@ "save": { "message": "Save" }, + "slow": { + "message": "Slow" + }, "saveAsCsvFile": { "message": "Save as CSV File" }, @@ -1018,6 +1063,9 @@ "secretPhrase": { "message": "Enter your secret twelve word phrase here to restore your vault." }, + "secondsShorthand": { + "message": "Sec" + }, "seedPhraseReq": { "message": "Seed phrases are 12 words long" }, @@ -1039,6 +1087,9 @@ "send": { "message": "Send" }, + "sendAmount": { + "message": "Send Amount" + }, "sendETH": { "message": "Send ETH" }, @@ -1244,12 +1295,18 @@ "transactionErrorNoContract": { "message": "Trying to call a function on a non-contract address." }, + "transactionFee": { + "message": "Transaction Fee" + }, "transactionMemo": { "message": "Transaction memo (optional)" }, "transactionNumber": { "message": "Transaction Number" }, + "transactionTime": { + "message": "Transaction Time" + }, "transfer": { "message": "Transfer" }, diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 9cd8429fb..f530fbd22 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -290,6 +290,29 @@ class TransactionController extends EventEmitter { return newTxMeta } + async createSpeedUpTransaction (originalTxId, customGasPrice) { + const originalTxMeta = this.txStateManager.getTx(originalTxId) + const { txParams } = originalTxMeta + const { gasPrice: lastGasPrice } = txParams + + const newGasPrice = customGasPrice || bnToHex(BnMultiplyByFraction(hexToBn(lastGasPrice), 11, 10)) + + const newTxMeta = this.txStateManager.generateTxMeta({ + txParams: { + ...txParams, + gasPrice: newGasPrice, + }, + lastGasPrice, + loadingDefaults: false, + status: TRANSACTION_STATUS_APPROVED, + type: TRANSACTION_TYPE_RETRY, + }) + + this.addTx(newTxMeta) + await this.approveTransaction(newTxMeta.id) + return newTxMeta + } + /** updates the txMeta in the txStateManager @param txMeta {Object} - the updated txMeta diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index fe806e47e..d382b1ad0 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -445,6 +445,7 @@ module.exports = class MetamaskController extends EventEmitter { updateAndApproveTransaction: nodeify(txController.updateAndApproveTransaction, txController), retryTransaction: nodeify(this.retryTransaction, this), createCancelTransaction: nodeify(this.createCancelTransaction, this), + createSpeedUpTransaction: nodeify(this.createSpeedUpTransaction, this), getFilteredTxList: nodeify(txController.getFilteredTxList, txController), isNonceTaken: nodeify(txController.isNonceTaken, txController), estimateGas: nodeify(this.estimateGas, this), @@ -1162,6 +1163,12 @@ module.exports = class MetamaskController extends EventEmitter { return state } + async createSpeedUpTransaction (originalTxId, customGasPrice, cb) { + await this.txController.createSpeedUpTransaction(originalTxId, customGasPrice) + const state = await this.getState() + return state + } + estimateGas (estimateGasParams) { return new Promise((resolve, reject) => { return this.txController.txGasUtil.query.estimateGas(estimateGasParams, (err, res) => { |