@metamask/transaction-controller 21.1.0 → 22.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -1
- package/dist/TransactionController.d.ts +20 -9
- package/dist/TransactionController.d.ts.map +1 -1
- package/dist/TransactionController.js +62 -24
- package/dist/TransactionController.js.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.ts +6 -0
- package/dist/helpers/PendingTransactionTracker.d.ts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.js +20 -0
- package/dist/helpers/PendingTransactionTracker.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [22.0.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **BREAKING:** Add peerDependency on `@babel/runtime` ([#3897](https://github.com/MetaMask/core/pull/3897))
|
|
15
|
+
- Throw after publishing a canceled or sped-up transaction if already confirmed ([#3800](https://github.com/MetaMask/core/pull/3800))
|
|
16
|
+
- Bump `eth-method-registry` from `^3.0.0` to `^4.0.0` ([#3897](https://github.com/MetaMask/core/pull/3897))
|
|
17
|
+
- Bump `@metamask/controller-utils` to `^8.0.3` ([#3915](https://github.com/MetaMask/core/pull/3915))
|
|
18
|
+
- Bump `@metamask/gas-fee-controller` to `^13.0.1` ([#3915](https://github.com/MetaMask/core/pull/3915))
|
|
19
|
+
|
|
20
|
+
### Removed
|
|
21
|
+
|
|
22
|
+
- **BREAKING:** Remove `cancelMultiplier` and `speedUpMultiplier` constructor options as both values are now fixed at `1.1`. ([#3909](https://github.com/MetaMask/core/pull/3909))
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- Remove implicit peerDependency on `babel-runtime` ([#3897](https://github.com/MetaMask/core/pull/3897))
|
|
27
|
+
|
|
28
|
+
## [21.2.0]
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- Add optional `publish` hook to support custom logic instead of submission to the RPC provider ([#3883](https://github.com/MetaMask/core/pull/3883))
|
|
33
|
+
- Add `hasNonce` option to `approveTransactionsWithSameNonce` method ([#3883](https://github.com/MetaMask/core/pull/3883))
|
|
34
|
+
|
|
10
35
|
## [21.1.0]
|
|
11
36
|
|
|
12
37
|
### Added
|
|
@@ -470,7 +495,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
470
495
|
|
|
471
496
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
472
497
|
|
|
473
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@
|
|
498
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@22.0.0...HEAD
|
|
499
|
+
[22.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@21.2.0...@metamask/transaction-controller@22.0.0
|
|
500
|
+
[21.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@21.1.0...@metamask/transaction-controller@21.2.0
|
|
474
501
|
[21.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@21.0.1...@metamask/transaction-controller@21.1.0
|
|
475
502
|
[21.0.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@21.0.0...@metamask/transaction-controller@21.0.1
|
|
476
503
|
[21.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@20.0.0...@metamask/transaction-controller@21.0.0
|
|
@@ -69,7 +69,7 @@ export interface TransactionState extends BaseState {
|
|
|
69
69
|
/**
|
|
70
70
|
* Multiplier used to determine a transaction's increased gas fee during cancellation
|
|
71
71
|
*/
|
|
72
|
-
export declare const CANCEL_RATE = 1.
|
|
72
|
+
export declare const CANCEL_RATE = 1.1;
|
|
73
73
|
/**
|
|
74
74
|
* Multiplier used to determine a transaction's increased gas fee during speed up
|
|
75
75
|
*/
|
|
@@ -115,13 +115,12 @@ export declare class TransactionController extends BaseControllerV1<TransactionC
|
|
|
115
115
|
private readonly incomingTransactionHelper;
|
|
116
116
|
private readonly securityProviderRequest?;
|
|
117
117
|
private readonly pendingTransactionTracker;
|
|
118
|
-
private readonly cancelMultiplier;
|
|
119
|
-
private readonly speedUpMultiplier;
|
|
120
118
|
private readonly signAbortCallbacks;
|
|
121
119
|
private readonly afterSign;
|
|
122
120
|
private readonly beforeApproveOnInit;
|
|
123
121
|
private readonly beforeCheckPendingTransaction;
|
|
124
122
|
private readonly beforePublish;
|
|
123
|
+
private readonly publish;
|
|
125
124
|
private readonly getAdditionalSignArguments;
|
|
126
125
|
private failTransaction;
|
|
127
126
|
private registryLookup;
|
|
@@ -142,7 +141,6 @@ export declare class TransactionController extends BaseControllerV1<TransactionC
|
|
|
142
141
|
*
|
|
143
142
|
* @param options - The controller options.
|
|
144
143
|
* @param options.blockTracker - The block tracker used to poll for new blocks data.
|
|
145
|
-
* @param options.cancelMultiplier - Multiplier used to determine a transaction's increased gas fee during cancellation.
|
|
146
144
|
* @param options.disableHistory - Whether to disable storing history in transaction metadata.
|
|
147
145
|
* @param options.disableSendFlowHistory - Explicitly disable transaction metadata history.
|
|
148
146
|
* @param options.disableSwaps - Whether to disable additional processing on swaps transactions.
|
|
@@ -165,19 +163,18 @@ export declare class TransactionController extends BaseControllerV1<TransactionC
|
|
|
165
163
|
* @param options.pendingTransactions.isResubmitEnabled - Whether transaction publishing is automatically retried.
|
|
166
164
|
* @param options.provider - The provider used to create the underlying EthQuery instance.
|
|
167
165
|
* @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.
|
|
168
|
-
* @param options.speedUpMultiplier - Multiplier used to determine a transaction's increased gas fee during speed up.
|
|
169
166
|
* @param options.hooks - The controller hooks.
|
|
170
167
|
* @param options.hooks.afterSign - Additional logic to execute after signing a transaction. Return false to not change the status to signed.
|
|
171
168
|
* @param options.hooks.beforeApproveOnInit - Additional logic to execute before starting an approval flow for a transaction during initialization. Return false to skip the transaction.
|
|
172
169
|
* @param options.hooks.beforeCheckPendingTransaction - Additional logic to execute before checking pending transactions. Return false to prevent the broadcast of the transaction.
|
|
173
170
|
* @param options.hooks.beforePublish - Additional logic to execute before publishing a transaction. Return false to prevent the broadcast of the transaction.
|
|
174
171
|
* @param options.hooks.getAdditionalSignArguments - Returns additional arguments required to sign a transaction.
|
|
172
|
+
* @param options.hooks.publish - Alternate logic to publish a transaction.
|
|
175
173
|
* @param config - Initial options used to configure this controller.
|
|
176
174
|
* @param state - Initial state to set on this controller.
|
|
177
175
|
*/
|
|
178
|
-
constructor({ blockTracker,
|
|
176
|
+
constructor({ blockTracker, disableHistory, disableSendFlowHistory, disableSwaps, getCurrentAccountEIP1559Compatibility, getCurrentNetworkEIP1559Compatibility, getExternalPendingTransactions, getGasFeeEstimates, getNetworkState, getPermittedAccounts, getSavedGasFees, getSelectedAddress, incomingTransactions, messenger, onNetworkStateChange, pendingTransactions, provider, securityProviderRequest, hooks, }: {
|
|
179
177
|
blockTracker: BlockTracker;
|
|
180
|
-
cancelMultiplier?: number;
|
|
181
178
|
disableHistory: boolean;
|
|
182
179
|
disableSendFlowHistory: boolean;
|
|
183
180
|
disableSwaps: boolean;
|
|
@@ -202,13 +199,15 @@ export declare class TransactionController extends BaseControllerV1<TransactionC
|
|
|
202
199
|
};
|
|
203
200
|
provider: Provider;
|
|
204
201
|
securityProviderRequest?: SecurityProviderRequest;
|
|
205
|
-
speedUpMultiplier?: number;
|
|
206
202
|
hooks: {
|
|
207
203
|
afterSign?: (transactionMeta: TransactionMeta, signedTx: TypedTransaction) => boolean;
|
|
208
204
|
beforeApproveOnInit?: (transactionMeta: TransactionMeta) => boolean;
|
|
209
205
|
beforeCheckPendingTransaction?: (transactionMeta: TransactionMeta) => boolean;
|
|
210
206
|
beforePublish?: (transactionMeta: TransactionMeta) => boolean;
|
|
211
207
|
getAdditionalSignArguments?: (transactionMeta: TransactionMeta) => (TransactionMeta | undefined)[];
|
|
208
|
+
publish?: (transactionMeta: TransactionMeta) => Promise<{
|
|
209
|
+
transactionHash: string;
|
|
210
|
+
}>;
|
|
212
211
|
};
|
|
213
212
|
}, config?: Partial<TransactionConfig>, state?: Partial<TransactionState>);
|
|
214
213
|
/**
|
|
@@ -437,9 +436,13 @@ export declare class TransactionController extends BaseControllerV1<TransactionC
|
|
|
437
436
|
* Signs and returns the raw transaction data for provided transaction params list.
|
|
438
437
|
*
|
|
439
438
|
* @param listOfTxParams - The list of transaction params to approve.
|
|
439
|
+
* @param opts - Options bag.
|
|
440
|
+
* @param opts.hasNonce - Whether the transactions already have a nonce.
|
|
440
441
|
* @returns The raw transactions.
|
|
441
442
|
*/
|
|
442
|
-
approveTransactionsWithSameNonce(listOfTxParams?: TransactionParams[]
|
|
443
|
+
approveTransactionsWithSameNonce(listOfTxParams?: TransactionParams[], { hasNonce }?: {
|
|
444
|
+
hasNonce?: boolean;
|
|
445
|
+
}): Promise<string | string[]>;
|
|
443
446
|
/**
|
|
444
447
|
* Update a custodial transaction.
|
|
445
448
|
*
|
|
@@ -603,6 +606,14 @@ export declare class TransactionController extends BaseControllerV1<TransactionC
|
|
|
603
606
|
private getNonceTrackerTransactions;
|
|
604
607
|
private onConfirmedTransaction;
|
|
605
608
|
private updatePostBalance;
|
|
609
|
+
private publishTransactionForRetry;
|
|
610
|
+
/**
|
|
611
|
+
* Ensures that error is a nonce issue
|
|
612
|
+
*
|
|
613
|
+
* @param error - The error to check
|
|
614
|
+
* @returns Whether or not the error is a nonce issue
|
|
615
|
+
*/
|
|
616
|
+
private isTransactionAlreadyConfirmedError;
|
|
606
617
|
}
|
|
607
618
|
export {};
|
|
608
619
|
//# sourceMappingURL=TransactionController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionController.d.ts","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAA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AC,0BAA0B;YAMpB,0BAA0B;IAUxC;;;;;;OAMG;YACW,wBAAwB;YAexB,uBAAuB;IAYrC,OAAO,CAAC,qCAAqC;YAsB/B,eAAe;IA+D7B,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,kCAAkC;IAY1C,OAAO,CAAC,2BAA2B;IAcnC,OAAO,CAAC,sBAAsB;YAehB,iBAAiB;YAuBjB,0BAA0B;IAkBxC;;;;;OAKG;IAIH,OAAO,CAAC,kCAAkC;CAM3C"}
|
|
@@ -44,7 +44,7 @@ exports.HARDFORK = common_1.Hardfork.London;
|
|
|
44
44
|
/**
|
|
45
45
|
* Multiplier used to determine a transaction's increased gas fee during cancellation
|
|
46
46
|
*/
|
|
47
|
-
exports.CANCEL_RATE = 1.
|
|
47
|
+
exports.CANCEL_RATE = 1.1;
|
|
48
48
|
/**
|
|
49
49
|
* Multiplier used to determine a transaction's increased gas fee during speed up
|
|
50
50
|
*/
|
|
@@ -62,7 +62,6 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
62
62
|
*
|
|
63
63
|
* @param options - The controller options.
|
|
64
64
|
* @param options.blockTracker - The block tracker used to poll for new blocks data.
|
|
65
|
-
* @param options.cancelMultiplier - Multiplier used to determine a transaction's increased gas fee during cancellation.
|
|
66
65
|
* @param options.disableHistory - Whether to disable storing history in transaction metadata.
|
|
67
66
|
* @param options.disableSendFlowHistory - Explicitly disable transaction metadata history.
|
|
68
67
|
* @param options.disableSwaps - Whether to disable additional processing on swaps transactions.
|
|
@@ -85,18 +84,18 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
85
84
|
* @param options.pendingTransactions.isResubmitEnabled - Whether transaction publishing is automatically retried.
|
|
86
85
|
* @param options.provider - The provider used to create the underlying EthQuery instance.
|
|
87
86
|
* @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.
|
|
88
|
-
* @param options.speedUpMultiplier - Multiplier used to determine a transaction's increased gas fee during speed up.
|
|
89
87
|
* @param options.hooks - The controller hooks.
|
|
90
88
|
* @param options.hooks.afterSign - Additional logic to execute after signing a transaction. Return false to not change the status to signed.
|
|
91
89
|
* @param options.hooks.beforeApproveOnInit - Additional logic to execute before starting an approval flow for a transaction during initialization. Return false to skip the transaction.
|
|
92
90
|
* @param options.hooks.beforeCheckPendingTransaction - Additional logic to execute before checking pending transactions. Return false to prevent the broadcast of the transaction.
|
|
93
91
|
* @param options.hooks.beforePublish - Additional logic to execute before publishing a transaction. Return false to prevent the broadcast of the transaction.
|
|
94
92
|
* @param options.hooks.getAdditionalSignArguments - Returns additional arguments required to sign a transaction.
|
|
93
|
+
* @param options.hooks.publish - Alternate logic to publish a transaction.
|
|
95
94
|
* @param config - Initial options used to configure this controller.
|
|
96
95
|
* @param state - Initial state to set on this controller.
|
|
97
96
|
*/
|
|
98
|
-
constructor({ blockTracker,
|
|
99
|
-
var _a, _b, _c, _d, _e;
|
|
97
|
+
constructor({ blockTracker, disableHistory, disableSendFlowHistory, disableSwaps, getCurrentAccountEIP1559Compatibility, getCurrentNetworkEIP1559Compatibility, getExternalPendingTransactions, getGasFeeEstimates, getNetworkState, getPermittedAccounts, getSavedGasFees, getSelectedAddress, incomingTransactions = {}, messenger, onNetworkStateChange, pendingTransactions = {}, provider, securityProviderRequest, hooks = {}, }, config, state) {
|
|
98
|
+
var _a, _b, _c, _d, _e, _f;
|
|
100
99
|
super(config, state);
|
|
101
100
|
this.inProcessOfSigning = new Set();
|
|
102
101
|
this.mutex = new async_mutex_1.Mutex();
|
|
@@ -139,8 +138,6 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
139
138
|
this.getExternalPendingTransactions =
|
|
140
139
|
getExternalPendingTransactions !== null && getExternalPendingTransactions !== void 0 ? getExternalPendingTransactions : (() => []);
|
|
141
140
|
this.securityProviderRequest = securityProviderRequest;
|
|
142
|
-
this.cancelMultiplier = cancelMultiplier !== null && cancelMultiplier !== void 0 ? cancelMultiplier : exports.CANCEL_RATE;
|
|
143
|
-
this.speedUpMultiplier = speedUpMultiplier !== null && speedUpMultiplier !== void 0 ? speedUpMultiplier : exports.SPEED_UP_RATE;
|
|
144
141
|
this.afterSign = (_a = hooks === null || hooks === void 0 ? void 0 : hooks.afterSign) !== null && _a !== void 0 ? _a : (() => true);
|
|
145
142
|
this.beforeApproveOnInit = (_b = hooks === null || hooks === void 0 ? void 0 : hooks.beforeApproveOnInit) !== null && _b !== void 0 ? _b : (() => true);
|
|
146
143
|
this.beforeCheckPendingTransaction =
|
|
@@ -150,6 +147,8 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
150
147
|
this.beforePublish = (_d = hooks === null || hooks === void 0 ? void 0 : hooks.beforePublish) !== null && _d !== void 0 ? _d : (() => true);
|
|
151
148
|
this.getAdditionalSignArguments =
|
|
152
149
|
(_e = hooks === null || hooks === void 0 ? void 0 : hooks.getAdditionalSignArguments) !== null && _e !== void 0 ? _e : (() => []);
|
|
150
|
+
this.publish =
|
|
151
|
+
(_f = hooks === null || hooks === void 0 ? void 0 : hooks.publish) !== null && _f !== void 0 ? _f : (() => Promise.resolve({ transactionHash: undefined }));
|
|
153
152
|
this.nonceTracker = new nonce_tracker_1.NonceTracker({
|
|
154
153
|
// @ts-expect-error provider types misaligned: SafeEventEmitterProvider vs Record<string,string>
|
|
155
154
|
provider,
|
|
@@ -369,21 +368,21 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
369
368
|
throw new Error('No sign method defined.');
|
|
370
369
|
}
|
|
371
370
|
// gasPrice (legacy non EIP1559)
|
|
372
|
-
const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.txParams.gasPrice,
|
|
371
|
+
const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.txParams.gasPrice, exports.CANCEL_RATE);
|
|
373
372
|
const gasPriceFromValues = (0, utils_1.isGasPriceValue)(gasValues) && gasValues.gasPrice;
|
|
374
373
|
const newGasPrice = (gasPriceFromValues &&
|
|
375
374
|
(0, utils_1.validateMinimumIncrease)(gasPriceFromValues, minGasPrice)) ||
|
|
376
375
|
minGasPrice;
|
|
377
376
|
// maxFeePerGas (EIP1559)
|
|
378
377
|
const existingMaxFeePerGas = (_a = transactionMeta.txParams) === null || _a === void 0 ? void 0 : _a.maxFeePerGas;
|
|
379
|
-
const minMaxFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxFeePerGas,
|
|
378
|
+
const minMaxFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxFeePerGas, exports.CANCEL_RATE);
|
|
380
379
|
const maxFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxFeePerGas;
|
|
381
380
|
const newMaxFeePerGas = (maxFeePerGasValues &&
|
|
382
381
|
(0, utils_1.validateMinimumIncrease)(maxFeePerGasValues, minMaxFeePerGas)) ||
|
|
383
382
|
(existingMaxFeePerGas && minMaxFeePerGas);
|
|
384
383
|
// maxPriorityFeePerGas (EIP1559)
|
|
385
384
|
const existingMaxPriorityFeePerGas = (_b = transactionMeta.txParams) === null || _b === void 0 ? void 0 : _b.maxPriorityFeePerGas;
|
|
386
|
-
const minMaxPriorityFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxPriorityFeePerGas,
|
|
385
|
+
const minMaxPriorityFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxPriorityFeePerGas, exports.CANCEL_RATE);
|
|
387
386
|
const maxPriorityFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxPriorityFeePerGas;
|
|
388
387
|
const newMaxPriorityFeePerGas = (maxPriorityFeePerGasValues &&
|
|
389
388
|
(0, utils_1.validateMinimumIncrease)(maxPriorityFeePerGasValues, minMaxPriorityFeePerGas)) ||
|
|
@@ -419,7 +418,7 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
419
418
|
newFee,
|
|
420
419
|
txParams: newTxParams,
|
|
421
420
|
});
|
|
422
|
-
const hash = yield this.
|
|
421
|
+
const hash = yield this.publishTransactionForRetry(rawTx, transactionMeta);
|
|
423
422
|
const cancelTransactionMeta = {
|
|
424
423
|
actionId,
|
|
425
424
|
chainId: transactionMeta.chainId,
|
|
@@ -477,21 +476,21 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
477
476
|
throw new Error('No sign method defined.');
|
|
478
477
|
}
|
|
479
478
|
// gasPrice (legacy non EIP1559)
|
|
480
|
-
const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.txParams.gasPrice,
|
|
479
|
+
const minGasPrice = (0, utils_1.getIncreasedPriceFromExisting)(transactionMeta.txParams.gasPrice, exports.SPEED_UP_RATE);
|
|
481
480
|
const gasPriceFromValues = (0, utils_1.isGasPriceValue)(gasValues) && gasValues.gasPrice;
|
|
482
481
|
const newGasPrice = (gasPriceFromValues &&
|
|
483
482
|
(0, utils_1.validateMinimumIncrease)(gasPriceFromValues, minGasPrice)) ||
|
|
484
483
|
minGasPrice;
|
|
485
484
|
// maxFeePerGas (EIP1559)
|
|
486
485
|
const existingMaxFeePerGas = (_a = transactionMeta.txParams) === null || _a === void 0 ? void 0 : _a.maxFeePerGas;
|
|
487
|
-
const minMaxFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxFeePerGas,
|
|
486
|
+
const minMaxFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxFeePerGas, exports.SPEED_UP_RATE);
|
|
488
487
|
const maxFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxFeePerGas;
|
|
489
488
|
const newMaxFeePerGas = (maxFeePerGasValues &&
|
|
490
489
|
(0, utils_1.validateMinimumIncrease)(maxFeePerGasValues, minMaxFeePerGas)) ||
|
|
491
490
|
(existingMaxFeePerGas && minMaxFeePerGas);
|
|
492
491
|
// maxPriorityFeePerGas (EIP1559)
|
|
493
492
|
const existingMaxPriorityFeePerGas = (_b = transactionMeta.txParams) === null || _b === void 0 ? void 0 : _b.maxPriorityFeePerGas;
|
|
494
|
-
const minMaxPriorityFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxPriorityFeePerGas,
|
|
493
|
+
const minMaxPriorityFeePerGas = (0, utils_1.getIncreasedPriceFromExisting)(existingMaxPriorityFeePerGas, exports.SPEED_UP_RATE);
|
|
495
494
|
const maxPriorityFeePerGasValues = (0, utils_1.isFeeMarketEIP1559Values)(gasValues) && gasValues.maxPriorityFeePerGas;
|
|
496
495
|
const newMaxPriorityFeePerGas = (maxPriorityFeePerGasValues &&
|
|
497
496
|
(0, utils_1.validateMinimumIncrease)(maxPriorityFeePerGasValues, minMaxPriorityFeePerGas)) ||
|
|
@@ -507,7 +506,7 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
507
506
|
? transactionMeta.txParams.maxFeePerGas
|
|
508
507
|
: transactionMeta.txParams.gasPrice;
|
|
509
508
|
(0, logger_1.projectLogger)('Submitting speed up transaction', { oldFee, newFee, txParams });
|
|
510
|
-
const hash = yield
|
|
509
|
+
const hash = yield this.publishTransactionForRetry(rawTx, transactionMeta);
|
|
511
510
|
const baseTransactionMeta = Object.assign(Object.assign({}, transactionMeta), { estimatedBaseFee, id: (0, uuid_1.v1)(), time: Date.now(), hash,
|
|
512
511
|
actionId, originalGasEstimate: transactionMeta.txParams.gas, type: types_1.TransactionType.retry, originalType: transactionMeta.type });
|
|
513
512
|
const newTransactionMeta = newMaxFeePerGas && newMaxPriorityFeePerGas
|
|
@@ -820,9 +819,11 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
820
819
|
* Signs and returns the raw transaction data for provided transaction params list.
|
|
821
820
|
*
|
|
822
821
|
* @param listOfTxParams - The list of transaction params to approve.
|
|
822
|
+
* @param opts - Options bag.
|
|
823
|
+
* @param opts.hasNonce - Whether the transactions already have a nonce.
|
|
823
824
|
* @returns The raw transactions.
|
|
824
825
|
*/
|
|
825
|
-
approveTransactionsWithSameNonce(listOfTxParams = []) {
|
|
826
|
+
approveTransactionsWithSameNonce(listOfTxParams = [], { hasNonce } = {}) {
|
|
826
827
|
return __awaiter(this, void 0, void 0, function* () {
|
|
827
828
|
(0, logger_1.projectLogger)('Approving transactions with same nonce', {
|
|
828
829
|
transactions: listOfTxParams,
|
|
@@ -844,11 +845,18 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
844
845
|
try {
|
|
845
846
|
// TODO: we should add a check to verify that all transactions have the same from address
|
|
846
847
|
const fromAddress = initialTx.from;
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
848
|
+
const requiresNonce = hasNonce !== true;
|
|
849
|
+
nonceLock = requiresNonce
|
|
850
|
+
? yield this.nonceTracker.getNonceLock(fromAddress)
|
|
851
|
+
: undefined;
|
|
852
|
+
const nonce = nonceLock
|
|
853
|
+
? (0, ethereumjs_util_1.addHexPrefix)(nonceLock.nextNonce.toString(16))
|
|
854
|
+
: initialTx.nonce;
|
|
855
|
+
if (nonceLock) {
|
|
856
|
+
(0, logger_1.projectLogger)('Using nonce from nonce tracker', nonce, nonceLock.nonceDetails);
|
|
857
|
+
}
|
|
850
858
|
rawTransactions = yield Promise.all(listOfTxParams.map((txParams) => {
|
|
851
|
-
txParams.nonce =
|
|
859
|
+
txParams.nonce = nonce;
|
|
852
860
|
return this.signExternalTransaction(txParams);
|
|
853
861
|
}));
|
|
854
862
|
}
|
|
@@ -859,9 +867,7 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
859
867
|
throw err;
|
|
860
868
|
}
|
|
861
869
|
finally {
|
|
862
|
-
|
|
863
|
-
nonceLock.releaseLock();
|
|
864
|
-
}
|
|
870
|
+
nonceLock === null || nonceLock === void 0 ? void 0 : nonceLock.releaseLock();
|
|
865
871
|
this.inProcessOfSigning.delete(initialTxAsSerializedHex);
|
|
866
872
|
}
|
|
867
873
|
return rawTransactions;
|
|
@@ -1228,7 +1234,10 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
1228
1234
|
(0, logger_1.projectLogger)('Updated pre-transaction balance', transactionMeta.preTxBalance);
|
|
1229
1235
|
}
|
|
1230
1236
|
(0, logger_1.projectLogger)('Publishing transaction', txParams);
|
|
1231
|
-
|
|
1237
|
+
let { transactionHash: hash } = yield this.publish(transactionMeta, rawTx);
|
|
1238
|
+
if (hash === undefined) {
|
|
1239
|
+
hash = yield this.publishTransaction(rawTx);
|
|
1240
|
+
}
|
|
1232
1241
|
(0, logger_1.projectLogger)('Publish successful', hash);
|
|
1233
1242
|
transactionMeta.hash = hash;
|
|
1234
1243
|
transactionMeta.status = types_1.TransactionStatus.submitted;
|
|
@@ -1638,6 +1647,35 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
|
|
|
1638
1647
|
}
|
|
1639
1648
|
});
|
|
1640
1649
|
}
|
|
1650
|
+
publishTransactionForRetry(rawTx, transactionMeta) {
|
|
1651
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1652
|
+
try {
|
|
1653
|
+
const hash = yield this.publishTransaction(rawTx);
|
|
1654
|
+
return hash;
|
|
1655
|
+
}
|
|
1656
|
+
catch (error) {
|
|
1657
|
+
if (this.isTransactionAlreadyConfirmedError(error)) {
|
|
1658
|
+
yield this.pendingTransactionTracker.forceCheckTransaction(transactionMeta);
|
|
1659
|
+
throw new Error('Previous transaction is already confirmed');
|
|
1660
|
+
}
|
|
1661
|
+
throw error;
|
|
1662
|
+
}
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* Ensures that error is a nonce issue
|
|
1667
|
+
*
|
|
1668
|
+
* @param error - The error to check
|
|
1669
|
+
* @returns Whether or not the error is a nonce issue
|
|
1670
|
+
*/
|
|
1671
|
+
// TODO: Replace `any` with type
|
|
1672
|
+
// Some networks are returning original error in the data field
|
|
1673
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1674
|
+
isTransactionAlreadyConfirmedError(error) {
|
|
1675
|
+
var _a, _b, _c;
|
|
1676
|
+
return (((_a = error === null || error === void 0 ? void 0 : error.message) === null || _a === void 0 ? void 0 : _a.includes('nonce too low')) ||
|
|
1677
|
+
((_c = (_b = error === null || error === void 0 ? void 0 : error.data) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.includes('nonce too low')));
|
|
1678
|
+
}
|
|
1641
1679
|
}
|
|
1642
1680
|
exports.TransactionController = TransactionController;
|
|
1643
1681
|
//# sourceMappingURL=TransactionController.js.map
|