aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/controllers/transactions/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/controllers/transactions/index.js')
-rw-r--r--app/scripts/controllers/transactions/index.js23
1 files changed, 23 insertions, 0 deletions
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