Skip to content

Commit e7362fc

Browse files
committed
Relocate resimulate helpers
1 parent ee4c784 commit e7362fc

File tree

6 files changed

+681
-685
lines changed

6 files changed

+681
-685
lines changed

packages/transaction-controller/src/TransactionController.test.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ import {
8686
getTransactionLayer1GasFee,
8787
updateTransactionLayer1GasFee,
8888
} from './utils/layer1-gas-fee-flow';
89-
import { shouldResimulate } from './utils/resimulate';
89+
import { shouldResimulate } from './helpers/ResimulateHelper';
9090
import { getSimulationData } from './utils/simulation';
9191
import {
9292
updatePostTransactionBalance,
@@ -115,7 +115,10 @@ jest.mock('./utils/gas');
115115
jest.mock('./utils/gas-fees');
116116
jest.mock('./utils/gas-flow');
117117
jest.mock('./utils/layer1-gas-fee-flow');
118-
jest.mock('./utils/resimulate');
118+
jest.mock('./helpers/ResimulateHelper', () => ({
119+
...jest.requireActual('./helpers/ResimulateHelper'),
120+
shouldResimulate: jest.fn(),
121+
}));
119122
jest.mock('./utils/simulation');
120123
jest.mock('./utils/swaps');
121124
jest.mock('uuid');
@@ -4881,7 +4884,6 @@ describe('TransactionController', () => {
48814884
};
48824885

48834886
it('adds a transaction, signs and update status to `approved`', async () => {
4884-
console.log("saddsaads")
48854887
const { controller, mockTransactionApprovalRequest } = setupController({
48864888
options: {
48874889
hooks: {

packages/transaction-controller/src/TransactionController.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ import { IncomingTransactionHelper } from './helpers/IncomingTransactionHelper';
6868
import { MethodDataHelper } from './helpers/MethodDataHelper';
6969
import { MultichainTrackingHelper } from './helpers/MultichainTrackingHelper';
7070
import { PendingTransactionTracker } from './helpers/PendingTransactionTracker';
71-
import { ResimulateHelper } from './helpers/ResimulateHelper';
71+
import type { ResimulateResponse } from './helpers/ResimulateHelper';
72+
import {
73+
ResimulateHelper,
74+
hasSimulationDataChanged,
75+
shouldResimulate,
76+
} from './helpers/ResimulateHelper';
7277
import { projectLogger as log } from './logger';
7378
import type {
7479
DappSuggestedGasFees,
@@ -111,8 +116,6 @@ import {
111116
getAndFormatTransactionsForNonceTracker,
112117
getNextNonce,
113118
} from './utils/nonce';
114-
import type { ResimulateResponse } from './utils/resimulate';
115-
import { hasSimulationDataChanged, shouldResimulate } from './utils/resimulate';
116119
import { getTransactionParamsWithIncreasedGasFee } from './utils/retry';
117120
import { getSimulationData } from './utils/simulation';
118121
import {
@@ -1035,9 +1038,8 @@ export class TransactionController extends BaseController<
10351038
);
10361039
}
10371040

1038-
const isEIP1559Compatible = await this.getEIP1559Compatibility(
1039-
networkClientId,
1040-
);
1041+
const isEIP1559Compatible =
1042+
await this.getEIP1559Compatibility(networkClientId);
10411043

10421044
validateTxParams(txParams, isEIP1559Compatible);
10431045

0 commit comments

Comments
 (0)