From 8aacca4a72f50fae2085eb97ef6b689f56fc9bcd Mon Sep 17 00:00:00 2001 From: Vinicius Stevam Date: Wed, 26 Jul 2023 06:47:06 +0100 Subject: [PATCH 1/2] remove updateTransactionEstimatedBaseFee --- app/scripts/controllers/transactions/index.js | 27 ------------------- .../controllers/transactions/index.test.js | 10 ------- 2 files changed, 37 deletions(-) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 0d06fbc991c6..285a82260924 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -557,33 +557,6 @@ export default class TransactionController extends EventEmitter { return this._getTransaction(txId); } - /** - * updates the estimate base fees of the transaction with id if the transaction state is unapproved - * - * @param {string} txId - transaction id - * @param {object} txEstimateBaseFees - holds the estimate base fees parameters - * @param {string} txEstimateBaseFees.estimatedBaseFee - * @param {string} txEstimateBaseFees.decEstimatedBaseFee - * @returns {TransactionMeta} the txMeta of the updated transaction - */ - updateTransactionEstimatedBaseFee( - txId, - { estimatedBaseFee, decEstimatedBaseFee }, - ) { - this._throwErrorIfNotUnapprovedTx( - txId, - 'updateTransactionEstimatedBaseFee', - ); - - let txEstimateBaseFees = { estimatedBaseFee, decEstimatedBaseFee }; - // only update what is defined - txEstimateBaseFees = pickBy(txEstimateBaseFees); - - const note = `Update Transaction Estimated Base Fees for ${txId}`; - this._updateTransaction(txId, txEstimateBaseFees, note); - return this._getTransaction(txId); - } - /** * updates a transaction's user settings only if the transaction state is unapproved * diff --git a/app/scripts/controllers/transactions/index.test.js b/app/scripts/controllers/transactions/index.test.js index 9c1f7a131817..f6f3ea953b94 100644 --- a/app/scripts/controllers/transactions/index.test.js +++ b/app/scripts/controllers/transactions/index.test.js @@ -3021,16 +3021,6 @@ describe('Transaction Controller', function () { assert.equal(result.estimateUsed, '0x0055'); }); - it('updates estimated base fee', function () { - txController.updateTransactionEstimatedBaseFee('1', { - estimatedBaseFee: '0x0066', - decEstimatedBaseFee: '66', - }); - const result = txStateManager.getTransaction('1'); - assert.equal(result.estimatedBaseFee, '0x0066'); - assert.equal(result.decEstimatedBaseFee, '66'); - }); - it('updates transaction user settings', function () { txController.updateTransactionUserSettings('1', { userEditedGasLimit: '0x0088', From ec2306ac3d0e638d54b29017b968aa7ecbb40b6c Mon Sep 17 00:00:00 2001 From: Vinicius Stevam Date: Wed, 26 Jul 2023 09:50:17 +0100 Subject: [PATCH 2/2] remove unused method updateTransactionUserSettings --- app/scripts/controllers/transactions/index.js | 21 ------------------- .../controllers/transactions/index.test.js | 11 ---------- 2 files changed, 32 deletions(-) diff --git a/app/scripts/controllers/transactions/index.js b/app/scripts/controllers/transactions/index.js index 285a82260924..5301d1b1c964 100644 --- a/app/scripts/controllers/transactions/index.js +++ b/app/scripts/controllers/transactions/index.js @@ -557,27 +557,6 @@ export default class TransactionController extends EventEmitter { return this._getTransaction(txId); } - /** - * updates a transaction's user settings only if the transaction state is unapproved - * - * @param {string} txId - * @param {object} userSettings - holds the metadata - * @param {string} userSettings.userEditedGasLimit - * @param {string} userSettings.userFeeLevel - * @returns {TransactionMeta} the txMeta of the updated transaction - */ - updateTransactionUserSettings(txId, { userEditedGasLimit, userFeeLevel }) { - this._throwErrorIfNotUnapprovedTx(txId, 'updateTransactionUserSettings'); - - let userSettings = { userEditedGasLimit, userFeeLevel }; - // only update what is defined - userSettings = pickBy(userSettings); - - const note = `Update User Settings for ${txId}`; - this._updateTransaction(txId, userSettings, note); - return this._getTransaction(txId); - } - /** * append new sendFlowHistory to the transaction with id if the transaction * state is unapproved. Returns the updated transaction. diff --git a/app/scripts/controllers/transactions/index.test.js b/app/scripts/controllers/transactions/index.test.js index f6f3ea953b94..1237c9be333d 100644 --- a/app/scripts/controllers/transactions/index.test.js +++ b/app/scripts/controllers/transactions/index.test.js @@ -3021,17 +3021,6 @@ describe('Transaction Controller', function () { assert.equal(result.estimateUsed, '0x0055'); }); - it('updates transaction user settings', function () { - txController.updateTransactionUserSettings('1', { - userEditedGasLimit: '0x0088', - userFeeLevel: 'high', - }); - - const result = txStateManager.getTransaction('1'); - assert.equal(result.userEditedGasLimit, '0x0088'); - assert.equal(result.userFeeLevel, 'high'); - }); - it('should not update and should throw error if status is not type "unapproved"', function () { txStateManager.addTransaction({ id: '4',