@metamask/transaction-controller 20.0.0 → 21.0.1

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 CHANGED
@@ -1,4 +1,5 @@
1
1
  # Changelog
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
@@ -6,19 +7,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
7
 
7
8
  ## [Unreleased]
8
9
 
10
+ ## [21.0.1]
11
+
12
+ ### Fixed
13
+
14
+ - Resolves transaction custodian promise when setting transaction status to `submitted` or `failed` ([#3845](https://github.com/MetaMask/core/pull/3845))
15
+ - Fix normalizer ensuring property `type` is always present in `TransactionParams` ([#3817](https://github.com/MetaMask/core/pull/3817))
16
+
17
+ ## [21.0.0]
18
+
19
+ ### Changed
20
+
21
+ - **BREAKING:** Bump `@metamask/approval-controller` peer dependency to `^5.1.2` ([#3821](https://github.com/MetaMask/core/pull/3821))
22
+ - **BREAKING:** Bump `@metamask/gas-fee-controller` peer dependency to `^13.0.0` ([#3821](https://github.com/MetaMask/core/pull/3821))
23
+ - **BREAKING:** Bump `@metamask/network-controller` peer dependency to `^17.2.0` ([#3821](https://github.com/MetaMask/core/pull/3821))
24
+ - Bump `@metamask/base-controller` to `^4.1.1` ([#3821](https://github.com/MetaMask/core/pull/3821))
25
+ - Bump `@metamask/controller-utils` to `^8.0.2` ([#3821](https://github.com/MetaMask/core/pull/3821))
26
+
9
27
  ## [20.0.0]
28
+
10
29
  ### Changed
30
+
11
31
  - **BREAKING:** Change type of `destinationTokenDecimals` property in `TransactionMeta` to `number` ([#3749](https://github.com/MetaMask/core/pull/3749))
12
32
 
13
33
  ### Fixed
34
+
14
35
  - Handle missing current account in incoming transactions ([#3741](https://github.com/MetaMask/core/pull/3741))
15
36
 
16
37
  ## [19.0.1]
38
+
17
39
  ### Changed
40
+
18
41
  - Bump `eth-method-registry` from `^1.1.0` to `^3.0.0` ([#3688](https://github.com/MetaMask/core/pull/3688))
19
42
 
20
43
  ## [19.0.0]
44
+
21
45
  ### Changed
46
+
22
47
  - **BREAKING:** Bump `@metamask/approval-controller` dependency and peer dependency from `^5.1.0` to `^5.1.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
23
48
  - **BREAKING:** Bump `@metamask/gas-fee-controller` dependency and peer dependency from `^11.0.0` to `^12.0.0` ([#3695](https://github.com/MetaMask/core/pull/3695))
24
49
  - **BREAKING:** Bump `@metamask/network-controller` dependency and peer dependency from `^17.0.0` to `^17.1.0` ([#3695](https://github.com/MetaMask/core/pull/3695))
@@ -26,10 +51,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
26
51
  - Bump `@metamask/controller-utils` to `^8.0.1` ([#3695](https://github.com/MetaMask/core/pull/3695))
27
52
 
28
53
  ### Fixed
54
+
29
55
  - Use estimate gas instead of fixed gas (21k) when a contract is deployed and the gas is not specified ([#3694](https://github.com/MetaMask/core/pull/3694))
30
56
 
31
57
  ## [18.3.1]
58
+
32
59
  ### Fixed
60
+
33
61
  - Fix incorrect transaction statuses ([#3676](https://github.com/MetaMask/core/pull/3676))
34
62
  - Fix `dropped` status detection by ignoring transactions on other chains.
35
63
  - Start polling if network changes and associated transactions are pending.
@@ -38,32 +66,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
38
66
  - Fix incoming transactions on Linea Goerli ([#3674](https://github.com/MetaMask/core/pull/3674))
39
67
 
40
68
  ## [18.3.0]
69
+
41
70
  ### Added
71
+
42
72
  - Add optional `getExternalPendingTransactions` callback argument to constructor ([#3587](https://github.com/MetaMask/core/pull/3587))
43
73
 
44
74
  ## [18.2.0]
75
+
45
76
  ### Added
77
+
46
78
  - Add the `customNonceValue` property to the transaction metadata ([#3579](https://github.com/MetaMask/core/pull/3579))
47
79
 
48
80
  ### Changed
49
- - Update transaction metadata after approval if the approval result includes the `value.txMeta` property ([#3579](https://github.com/MetaMask/core/pull/3579))
81
+
82
+ - Update transaction metadata after approval if the approval result includes the `value.txMeta` property ([#3579](https://github.com/MetaMask/core/pull/3579))
50
83
  - Add `type` property to all incoming transactions ([#3579](https://github.com/MetaMask/core/pull/3579))
51
84
 
52
85
  ## [18.1.0]
86
+
53
87
  ### Added
88
+
54
89
  - Add `cancelMultiplier` and `speedUpMultiplier` constructor arguments to optionally override the default multipliers of `1.5` and `1.1` respectively ([#2678](https://github.com/MetaMask/core/pull/2678))
55
90
 
56
91
  ### Changed
92
+
57
93
  - Populate the `preTxBalance` property before publishing transactions with the `swap` type ([#2678](https://github.com/MetaMask/core/pull/2678))
58
94
  - Change the status of transactions with matching nonces to `dropped` when confirming a transaction ([#2678](https://github.com/MetaMask/core/pull/2678))
59
95
 
60
96
  ## [18.0.0]
97
+
61
98
  ### Added
99
+
62
100
  - Add `updateEditableParams` method ([#2056](https://github.com/MetaMask/core/pull/2056))
63
101
  - Add `initApprovals` method to trigger the approval flow for any pending transactions during initialisation ([#2056](https://github.com/MetaMask/core/pull/2056))
64
102
  - Add `getTransactions` method to search transactions using the given criteria and options ([#2056](https://github.com/MetaMask/core/pull/2056))
65
103
 
66
104
  ### Changed
105
+
67
106
  - **BREAKING:** Bump `@metamask/base-controller` to ^4.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
68
107
  - This is breaking because the type of the `messenger` has backward-incompatible changes. See the changelog for this package for more.
69
108
  - **BREAKING:** Add `finished` and `publish-skip` events to `Events` type
@@ -81,7 +120,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
81
120
  - Bump `@metamask/network-controller` to ^17.0.0 ([#2063](https://github.com/MetaMask/core/pull/2063))
82
121
 
83
122
  ## [17.0.0]
123
+
84
124
  ### Added
125
+
85
126
  - **BREAKING:** Add additional support swaps support ([#1877](https://github.com/MetaMask/core/pull/1877))
86
127
  - Swap transaction updates can be prevented by setting `disableSwaps` as `true`. If not set it will default to `false`.
87
128
  - If `disableSwaps` is `false` or not set, then the `createSwapsTransaction` callback MUST be defined.
@@ -108,6 +149,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
108
149
  - Populate the `firstRetryBlockNumber`, `retryCount`, and `warning` properties in the transaction metadata. ([#1896](https://github.com/MetaMask/core/pull/1896))
109
150
 
110
151
  ### Changed
152
+
111
153
  - **BREAKING:** Pending transactions are now automatically resubmitted. ([#1896](https://github.com/MetaMask/core/pull/1896))
112
154
  - This can be disabled by setting the new `pendingTransactions.isResubmitEnabled` constructor option to `false`.
113
155
  - **BREAKING:** Bump dependency and peer dependency on `@metamask/network-controller` to ^16.0.0
@@ -121,18 +163,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
121
163
  - Bump @metamask/utils from 8.1.0 to 8.2.0 ([#1957](https://github.com/MetaMask/core/pull/1957))
122
164
 
123
165
  ## [16.0.0]
166
+
124
167
  ### Changed
168
+
125
169
  - **BREAKING:** Bump dependency and peer dependency on `@metamask/gas-fee-controller` to ^10.0.0
126
170
  - Bump dependency and peer dependency on `@metamask/network-controller` to ^15.1.0
127
171
 
128
172
  ## [15.0.0]
173
+
129
174
  ### Changed
175
+
130
176
  - **BREAKING:** Bump dependency and peer dependency on `@metamask/network-controller` to ^15.0.0
131
177
  - Bump dependency on `@metamask/rpc-errors` to ^6.1.0 ([#1653](https://github.com/MetaMask/core/pull/1653))
132
178
  - Bump dependency and peer dependency on `@metamask/approval-controller` to ^4.0.1
133
179
 
134
180
  ## [14.0.0]
181
+
135
182
  ### Added
183
+
136
184
  - **BREAKING:** Add required `getPermittedAccounts` argument to constructor, used to validate `from` addresses ([#1722](https://github.com/MetaMask/core/pull/1722))
137
185
  - Add `securityProviderRequest` option to constructor ([#1725](https://github.com/MetaMask/core/pull/1725))
138
186
  - Add `method` option to `addTransaction` method ([#1725](https://github.com/MetaMask/core/pull/1725))
@@ -143,6 +191,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
143
191
  - Update `addTransaction` to ensure allowed `from` address when `origin` is specified ([#1722](https://github.com/MetaMask/core/pull/1722))
144
192
 
145
193
  ### Changed
194
+
146
195
  - Bump dependency on `@metamask/utils` to ^8.1.0 ([#1639](https://github.com/MetaMask/core/pull/1639))
147
196
  - Bump dependency and peer dependency on `@metamask/approval-controller` to ^4.0.0
148
197
  - Bump dependency on `@metamask/base-controller` to ^3.2.3
@@ -150,6 +199,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
150
199
  - Bump dependency and peer dependency on `@metamask/network-controller` to ^14.0.0
151
200
 
152
201
  ### Removed
202
+
153
203
  - **BREAKING:** Remove `interval` config option ([#1746](https://github.com/MetaMask/core/pull/1746))
154
204
  - The block tracker (which has its own interval) is now used to poll for pending transactions instead.
155
205
  - **BREAKING:** Remove `poll` method ([#1746](https://github.com/MetaMask/core/pull/1746))
@@ -158,15 +208,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
158
208
  - This functionality has been moved to a private interface and there is no way to use it externally.
159
209
 
160
210
  ## [13.0.0]
211
+
161
212
  ### Changed
162
- - **BREAKING**: Add required `getCurrentAccountEIP1559Compatibility` and `getCurrentNetworkEIP1559Compatibility` callback arguments to constructor ([#1693](https://github.com/MetaMask/core/pull/1693))
213
+
214
+ - **BREAKING**: Add required `getCurrentAccountEIP1559Compatibility` and `getCurrentNetworkEIP1559Compatibility` callback arguments to constructor ([#1693](https://github.com/MetaMask/core/pull/1693))
163
215
  - Update `validateTxParams` to throw standardised errors using the `@metamask/rpc-errors` package ([#1690](https://github.com/MetaMask/core/pull/1690))
164
216
  - The dependency `eth-rpc-errors` has been replaced by `@metamask/rpc-errors`
165
217
  - Preserve `type` transaction parameter for legacy transactions ([#1713](https://github.com/MetaMask/core/pull/1713))
166
218
  - Update TypeScript to v4.8.x ([#1718](https://github.com/MetaMask/core/pull/1718))
167
219
 
168
220
  ## [12.0.0]
221
+
169
222
  ### Changed
223
+
170
224
  - **BREAKING**: Use only `chainId` to determine if a transaction belongs to the current network ([#1633](https://github.com/MetaMask/core/pull/1633))
171
225
  - No longer uses `networkID` as a fallback if `chainId` is missing
172
226
  - **BREAKING**: Change `TransactionMeta.chainId` to be required ([#1633](https://github.com/MetaMask/core/pull/1633))
@@ -176,24 +230,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
176
230
  - Bump dependency on `@metamask/controller-utils` to ^5.0.0 ([#1633](https://github.com/MetaMask/core/pull/1633))
177
231
 
178
232
  ### Removed
233
+
179
234
  - Remove `networkId` param from `RemoteTransactionSource.isSupportedNetwork()` interface ([#1633](https://github.com/MetaMask/core/pull/1633))
180
235
  - Remove `currentNetworkId` property from `RemoteTransactionSourceRequest` ([#1633](https://github.com/MetaMask/core/pull/1633))
181
236
 
182
237
  ## [11.1.0]
238
+
183
239
  ### Added
240
+
184
241
  - Add `type` property to the transaction metadata ([#1670](https://github.com/MetaMask/core/pull/1670))
185
242
 
186
243
  ## [11.0.0]
244
+
187
245
  ### Added
246
+
188
247
  - Add optional `getLastBlockVariations` method to `RemoteTransactionSource` type ([#1668](https://github.com/MetaMask/core/pull/1668))
189
248
  - Add `updateTransactionGasFees` method to `TransactionController` ([#1674](https://github.com/MetaMask/core/pull/1674))
190
- - Add `r`, `s` and `v` properties to the transaction metadata ([#1664](https://github.com/MetaMask/core/pull/1664))
249
+ - Add `r`, `s` and `v` properties to the transaction metadata ([#1664](https://github.com/MetaMask/core/pull/1664))
191
250
  - Add `sendFlowHistory` property to the transaction metadata ([#1665](https://github.com/MetaMask/core/pull/1665))
192
251
  - Add `updateTransactionSendFlowHistory` method to `TransactionController` ([#1665](https://github.com/MetaMask/core/pull/1665))
193
252
  - Add `originalGasEstimate` property to the transaction metadata ([#1656](https://github.com/MetaMask/core/pull/1656))
194
253
  - Add `incomingTransactions.queryEntireHistory` constructor option ([#1652](https://github.com/MetaMask/core/pull/1652))
195
254
 
196
255
  ### Changed
256
+
197
257
  - **BREAKING**: Remove `apiKey` property from `RemoteTransactionSourceRequest` type ([#1668](https://github.com/MetaMask/core/pull/1668))
198
258
  - **BREAKING**: Remove unused `FetchAllOptions` type from `TransactionController` ([#1668](https://github.com/MetaMask/core/pull/1668))
199
259
  - **BREAKING**: Remove `incomingTransactions.apiKey` constructor option ([#1668](https://github.com/MetaMask/core/pull/1668))
@@ -205,36 +265,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
205
265
  - **BREAKING**: Rename the `transactionHash` property to `hash` in the transaction metadata
206
266
 
207
267
  ### Fixed
268
+
208
269
  - Fix the sorting of incoming and updated transactions ([#1652](https://github.com/MetaMask/core/pull/1652))
209
270
  - Prevent rate limit errors when `incomingTransactions.includeTokenTransfers` is `true` by by alternating Etherscan request types on each update ([#1668](https://github.com/MetaMask/core/pull/1668))
210
271
 
211
272
  ## [10.0.0]
273
+
212
274
  ### Added
275
+
213
276
  - Add `submittedTime` to the transaction metadata ([#1645](https://github.com/MetaMask/core/pull/1645))
214
277
  - Add optional `actionId` argument to `addTransaction` and `speedUpTransaction` to prevent duplicate requests ([#1582](https://github.com/MetaMask/core/pull/1582))
215
278
  - Add `confirmExternalTransaction` method ([#1625](https://github.com/MetaMask/core/pull/1625))
216
279
 
217
280
  ### Changed
281
+
218
282
  - **BREAKING**: Rename `rawTransaction` to `rawTx` in the transaction metadata ([#1624](https://github.com/MetaMask/core/pull/1624))
219
283
 
220
284
  ## [9.2.0]
285
+
221
286
  ### Added
287
+
222
288
  - Persist `estimatedBaseFee` in `stopTransaction` and `speedUpTransaction` ([#1621](https://github.com/MetaMask/core/pull/1621))
223
289
  - Add `securityAlertResponse` to `addTransaction` `opts` argument ([#1636](https://github.com/MetaMask/core/pull/1636))
224
290
 
225
291
  ## [9.1.0]
292
+
226
293
  ### Added
294
+
227
295
  - Add `blockTimestamp` to `TransactionMetaBase` type ([#1616](https://github.com/MetaMask/core/pull/1616))
228
296
  - Update `queryTransactionStatuses` to populate `blockTimestamp` on each transaction when it is verified ([#1616](https://github.com/MetaMask/core/pull/1616))
229
297
 
230
298
  ### Changed
299
+
231
300
  - Bump dependency and peer dependency on `@metamask/approval-controller` to ^3.5.1
232
301
  - Bump dependency on `@metamask/base-controller` to ^3.2.1
233
302
  - Bump dependency on `@metamask/controller-utils` to ^4.3.2
234
303
  - Bump dependency and peer dependency on `@metamask/network-controller` to ^12.1.2
235
304
 
236
305
  ## [9.0.0]
306
+
237
307
  ### Added
308
+
238
309
  - Add `baseFeePerGas` to transaction metadata ([#1590](https://github.com/MetaMask/core/pull/1590))
239
310
  - Add `txReceipt` to transaction metadata ([#1592](https://github.com/MetaMask/core/pull/1592))
240
311
  - Add `initApprovals` method to generate approval requests from unapproved transactions ([#1575](https://github.com/MetaMask/core/pull/1575))
@@ -252,6 +323,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
252
323
  - Add `address` argument to `wipeTransactions` method ([#1573](https://github.com/MetaMask/core/pull/1573))
253
324
 
254
325
  ### Changed
326
+
255
327
  - **BREAKING**: Add required `getSelectedAddress` callback argument to constructor ([#1579](https://github.com/MetaMask/core/pull/1579))
256
328
  - **BREAKING**: Add `isSupportedNetwork` method to `RemoteTransactionSource` interface ([#1579](https://github.com/MetaMask/core/pull/1579))
257
329
  - **BREAKING**: Move all but first argument to options bag in `addTransaction` method ([#1576](https://github.com/MetaMask/core/pull/1576))
@@ -261,6 +333,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
261
333
  - This type is intended mainly for internal use, so it's likely this change doesn't affect most projects
262
334
 
263
335
  ### Removed
336
+
264
337
  - **BREAKING**: Remove `fetchAll` method ([#1579](https://github.com/MetaMask/core/pull/1579))
265
338
  - This method was used to fetch transaction history from Etherscan
266
339
  - This is now handled automatically by the controller on each new block, if polling is enabled
@@ -271,38 +344,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
271
344
  - These methods were intended mainly for internal use, so it's likely this change doesn't affect most projects
272
345
 
273
346
  ## [8.0.1]
347
+
274
348
  ### Changed
349
+
275
350
  - Replace `eth-query` ^2.1.2 with `@metamask/eth-query` ^3.0.1 ([#1546](https://github.com/MetaMask/core/pull/1546))
276
351
 
277
352
  ## [8.0.0]
353
+
278
354
  ### Changed
355
+
279
356
  - **BREAKING**: Change `babel-runtime` from a `dependency` to a `peerDependency` ([#1504](https://github.com/MetaMask/core/pull/1504))
280
357
  - Update `@metamask/utils` to `^6.2.0` ([#1514](https://github.com/MetaMask/core/pull/1514))
281
358
 
282
359
  ## [7.1.0]
360
+
283
361
  ### Added
362
+
284
363
  - Expose `HARDFORK` constant ([#1423](https://github.com/MetaMask/core/pull/1423))
285
364
  - Add support for transactions on Linea networks ([#1423](https://github.com/MetaMask/core/pull/1423))
286
365
 
287
366
  ## [7.0.0]
367
+
288
368
  ### Changed
369
+
289
370
  - **BREAKING**: Change the approveTransaction and cancelTransaction methods to private ([#1435](https://github.com/MetaMask/core/pull/1435))
290
371
  - Consumers should migrate from use of these methods to use of `processApproval`.
291
372
  - Update the TransactionController to await the approval request promise before automatically performing the relevant logic, either signing and submitting the transaction, or cancelling it ([#1435](https://github.com/MetaMask/core/pull/1435))
292
373
 
293
374
  ## [6.1.0]
375
+
294
376
  ### Changed
377
+
295
378
  - Relax types of `provider` and `blockTracker` options ([#1443](https://github.com/MetaMask/core/pull/1443))
296
379
  - The types used to require proxy versions of Provider and BlockTracker. Now they just require the non-proxy versions, which are a strict subset of the proxied versions.
297
380
 
298
381
  ## [6.0.0]
382
+
299
383
  ### Added
384
+
300
385
  - Update transaction controller to automatically initiate, finalize, and cancel approval requests as transactions move through states ([#1241](https://github.com/MetaMask/core/pull/1241))
301
386
  - The `ApprovalController:addRequest` action will be called when a new transaction is initiated
302
387
  - The `ApprovalController:rejectRequest` action will be called if a transaction fails
303
388
  - The `ApprovalController:acceptRequest` action will be called when a transaction is approved
304
389
 
305
390
  ### Changed
391
+
306
392
  - **BREAKING:** Bump to Node 16 ([#1262](https://github.com/MetaMask/core/pull/1262))
307
393
  - **BREAKING:** Update `@metamask/network-controller` dependency and peer dependency ([#1367](https://github.com/MetaMask/core/pull/1367))
308
394
  - This affects the `getNetworkState` and `onNetworkStateChange` constructor parameters
@@ -318,51 +404,69 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
318
404
  - Add `@metamask/utils` dependency ([#1367](https://github.com/MetaMask/core/pull/1367))
319
405
 
320
406
  ### Fixed
407
+
321
408
  - Fix inaccurate hard-coded `chainId` on incoming token transactions ([#1366](https://github.com/MetaMask/core/pull/1366))
322
409
 
323
410
  ## [5.0.0]
411
+
324
412
  ### Changed
413
+
325
414
  - **BREAKING**: peerDeps: @metamask/network-controller@6.0.0->8.0.0 ([#1196](https://github.com/MetaMask/core/pull/1196))
326
415
  - deps: eth-rpc-errors@4.0.0->4.0.2 ([#1215](https://github.com/MetaMask/core/pull/1215))
327
416
  - Add nonce tracker to transactions controller ([#1147](https://github.com/MetaMask/core/pull/1147))
328
- - Previously this controller would get the next nonce by calling `eth_getTransactionCount` with a block reference of `pending`. The next nonce would then be returned from our middleware (within `web3-provider-engine`).
417
+ - Previously this controller would get the next nonce by calling `eth_getTransactionCount` with a block reference of `pending`. The next nonce would then be returned from our middleware (within `web3-provider-engine`).
329
418
  - Instead we're now using the nonce tracker to get the next nonce, dropping our reliance on this `eth_getTransactionCount` middleware. This will let us drop that middleware in a future update without impacting the transaction controller.
330
419
  - This should result in no functional changes, except that the nonce middleware is no longer required.
331
420
 
332
421
  ## [4.0.1]
422
+
333
423
  ### Changed
424
+
334
425
  - Use `NetworkType` enum for chain configuration ([#1132](https://github.com/MetaMask/core/pull/1132))
335
426
 
336
427
  ## [4.0.0]
428
+
337
429
  ### Removed
430
+
338
431
  - **BREAKING:** Remove `isomorphic-fetch` ([#1106](https://github.com/MetaMask/controllers/pull/1106))
339
432
  - Consumers must now import `isomorphic-fetch` or another polyfill themselves if they are running in an environment without `fetch`
340
433
 
341
434
  ## [3.0.0]
435
+
342
436
  ### Added
437
+
343
438
  - Add Etherscan API support for Sepolia and Goerli ([#1041](https://github.com/MetaMask/controllers/pull/1041))
344
439
  - Export `isEIP1559Transaction` function from package ([#1058](https://github.com/MetaMask/controllers/pull/1058))
345
440
 
346
441
  ### Changed
442
+
347
443
  - **BREAKING**: Drop Etherscan API support for Ropsten, Rinkeby, and Kovan ([#1041](https://github.com/MetaMask/controllers/pull/1041))
348
444
  - Rename this repository to `core` ([#1031](https://github.com/MetaMask/controllers/pull/1031))
349
445
  - Update `@metamask/controller-utils` package ([#1041](https://github.com/MetaMask/controllers/pull/1041))
350
446
 
351
447
  ## [2.0.0]
448
+
352
449
  ### Changed
450
+
353
451
  - **BREAKING:** Update `getNetworkState` constructor option to take an object with `providerConfig` property rather than `providerConfig` ([#995](https://github.com/MetaMask/core/pull/995))
354
452
  - Relax dependency on `@metamask/base-controller`, `@metamask/controller-utils`, and `@metamask/network-controller` (use `^` instead of `~`) ([#998](https://github.com/MetaMask/core/pull/998))
355
453
 
356
454
  ## [1.0.0]
455
+
357
456
  ### Added
457
+
358
458
  - Initial release
459
+
359
460
  - As a result of converting our shared controllers repo into a monorepo ([#831](https://github.com/MetaMask/core/pull/831)), we've created this package from select parts of [`@metamask/controllers` v33.0.0](https://github.com/MetaMask/core/tree/v33.0.0), namely:
461
+
360
462
  - Everything in `src/transaction`
361
463
  - Transaction-related functions from `src/util.ts` and accompanying tests
362
464
 
363
465
  All changes listed after this point were applied to this package following the monorepo conversion.
364
466
 
365
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@20.0.0...HEAD
467
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@21.0.1...HEAD
468
+ [21.0.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@21.0.0...@metamask/transaction-controller@21.0.1
469
+ [21.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@20.0.0...@metamask/transaction-controller@21.0.0
366
470
  [20.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@19.0.1...@metamask/transaction-controller@20.0.0
367
471
  [19.0.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@19.0.0...@metamask/transaction-controller@19.0.1
368
472
  [19.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@18.3.1...@metamask/transaction-controller@19.0.0
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionController.d.ts","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA4B,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAU7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACT,MAAM,8BAA8B,CAAC;AAEtC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAI3C,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,KAAK,EACV,SAAS,EACT,WAAW,IAAI,uBAAuB,EACvC,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EACV,MAAM,EAEN,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EAEL,eAAe,EACf,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAkCjB,eAAO,MAAM,QAAQ,kBAAkB,CAAC;AAExC;;;;GAIG;AAIH,MAAM,WAAW,MAAM;IACrB,MAAM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B;;;;;OAKG;IACH,OAAO,CAAC,iBAAiB;YASX,eAAe;IAsB7B,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,aAAa;IAIrB,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,UAAU;IAKlB,OAAO,CAAC,oBAAoB;IAO5B;;;;;;;;OAQG;IACH,OAAO,CAAC,sBAAsB;IAsB9B,OAAO,CAAC,sBAAsB;IAyB9B,OAAO,CAAC,gCAAgC;IAaxC,OAAO,CAAC,4BAA4B;IAsCpC;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAmC9B;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;IA8BlC;;;;OAIG;IACH,OAAO,CAAC,2BAA2B;IAYnC;;;;;OAKG;IACH,OAAO,CAAC,0BAA0B;YAMpB,0BAA0B;IAUxC;;;;;;OAMG;YACW,wBAAwB;YAexB,uBAAuB;IAYrC,OAAO,CAAC,qCAAqC;YAsB/B,eAAe;IAuD7B,OAAO,CAAC,yBAAyB;IAIjC,OAAO,CAAC,kCAAkC;IAY1C,OAAO,CAAC,2BAA2B;IAcnC,OAAO,CAAC,sBAAsB;YAehB,iBAAiB;CAsBhC"}
@@ -899,6 +899,9 @@ class TransactionController extends base_controller_1.BaseControllerV1 {
899
899
  updatedTransactionMeta.error = (0, utils_1.normalizeTxError)(new Error(errorMessage));
900
900
  }
901
901
  this.updateTransaction(updatedTransactionMeta, `TransactionController:updateCustodialTransaction - Custodial transaction updated`);
902
+ if ([types_1.TransactionStatus.submitted, types_1.TransactionStatus.failed].includes(status)) {
903
+ this.hub.emit(`${transactionMeta.id}:finished`, updatedTransactionMeta);
904
+ }
902
905
  }
903
906
  /**
904
907
  * Creates approvals for all unapproved transactions persisted.
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionController.js","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAwE;AAExE,uCAAoD;AAWpD,+DAA6D;AAC7D,iEAOoC;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AEa,iBAAiB,CAAC,eAAgC;;YAC9D,IAAI;gBACF,IAAI,eAAe,CAAC,IAAI,KAAK,uBAAe,CAAC,IAAI,EAAE;oBACjD,OAAO;iBACR;gBAED,MAAM,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,GACvD,MAAM,IAAA,oCAA4B,EAAC,eAAe,EAAE;oBAClD,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC9C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;iBACrD,CAAC,CAAC;gBAEL,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,EAAE;oBAChD,eAAe,EAAE,sBAAsB;oBACvC,uBAAuB;iBACxB,CAAC,CAAC;aACJ;YAAC,OAAO,KAAK,EAAE;gBACd,0BAA0B;gBAC1B,IAAA,sBAAG,EAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;aAC7D;QACH,CAAC;KAAA;CACF;AAz5ED,sDAy5EC","sourcesContent":["import { Hardfork, Common, type ChainConfig } from '@ethereumjs/common';\nimport type { TypedTransaction } from '@ethereumjs/tx';\nimport { TransactionFactory } from '@ethereumjs/tx';\nimport type {\n AcceptResultCallbacks,\n AddApprovalRequest,\n AddResult,\n} from '@metamask/approval-controller';\nimport type {\n BaseConfig,\n BaseState,\n RestrictedControllerMessenger,\n} from '@metamask/base-controller';\nimport { BaseControllerV1 } from '@metamask/base-controller';\nimport {\n query,\n NetworkType,\n RPC,\n ApprovalType,\n ORIGIN_METAMASK,\n convertHexToDecimal,\n} from '@metamask/controller-utils';\nimport EthQuery from '@metamask/eth-query';\nimport type { GasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n BlockTracker,\n NetworkState,\n Provider,\n} from '@metamask/network-controller';\nimport { errorCodes, rpcErrors, providerErrors } from '@metamask/rpc-errors';\nimport type { Hex } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\nimport { MethodRegistry } from 'eth-method-registry';\nimport { addHexPrefix, bufferToHex } from 'ethereumjs-util';\nimport { EventEmitter } from 'events';\nimport { mapValues, merge, pickBy, sortBy } from 'lodash';\nimport { NonceTracker } from 'nonce-tracker';\nimport type {\n NonceLock,\n Transaction as NonceTrackerTransaction,\n} from 'nonce-tracker';\nimport { v1 as random } from 'uuid';\n\nimport { EtherscanRemoteTransactionSource } from './helpers/EtherscanRemoteTransactionSource';\nimport { IncomingTransactionHelper } from './helpers/IncomingTransactionHelper';\nimport { PendingTransactionTracker } from './helpers/PendingTransactionTracker';\nimport { projectLogger as log } from './logger';\nimport type {\n Events,\n DappSuggestedGasFees,\n SavedGasFees,\n SecurityProviderRequest,\n SendFlowHistoryEntry,\n TransactionParams,\n TransactionMeta,\n TransactionReceipt,\n WalletDevice,\n SecurityAlertResponse,\n} from './types';\nimport {\n TransactionEnvelopeType,\n TransactionType,\n TransactionStatus,\n} from './types';\nimport { validateConfirmedExternalTransaction } from './utils/external-transactions';\nimport { addGasBuffer, estimateGas, updateGas } from './utils/gas';\nimport { updateGasFees } from './utils/gas-fees';\nimport {\n addInitialHistorySnapshot,\n updateTransactionHistory,\n} from './utils/history';\nimport {\n getAndFormatTransactionsForNonceTracker,\n getNextNonce,\n} from './utils/nonce';\nimport {\n updatePostTransactionBalance,\n updateSwapsTransaction,\n} from './utils/swaps';\nimport { determineTransactionType } from './utils/transaction-type';\nimport {\n getIncreasedPriceFromExisting,\n normalizeTxParams,\n isEIP1559Transaction,\n isFeeMarketEIP1559Values,\n isGasPriceValue,\n validateGasValues,\n validateIfTransactionUnapproved,\n validateMinimumIncrease,\n normalizeTxError,\n normalizeGasFeeValues,\n} from './utils/utils';\nimport {\n validateTransactionOrigin,\n validateTxParams,\n} from './utils/validation';\n\nexport const HARDFORK = Hardfork.London;\n\n/**\n * @type Result\n * @property result - Promise resolving to a new transaction hash\n * @property transactionMeta - Meta information about this new transaction\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface Result {\n result: Promise<string>;\n transactionMeta: TransactionMeta;\n}\n\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface GasPriceValue {\n gasPrice: string;\n}\n\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface FeeMarketEIP1559Values {\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n}\n\n/**\n * @type TransactionConfig\n *\n * Transaction controller configuration\n * @property provider - Provider used to create a new underlying EthQuery instance\n * @property sign - Method used to sign transactions\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransactionConfig extends BaseConfig {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n sign?: (txParams: TransactionParams, from: string) => Promise<any>;\n txHistoryLimit: number;\n}\n\n/**\n * @type MethodData\n *\n * Method data registry object\n * @property registryMethod - Registry method raw string\n * @property parsedRegistryMethod - Registry method object, containing name and method arguments\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface MethodData {\n registryMethod: string;\n parsedRegistryMethod: Record<string, unknown>;\n}\n\n/**\n * @type TransactionState\n *\n * Transaction controller state\n * @property transactions - A list of TransactionMeta objects\n * @property methodData - Object containing all known method data information\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransactionState extends BaseState {\n transactions: TransactionMeta[];\n methodData: { [key: string]: MethodData };\n lastFetchedBlockNumbers: { [key: string]: number };\n}\n\n/**\n * Multiplier used to determine a transaction's increased gas fee during cancellation\n */\nexport const CANCEL_RATE = 1.5;\n\n/**\n * Multiplier used to determine a transaction's increased gas fee during speed up\n */\nexport const SPEED_UP_RATE = 1.1;\n\n/**\n * The name of the {@link TransactionController}.\n */\nconst controllerName = 'TransactionController';\n\n/**\n * The external actions available to the {@link TransactionController}.\n */\ntype AllowedActions = AddApprovalRequest;\n\n/**\n * The messenger of the {@link TransactionController}.\n */\nexport type TransactionControllerMessenger = RestrictedControllerMessenger<\n typeof controllerName,\n AllowedActions,\n never,\n AllowedActions['type'],\n never\n>;\n\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransactionControllerEventEmitter extends EventEmitter {\n on<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): this;\n\n emit<T extends keyof Events>(eventName: T, ...args: Events[T]): boolean;\n}\n\n/**\n * Controller responsible for submitting and managing transactions.\n */\nexport class TransactionController extends BaseControllerV1<\n TransactionConfig,\n TransactionState\n> {\n private readonly ethQuery: EthQuery;\n\n private readonly isHistoryDisabled: boolean;\n\n private readonly isSwapsDisabled: boolean;\n\n private readonly isSendFlowHistoryDisabled: boolean;\n\n private readonly inProcessOfSigning: Set<string> = new Set();\n\n private readonly nonceTracker: NonceTracker;\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly registry: any;\n\n private readonly provider: Provider;\n\n private readonly mutex = new Mutex();\n\n private readonly getSavedGasFees: (chainId: Hex) => SavedGasFees | undefined;\n\n private readonly getNetworkState: () => NetworkState;\n\n private readonly getCurrentAccountEIP1559Compatibility: () => Promise<boolean>;\n\n private readonly getCurrentNetworkEIP1559Compatibility: () => Promise<boolean>;\n\n private readonly getGasFeeEstimates: () => Promise<GasFeeState>;\n\n private readonly getPermittedAccounts: (origin?: string) => Promise<string[]>;\n\n private readonly getSelectedAddress: () => string;\n\n private readonly getExternalPendingTransactions: (\n address: string,\n ) => NonceTrackerTransaction[];\n\n private readonly messagingSystem: TransactionControllerMessenger;\n\n private readonly incomingTransactionHelper: IncomingTransactionHelper;\n\n private readonly securityProviderRequest?: SecurityProviderRequest;\n\n private readonly pendingTransactionTracker: PendingTransactionTracker;\n\n private readonly cancelMultiplier: number;\n\n private readonly speedUpMultiplier: number;\n\n private readonly afterSign: (\n transactionMeta: TransactionMeta,\n signedTx: TypedTransaction,\n ) => boolean;\n\n private readonly beforeApproveOnInit: (\n transactionMeta: TransactionMeta,\n ) => boolean;\n\n private readonly beforeCheckPendingTransaction: (\n transactionMeta: TransactionMeta,\n ) => boolean;\n\n private readonly beforePublish: (transactionMeta: TransactionMeta) => boolean;\n\n private readonly getAdditionalSignArguments: (\n transactionMeta: TransactionMeta,\n ) => (TransactionMeta | undefined)[];\n\n private failTransaction(\n transactionMeta: TransactionMeta,\n error: Error,\n actionId?: string,\n ) {\n const newTransactionMeta = {\n ...transactionMeta,\n error: normalizeTxError(error),\n status: TransactionStatus.failed,\n };\n this.hub.emit('transaction-failed', {\n actionId,\n error: error.message,\n transactionMeta: newTransactionMeta,\n });\n this.updateTransaction(\n newTransactionMeta,\n 'TransactionController#failTransaction - Add error message and set status to failed',\n );\n this.onTransactionStatusChange(newTransactionMeta);\n this.hub.emit(`${transactionMeta.id}:finished`, newTransactionMeta);\n }\n\n private async registryLookup(fourBytePrefix: string): Promise<MethodData> {\n const registryMethod = await this.registry.lookup(fourBytePrefix);\n const parsedRegistryMethod = this.registry.parse(registryMethod);\n return { registryMethod, parsedRegistryMethod };\n }\n\n /**\n * EventEmitter instance used to listen to specific transactional events\n */\n hub = new EventEmitter() as TransactionControllerEventEmitter;\n\n /**\n * Name of this controller used during composition\n */\n override name = 'TransactionController';\n\n /**\n * Method used to sign transactions\n */\n sign?: (\n transaction: TypedTransaction,\n from: string,\n transactionMeta?: TransactionMeta,\n ) => Promise<TypedTransaction>;\n\n /**\n * Creates a TransactionController instance.\n *\n * @param options - The controller options.\n * @param options.blockTracker - The block tracker used to poll for new blocks data.\n * @param options.cancelMultiplier - Multiplier used to determine a transaction's increased gas fee during cancellation.\n * @param options.disableHistory - Whether to disable storing history in transaction metadata.\n * @param options.disableSendFlowHistory - Explicitly disable transaction metadata history.\n * @param options.disableSwaps - Whether to disable additional processing on swaps transactions.\n * @param options.getCurrentAccountEIP1559Compatibility - Whether or not the account supports EIP-1559.\n * @param options.getCurrentNetworkEIP1559Compatibility - Whether or not the network supports EIP-1559.\n * @param options.getExternalPendingTransactions - Callback to retrieve pending transactions from external sources.\n * @param options.getGasFeeEstimates - Callback to retrieve gas fee estimates.\n * @param options.getNetworkState - Gets the state of the network controller.\n * @param options.getPermittedAccounts - Get accounts that a given origin has permissions for.\n * @param options.getSavedGasFees - Gets the saved gas fee config.\n * @param options.getSelectedAddress - Gets the address of the currently selected account.\n * @param options.incomingTransactions - Configuration options for incoming transaction support.\n * @param options.incomingTransactions.includeTokenTransfers - Whether or not to include ERC20 token transfers.\n * @param options.incomingTransactions.isEnabled - Whether or not incoming transaction retrieval is enabled.\n * @param options.incomingTransactions.queryEntireHistory - Whether to initially query the entire transaction history or only recent blocks.\n * @param options.incomingTransactions.updateTransactions - Whether to update local transactions using remote transaction data.\n * @param options.messenger - The controller messenger.\n * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.\n * @param options.pendingTransactions - Configuration options for pending transaction support.\n * @param options.pendingTransactions.isResubmitEnabled - Whether transaction publishing is automatically retried.\n * @param options.provider - The provider used to create the underlying EthQuery instance.\n * @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.\n * @param options.speedUpMultiplier - Multiplier used to determine a transaction's increased gas fee during speed up.\n * @param options.hooks - The controller hooks.\n * @param options.hooks.afterSign - Additional logic to execute after signing a transaction. Return false to not change the status to signed.\n * @param options.hooks.beforeApproveOnInit - Additional logic to execute before starting an approval flow for a transaction during initialization. Return false to skip the transaction.\n * @param options.hooks.beforeCheckPendingTransaction - Additional logic to execute before checking pending transactions. Return false to prevent the broadcast of the transaction.\n * @param options.hooks.beforePublish - Additional logic to execute before publishing a transaction. Return false to prevent the broadcast of the transaction.\n * @param options.hooks.getAdditionalSignArguments - Returns additional arguments required to sign a transaction.\n * @param config - Initial options used to configure this controller.\n * @param state - Initial state to set on this controller.\n */\n constructor(\n {\n blockTracker,\n cancelMultiplier,\n disableHistory,\n disableSendFlowHistory,\n disableSwaps,\n getCurrentAccountEIP1559Compatibility,\n getCurrentNetworkEIP1559Compatibility,\n getExternalPendingTransactions,\n getGasFeeEstimates,\n getNetworkState,\n getPermittedAccounts,\n getSavedGasFees,\n getSelectedAddress,\n incomingTransactions = {},\n messenger,\n onNetworkStateChange,\n pendingTransactions = {},\n provider,\n securityProviderRequest,\n speedUpMultiplier,\n hooks = {},\n }: {\n blockTracker: BlockTracker;\n cancelMultiplier?: number;\n disableHistory: boolean;\n disableSendFlowHistory: boolean;\n disableSwaps: boolean;\n getCurrentAccountEIP1559Compatibility?: () => Promise<boolean>;\n getCurrentNetworkEIP1559Compatibility: () => Promise<boolean>;\n getExternalPendingTransactions?: (\n address: string,\n ) => NonceTrackerTransaction[];\n getGasFeeEstimates?: () => Promise<GasFeeState>;\n getNetworkState: () => NetworkState;\n getPermittedAccounts: (origin?: string) => Promise<string[]>;\n getSavedGasFees?: (chainId: Hex) => SavedGasFees | undefined;\n getSelectedAddress: () => string;\n incomingTransactions?: {\n includeTokenTransfers?: boolean;\n isEnabled?: () => boolean;\n queryEntireHistory?: boolean;\n updateTransactions?: boolean;\n };\n messenger: TransactionControllerMessenger;\n onNetworkStateChange: (listener: (state: NetworkState) => void) => void;\n pendingTransactions?: {\n isResubmitEnabled?: boolean;\n };\n provider: Provider;\n securityProviderRequest?: SecurityProviderRequest;\n speedUpMultiplier?: number;\n hooks: {\n afterSign?: (\n transactionMeta: TransactionMeta,\n signedTx: TypedTransaction,\n ) => boolean;\n beforeApproveOnInit?: (transactionMeta: TransactionMeta) => boolean;\n beforeCheckPendingTransaction?: (\n transactionMeta: TransactionMeta,\n ) => boolean;\n beforePublish?: (transactionMeta: TransactionMeta) => boolean;\n getAdditionalSignArguments?: (\n transactionMeta: TransactionMeta,\n ) => (TransactionMeta | undefined)[];\n };\n },\n config?: Partial<TransactionConfig>,\n state?: Partial<TransactionState>,\n ) {\n super(config, state);\n\n this.defaultConfig = {\n txHistoryLimit: 40,\n };\n\n this.defaultState = {\n methodData: {},\n transactions: [],\n lastFetchedBlockNumbers: {},\n };\n\n this.initialize();\n\n this.provider = provider;\n this.messagingSystem = messenger;\n this.getNetworkState = getNetworkState;\n this.ethQuery = new EthQuery(provider);\n this.isSendFlowHistoryDisabled = disableSendFlowHistory ?? false;\n this.isHistoryDisabled = disableHistory ?? false;\n this.isSwapsDisabled = disableSwaps ?? false;\n // @ts-expect-error the type in eth-method-registry is inappropriate and should be changed\n this.registry = new MethodRegistry({ provider });\n this.getSavedGasFees = getSavedGasFees ?? ((_chainId) => undefined);\n this.getCurrentAccountEIP1559Compatibility =\n getCurrentAccountEIP1559Compatibility ?? (() => Promise.resolve(true));\n this.getCurrentNetworkEIP1559Compatibility =\n getCurrentNetworkEIP1559Compatibility;\n this.getGasFeeEstimates =\n getGasFeeEstimates || (() => Promise.resolve({} as GasFeeState));\n this.getPermittedAccounts = getPermittedAccounts;\n this.getSelectedAddress = getSelectedAddress;\n this.getExternalPendingTransactions =\n getExternalPendingTransactions ?? (() => []);\n this.securityProviderRequest = securityProviderRequest;\n this.cancelMultiplier = cancelMultiplier ?? CANCEL_RATE;\n this.speedUpMultiplier = speedUpMultiplier ?? SPEED_UP_RATE;\n\n this.afterSign = hooks?.afterSign ?? (() => true);\n this.beforeApproveOnInit = hooks?.beforeApproveOnInit ?? (() => true);\n this.beforeCheckPendingTransaction =\n hooks?.beforeCheckPendingTransaction ??\n /* istanbul ignore next */\n (() => true);\n this.beforePublish = hooks?.beforePublish ?? (() => true);\n this.getAdditionalSignArguments =\n hooks?.getAdditionalSignArguments ?? (() => []);\n\n this.nonceTracker = new NonceTracker({\n // @ts-expect-error provider types misaligned: SafeEventEmitterProvider vs Record<string,string>\n provider,\n blockTracker,\n getPendingTransactions:\n this.getNonceTrackerPendingTransactions.bind(this),\n getConfirmedTransactions: this.getNonceTrackerTransactions.bind(\n this,\n TransactionStatus.confirmed,\n ),\n });\n\n this.incomingTransactionHelper = new IncomingTransactionHelper({\n blockTracker,\n getCurrentAccount: getSelectedAddress,\n getLastFetchedBlockNumbers: () => this.state.lastFetchedBlockNumbers,\n getNetworkState,\n isEnabled: incomingTransactions.isEnabled,\n queryEntireHistory: incomingTransactions.queryEntireHistory,\n remoteTransactionSource: new EtherscanRemoteTransactionSource({\n includeTokenTransfers: incomingTransactions.includeTokenTransfers,\n }),\n transactionLimit: this.config.txHistoryLimit,\n updateTransactions: incomingTransactions.updateTransactions,\n });\n\n this.incomingTransactionHelper.hub.on(\n 'transactions',\n this.onIncomingTransactions.bind(this),\n );\n\n this.incomingTransactionHelper.hub.on(\n 'updatedLastFetchedBlockNumbers',\n this.onUpdatedLastFetchedBlockNumbers.bind(this),\n );\n\n this.pendingTransactionTracker = new PendingTransactionTracker({\n approveTransaction: this.approveTransaction.bind(this),\n blockTracker,\n getChainId: this.getChainId.bind(this),\n getEthQuery: () => this.ethQuery,\n getTransactions: () => this.state.transactions,\n isResubmitEnabled: pendingTransactions.isResubmitEnabled,\n nonceTracker: this.nonceTracker,\n onStateChange: (listener) => {\n this.subscribe(listener);\n onNetworkStateChange(listener);\n listener();\n },\n publishTransaction: this.publishTransaction.bind(this),\n hooks: {\n beforeCheckPendingTransaction:\n this.beforeCheckPendingTransaction.bind(this),\n beforePublish: this.beforePublish.bind(this),\n },\n });\n\n this.addPendingTransactionTrackerListeners();\n\n onNetworkStateChange(() => {\n log('Detected network change', this.getChainId());\n this.onBootCleanup();\n });\n\n this.onBootCleanup();\n }\n\n /**\n * Handle new method data request.\n *\n * @param fourBytePrefix - The method prefix.\n * @returns The method data object corresponding to the given signature prefix.\n */\n async handleMethodData(fourBytePrefix: string): Promise<MethodData> {\n const releaseLock = await this.mutex.acquire();\n try {\n const { methodData } = this.state;\n const knownMethod = Object.keys(methodData).find(\n (knownFourBytePrefix) => fourBytePrefix === knownFourBytePrefix,\n );\n if (knownMethod) {\n return methodData[fourBytePrefix];\n }\n const registry = await this.registryLookup(fourBytePrefix);\n this.update({\n methodData: { ...methodData, ...{ [fourBytePrefix]: registry } },\n });\n return registry;\n } finally {\n releaseLock();\n }\n }\n\n /**\n * Add a new unapproved transaction to state. Parameters will be validated, a\n * unique transaction id will be generated, and gas and gasPrice will be calculated\n * if not provided. If A `<tx.id>:unapproved` hub event will be emitted once added.\n *\n * @param txParams - Standard parameters for an Ethereum transaction.\n * @param opts - Additional options to control how the transaction is added.\n * @param opts.actionId - Unique ID to prevent duplicate requests.\n * @param opts.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.\n * @param opts.method - RPC method that requested the transaction.\n * @param opts.origin - The origin of the transaction request, such as a dApp hostname.\n * @param opts.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.\n * @param opts.securityAlertResponse - Response from security validator.\n * @param opts.sendFlowHistory - The sendFlowHistory entries to add.\n * @param opts.type - Type of transaction to add, such as 'cancel' or 'swap'.\n * @param opts.swaps - Options for swaps transactions.\n * @param opts.swaps.hasApproveTx - Whether the transaction has an approval transaction.\n * @param opts.swaps.meta - Metadata for swap transaction.\n * @returns Object containing a promise resolving to the transaction hash if approved.\n */\n async addTransaction(\n txParams: TransactionParams,\n {\n actionId,\n deviceConfirmedOn,\n method,\n origin,\n requireApproval,\n securityAlertResponse,\n sendFlowHistory,\n swaps = {},\n type,\n }: {\n actionId?: string;\n deviceConfirmedOn?: WalletDevice;\n method?: string;\n origin?: string;\n requireApproval?: boolean | undefined;\n securityAlertResponse?: SecurityAlertResponse;\n sendFlowHistory?: SendFlowHistoryEntry[];\n swaps?: {\n hasApproveTx?: boolean;\n meta?: Partial<TransactionMeta>;\n };\n type?: TransactionType;\n } = {},\n ): Promise<Result> {\n log('Adding transaction', txParams);\n\n txParams = normalizeTxParams(txParams);\n\n const isEIP1559Compatible = await this.getEIP1559Compatibility();\n\n validateTxParams(txParams, isEIP1559Compatible);\n\n if (origin) {\n await validateTransactionOrigin(\n await this.getPermittedAccounts(origin),\n this.getSelectedAddress(),\n txParams.from,\n origin,\n );\n }\n\n const dappSuggestedGasFees = this.generateDappSuggestedGasFees(\n txParams,\n origin,\n );\n\n const transactionType =\n type ?? (await determineTransactionType(txParams, this.ethQuery)).type;\n\n const existingTransactionMeta = this.getTransactionWithActionId(actionId);\n const chainId = this.getChainId();\n\n // If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.\n const transactionMeta: TransactionMeta = existingTransactionMeta || {\n // Add actionId to txMeta to check if same actionId is seen again\n actionId,\n chainId,\n dappSuggestedGasFees,\n deviceConfirmedOn,\n id: random(),\n origin,\n securityAlertResponse,\n status: TransactionStatus.unapproved as TransactionStatus.unapproved,\n time: Date.now(),\n txParams,\n userEditedGasLimit: false,\n verifiedOnBlockchain: false,\n type: transactionType,\n };\n\n await this.updateGasProperties(transactionMeta);\n\n // Checks if a transaction already exists with a given actionId\n if (!existingTransactionMeta) {\n // Set security provider response\n if (method && this.securityProviderRequest) {\n const securityProviderResponse = await this.securityProviderRequest(\n transactionMeta,\n method,\n );\n transactionMeta.securityProviderResponse = securityProviderResponse;\n }\n\n if (!this.isSendFlowHistoryDisabled) {\n transactionMeta.sendFlowHistory = sendFlowHistory ?? [];\n }\n // Initial history push\n if (!this.isHistoryDisabled) {\n addInitialHistorySnapshot(transactionMeta);\n }\n\n await updateSwapsTransaction(transactionMeta, transactionType, swaps, {\n isSwapsDisabled: this.isSwapsDisabled,\n cancelTransaction: this.cancelTransaction.bind(this),\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n controllerHubEmitter: this.hub.emit.bind(this.hub) as any,\n });\n\n this.addMetadata(transactionMeta);\n this.hub.emit(`unapprovedTransaction`, transactionMeta);\n }\n\n return {\n result: this.processApproval(transactionMeta, {\n isExisting: Boolean(existingTransactionMeta),\n requireApproval,\n actionId,\n }),\n transactionMeta,\n };\n }\n\n startIncomingTransactionPolling() {\n this.incomingTransactionHelper.start();\n }\n\n stopIncomingTransactionPolling() {\n this.incomingTransactionHelper.stop();\n }\n\n async updateIncomingTransactions() {\n await this.incomingTransactionHelper.update();\n }\n\n /**\n * Attempts to cancel a transaction based on its ID by setting its status to \"rejected\"\n * and emitting a `<tx.id>:finished` hub event.\n *\n * @param transactionId - The ID of the transaction to cancel.\n * @param gasValues - The gas values to use for the cancellation transaction.\n * @param options - The options for the cancellation transaction.\n * @param options.actionId - Unique ID to prevent duplicate requests.\n * @param options.estimatedBaseFee - The estimated base fee of the transaction.\n */\n async stopTransaction(\n transactionId: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n {\n estimatedBaseFee,\n actionId,\n }: { estimatedBaseFee?: string; actionId?: string } = {},\n ) {\n // If transaction is found for same action id, do not create a cancel transaction.\n if (this.getTransactionWithActionId(actionId)) {\n return;\n }\n\n if (gasValues) {\n // Not good practice to reassign a parameter but temporarily avoiding a larger refactor.\n gasValues = normalizeGasFeeValues(gasValues);\n validateGasValues(gasValues);\n }\n\n log('Creating cancel transaction', transactionId, gasValues);\n\n const transactionMeta = this.getTransaction(transactionId);\n if (!transactionMeta) {\n return;\n }\n\n if (!this.sign) {\n throw new Error('No sign method defined.');\n }\n\n // gasPrice (legacy non EIP1559)\n const minGasPrice = getIncreasedPriceFromExisting(\n transactionMeta.txParams.gasPrice,\n this.cancelMultiplier,\n );\n\n const gasPriceFromValues = isGasPriceValue(gasValues) && gasValues.gasPrice;\n\n const newGasPrice =\n (gasPriceFromValues &&\n validateMinimumIncrease(gasPriceFromValues, minGasPrice)) ||\n minGasPrice;\n\n // maxFeePerGas (EIP1559)\n const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n this.cancelMultiplier,\n );\n const maxFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxFeePerGas;\n const newMaxFeePerGas =\n (maxFeePerGasValues &&\n validateMinimumIncrease(maxFeePerGasValues, minMaxFeePerGas)) ||\n (existingMaxFeePerGas && minMaxFeePerGas);\n\n // maxPriorityFeePerGas (EIP1559)\n const existingMaxPriorityFeePerGas =\n transactionMeta.txParams?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n this.cancelMultiplier,\n );\n const maxPriorityFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxPriorityFeePerGas;\n const newMaxPriorityFeePerGas =\n (maxPriorityFeePerGasValues &&\n validateMinimumIncrease(\n maxPriorityFeePerGasValues,\n minMaxPriorityFeePerGas,\n )) ||\n (existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas);\n\n const newTxParams: TransactionParams =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n from: transactionMeta.txParams.from,\n gasLimit: transactionMeta.txParams.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: TransactionEnvelopeType.feeMarket,\n nonce: transactionMeta.txParams.nonce,\n to: transactionMeta.txParams.from,\n value: '0x0',\n }\n : {\n from: transactionMeta.txParams.from,\n gasLimit: transactionMeta.txParams.gas,\n gasPrice: newGasPrice,\n nonce: transactionMeta.txParams.nonce,\n to: transactionMeta.txParams.from,\n value: '0x0',\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(newTxParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.txParams.from,\n );\n\n const rawTx = bufferToHex(signedTx.serialize());\n\n const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;\n\n const oldFee = newTxParams.maxFeePerGas\n ? transactionMeta.txParams.maxFeePerGas\n : transactionMeta.txParams.gasPrice;\n\n log('Submitting cancel transaction', {\n oldFee,\n newFee,\n txParams: newTxParams,\n });\n\n const hash = await this.publishTransaction(rawTx);\n\n const cancelTransactionMeta: TransactionMeta = {\n actionId,\n chainId: transactionMeta.chainId,\n estimatedBaseFee,\n hash,\n id: random(),\n originalGasEstimate: transactionMeta.txParams.gas,\n status: TransactionStatus.submitted,\n time: Date.now(),\n type: TransactionType.cancel,\n txParams: newTxParams,\n };\n\n this.addMetadata(cancelTransactionMeta);\n\n // stopTransaction has no approval request, so we assume the user has already approved the transaction\n this.hub.emit('transaction-approved', {\n transactionMeta: cancelTransactionMeta,\n actionId,\n });\n this.hub.emit('transaction-submitted', {\n transactionMeta: cancelTransactionMeta,\n actionId,\n });\n\n this.hub.emit(\n `${cancelTransactionMeta.id}:finished`,\n cancelTransactionMeta,\n );\n }\n\n /**\n * Attempts to speed up a transaction increasing transaction gasPrice by ten percent.\n *\n * @param transactionId - The ID of the transaction to speed up.\n * @param gasValues - The gas values to use for the speed up transaction.\n * @param options - The options for the speed up transaction.\n * @param options.actionId - Unique ID to prevent duplicate requests\n * @param options.estimatedBaseFee - The estimated base fee of the transaction.\n */\n async speedUpTransaction(\n transactionId: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n {\n actionId,\n estimatedBaseFee,\n }: { actionId?: string; estimatedBaseFee?: string } = {},\n ) {\n // If transaction is found for same action id, do not create a new speed up transaction.\n if (this.getTransactionWithActionId(actionId)) {\n return;\n }\n\n if (gasValues) {\n // Not good practice to reassign a parameter but temporarily avoiding a larger refactor.\n gasValues = normalizeGasFeeValues(gasValues);\n validateGasValues(gasValues);\n }\n\n log('Creating speed up transaction', transactionId, gasValues);\n\n const transactionMeta = this.state.transactions.find(\n ({ id }) => id === transactionId,\n );\n /* istanbul ignore next */\n if (!transactionMeta) {\n return;\n }\n\n /* istanbul ignore next */\n if (!this.sign) {\n throw new Error('No sign method defined.');\n }\n\n // gasPrice (legacy non EIP1559)\n const minGasPrice = getIncreasedPriceFromExisting(\n transactionMeta.txParams.gasPrice,\n this.speedUpMultiplier,\n );\n\n const gasPriceFromValues = isGasPriceValue(gasValues) && gasValues.gasPrice;\n\n const newGasPrice =\n (gasPriceFromValues &&\n validateMinimumIncrease(gasPriceFromValues, minGasPrice)) ||\n minGasPrice;\n\n // maxFeePerGas (EIP1559)\n const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n this.speedUpMultiplier,\n );\n const maxFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxFeePerGas;\n const newMaxFeePerGas =\n (maxFeePerGasValues &&\n validateMinimumIncrease(maxFeePerGasValues, minMaxFeePerGas)) ||\n (existingMaxFeePerGas && minMaxFeePerGas);\n\n // maxPriorityFeePerGas (EIP1559)\n const existingMaxPriorityFeePerGas =\n transactionMeta.txParams?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n this.speedUpMultiplier,\n );\n const maxPriorityFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxPriorityFeePerGas;\n const newMaxPriorityFeePerGas =\n (maxPriorityFeePerGasValues &&\n validateMinimumIncrease(\n maxPriorityFeePerGasValues,\n minMaxPriorityFeePerGas,\n )) ||\n (existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas);\n\n const txParams: TransactionParams =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...transactionMeta.txParams,\n gasLimit: transactionMeta.txParams.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: TransactionEnvelopeType.feeMarket,\n }\n : {\n ...transactionMeta.txParams,\n gasLimit: transactionMeta.txParams.gas,\n gasPrice: newGasPrice,\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.txParams.from,\n );\n\n await this.updateTransactionMetaRSV(transactionMeta, signedTx);\n const rawTx = bufferToHex(signedTx.serialize());\n\n const newFee = txParams.maxFeePerGas ?? txParams.gasPrice;\n\n const oldFee = txParams.maxFeePerGas\n ? transactionMeta.txParams.maxFeePerGas\n : transactionMeta.txParams.gasPrice;\n\n log('Submitting speed up transaction', { oldFee, newFee, txParams });\n\n const hash = await query(this.ethQuery, 'sendRawTransaction', [rawTx]);\n\n const baseTransactionMeta: TransactionMeta = {\n ...transactionMeta,\n estimatedBaseFee,\n id: random(),\n time: Date.now(),\n hash,\n actionId,\n originalGasEstimate: transactionMeta.txParams.gas,\n type: TransactionType.retry,\n originalType: transactionMeta.type,\n };\n\n const newTransactionMeta =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...baseTransactionMeta,\n txParams: {\n ...transactionMeta.txParams,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n },\n }\n : {\n ...baseTransactionMeta,\n txParams: {\n ...transactionMeta.txParams,\n gasPrice: newGasPrice,\n },\n };\n\n this.addMetadata(newTransactionMeta);\n\n // speedUpTransaction has no approval request, so we assume the user has already approved the transaction\n this.hub.emit('transaction-approved', {\n transactionMeta: newTransactionMeta,\n actionId,\n });\n\n this.hub.emit('transaction-submitted', {\n transactionMeta: newTransactionMeta,\n actionId,\n });\n\n this.hub.emit(`${transactionMeta.id}:speedup`, newTransactionMeta);\n }\n\n /**\n * Estimates required gas for a given transaction.\n *\n * @param transaction - The transaction to estimate gas for.\n * @returns The gas and gas price.\n */\n async estimateGas(transaction: TransactionParams) {\n const { estimatedGas, simulationFails } = await estimateGas(\n transaction,\n this.ethQuery,\n );\n\n return { gas: estimatedGas, simulationFails };\n }\n\n /**\n * Estimates required gas for a given transaction and add additional gas buffer with the given multiplier.\n *\n * @param transaction - The transaction params to estimate gas for.\n * @param multiplier - The multiplier to use for the gas buffer.\n */\n async estimateGasBuffered(\n transaction: TransactionParams,\n multiplier: number,\n ) {\n const { blockGasLimit, estimatedGas, simulationFails } = await estimateGas(\n transaction,\n this.ethQuery,\n );\n\n const gas = addGasBuffer(estimatedGas, blockGasLimit, multiplier);\n\n return {\n gas,\n simulationFails,\n };\n }\n\n /**\n * Updates an existing transaction in state.\n *\n * @param transactionMeta - The new transaction to store in state.\n * @param note - A note or update reason to include in the transaction history.\n */\n updateTransaction(transactionMeta: TransactionMeta, note: string) {\n const { transactions } = this.state;\n transactionMeta.txParams = normalizeTxParams(transactionMeta.txParams);\n validateTxParams(transactionMeta.txParams);\n if (!this.isHistoryDisabled) {\n updateTransactionHistory(transactionMeta, note);\n }\n const index = transactions.findIndex(({ id }) => transactionMeta.id === id);\n transactions[index] = transactionMeta;\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n }\n\n /**\n * Update the security alert response for a transaction.\n *\n * @param transactionId - ID of the transaction.\n * @param securityAlertResponse - The new security alert response for the transaction.\n */\n updateSecurityAlertResponse(\n transactionId: string,\n securityAlertResponse: SecurityAlertResponse,\n ) {\n if (!securityAlertResponse) {\n throw new Error(\n 'updateSecurityAlertResponse: securityAlertResponse should not be null',\n );\n }\n const transactionMeta = this.getTransaction(transactionId);\n if (!transactionMeta) {\n throw new Error(\n `Cannot update security alert response as no transaction metadata found`,\n );\n }\n const updatedMeta = merge(transactionMeta, { securityAlertResponse });\n this.updateTransaction(\n updatedMeta,\n 'TransactionController:updatesecurityAlertResponse - securityAlertResponse updated',\n );\n }\n\n /**\n * Removes all transactions from state, optionally based on the current network.\n *\n * @param ignoreNetwork - Determines whether to wipe all transactions, or just those on the\n * current network. If `true`, all transactions are wiped.\n * @param address - If specified, only transactions originating from this address will be\n * wiped on current network.\n */\n wipeTransactions(ignoreNetwork?: boolean, address?: string) {\n /* istanbul ignore next */\n if (ignoreNetwork && !address) {\n this.update({ transactions: [] });\n return;\n }\n const currentChainId = this.getChainId();\n const newTransactions = this.state.transactions.filter(\n ({ chainId, txParams }) => {\n const isMatchingNetwork = ignoreNetwork || chainId === currentChainId;\n\n if (!isMatchingNetwork) {\n return true;\n }\n\n const isMatchingAddress =\n !address || txParams.from?.toLowerCase() === address.toLowerCase();\n\n return !isMatchingAddress;\n },\n );\n\n this.update({\n transactions: this.trimTransactionsForState(newTransactions),\n });\n }\n\n startIncomingTransactionProcessing() {\n this.incomingTransactionHelper.start();\n }\n\n stopIncomingTransactionProcessing() {\n this.incomingTransactionHelper.stop();\n }\n\n /**\n * Adds external provided transaction to state as confirmed transaction.\n *\n * @param transactionMeta - TransactionMeta to add transactions.\n * @param transactionReceipt - TransactionReceipt of the external transaction.\n * @param baseFeePerGas - Base fee per gas of the external transaction.\n */\n async confirmExternalTransaction(\n transactionMeta: TransactionMeta,\n transactionReceipt: TransactionReceipt,\n baseFeePerGas: Hex,\n ) {\n // Run validation and add external transaction to state.\n this.addExternalTransaction(transactionMeta);\n\n try {\n const transactionId = transactionMeta.id;\n\n // Make sure status is confirmed and define gasUsed as in receipt.\n transactionMeta.status = TransactionStatus.confirmed;\n transactionMeta.txReceipt = transactionReceipt;\n if (baseFeePerGas) {\n transactionMeta.baseFeePerGas = baseFeePerGas;\n }\n\n // Update same nonce local transactions as dropped and define replacedBy properties.\n this.markNonceDuplicatesDropped(transactionId);\n\n // Update external provided transaction with updated gas values and confirmed status.\n this.updateTransaction(\n transactionMeta,\n 'TransactionController:confirmExternalTransaction - Add external transaction',\n );\n this.onTransactionStatusChange(transactionMeta);\n\n // Intentional given potential duration of process.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.updatePostBalance(transactionMeta);\n\n this.hub.emit('transaction-confirmed', {\n transactionMeta,\n });\n } catch (error) {\n console.error('Failed to confirm external transaction', error);\n }\n }\n\n /**\n * Append new send flow history to a transaction.\n *\n * @param transactionID - The ID of the transaction to update.\n * @param currentSendFlowHistoryLength - The length of the current sendFlowHistory array.\n * @param sendFlowHistoryToAdd - The sendFlowHistory entries to add.\n * @returns The updated transactionMeta.\n */\n updateTransactionSendFlowHistory(\n transactionID: string,\n currentSendFlowHistoryLength: number,\n sendFlowHistoryToAdd: SendFlowHistoryEntry[],\n ): TransactionMeta {\n if (this.isSendFlowHistoryDisabled) {\n throw new Error(\n 'Send flow history is disabled for the current transaction controller',\n );\n }\n\n const transactionMeta = this.getTransaction(transactionID);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update send flow history as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(\n transactionMeta,\n 'updateTransactionSendFlowHistory',\n );\n\n if (\n currentSendFlowHistoryLength ===\n (transactionMeta?.sendFlowHistory?.length || 0)\n ) {\n transactionMeta.sendFlowHistory = [\n ...(transactionMeta?.sendFlowHistory ?? []),\n ...sendFlowHistoryToAdd,\n ];\n this.updateTransaction(\n transactionMeta,\n 'TransactionController:updateTransactionSendFlowHistory - sendFlowHistory updated',\n );\n }\n\n return this.getTransaction(transactionID) as TransactionMeta;\n }\n\n /**\n * Update the gas values of a transaction.\n *\n * @param transactionId - The ID of the transaction to update.\n * @param gasValues - Gas values to update.\n * @param gasValues.gas - Same as transaction.gasLimit.\n * @param gasValues.gasLimit - Maxmimum number of units of gas to use for this transaction.\n * @param gasValues.gasPrice - Price per gas for legacy transactions.\n * @param gasValues.maxPriorityFeePerGas - Maximum amount per gas to give to validator as incentive.\n * @param gasValues.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.\n * @param gasValues.estimateUsed - Which estimate level was used.\n * @param gasValues.estimateSuggested - Which estimate level that the API suggested.\n * @param gasValues.defaultGasEstimates - The default estimate for gas.\n * @param gasValues.originalGasEstimate - Original estimate for gas.\n * @param gasValues.userEditedGasLimit - The gas limit supplied by user.\n * @param gasValues.userFeeLevel - Estimate level user selected.\n * @returns The updated transactionMeta.\n */\n updateTransactionGasFees(\n transactionId: string,\n {\n defaultGasEstimates,\n estimateUsed,\n estimateSuggested,\n gas,\n gasLimit,\n gasPrice,\n maxPriorityFeePerGas,\n maxFeePerGas,\n originalGasEstimate,\n userEditedGasLimit,\n userFeeLevel,\n }: {\n defaultGasEstimates?: string;\n estimateUsed?: string;\n estimateSuggested?: string;\n gas?: string;\n gasLimit?: string;\n gasPrice?: string;\n maxPriorityFeePerGas?: string;\n maxFeePerGas?: string;\n originalGasEstimate?: string;\n userEditedGasLimit?: boolean;\n userFeeLevel?: string;\n },\n ): TransactionMeta {\n const transactionMeta = this.getTransaction(transactionId);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update transaction as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(\n transactionMeta,\n 'updateTransactionGasFees',\n );\n\n let transactionGasFees = {\n txParams: {\n gas,\n gasLimit,\n gasPrice,\n maxPriorityFeePerGas,\n maxFeePerGas,\n },\n defaultGasEstimates,\n estimateUsed,\n estimateSuggested,\n originalGasEstimate,\n userEditedGasLimit,\n userFeeLevel,\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any;\n\n // only update what is defined\n transactionGasFees.txParams = pickBy(transactionGasFees.txParams);\n transactionGasFees = pickBy(transactionGasFees);\n\n // merge updated gas values with existing transaction meta\n const updatedMeta = merge(transactionMeta, transactionGasFees);\n\n this.updateTransaction(\n updatedMeta,\n 'TransactionController:updateTransactionGasFees - gas values updated',\n );\n\n return this.getTransaction(transactionId) as TransactionMeta;\n }\n\n /**\n * Update the previous gas values of a transaction.\n *\n * @param transactionId - The ID of the transaction to update.\n * @param previousGas - Previous gas values to update.\n * @param previousGas.gasLimit - Maxmimum number of units of gas to use for this transaction.\n * @param previousGas.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.\n * @param previousGas.maxPriorityFeePerGas - Maximum amount per gas to give to validator as incentive.\n * @returns The updated transactionMeta.\n */\n updatePreviousGasParams(\n transactionId: string,\n {\n gasLimit,\n maxFeePerGas,\n maxPriorityFeePerGas,\n }: {\n gasLimit?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: string;\n },\n ): TransactionMeta {\n const transactionMeta = this.getTransaction(transactionId);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update transaction as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(transactionMeta, 'updatePreviousGasParams');\n\n const transactionPreviousGas = {\n previousGas: {\n gasLimit,\n maxFeePerGas,\n maxPriorityFeePerGas,\n },\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any;\n\n // only update what is defined\n transactionPreviousGas.previousGas = pickBy(\n transactionPreviousGas.previousGas,\n );\n\n // merge updated previous gas values with existing transaction meta\n const updatedMeta = merge(transactionMeta, transactionPreviousGas);\n\n this.updateTransaction(\n updatedMeta,\n 'TransactionController:updatePreviousGasParams - Previous gas values updated',\n );\n\n return this.getTransaction(transactionId) as TransactionMeta;\n }\n\n /**\n * Gets the next nonce according to the nonce-tracker.\n * Ensure `releaseLock` is called once processing of the `nonce` value is complete.\n *\n * @param address - The hex string address for the transaction.\n * @returns object with the `nextNonce` `nonceDetails`, and the releaseLock.\n */\n async getNonceLock(address: string): Promise<NonceLock> {\n return this.nonceTracker.getNonceLock(address);\n }\n\n /**\n * Updates the editable parameters of a transaction.\n *\n * @param txId - The ID of the transaction to update.\n * @param params - The editable parameters to update.\n * @param params.data - Data to pass with the transaction.\n * @param params.gas - Maximum number of units of gas to use for the transaction.\n * @param params.gasPrice - Price per gas for legacy transactions.\n * @param params.from - Address to send the transaction from.\n * @param params.to - Address to send the transaction to.\n * @param params.value - Value associated with the transaction.\n * @returns The updated transaction metadata.\n */\n async updateEditableParams(\n txId: string,\n {\n data,\n gas,\n gasPrice,\n from,\n to,\n value,\n }: {\n data?: string;\n gas?: string;\n gasPrice?: string;\n from?: string;\n to?: string;\n value?: string;\n },\n ) {\n const transactionMeta = this.getTransaction(txId);\n if (!transactionMeta) {\n throw new Error(\n `Cannot update editable params as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(transactionMeta, 'updateEditableParams');\n\n const editableParams = {\n txParams: {\n data,\n from,\n to,\n value,\n gas,\n gasPrice,\n },\n } as Partial<TransactionMeta>;\n\n editableParams.txParams = pickBy(\n editableParams.txParams,\n ) as TransactionParams;\n\n const updatedTransaction = merge(transactionMeta, editableParams);\n const { type } = await determineTransactionType(\n updatedTransaction.txParams,\n this.ethQuery,\n );\n updatedTransaction.type = type;\n\n this.updateTransaction(\n updatedTransaction,\n `Update Editable Params for ${txId}`,\n );\n return this.getTransaction(txId);\n }\n\n /**\n * Signs and returns the raw transaction data for provided transaction params list.\n *\n * @param listOfTxParams - The list of transaction params to approve.\n * @returns The raw transactions.\n */\n async approveTransactionsWithSameNonce(\n listOfTxParams: TransactionParams[] = [],\n ): Promise<string | string[]> {\n log('Approving transactions with same nonce', {\n transactions: listOfTxParams,\n });\n\n if (listOfTxParams.length === 0) {\n return '';\n }\n\n const initialTx = listOfTxParams[0];\n const common = this.getCommonConfiguration();\n\n const initialTxAsEthTx = TransactionFactory.fromTxData(initialTx, {\n common,\n });\n\n const initialTxAsSerializedHex = bufferToHex(initialTxAsEthTx.serialize());\n\n if (this.inProcessOfSigning.has(initialTxAsSerializedHex)) {\n return '';\n }\n\n this.inProcessOfSigning.add(initialTxAsSerializedHex);\n\n let rawTransactions, nonceLock;\n try {\n // TODO: we should add a check to verify that all transactions have the same from address\n const fromAddress = initialTx.from;\n nonceLock = await this.nonceTracker.getNonceLock(fromAddress);\n const nonce = nonceLock.nextNonce;\n\n log('Using nonce from nonce tracker', nonce, nonceLock.nonceDetails);\n\n rawTransactions = await Promise.all(\n listOfTxParams.map((txParams) => {\n txParams.nonce = addHexPrefix(nonce.toString(16));\n return this.signExternalTransaction(txParams);\n }),\n );\n } catch (err) {\n log('Error while signing transactions with same nonce', err);\n // Must set transaction to submitted/failed before releasing lock\n // continue with error chain\n throw err;\n } finally {\n if (nonceLock) {\n nonceLock.releaseLock();\n }\n this.inProcessOfSigning.delete(initialTxAsSerializedHex);\n }\n return rawTransactions;\n }\n\n /**\n * Update a custodial transaction.\n *\n * @param transactionId - The ID of the transaction to update.\n * @param options - The custodial transaction options to update.\n * @param options.errorMessage - The error message to be assigned in case transaction status update to failed.\n * @param options.hash - The new hash value to be assigned.\n * @param options.status - The new status value to be assigned.\n */\n updateCustodialTransaction(\n transactionId: string,\n {\n errorMessage,\n hash,\n status,\n }: {\n errorMessage?: string;\n hash?: string;\n status?: TransactionStatus;\n },\n ) {\n const transactionMeta = this.getTransaction(transactionId);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update custodial transaction as no transaction metadata found`,\n );\n }\n\n if (!transactionMeta.custodyId) {\n throw new Error('Transaction must be a custodian transaction');\n }\n\n if (\n status &&\n ![\n TransactionStatus.submitted,\n TransactionStatus.signed,\n TransactionStatus.failed,\n ].includes(status)\n ) {\n throw new Error(\n `Cannot update custodial transaction with status: ${status}`,\n );\n }\n\n const updatedTransactionMeta = merge(\n transactionMeta,\n pickBy({ hash, status }),\n );\n\n if (status === TransactionStatus.submitted) {\n updatedTransactionMeta.submittedTime = new Date().getTime();\n }\n\n if (status === TransactionStatus.failed) {\n updatedTransactionMeta.error = normalizeTxError(new Error(errorMessage));\n }\n\n this.updateTransaction(\n updatedTransactionMeta,\n `TransactionController:updateCustodialTransaction - Custodial transaction updated`,\n );\n }\n\n /**\n * Creates approvals for all unapproved transactions persisted.\n */\n initApprovals() {\n const chainId = this.getChainId();\n const unapprovedTxs = this.state.transactions.filter(\n (transaction) =>\n transaction.status === TransactionStatus.unapproved &&\n transaction.chainId === chainId &&\n !transaction.isUserOperation,\n );\n\n for (const txMeta of unapprovedTxs) {\n this.processApproval(txMeta, {\n shouldShowRequest: false,\n }).catch((error) => {\n if (error?.code === errorCodes.provider.userRejectedRequest) {\n return;\n }\n console.error('Error during persisted transaction approval', error);\n });\n }\n }\n\n /**\n * Search transaction metadata for matching entries.\n *\n * @param opts - Options bag.\n * @param opts.searchCriteria - An object containing values or functions for transaction properties to filter transactions with.\n * @param opts.initialList - The transactions to search. Defaults to the current state.\n * @param opts.filterToCurrentNetwork - Whether to filter the results to the current network. Defaults to true.\n * @param opts.limit - The maximum number of transactions to return. No limit by default.\n * @returns An array of transactions matching the provided options.\n */\n getTransactions({\n searchCriteria = {},\n initialList,\n filterToCurrentNetwork = true,\n limit,\n }: {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n searchCriteria?: any;\n initialList?: TransactionMeta[];\n filterToCurrentNetwork?: boolean;\n limit?: number;\n } = {}): TransactionMeta[] {\n const chainId = this.getChainId();\n // searchCriteria is an object that might have values that aren't predicate\n // methods. When providing any other value type (string, number, etc), we\n // consider this shorthand for \"check the value at key for strict equality\n // with the provided value\". To conform this object to be only methods, we\n // mapValues (lodash) such that every value on the object is a method that\n // returns a boolean.\n const predicateMethods = mapValues(searchCriteria, (predicate) => {\n return typeof predicate === 'function'\n ? predicate\n : // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (v: any) => v === predicate;\n });\n\n const transactionsToFilter = initialList ?? this.state.transactions;\n\n // Combine sortBy and pickBy to transform our state object into an array of\n // matching transactions that are sorted by time.\n const filteredTransactions = sortBy(\n pickBy(transactionsToFilter, (transaction) => {\n if (filterToCurrentNetwork && transaction.chainId !== chainId) {\n return false;\n }\n // iterate over the predicateMethods keys to check if the transaction\n // matches the searchCriteria\n for (const [key, predicate] of Object.entries(predicateMethods)) {\n // We return false early as soon as we know that one of the specified\n // search criteria do not match the transaction. This prevents\n // needlessly checking all criteria when we already know the criteria\n // are not fully satisfied. We check both txParams and the base\n // object as predicate keys can be either.\n if (key in transaction.txParams) {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (predicate((transaction.txParams as any)[key]) === false) {\n return false;\n }\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } else if (predicate((transaction as any)[key]) === false) {\n return false;\n }\n }\n\n return true;\n }),\n 'time',\n );\n if (limit !== undefined) {\n // We need to have all transactions of a given nonce in order to display\n // necessary details in the UI. We use the size of this set to determine\n // whether we have reached the limit provided, thus ensuring that all\n // transactions of nonces we include will be sent to the UI.\n const nonces = new Set();\n const txs = [];\n // By default, the transaction list we filter from is sorted by time ASC.\n // To ensure that filtered results prefers the newest transactions we\n // iterate from right to left, inserting transactions into front of a new\n // array. The original order is preserved, but we ensure that newest txs\n // are preferred.\n for (let i = filteredTransactions.length - 1; i > -1; i--) {\n const txMeta = filteredTransactions[i];\n const { nonce } = txMeta.txParams;\n if (!nonces.has(nonce)) {\n if (nonces.size < limit) {\n nonces.add(nonce);\n } else {\n continue;\n }\n }\n // Push transaction into the beginning of our array to ensure the\n // original order is preserved.\n txs.unshift(txMeta);\n }\n return txs;\n }\n return filteredTransactions;\n }\n\n private async signExternalTransaction(\n transactionParams: TransactionParams,\n ): Promise<string> {\n if (!this.sign) {\n throw new Error('No sign method defined.');\n }\n\n const normalizedTransactionParams = normalizeTxParams(transactionParams);\n const chainId = this.getChainId();\n const type = isEIP1559Transaction(normalizedTransactionParams)\n ? TransactionEnvelopeType.feeMarket\n : TransactionEnvelopeType.legacy;\n const updatedTransactionParams = {\n ...normalizedTransactionParams,\n type,\n gasLimit: normalizedTransactionParams.gas,\n chainId,\n };\n\n const { from } = updatedTransactionParams;\n const common = this.getCommonConfiguration();\n const unsignedTransaction = TransactionFactory.fromTxData(\n updatedTransactionParams,\n { common },\n );\n const signedTransaction = await this.sign(unsignedTransaction, from);\n\n const rawTransaction = bufferToHex(signedTransaction.serialize());\n return rawTransaction;\n }\n\n /**\n * Removes unapproved transactions from state.\n */\n clearUnapprovedTransactions() {\n const transactions = this.state.transactions.filter(\n ({ status }) => status !== TransactionStatus.unapproved,\n );\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n }\n\n private addMetadata(transactionMeta: TransactionMeta) {\n const { transactions } = this.state;\n transactions.push(transactionMeta);\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n }\n\n private async updateGasProperties(transactionMeta: TransactionMeta) {\n const isEIP1559Compatible =\n (await this.getEIP1559Compatibility()) &&\n transactionMeta.txParams.type !== TransactionEnvelopeType.legacy;\n\n const chainId = this.getChainId();\n\n await updateGas({\n ethQuery: this.ethQuery,\n providerConfig: this.getNetworkState().providerConfig,\n txMeta: transactionMeta,\n });\n\n await updateGasFees({\n eip1559: isEIP1559Compatible,\n ethQuery: this.ethQuery,\n getSavedGasFees: this.getSavedGasFees.bind(this, chainId),\n getGasFeeEstimates: this.getGasFeeEstimates.bind(this),\n txMeta: transactionMeta,\n });\n }\n\n private getCurrentChainTransactionsByStatus(status: TransactionStatus) {\n const chainId = this.getChainId();\n return this.state.transactions.filter(\n (transaction) =>\n transaction.status === status && transaction.chainId === chainId,\n );\n }\n\n private onBootCleanup() {\n this.submitApprovedTransactions();\n }\n\n /**\n * Force to submit approved transactions on current chain.\n */\n private submitApprovedTransactions() {\n const approvedTransactions = this.getCurrentChainTransactionsByStatus(\n TransactionStatus.approved,\n );\n for (const transactionMeta of approvedTransactions) {\n if (this.beforeApproveOnInit(transactionMeta)) {\n this.approveTransaction(transactionMeta.id).catch((error) => {\n /* istanbul ignore next */\n console.error('Error while submitting persisted transaction', error);\n });\n }\n }\n }\n\n private async processApproval(\n transactionMeta: TransactionMeta,\n {\n isExisting = false,\n requireApproval,\n shouldShowRequest = true,\n actionId,\n }: {\n isExisting?: boolean;\n requireApproval?: boolean | undefined;\n shouldShowRequest?: boolean;\n actionId?: string;\n },\n ): Promise<string> {\n const transactionId = transactionMeta.id;\n let resultCallbacks: AcceptResultCallbacks | undefined;\n const { meta, isCompleted } = this.isTransactionCompleted(transactionId);\n const finishedPromise = isCompleted\n ? Promise.resolve(meta)\n : this.waitForTransactionFinished(transactionId);\n\n if (meta && !isExisting && !isCompleted) {\n try {\n if (requireApproval !== false) {\n const acceptResult = await this.requestApproval(transactionMeta, {\n shouldShowRequest,\n });\n\n resultCallbacks = acceptResult.resultCallbacks;\n\n if (resultCallbacks) {\n this.hub.once(`${transactionId}:publish-skip`, () => {\n resultCallbacks?.success();\n\n // Remove the reference to prevent additional reports once submitted.\n resultCallbacks = undefined;\n });\n }\n\n const approvalValue = acceptResult.value as\n | {\n txMeta?: TransactionMeta;\n }\n | undefined;\n\n const updatedTransaction = approvalValue?.txMeta;\n\n if (updatedTransaction) {\n log('Updating transaction with approval data', {\n customNonce: updatedTransaction.customNonceValue,\n params: updatedTransaction.txParams,\n });\n\n this.updateTransaction(\n updatedTransaction,\n 'TransactionController#processApproval - Updated with approval data',\n );\n }\n }\n\n const { isCompleted: isTxCompleted } =\n this.isTransactionCompleted(transactionId);\n\n if (!isTxCompleted) {\n await this.approveTransaction(transactionId);\n const updatedTransactionMeta = this.getTransaction(\n transactionId,\n ) as TransactionMeta;\n this.hub.emit('transaction-approved', {\n transactionMeta: updatedTransactionMeta,\n actionId,\n });\n }\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const { isCompleted: isTxCompleted } =\n this.isTransactionCompleted(transactionId);\n if (!isTxCompleted) {\n if (error?.code === errorCodes.provider.userRejectedRequest) {\n this.cancelTransaction(transactionId, actionId);\n\n throw providerErrors.userRejectedRequest(\n 'MetaMask Tx Signature: User denied transaction signature.',\n );\n } else {\n this.failTransaction(meta, error, actionId);\n }\n }\n }\n }\n\n const finalMeta = await finishedPromise;\n\n switch (finalMeta?.status) {\n case TransactionStatus.failed:\n resultCallbacks?.error(finalMeta.error);\n throw rpcErrors.internal(finalMeta.error.message);\n\n case TransactionStatus.submitted:\n resultCallbacks?.success();\n return finalMeta.hash as string;\n\n default:\n const internalError = rpcErrors.internal(\n `MetaMask Tx Signature: Unknown problem: ${JSON.stringify(\n finalMeta || transactionId,\n )}`,\n );\n\n resultCallbacks?.error(internalError);\n throw internalError;\n }\n }\n\n /**\n * Approves a transaction and updates it's status in state. If this is not a\n * retry transaction, a nonce will be generated. The transaction is signed\n * using the sign configuration property, then published to the blockchain.\n * A `<tx.id>:finished` hub event is fired after success or failure.\n *\n * @param transactionId - The ID of the transaction to approve.\n */\n private async approveTransaction(transactionId: string) {\n const { transactions } = this.state;\n const releaseLock = await this.mutex.acquire();\n const chainId = this.getChainId();\n const index = transactions.findIndex(({ id }) => transactionId === id);\n const transactionMeta = transactions[index];\n\n const {\n txParams: { from },\n } = transactionMeta;\n\n let releaseNonceLock: (() => void) | undefined;\n\n try {\n if (!this.sign) {\n releaseLock();\n this.failTransaction(\n transactionMeta,\n new Error('No sign method defined.'),\n );\n return;\n } else if (!chainId) {\n releaseLock();\n this.failTransaction(transactionMeta, new Error('No chainId defined.'));\n return;\n }\n\n if (this.inProcessOfSigning.has(transactionId)) {\n log('Skipping approval as signing in progress', transactionId);\n return;\n }\n\n const [nonce, releaseNonce] = await getNextNonce(\n transactionMeta,\n this.nonceTracker,\n );\n\n releaseNonceLock = releaseNonce;\n\n transactionMeta.status = TransactionStatus.approved;\n transactionMeta.txParams.nonce = nonce;\n transactionMeta.txParams.chainId = chainId;\n\n const baseTxParams = {\n ...transactionMeta.txParams,\n gasLimit: transactionMeta.txParams.gas,\n };\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - Transaction approved',\n );\n\n this.onTransactionStatusChange(transactionMeta);\n\n const isEIP1559 = isEIP1559Transaction(transactionMeta.txParams);\n\n const txParams: TransactionParams = isEIP1559\n ? {\n ...baseTxParams,\n estimatedBaseFee: transactionMeta.txParams.estimatedBaseFee,\n type: TransactionEnvelopeType.feeMarket,\n }\n : baseTxParams;\n\n const rawTx = await this.signTransaction(transactionMeta, txParams);\n\n if (!this.beforePublish(transactionMeta)) {\n log('Skipping publishing transaction based on hook');\n this.hub.emit(`${transactionMeta.id}:publish-skip`, transactionMeta);\n return;\n }\n\n if (!rawTx) {\n return;\n }\n\n if (transactionMeta.type === TransactionType.swap) {\n log('Determining pre-transaction balance');\n\n const preTxBalance = await query(this.ethQuery, 'getBalance', [from]);\n\n transactionMeta.preTxBalance = preTxBalance;\n\n log('Updated pre-transaction balance', transactionMeta.preTxBalance);\n }\n\n log('Publishing transaction', txParams);\n\n const hash = await this.publishTransaction(rawTx);\n\n log('Publish successful', hash);\n\n transactionMeta.hash = hash;\n transactionMeta.status = TransactionStatus.submitted;\n transactionMeta.submittedTime = new Date().getTime();\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - Transaction submitted',\n );\n\n this.hub.emit('transaction-submitted', {\n transactionMeta,\n });\n\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n\n this.onTransactionStatusChange(transactionMeta);\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n this.failTransaction(transactionMeta, error);\n } finally {\n this.inProcessOfSigning.delete(transactionId);\n // must set transaction to submitted/failed before releasing lock\n releaseNonceLock?.();\n releaseLock();\n }\n }\n\n private async publishTransaction(rawTransaction: string): Promise<string> {\n return await query(this.ethQuery, 'sendRawTransaction', [rawTransaction]);\n }\n\n /**\n * Cancels a transaction based on its ID by setting its status to \"rejected\"\n * and emitting a `<tx.id>:finished` hub event.\n *\n * @param transactionId - The ID of the transaction to cancel.\n * @param actionId - The actionId passed from UI\n */\n private cancelTransaction(transactionId: string, actionId?: string) {\n const transactionMeta = this.state.transactions.find(\n ({ id }) => id === transactionId,\n );\n if (!transactionMeta) {\n return;\n }\n transactionMeta.status = TransactionStatus.rejected;\n const transactions = this.state.transactions.filter(\n ({ id }) => id !== transactionId,\n );\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n this.hub.emit('transaction-rejected', {\n transactionMeta,\n actionId,\n });\n this.onTransactionStatusChange(transactionMeta);\n }\n\n /**\n * Trim the amount of transactions that are set on the state. Checks\n * if the length of the tx history is longer then desired persistence\n * limit and then if it is removes the oldest confirmed or rejected tx.\n * Pending or unapproved transactions will not be removed by this\n * operation. For safety of presenting a fully functional transaction UI\n * representation, this function will not break apart transactions with the\n * same nonce, created on the same day, per network. Not accounting for transactions of the same\n * nonce, same day and network combo can result in confusing or broken experiences\n * in the UI. The transactions are then updated using the BaseControllerV1 update.\n *\n * @param transactions - The transactions to be applied to the state.\n * @returns The trimmed list of transactions.\n */\n private trimTransactionsForState(\n transactions: TransactionMeta[],\n ): TransactionMeta[] {\n const nonceNetworkSet = new Set();\n\n const txsToKeep = transactions\n .sort((a, b) => (a.time > b.time ? -1 : 1)) // Descending time order\n .filter((tx) => {\n const { chainId, status, txParams, time } = tx;\n\n if (txParams) {\n const key = `${txParams.nonce}-${convertHexToDecimal(\n chainId,\n )}-${new Date(time).toDateString()}`;\n\n if (nonceNetworkSet.has(key)) {\n return true;\n } else if (\n nonceNetworkSet.size < this.config.txHistoryLimit ||\n !this.isFinalState(status)\n ) {\n nonceNetworkSet.add(key);\n return true;\n }\n }\n\n return false;\n });\n\n txsToKeep.reverse(); // Ascending time order\n return txsToKeep;\n }\n\n /**\n * Determines if the transaction is in a final state.\n *\n * @param status - The transaction status.\n * @returns Whether the transaction is in a final state.\n */\n private isFinalState(status: TransactionStatus): boolean {\n return (\n status === TransactionStatus.rejected ||\n status === TransactionStatus.confirmed ||\n status === TransactionStatus.failed\n );\n }\n\n /**\n * Whether the transaction has at least completed all local processing.\n *\n * @param status - The transaction status.\n * @returns Whether the transaction is in a final state.\n */\n private isLocalFinalState(status: TransactionStatus): boolean {\n return [\n TransactionStatus.confirmed,\n TransactionStatus.failed,\n TransactionStatus.rejected,\n TransactionStatus.submitted,\n ].includes(status);\n }\n\n private async requestApproval(\n txMeta: TransactionMeta,\n { shouldShowRequest }: { shouldShowRequest: boolean },\n ): Promise<AddResult> {\n const id = this.getApprovalId(txMeta);\n const { origin } = txMeta;\n const type = ApprovalType.Transaction;\n const requestData = { txId: txMeta.id };\n\n return (await this.messagingSystem.call(\n 'ApprovalController:addRequest',\n {\n id,\n origin: origin || ORIGIN_METAMASK,\n type,\n requestData,\n expectsResult: true,\n },\n shouldShowRequest,\n )) as Promise<AddResult>;\n }\n\n private getTransaction(transactionId: string): TransactionMeta | undefined {\n const { transactions } = this.state;\n return transactions.find(({ id }) => id === transactionId);\n }\n\n private getApprovalId(txMeta: TransactionMeta) {\n return String(txMeta.id);\n }\n\n private isTransactionCompleted(transactionId: string): {\n meta?: TransactionMeta;\n isCompleted: boolean;\n } {\n const transaction = this.getTransaction(transactionId);\n\n if (!transaction) {\n return { meta: undefined, isCompleted: false };\n }\n\n const isCompleted = this.isLocalFinalState(transaction.status);\n\n return { meta: transaction, isCompleted };\n }\n\n private getChainId(): Hex {\n const { providerConfig } = this.getNetworkState();\n return providerConfig.chainId;\n }\n\n private prepareUnsignedEthTx(txParams: TransactionParams): TypedTransaction {\n return TransactionFactory.fromTxData(txParams, {\n common: this.getCommonConfiguration(),\n freeze: false,\n });\n }\n\n /**\n * `@ethereumjs/tx` uses `@ethereumjs/common` as a configuration tool for\n * specifying which chain, network, hardfork and EIPs to support for\n * a transaction. By referencing this configuration, and analyzing the fields\n * specified in txParams, @ethereumjs/tx is able to determine which EIP-2718\n * transaction type to use.\n *\n * @returns common configuration object\n */\n private getCommonConfiguration(): Common {\n const {\n providerConfig: { type: chain, chainId, nickname: name },\n } = this.getNetworkState();\n\n if (\n chain !== RPC &&\n chain !== NetworkType['linea-goerli'] &&\n chain !== NetworkType['linea-mainnet']\n ) {\n return new Common({ chain, hardfork: HARDFORK });\n }\n\n const customChainParams: Partial<ChainConfig> = {\n name,\n chainId: parseInt(chainId, 16),\n defaultHardfork: HARDFORK,\n };\n\n return Common.custom(customChainParams);\n }\n\n private onIncomingTransactions({\n added,\n updated,\n }: {\n added: TransactionMeta[];\n updated: TransactionMeta[];\n }) {\n const { transactions: currentTransactions } = this.state;\n\n const updatedTransactions = [\n ...added,\n ...currentTransactions.map((originalTransaction) => {\n const updatedTransaction = updated.find(\n ({ hash }) => hash === originalTransaction.hash,\n );\n\n return updatedTransaction ?? originalTransaction;\n }),\n ];\n\n this.update({\n transactions: this.trimTransactionsForState(updatedTransactions),\n });\n }\n\n private onUpdatedLastFetchedBlockNumbers({\n lastFetchedBlockNumbers,\n blockNumber,\n }: {\n lastFetchedBlockNumbers: {\n [key: string]: number;\n };\n blockNumber: number;\n }) {\n this.update({ lastFetchedBlockNumbers });\n this.hub.emit('incomingTransactionBlock', blockNumber);\n }\n\n private generateDappSuggestedGasFees(\n txParams: TransactionParams,\n origin?: string,\n ): DappSuggestedGasFees | undefined {\n if (!origin || origin === ORIGIN_METAMASK) {\n return undefined;\n }\n\n const { gasPrice, maxFeePerGas, maxPriorityFeePerGas, gas } = txParams;\n\n if (\n gasPrice === undefined &&\n maxFeePerGas === undefined &&\n maxPriorityFeePerGas === undefined &&\n gas === undefined\n ) {\n return undefined;\n }\n\n const dappSuggestedGasFees: DappSuggestedGasFees = {};\n\n if (gasPrice !== undefined) {\n dappSuggestedGasFees.gasPrice = gasPrice;\n } else if (\n maxFeePerGas !== undefined ||\n maxPriorityFeePerGas !== undefined\n ) {\n dappSuggestedGasFees.maxFeePerGas = maxFeePerGas;\n dappSuggestedGasFees.maxPriorityFeePerGas = maxPriorityFeePerGas;\n }\n\n if (gas !== undefined) {\n dappSuggestedGasFees.gas = gas;\n }\n\n return dappSuggestedGasFees;\n }\n\n /**\n * Validates and adds external provided transaction to state.\n *\n * @param transactionMeta - Nominated external transaction to be added to state.\n */\n private addExternalTransaction(transactionMeta: TransactionMeta) {\n const chainId = this.getChainId();\n const { transactions } = this.state;\n const fromAddress = transactionMeta?.txParams?.from;\n const sameFromAndNetworkTransactions = transactions.filter(\n (transaction) =>\n transaction.txParams.from === fromAddress &&\n transaction.chainId === chainId,\n );\n const confirmedTxs = sameFromAndNetworkTransactions.filter(\n (transaction) => transaction.status === TransactionStatus.confirmed,\n );\n const pendingTxs = sameFromAndNetworkTransactions.filter(\n (transaction) => transaction.status === TransactionStatus.submitted,\n );\n\n validateConfirmedExternalTransaction(\n transactionMeta,\n confirmedTxs,\n pendingTxs,\n );\n\n // Make sure provided external transaction has non empty history array\n if (!(transactionMeta.history ?? []).length) {\n if (!this.isHistoryDisabled) {\n addInitialHistorySnapshot(transactionMeta);\n }\n }\n\n const updatedTransactions = [...transactions, transactionMeta];\n this.update({\n transactions: this.trimTransactionsForState(updatedTransactions),\n });\n }\n\n /**\n * Sets other txMeta statuses to dropped if the txMeta that has been confirmed has other transactions\n * in the transactions have the same nonce.\n *\n * @param transactionId - Used to identify original transaction.\n */\n private markNonceDuplicatesDropped(transactionId: string) {\n const chainId = this.getChainId();\n const transactionMeta = this.getTransaction(transactionId);\n const nonce = transactionMeta?.txParams?.nonce;\n const from = transactionMeta?.txParams?.from;\n\n const sameNonceTxs = this.state.transactions.filter(\n (transaction) =>\n transaction.id !== transactionId &&\n transaction.txParams.from === from &&\n transaction.txParams.nonce === nonce &&\n transaction.chainId === chainId &&\n transaction.type !== TransactionType.incoming,\n );\n\n if (!sameNonceTxs.length) {\n return;\n }\n\n // Mark all same nonce transactions as dropped and give it a replacedBy hash\n for (const transaction of sameNonceTxs) {\n transaction.replacedBy = transactionMeta?.hash;\n transaction.replacedById = transactionMeta?.id;\n // Drop any transaction that wasn't previously failed (off chain failure)\n if (transaction.status !== TransactionStatus.failed) {\n this.setTransactionStatusDropped(transaction);\n }\n }\n }\n\n /**\n * Method to set transaction status to dropped.\n *\n * @param transactionMeta - TransactionMeta of transaction to be marked as dropped.\n */\n private setTransactionStatusDropped(transactionMeta: TransactionMeta) {\n transactionMeta.status = TransactionStatus.dropped;\n this.hub.emit('transaction-dropped', {\n transactionMeta,\n });\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#setTransactionStatusDropped - Transaction dropped',\n );\n this.onTransactionStatusChange(transactionMeta);\n }\n\n /**\n * Get transaction with provided actionId.\n *\n * @param actionId - Unique ID to prevent duplicate requests\n * @returns the filtered transaction\n */\n private getTransactionWithActionId(actionId?: string) {\n return this.state.transactions.find(\n (transaction) => actionId && transaction.actionId === actionId,\n );\n }\n\n private async waitForTransactionFinished(\n transactionId: string,\n ): Promise<TransactionMeta> {\n return new Promise((resolve) => {\n this.hub.once(`${transactionId}:finished`, (txMeta) => {\n resolve(txMeta);\n });\n });\n }\n\n /**\n * Updates the r, s, and v properties of a TransactionMeta object\n * with values from a signed transaction.\n *\n * @param transactionMeta - The TransactionMeta object to update.\n * @param signedTx - The encompassing type for all transaction types containing r, s, and v values.\n */\n private async updateTransactionMetaRSV(\n transactionMeta: TransactionMeta,\n signedTx: TypedTransaction,\n ): Promise<void> {\n for (const key of ['r', 's', 'v'] as const) {\n const value = signedTx[key];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n transactionMeta[key] = addHexPrefix(value.toString(16));\n }\n }\n\n private async getEIP1559Compatibility() {\n const currentNetworkIsEIP1559Compatible =\n await this.getCurrentNetworkEIP1559Compatibility();\n\n const currentAccountIsEIP1559Compatible =\n await this.getCurrentAccountEIP1559Compatibility();\n\n return (\n currentNetworkIsEIP1559Compatible && currentAccountIsEIP1559Compatible\n );\n }\n\n private addPendingTransactionTrackerListeners() {\n this.pendingTransactionTracker.hub.on(\n 'transaction-confirmed',\n this.onConfirmedTransaction.bind(this),\n );\n\n this.pendingTransactionTracker.hub.on(\n 'transaction-dropped',\n this.setTransactionStatusDropped.bind(this),\n );\n\n this.pendingTransactionTracker.hub.on(\n 'transaction-failed',\n this.failTransaction.bind(this),\n );\n\n this.pendingTransactionTracker.hub.on(\n 'transaction-updated',\n this.updateTransaction.bind(this),\n );\n }\n\n private async signTransaction(\n transactionMeta: TransactionMeta,\n txParams: TransactionParams,\n ): Promise<string | undefined> {\n log('Signing transaction', txParams);\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n this.inProcessOfSigning.add(transactionMeta.id);\n\n const signedTx = await this.sign?.(\n unsignedEthTx,\n txParams.from,\n ...this.getAdditionalSignArguments(transactionMeta),\n );\n\n if (!signedTx) {\n log('Skipping signed status as no signed transaction');\n return undefined;\n }\n\n if (!this.afterSign(transactionMeta, signedTx)) {\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#signTransaction - Update after sign',\n );\n\n log('Skipping signed status based on hook');\n\n return undefined;\n }\n\n await this.updateTransactionMetaRSV(transactionMeta, signedTx);\n\n transactionMeta.status = TransactionStatus.signed;\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - Transaction signed',\n );\n\n this.onTransactionStatusChange(transactionMeta);\n\n const rawTx = bufferToHex(signedTx.serialize());\n\n transactionMeta.rawTx = rawTx;\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - RawTransaction added',\n );\n\n return rawTx;\n }\n\n private onTransactionStatusChange(transactionMeta: TransactionMeta) {\n this.hub.emit('transaction-status-update', { transactionMeta });\n }\n\n private getNonceTrackerPendingTransactions(address: string) {\n const standardPendingTransactions = this.getNonceTrackerTransactions(\n TransactionStatus.submitted,\n address,\n );\n\n const externalPendingTransactions =\n this.getExternalPendingTransactions(address);\n\n return [...standardPendingTransactions, ...externalPendingTransactions];\n }\n\n private getNonceTrackerTransactions(\n status: TransactionStatus,\n address: string,\n ) {\n const currentChainId = this.getChainId();\n\n return getAndFormatTransactionsForNonceTracker(\n currentChainId,\n address,\n status,\n this.state.transactions,\n );\n }\n\n private onConfirmedTransaction(transactionMeta: TransactionMeta) {\n log('Processing confirmed transaction', transactionMeta.id);\n\n this.markNonceDuplicatesDropped(transactionMeta.id);\n\n this.hub.emit('transaction-confirmed', { transactionMeta });\n this.hub.emit(`${transactionMeta.id}:confirmed`, transactionMeta);\n\n this.onTransactionStatusChange(transactionMeta);\n\n // Intentional given potential duration of process.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.updatePostBalance(transactionMeta);\n }\n\n private async updatePostBalance(transactionMeta: TransactionMeta) {\n try {\n if (transactionMeta.type !== TransactionType.swap) {\n return;\n }\n\n const { updatedTransactionMeta, approvalTransactionMeta } =\n await updatePostTransactionBalance(transactionMeta, {\n ethQuery: this.ethQuery,\n getTransaction: this.getTransaction.bind(this),\n updateTransaction: this.updateTransaction.bind(this),\n });\n\n this.hub.emit('post-transaction-balance-updated', {\n transactionMeta: updatedTransactionMeta,\n approvalTransactionMeta,\n });\n } catch (error) {\n /* istanbul ignore next */\n log('Error while updating post transaction balance', error);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"TransactionController.js","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+CAAwE;AAExE,uCAAoD;AAWpD,+DAA6D;AAC7D,iEAOoC;AACpC,oEAA2C;AAO3C,qDAA6E;AAE7E,6CAAoC;AACpC,6DAAqD;AACrD,qDAA4D;AAC5D,mCAAsC;AACtC,mCAA0D;AAC1D,iDAA6C;AAK7C,+BAAoC;AAEpC,iGAA8F;AAC9F,mFAAgF;AAChF,mFAAgF;AAChF,qCAAgD;AAahD,mCAIiB;AACjB,yEAAqF;AACrF,qCAAmE;AACnE,+CAAiD;AACjD,6CAGyB;AACzB,yCAGuB;AACvB,yCAGuB;AACvB,+DAAoE;AACpE,yCAWuB;AACvB,mDAG4B;AAEf,QAAA,QAAQ,GAAG,iBAAQ,CAAC,MAAM,CAAC;AA8ExC;;GAEG;AACU,QAAA,WAAW,GAAG,GAAG,CAAC;AAE/B;;GAEG;AACU,QAAA,aAAa,GAAG,GAAG,CAAC;AAEjC;;GAEG;AACH,MAAM,cAAc,GAAG,uBAAuB,CAAC;AA8B/C;;GAEG;AACH,MAAa,qBAAsB,SAAQ,kCAG1C;IAsHC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,YACE,EACE,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,qCAAqC,EACrC,qCAAqC,EACrC,8BAA8B,EAC9B,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,GAAG,EAAE,EACzB,SAAS,EACT,oBAAoB,EACpB,mBAAmB,GAAG,EAAE,EACxB,QAAQ,EACR,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,GAAG,EAAE,GA6CX,EACD,MAAmC,EACnC,KAAiC;;QAEjC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,C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,IAAI,CAAC,0BAA0B,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAEpD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,eAAe,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC;QAElE,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;QAEhD,mDAAmD;QACnD,mEAAmE;QACnE,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC1C,CAAC;IAEa,iBAAiB,CAAC,eAAgC;;YAC9D,IAAI;gBACF,IAAI,eAAe,CAAC,IAAI,KAAK,uBAAe,CAAC,IAAI,EAAE;oBACjD,OAAO;iBACR;gBAED,MAAM,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,GACvD,MAAM,IAAA,oCAA4B,EAAC,eAAe,EAAE;oBAClD,QAAQ,EAAE,IAAI,CAAC,QAAQ;oBACvB,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC9C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC;iBACrD,CAAC,CAAC;gBAEL,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,EAAE;oBAChD,eAAe,EAAE,sBAAsB;oBACvC,uBAAuB;iBACxB,CAAC,CAAC;aACJ;YAAC,OAAO,KAAK,EAAE;gBACd,0BAA0B;gBAC1B,IAAA,sBAAG,EAAC,+CAA+C,EAAE,KAAK,CAAC,CAAC;aAC7D;QACH,CAAC;KAAA;CACF;AAj6ED,sDAi6EC","sourcesContent":["import { Hardfork, Common, type ChainConfig } from '@ethereumjs/common';\nimport type { TypedTransaction } from '@ethereumjs/tx';\nimport { TransactionFactory } from '@ethereumjs/tx';\nimport type {\n AcceptResultCallbacks,\n AddApprovalRequest,\n AddResult,\n} from '@metamask/approval-controller';\nimport type {\n BaseConfig,\n BaseState,\n RestrictedControllerMessenger,\n} from '@metamask/base-controller';\nimport { BaseControllerV1 } from '@metamask/base-controller';\nimport {\n query,\n NetworkType,\n RPC,\n ApprovalType,\n ORIGIN_METAMASK,\n convertHexToDecimal,\n} from '@metamask/controller-utils';\nimport EthQuery from '@metamask/eth-query';\nimport type { GasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n BlockTracker,\n NetworkState,\n Provider,\n} from '@metamask/network-controller';\nimport { errorCodes, rpcErrors, providerErrors } from '@metamask/rpc-errors';\nimport type { Hex } from '@metamask/utils';\nimport { Mutex } from 'async-mutex';\nimport { MethodRegistry } from 'eth-method-registry';\nimport { addHexPrefix, bufferToHex } from 'ethereumjs-util';\nimport { EventEmitter } from 'events';\nimport { mapValues, merge, pickBy, sortBy } from 'lodash';\nimport { NonceTracker } from 'nonce-tracker';\nimport type {\n NonceLock,\n Transaction as NonceTrackerTransaction,\n} from 'nonce-tracker';\nimport { v1 as random } from 'uuid';\n\nimport { EtherscanRemoteTransactionSource } from './helpers/EtherscanRemoteTransactionSource';\nimport { IncomingTransactionHelper } from './helpers/IncomingTransactionHelper';\nimport { PendingTransactionTracker } from './helpers/PendingTransactionTracker';\nimport { projectLogger as log } from './logger';\nimport type {\n Events,\n DappSuggestedGasFees,\n SavedGasFees,\n SecurityProviderRequest,\n SendFlowHistoryEntry,\n TransactionParams,\n TransactionMeta,\n TransactionReceipt,\n WalletDevice,\n SecurityAlertResponse,\n} from './types';\nimport {\n TransactionEnvelopeType,\n TransactionType,\n TransactionStatus,\n} from './types';\nimport { validateConfirmedExternalTransaction } from './utils/external-transactions';\nimport { addGasBuffer, estimateGas, updateGas } from './utils/gas';\nimport { updateGasFees } from './utils/gas-fees';\nimport {\n addInitialHistorySnapshot,\n updateTransactionHistory,\n} from './utils/history';\nimport {\n getAndFormatTransactionsForNonceTracker,\n getNextNonce,\n} from './utils/nonce';\nimport {\n updatePostTransactionBalance,\n updateSwapsTransaction,\n} from './utils/swaps';\nimport { determineTransactionType } from './utils/transaction-type';\nimport {\n getIncreasedPriceFromExisting,\n normalizeTxParams,\n isEIP1559Transaction,\n isFeeMarketEIP1559Values,\n isGasPriceValue,\n validateGasValues,\n validateIfTransactionUnapproved,\n validateMinimumIncrease,\n normalizeTxError,\n normalizeGasFeeValues,\n} from './utils/utils';\nimport {\n validateTransactionOrigin,\n validateTxParams,\n} from './utils/validation';\n\nexport const HARDFORK = Hardfork.London;\n\n/**\n * @type Result\n * @property result - Promise resolving to a new transaction hash\n * @property transactionMeta - Meta information about this new transaction\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface Result {\n result: Promise<string>;\n transactionMeta: TransactionMeta;\n}\n\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface GasPriceValue {\n gasPrice: string;\n}\n\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface FeeMarketEIP1559Values {\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n}\n\n/**\n * @type TransactionConfig\n *\n * Transaction controller configuration\n * @property provider - Provider used to create a new underlying EthQuery instance\n * @property sign - Method used to sign transactions\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransactionConfig extends BaseConfig {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n sign?: (txParams: TransactionParams, from: string) => Promise<any>;\n txHistoryLimit: number;\n}\n\n/**\n * @type MethodData\n *\n * Method data registry object\n * @property registryMethod - Registry method raw string\n * @property parsedRegistryMethod - Registry method object, containing name and method arguments\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface MethodData {\n registryMethod: string;\n parsedRegistryMethod: Record<string, unknown>;\n}\n\n/**\n * @type TransactionState\n *\n * Transaction controller state\n * @property transactions - A list of TransactionMeta objects\n * @property methodData - Object containing all known method data information\n */\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransactionState extends BaseState {\n transactions: TransactionMeta[];\n methodData: { [key: string]: MethodData };\n lastFetchedBlockNumbers: { [key: string]: number };\n}\n\n/**\n * Multiplier used to determine a transaction's increased gas fee during cancellation\n */\nexport const CANCEL_RATE = 1.5;\n\n/**\n * Multiplier used to determine a transaction's increased gas fee during speed up\n */\nexport const SPEED_UP_RATE = 1.1;\n\n/**\n * The name of the {@link TransactionController}.\n */\nconst controllerName = 'TransactionController';\n\n/**\n * The external actions available to the {@link TransactionController}.\n */\ntype AllowedActions = AddApprovalRequest;\n\n/**\n * The messenger of the {@link TransactionController}.\n */\nexport type TransactionControllerMessenger = RestrictedControllerMessenger<\n typeof controllerName,\n AllowedActions,\n never,\n AllowedActions['type'],\n never\n>;\n\n// This interface was created before this ESLint rule was added.\n// Convert to a `type` in a future major version.\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport interface TransactionControllerEventEmitter extends EventEmitter {\n on<T extends keyof Events>(\n eventName: T,\n listener: (...args: Events[T]) => void,\n ): this;\n\n emit<T extends keyof Events>(eventName: T, ...args: Events[T]): boolean;\n}\n\n/**\n * Controller responsible for submitting and managing transactions.\n */\nexport class TransactionController extends BaseControllerV1<\n TransactionConfig,\n TransactionState\n> {\n private readonly ethQuery: EthQuery;\n\n private readonly isHistoryDisabled: boolean;\n\n private readonly isSwapsDisabled: boolean;\n\n private readonly isSendFlowHistoryDisabled: boolean;\n\n private readonly inProcessOfSigning: Set<string> = new Set();\n\n private readonly nonceTracker: NonceTracker;\n\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private readonly registry: any;\n\n private readonly provider: Provider;\n\n private readonly mutex = new Mutex();\n\n private readonly getSavedGasFees: (chainId: Hex) => SavedGasFees | undefined;\n\n private readonly getNetworkState: () => NetworkState;\n\n private readonly getCurrentAccountEIP1559Compatibility: () => Promise<boolean>;\n\n private readonly getCurrentNetworkEIP1559Compatibility: () => Promise<boolean>;\n\n private readonly getGasFeeEstimates: () => Promise<GasFeeState>;\n\n private readonly getPermittedAccounts: (origin?: string) => Promise<string[]>;\n\n private readonly getSelectedAddress: () => string;\n\n private readonly getExternalPendingTransactions: (\n address: string,\n ) => NonceTrackerTransaction[];\n\n private readonly messagingSystem: TransactionControllerMessenger;\n\n private readonly incomingTransactionHelper: IncomingTransactionHelper;\n\n private readonly securityProviderRequest?: SecurityProviderRequest;\n\n private readonly pendingTransactionTracker: PendingTransactionTracker;\n\n private readonly cancelMultiplier: number;\n\n private readonly speedUpMultiplier: number;\n\n private readonly afterSign: (\n transactionMeta: TransactionMeta,\n signedTx: TypedTransaction,\n ) => boolean;\n\n private readonly beforeApproveOnInit: (\n transactionMeta: TransactionMeta,\n ) => boolean;\n\n private readonly beforeCheckPendingTransaction: (\n transactionMeta: TransactionMeta,\n ) => boolean;\n\n private readonly beforePublish: (transactionMeta: TransactionMeta) => boolean;\n\n private readonly getAdditionalSignArguments: (\n transactionMeta: TransactionMeta,\n ) => (TransactionMeta | undefined)[];\n\n private failTransaction(\n transactionMeta: TransactionMeta,\n error: Error,\n actionId?: string,\n ) {\n const newTransactionMeta = {\n ...transactionMeta,\n error: normalizeTxError(error),\n status: TransactionStatus.failed,\n };\n this.hub.emit('transaction-failed', {\n actionId,\n error: error.message,\n transactionMeta: newTransactionMeta,\n });\n this.updateTransaction(\n newTransactionMeta,\n 'TransactionController#failTransaction - Add error message and set status to failed',\n );\n this.onTransactionStatusChange(newTransactionMeta);\n this.hub.emit(`${transactionMeta.id}:finished`, newTransactionMeta);\n }\n\n private async registryLookup(fourBytePrefix: string): Promise<MethodData> {\n const registryMethod = await this.registry.lookup(fourBytePrefix);\n const parsedRegistryMethod = this.registry.parse(registryMethod);\n return { registryMethod, parsedRegistryMethod };\n }\n\n /**\n * EventEmitter instance used to listen to specific transactional events\n */\n hub = new EventEmitter() as TransactionControllerEventEmitter;\n\n /**\n * Name of this controller used during composition\n */\n override name = 'TransactionController';\n\n /**\n * Method used to sign transactions\n */\n sign?: (\n transaction: TypedTransaction,\n from: string,\n transactionMeta?: TransactionMeta,\n ) => Promise<TypedTransaction>;\n\n /**\n * Creates a TransactionController instance.\n *\n * @param options - The controller options.\n * @param options.blockTracker - The block tracker used to poll for new blocks data.\n * @param options.cancelMultiplier - Multiplier used to determine a transaction's increased gas fee during cancellation.\n * @param options.disableHistory - Whether to disable storing history in transaction metadata.\n * @param options.disableSendFlowHistory - Explicitly disable transaction metadata history.\n * @param options.disableSwaps - Whether to disable additional processing on swaps transactions.\n * @param options.getCurrentAccountEIP1559Compatibility - Whether or not the account supports EIP-1559.\n * @param options.getCurrentNetworkEIP1559Compatibility - Whether or not the network supports EIP-1559.\n * @param options.getExternalPendingTransactions - Callback to retrieve pending transactions from external sources.\n * @param options.getGasFeeEstimates - Callback to retrieve gas fee estimates.\n * @param options.getNetworkState - Gets the state of the network controller.\n * @param options.getPermittedAccounts - Get accounts that a given origin has permissions for.\n * @param options.getSavedGasFees - Gets the saved gas fee config.\n * @param options.getSelectedAddress - Gets the address of the currently selected account.\n * @param options.incomingTransactions - Configuration options for incoming transaction support.\n * @param options.incomingTransactions.includeTokenTransfers - Whether or not to include ERC20 token transfers.\n * @param options.incomingTransactions.isEnabled - Whether or not incoming transaction retrieval is enabled.\n * @param options.incomingTransactions.queryEntireHistory - Whether to initially query the entire transaction history or only recent blocks.\n * @param options.incomingTransactions.updateTransactions - Whether to update local transactions using remote transaction data.\n * @param options.messenger - The controller messenger.\n * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.\n * @param options.pendingTransactions - Configuration options for pending transaction support.\n * @param options.pendingTransactions.isResubmitEnabled - Whether transaction publishing is automatically retried.\n * @param options.provider - The provider used to create the underlying EthQuery instance.\n * @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.\n * @param options.speedUpMultiplier - Multiplier used to determine a transaction's increased gas fee during speed up.\n * @param options.hooks - The controller hooks.\n * @param options.hooks.afterSign - Additional logic to execute after signing a transaction. Return false to not change the status to signed.\n * @param options.hooks.beforeApproveOnInit - Additional logic to execute before starting an approval flow for a transaction during initialization. Return false to skip the transaction.\n * @param options.hooks.beforeCheckPendingTransaction - Additional logic to execute before checking pending transactions. Return false to prevent the broadcast of the transaction.\n * @param options.hooks.beforePublish - Additional logic to execute before publishing a transaction. Return false to prevent the broadcast of the transaction.\n * @param options.hooks.getAdditionalSignArguments - Returns additional arguments required to sign a transaction.\n * @param config - Initial options used to configure this controller.\n * @param state - Initial state to set on this controller.\n */\n constructor(\n {\n blockTracker,\n cancelMultiplier,\n disableHistory,\n disableSendFlowHistory,\n disableSwaps,\n getCurrentAccountEIP1559Compatibility,\n getCurrentNetworkEIP1559Compatibility,\n getExternalPendingTransactions,\n getGasFeeEstimates,\n getNetworkState,\n getPermittedAccounts,\n getSavedGasFees,\n getSelectedAddress,\n incomingTransactions = {},\n messenger,\n onNetworkStateChange,\n pendingTransactions = {},\n provider,\n securityProviderRequest,\n speedUpMultiplier,\n hooks = {},\n }: {\n blockTracker: BlockTracker;\n cancelMultiplier?: number;\n disableHistory: boolean;\n disableSendFlowHistory: boolean;\n disableSwaps: boolean;\n getCurrentAccountEIP1559Compatibility?: () => Promise<boolean>;\n getCurrentNetworkEIP1559Compatibility: () => Promise<boolean>;\n getExternalPendingTransactions?: (\n address: string,\n ) => NonceTrackerTransaction[];\n getGasFeeEstimates?: () => Promise<GasFeeState>;\n getNetworkState: () => NetworkState;\n getPermittedAccounts: (origin?: string) => Promise<string[]>;\n getSavedGasFees?: (chainId: Hex) => SavedGasFees | undefined;\n getSelectedAddress: () => string;\n incomingTransactions?: {\n includeTokenTransfers?: boolean;\n isEnabled?: () => boolean;\n queryEntireHistory?: boolean;\n updateTransactions?: boolean;\n };\n messenger: TransactionControllerMessenger;\n onNetworkStateChange: (listener: (state: NetworkState) => void) => void;\n pendingTransactions?: {\n isResubmitEnabled?: boolean;\n };\n provider: Provider;\n securityProviderRequest?: SecurityProviderRequest;\n speedUpMultiplier?: number;\n hooks: {\n afterSign?: (\n transactionMeta: TransactionMeta,\n signedTx: TypedTransaction,\n ) => boolean;\n beforeApproveOnInit?: (transactionMeta: TransactionMeta) => boolean;\n beforeCheckPendingTransaction?: (\n transactionMeta: TransactionMeta,\n ) => boolean;\n beforePublish?: (transactionMeta: TransactionMeta) => boolean;\n getAdditionalSignArguments?: (\n transactionMeta: TransactionMeta,\n ) => (TransactionMeta | undefined)[];\n };\n },\n config?: Partial<TransactionConfig>,\n state?: Partial<TransactionState>,\n ) {\n super(config, state);\n\n this.defaultConfig = {\n txHistoryLimit: 40,\n };\n\n this.defaultState = {\n methodData: {},\n transactions: [],\n lastFetchedBlockNumbers: {},\n };\n\n this.initialize();\n\n this.provider = provider;\n this.messagingSystem = messenger;\n this.getNetworkState = getNetworkState;\n this.ethQuery = new EthQuery(provider);\n this.isSendFlowHistoryDisabled = disableSendFlowHistory ?? false;\n this.isHistoryDisabled = disableHistory ?? false;\n this.isSwapsDisabled = disableSwaps ?? false;\n // @ts-expect-error the type in eth-method-registry is inappropriate and should be changed\n this.registry = new MethodRegistry({ provider });\n this.getSavedGasFees = getSavedGasFees ?? ((_chainId) => undefined);\n this.getCurrentAccountEIP1559Compatibility =\n getCurrentAccountEIP1559Compatibility ?? (() => Promise.resolve(true));\n this.getCurrentNetworkEIP1559Compatibility =\n getCurrentNetworkEIP1559Compatibility;\n this.getGasFeeEstimates =\n getGasFeeEstimates || (() => Promise.resolve({} as GasFeeState));\n this.getPermittedAccounts = getPermittedAccounts;\n this.getSelectedAddress = getSelectedAddress;\n this.getExternalPendingTransactions =\n getExternalPendingTransactions ?? (() => []);\n this.securityProviderRequest = securityProviderRequest;\n this.cancelMultiplier = cancelMultiplier ?? CANCEL_RATE;\n this.speedUpMultiplier = speedUpMultiplier ?? SPEED_UP_RATE;\n\n this.afterSign = hooks?.afterSign ?? (() => true);\n this.beforeApproveOnInit = hooks?.beforeApproveOnInit ?? (() => true);\n this.beforeCheckPendingTransaction =\n hooks?.beforeCheckPendingTransaction ??\n /* istanbul ignore next */\n (() => true);\n this.beforePublish = hooks?.beforePublish ?? (() => true);\n this.getAdditionalSignArguments =\n hooks?.getAdditionalSignArguments ?? (() => []);\n\n this.nonceTracker = new NonceTracker({\n // @ts-expect-error provider types misaligned: SafeEventEmitterProvider vs Record<string,string>\n provider,\n blockTracker,\n getPendingTransactions:\n this.getNonceTrackerPendingTransactions.bind(this),\n getConfirmedTransactions: this.getNonceTrackerTransactions.bind(\n this,\n TransactionStatus.confirmed,\n ),\n });\n\n this.incomingTransactionHelper = new IncomingTransactionHelper({\n blockTracker,\n getCurrentAccount: getSelectedAddress,\n getLastFetchedBlockNumbers: () => this.state.lastFetchedBlockNumbers,\n getNetworkState,\n isEnabled: incomingTransactions.isEnabled,\n queryEntireHistory: incomingTransactions.queryEntireHistory,\n remoteTransactionSource: new EtherscanRemoteTransactionSource({\n includeTokenTransfers: incomingTransactions.includeTokenTransfers,\n }),\n transactionLimit: this.config.txHistoryLimit,\n updateTransactions: incomingTransactions.updateTransactions,\n });\n\n this.incomingTransactionHelper.hub.on(\n 'transactions',\n this.onIncomingTransactions.bind(this),\n );\n\n this.incomingTransactionHelper.hub.on(\n 'updatedLastFetchedBlockNumbers',\n this.onUpdatedLastFetchedBlockNumbers.bind(this),\n );\n\n this.pendingTransactionTracker = new PendingTransactionTracker({\n approveTransaction: this.approveTransaction.bind(this),\n blockTracker,\n getChainId: this.getChainId.bind(this),\n getEthQuery: () => this.ethQuery,\n getTransactions: () => this.state.transactions,\n isResubmitEnabled: pendingTransactions.isResubmitEnabled,\n nonceTracker: this.nonceTracker,\n onStateChange: (listener) => {\n this.subscribe(listener);\n onNetworkStateChange(listener);\n listener();\n },\n publishTransaction: this.publishTransaction.bind(this),\n hooks: {\n beforeCheckPendingTransaction:\n this.beforeCheckPendingTransaction.bind(this),\n beforePublish: this.beforePublish.bind(this),\n },\n });\n\n this.addPendingTransactionTrackerListeners();\n\n onNetworkStateChange(() => {\n log('Detected network change', this.getChainId());\n this.onBootCleanup();\n });\n\n this.onBootCleanup();\n }\n\n /**\n * Handle new method data request.\n *\n * @param fourBytePrefix - The method prefix.\n * @returns The method data object corresponding to the given signature prefix.\n */\n async handleMethodData(fourBytePrefix: string): Promise<MethodData> {\n const releaseLock = await this.mutex.acquire();\n try {\n const { methodData } = this.state;\n const knownMethod = Object.keys(methodData).find(\n (knownFourBytePrefix) => fourBytePrefix === knownFourBytePrefix,\n );\n if (knownMethod) {\n return methodData[fourBytePrefix];\n }\n const registry = await this.registryLookup(fourBytePrefix);\n this.update({\n methodData: { ...methodData, ...{ [fourBytePrefix]: registry } },\n });\n return registry;\n } finally {\n releaseLock();\n }\n }\n\n /**\n * Add a new unapproved transaction to state. Parameters will be validated, a\n * unique transaction id will be generated, and gas and gasPrice will be calculated\n * if not provided. If A `<tx.id>:unapproved` hub event will be emitted once added.\n *\n * @param txParams - Standard parameters for an Ethereum transaction.\n * @param opts - Additional options to control how the transaction is added.\n * @param opts.actionId - Unique ID to prevent duplicate requests.\n * @param opts.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.\n * @param opts.method - RPC method that requested the transaction.\n * @param opts.origin - The origin of the transaction request, such as a dApp hostname.\n * @param opts.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.\n * @param opts.securityAlertResponse - Response from security validator.\n * @param opts.sendFlowHistory - The sendFlowHistory entries to add.\n * @param opts.type - Type of transaction to add, such as 'cancel' or 'swap'.\n * @param opts.swaps - Options for swaps transactions.\n * @param opts.swaps.hasApproveTx - Whether the transaction has an approval transaction.\n * @param opts.swaps.meta - Metadata for swap transaction.\n * @returns Object containing a promise resolving to the transaction hash if approved.\n */\n async addTransaction(\n txParams: TransactionParams,\n {\n actionId,\n deviceConfirmedOn,\n method,\n origin,\n requireApproval,\n securityAlertResponse,\n sendFlowHistory,\n swaps = {},\n type,\n }: {\n actionId?: string;\n deviceConfirmedOn?: WalletDevice;\n method?: string;\n origin?: string;\n requireApproval?: boolean | undefined;\n securityAlertResponse?: SecurityAlertResponse;\n sendFlowHistory?: SendFlowHistoryEntry[];\n swaps?: {\n hasApproveTx?: boolean;\n meta?: Partial<TransactionMeta>;\n };\n type?: TransactionType;\n } = {},\n ): Promise<Result> {\n log('Adding transaction', txParams);\n\n txParams = normalizeTxParams(txParams);\n\n const isEIP1559Compatible = await this.getEIP1559Compatibility();\n\n validateTxParams(txParams, isEIP1559Compatible);\n\n if (origin) {\n await validateTransactionOrigin(\n await this.getPermittedAccounts(origin),\n this.getSelectedAddress(),\n txParams.from,\n origin,\n );\n }\n\n const dappSuggestedGasFees = this.generateDappSuggestedGasFees(\n txParams,\n origin,\n );\n\n const transactionType =\n type ?? (await determineTransactionType(txParams, this.ethQuery)).type;\n\n const existingTransactionMeta = this.getTransactionWithActionId(actionId);\n const chainId = this.getChainId();\n\n // If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.\n const transactionMeta: TransactionMeta = existingTransactionMeta || {\n // Add actionId to txMeta to check if same actionId is seen again\n actionId,\n chainId,\n dappSuggestedGasFees,\n deviceConfirmedOn,\n id: random(),\n origin,\n securityAlertResponse,\n status: TransactionStatus.unapproved as TransactionStatus.unapproved,\n time: Date.now(),\n txParams,\n userEditedGasLimit: false,\n verifiedOnBlockchain: false,\n type: transactionType,\n };\n\n await this.updateGasProperties(transactionMeta);\n\n // Checks if a transaction already exists with a given actionId\n if (!existingTransactionMeta) {\n // Set security provider response\n if (method && this.securityProviderRequest) {\n const securityProviderResponse = await this.securityProviderRequest(\n transactionMeta,\n method,\n );\n transactionMeta.securityProviderResponse = securityProviderResponse;\n }\n\n if (!this.isSendFlowHistoryDisabled) {\n transactionMeta.sendFlowHistory = sendFlowHistory ?? [];\n }\n // Initial history push\n if (!this.isHistoryDisabled) {\n addInitialHistorySnapshot(transactionMeta);\n }\n\n await updateSwapsTransaction(transactionMeta, transactionType, swaps, {\n isSwapsDisabled: this.isSwapsDisabled,\n cancelTransaction: this.cancelTransaction.bind(this),\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n controllerHubEmitter: this.hub.emit.bind(this.hub) as any,\n });\n\n this.addMetadata(transactionMeta);\n this.hub.emit(`unapprovedTransaction`, transactionMeta);\n }\n\n return {\n result: this.processApproval(transactionMeta, {\n isExisting: Boolean(existingTransactionMeta),\n requireApproval,\n actionId,\n }),\n transactionMeta,\n };\n }\n\n startIncomingTransactionPolling() {\n this.incomingTransactionHelper.start();\n }\n\n stopIncomingTransactionPolling() {\n this.incomingTransactionHelper.stop();\n }\n\n async updateIncomingTransactions() {\n await this.incomingTransactionHelper.update();\n }\n\n /**\n * Attempts to cancel a transaction based on its ID by setting its status to \"rejected\"\n * and emitting a `<tx.id>:finished` hub event.\n *\n * @param transactionId - The ID of the transaction to cancel.\n * @param gasValues - The gas values to use for the cancellation transaction.\n * @param options - The options for the cancellation transaction.\n * @param options.actionId - Unique ID to prevent duplicate requests.\n * @param options.estimatedBaseFee - The estimated base fee of the transaction.\n */\n async stopTransaction(\n transactionId: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n {\n estimatedBaseFee,\n actionId,\n }: { estimatedBaseFee?: string; actionId?: string } = {},\n ) {\n // If transaction is found for same action id, do not create a cancel transaction.\n if (this.getTransactionWithActionId(actionId)) {\n return;\n }\n\n if (gasValues) {\n // Not good practice to reassign a parameter but temporarily avoiding a larger refactor.\n gasValues = normalizeGasFeeValues(gasValues);\n validateGasValues(gasValues);\n }\n\n log('Creating cancel transaction', transactionId, gasValues);\n\n const transactionMeta = this.getTransaction(transactionId);\n if (!transactionMeta) {\n return;\n }\n\n if (!this.sign) {\n throw new Error('No sign method defined.');\n }\n\n // gasPrice (legacy non EIP1559)\n const minGasPrice = getIncreasedPriceFromExisting(\n transactionMeta.txParams.gasPrice,\n this.cancelMultiplier,\n );\n\n const gasPriceFromValues = isGasPriceValue(gasValues) && gasValues.gasPrice;\n\n const newGasPrice =\n (gasPriceFromValues &&\n validateMinimumIncrease(gasPriceFromValues, minGasPrice)) ||\n minGasPrice;\n\n // maxFeePerGas (EIP1559)\n const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n this.cancelMultiplier,\n );\n const maxFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxFeePerGas;\n const newMaxFeePerGas =\n (maxFeePerGasValues &&\n validateMinimumIncrease(maxFeePerGasValues, minMaxFeePerGas)) ||\n (existingMaxFeePerGas && minMaxFeePerGas);\n\n // maxPriorityFeePerGas (EIP1559)\n const existingMaxPriorityFeePerGas =\n transactionMeta.txParams?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n this.cancelMultiplier,\n );\n const maxPriorityFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxPriorityFeePerGas;\n const newMaxPriorityFeePerGas =\n (maxPriorityFeePerGasValues &&\n validateMinimumIncrease(\n maxPriorityFeePerGasValues,\n minMaxPriorityFeePerGas,\n )) ||\n (existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas);\n\n const newTxParams: TransactionParams =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n from: transactionMeta.txParams.from,\n gasLimit: transactionMeta.txParams.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: TransactionEnvelopeType.feeMarket,\n nonce: transactionMeta.txParams.nonce,\n to: transactionMeta.txParams.from,\n value: '0x0',\n }\n : {\n from: transactionMeta.txParams.from,\n gasLimit: transactionMeta.txParams.gas,\n gasPrice: newGasPrice,\n nonce: transactionMeta.txParams.nonce,\n to: transactionMeta.txParams.from,\n value: '0x0',\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(newTxParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.txParams.from,\n );\n\n const rawTx = bufferToHex(signedTx.serialize());\n\n const newFee = newTxParams.maxFeePerGas ?? newTxParams.gasPrice;\n\n const oldFee = newTxParams.maxFeePerGas\n ? transactionMeta.txParams.maxFeePerGas\n : transactionMeta.txParams.gasPrice;\n\n log('Submitting cancel transaction', {\n oldFee,\n newFee,\n txParams: newTxParams,\n });\n\n const hash = await this.publishTransaction(rawTx);\n\n const cancelTransactionMeta: TransactionMeta = {\n actionId,\n chainId: transactionMeta.chainId,\n estimatedBaseFee,\n hash,\n id: random(),\n originalGasEstimate: transactionMeta.txParams.gas,\n status: TransactionStatus.submitted,\n time: Date.now(),\n type: TransactionType.cancel,\n txParams: newTxParams,\n };\n\n this.addMetadata(cancelTransactionMeta);\n\n // stopTransaction has no approval request, so we assume the user has already approved the transaction\n this.hub.emit('transaction-approved', {\n transactionMeta: cancelTransactionMeta,\n actionId,\n });\n this.hub.emit('transaction-submitted', {\n transactionMeta: cancelTransactionMeta,\n actionId,\n });\n\n this.hub.emit(\n `${cancelTransactionMeta.id}:finished`,\n cancelTransactionMeta,\n );\n }\n\n /**\n * Attempts to speed up a transaction increasing transaction gasPrice by ten percent.\n *\n * @param transactionId - The ID of the transaction to speed up.\n * @param gasValues - The gas values to use for the speed up transaction.\n * @param options - The options for the speed up transaction.\n * @param options.actionId - Unique ID to prevent duplicate requests\n * @param options.estimatedBaseFee - The estimated base fee of the transaction.\n */\n async speedUpTransaction(\n transactionId: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n {\n actionId,\n estimatedBaseFee,\n }: { actionId?: string; estimatedBaseFee?: string } = {},\n ) {\n // If transaction is found for same action id, do not create a new speed up transaction.\n if (this.getTransactionWithActionId(actionId)) {\n return;\n }\n\n if (gasValues) {\n // Not good practice to reassign a parameter but temporarily avoiding a larger refactor.\n gasValues = normalizeGasFeeValues(gasValues);\n validateGasValues(gasValues);\n }\n\n log('Creating speed up transaction', transactionId, gasValues);\n\n const transactionMeta = this.state.transactions.find(\n ({ id }) => id === transactionId,\n );\n /* istanbul ignore next */\n if (!transactionMeta) {\n return;\n }\n\n /* istanbul ignore next */\n if (!this.sign) {\n throw new Error('No sign method defined.');\n }\n\n // gasPrice (legacy non EIP1559)\n const minGasPrice = getIncreasedPriceFromExisting(\n transactionMeta.txParams.gasPrice,\n this.speedUpMultiplier,\n );\n\n const gasPriceFromValues = isGasPriceValue(gasValues) && gasValues.gasPrice;\n\n const newGasPrice =\n (gasPriceFromValues &&\n validateMinimumIncrease(gasPriceFromValues, minGasPrice)) ||\n minGasPrice;\n\n // maxFeePerGas (EIP1559)\n const existingMaxFeePerGas = transactionMeta.txParams?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n this.speedUpMultiplier,\n );\n const maxFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxFeePerGas;\n const newMaxFeePerGas =\n (maxFeePerGasValues &&\n validateMinimumIncrease(maxFeePerGasValues, minMaxFeePerGas)) ||\n (existingMaxFeePerGas && minMaxFeePerGas);\n\n // maxPriorityFeePerGas (EIP1559)\n const existingMaxPriorityFeePerGas =\n transactionMeta.txParams?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n this.speedUpMultiplier,\n );\n const maxPriorityFeePerGasValues =\n isFeeMarketEIP1559Values(gasValues) && gasValues.maxPriorityFeePerGas;\n const newMaxPriorityFeePerGas =\n (maxPriorityFeePerGasValues &&\n validateMinimumIncrease(\n maxPriorityFeePerGasValues,\n minMaxPriorityFeePerGas,\n )) ||\n (existingMaxPriorityFeePerGas && minMaxPriorityFeePerGas);\n\n const txParams: TransactionParams =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...transactionMeta.txParams,\n gasLimit: transactionMeta.txParams.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: TransactionEnvelopeType.feeMarket,\n }\n : {\n ...transactionMeta.txParams,\n gasLimit: transactionMeta.txParams.gas,\n gasPrice: newGasPrice,\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.txParams.from,\n );\n\n await this.updateTransactionMetaRSV(transactionMeta, signedTx);\n const rawTx = bufferToHex(signedTx.serialize());\n\n const newFee = txParams.maxFeePerGas ?? txParams.gasPrice;\n\n const oldFee = txParams.maxFeePerGas\n ? transactionMeta.txParams.maxFeePerGas\n : transactionMeta.txParams.gasPrice;\n\n log('Submitting speed up transaction', { oldFee, newFee, txParams });\n\n const hash = await query(this.ethQuery, 'sendRawTransaction', [rawTx]);\n\n const baseTransactionMeta: TransactionMeta = {\n ...transactionMeta,\n estimatedBaseFee,\n id: random(),\n time: Date.now(),\n hash,\n actionId,\n originalGasEstimate: transactionMeta.txParams.gas,\n type: TransactionType.retry,\n originalType: transactionMeta.type,\n };\n\n const newTransactionMeta =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...baseTransactionMeta,\n txParams: {\n ...transactionMeta.txParams,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n },\n }\n : {\n ...baseTransactionMeta,\n txParams: {\n ...transactionMeta.txParams,\n gasPrice: newGasPrice,\n },\n };\n\n this.addMetadata(newTransactionMeta);\n\n // speedUpTransaction has no approval request, so we assume the user has already approved the transaction\n this.hub.emit('transaction-approved', {\n transactionMeta: newTransactionMeta,\n actionId,\n });\n\n this.hub.emit('transaction-submitted', {\n transactionMeta: newTransactionMeta,\n actionId,\n });\n\n this.hub.emit(`${transactionMeta.id}:speedup`, newTransactionMeta);\n }\n\n /**\n * Estimates required gas for a given transaction.\n *\n * @param transaction - The transaction to estimate gas for.\n * @returns The gas and gas price.\n */\n async estimateGas(transaction: TransactionParams) {\n const { estimatedGas, simulationFails } = await estimateGas(\n transaction,\n this.ethQuery,\n );\n\n return { gas: estimatedGas, simulationFails };\n }\n\n /**\n * Estimates required gas for a given transaction and add additional gas buffer with the given multiplier.\n *\n * @param transaction - The transaction params to estimate gas for.\n * @param multiplier - The multiplier to use for the gas buffer.\n */\n async estimateGasBuffered(\n transaction: TransactionParams,\n multiplier: number,\n ) {\n const { blockGasLimit, estimatedGas, simulationFails } = await estimateGas(\n transaction,\n this.ethQuery,\n );\n\n const gas = addGasBuffer(estimatedGas, blockGasLimit, multiplier);\n\n return {\n gas,\n simulationFails,\n };\n }\n\n /**\n * Updates an existing transaction in state.\n *\n * @param transactionMeta - The new transaction to store in state.\n * @param note - A note or update reason to include in the transaction history.\n */\n updateTransaction(transactionMeta: TransactionMeta, note: string) {\n const { transactions } = this.state;\n transactionMeta.txParams = normalizeTxParams(transactionMeta.txParams);\n validateTxParams(transactionMeta.txParams);\n if (!this.isHistoryDisabled) {\n updateTransactionHistory(transactionMeta, note);\n }\n const index = transactions.findIndex(({ id }) => transactionMeta.id === id);\n transactions[index] = transactionMeta;\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n }\n\n /**\n * Update the security alert response for a transaction.\n *\n * @param transactionId - ID of the transaction.\n * @param securityAlertResponse - The new security alert response for the transaction.\n */\n updateSecurityAlertResponse(\n transactionId: string,\n securityAlertResponse: SecurityAlertResponse,\n ) {\n if (!securityAlertResponse) {\n throw new Error(\n 'updateSecurityAlertResponse: securityAlertResponse should not be null',\n );\n }\n const transactionMeta = this.getTransaction(transactionId);\n if (!transactionMeta) {\n throw new Error(\n `Cannot update security alert response as no transaction metadata found`,\n );\n }\n const updatedMeta = merge(transactionMeta, { securityAlertResponse });\n this.updateTransaction(\n updatedMeta,\n 'TransactionController:updatesecurityAlertResponse - securityAlertResponse updated',\n );\n }\n\n /**\n * Removes all transactions from state, optionally based on the current network.\n *\n * @param ignoreNetwork - Determines whether to wipe all transactions, or just those on the\n * current network. If `true`, all transactions are wiped.\n * @param address - If specified, only transactions originating from this address will be\n * wiped on current network.\n */\n wipeTransactions(ignoreNetwork?: boolean, address?: string) {\n /* istanbul ignore next */\n if (ignoreNetwork && !address) {\n this.update({ transactions: [] });\n return;\n }\n const currentChainId = this.getChainId();\n const newTransactions = this.state.transactions.filter(\n ({ chainId, txParams }) => {\n const isMatchingNetwork = ignoreNetwork || chainId === currentChainId;\n\n if (!isMatchingNetwork) {\n return true;\n }\n\n const isMatchingAddress =\n !address || txParams.from?.toLowerCase() === address.toLowerCase();\n\n return !isMatchingAddress;\n },\n );\n\n this.update({\n transactions: this.trimTransactionsForState(newTransactions),\n });\n }\n\n startIncomingTransactionProcessing() {\n this.incomingTransactionHelper.start();\n }\n\n stopIncomingTransactionProcessing() {\n this.incomingTransactionHelper.stop();\n }\n\n /**\n * Adds external provided transaction to state as confirmed transaction.\n *\n * @param transactionMeta - TransactionMeta to add transactions.\n * @param transactionReceipt - TransactionReceipt of the external transaction.\n * @param baseFeePerGas - Base fee per gas of the external transaction.\n */\n async confirmExternalTransaction(\n transactionMeta: TransactionMeta,\n transactionReceipt: TransactionReceipt,\n baseFeePerGas: Hex,\n ) {\n // Run validation and add external transaction to state.\n this.addExternalTransaction(transactionMeta);\n\n try {\n const transactionId = transactionMeta.id;\n\n // Make sure status is confirmed and define gasUsed as in receipt.\n transactionMeta.status = TransactionStatus.confirmed;\n transactionMeta.txReceipt = transactionReceipt;\n if (baseFeePerGas) {\n transactionMeta.baseFeePerGas = baseFeePerGas;\n }\n\n // Update same nonce local transactions as dropped and define replacedBy properties.\n this.markNonceDuplicatesDropped(transactionId);\n\n // Update external provided transaction with updated gas values and confirmed status.\n this.updateTransaction(\n transactionMeta,\n 'TransactionController:confirmExternalTransaction - Add external transaction',\n );\n this.onTransactionStatusChange(transactionMeta);\n\n // Intentional given potential duration of process.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.updatePostBalance(transactionMeta);\n\n this.hub.emit('transaction-confirmed', {\n transactionMeta,\n });\n } catch (error) {\n console.error('Failed to confirm external transaction', error);\n }\n }\n\n /**\n * Append new send flow history to a transaction.\n *\n * @param transactionID - The ID of the transaction to update.\n * @param currentSendFlowHistoryLength - The length of the current sendFlowHistory array.\n * @param sendFlowHistoryToAdd - The sendFlowHistory entries to add.\n * @returns The updated transactionMeta.\n */\n updateTransactionSendFlowHistory(\n transactionID: string,\n currentSendFlowHistoryLength: number,\n sendFlowHistoryToAdd: SendFlowHistoryEntry[],\n ): TransactionMeta {\n if (this.isSendFlowHistoryDisabled) {\n throw new Error(\n 'Send flow history is disabled for the current transaction controller',\n );\n }\n\n const transactionMeta = this.getTransaction(transactionID);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update send flow history as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(\n transactionMeta,\n 'updateTransactionSendFlowHistory',\n );\n\n if (\n currentSendFlowHistoryLength ===\n (transactionMeta?.sendFlowHistory?.length || 0)\n ) {\n transactionMeta.sendFlowHistory = [\n ...(transactionMeta?.sendFlowHistory ?? []),\n ...sendFlowHistoryToAdd,\n ];\n this.updateTransaction(\n transactionMeta,\n 'TransactionController:updateTransactionSendFlowHistory - sendFlowHistory updated',\n );\n }\n\n return this.getTransaction(transactionID) as TransactionMeta;\n }\n\n /**\n * Update the gas values of a transaction.\n *\n * @param transactionId - The ID of the transaction to update.\n * @param gasValues - Gas values to update.\n * @param gasValues.gas - Same as transaction.gasLimit.\n * @param gasValues.gasLimit - Maxmimum number of units of gas to use for this transaction.\n * @param gasValues.gasPrice - Price per gas for legacy transactions.\n * @param gasValues.maxPriorityFeePerGas - Maximum amount per gas to give to validator as incentive.\n * @param gasValues.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.\n * @param gasValues.estimateUsed - Which estimate level was used.\n * @param gasValues.estimateSuggested - Which estimate level that the API suggested.\n * @param gasValues.defaultGasEstimates - The default estimate for gas.\n * @param gasValues.originalGasEstimate - Original estimate for gas.\n * @param gasValues.userEditedGasLimit - The gas limit supplied by user.\n * @param gasValues.userFeeLevel - Estimate level user selected.\n * @returns The updated transactionMeta.\n */\n updateTransactionGasFees(\n transactionId: string,\n {\n defaultGasEstimates,\n estimateUsed,\n estimateSuggested,\n gas,\n gasLimit,\n gasPrice,\n maxPriorityFeePerGas,\n maxFeePerGas,\n originalGasEstimate,\n userEditedGasLimit,\n userFeeLevel,\n }: {\n defaultGasEstimates?: string;\n estimateUsed?: string;\n estimateSuggested?: string;\n gas?: string;\n gasLimit?: string;\n gasPrice?: string;\n maxPriorityFeePerGas?: string;\n maxFeePerGas?: string;\n originalGasEstimate?: string;\n userEditedGasLimit?: boolean;\n userFeeLevel?: string;\n },\n ): TransactionMeta {\n const transactionMeta = this.getTransaction(transactionId);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update transaction as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(\n transactionMeta,\n 'updateTransactionGasFees',\n );\n\n let transactionGasFees = {\n txParams: {\n gas,\n gasLimit,\n gasPrice,\n maxPriorityFeePerGas,\n maxFeePerGas,\n },\n defaultGasEstimates,\n estimateUsed,\n estimateSuggested,\n originalGasEstimate,\n userEditedGasLimit,\n userFeeLevel,\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any;\n\n // only update what is defined\n transactionGasFees.txParams = pickBy(transactionGasFees.txParams);\n transactionGasFees = pickBy(transactionGasFees);\n\n // merge updated gas values with existing transaction meta\n const updatedMeta = merge(transactionMeta, transactionGasFees);\n\n this.updateTransaction(\n updatedMeta,\n 'TransactionController:updateTransactionGasFees - gas values updated',\n );\n\n return this.getTransaction(transactionId) as TransactionMeta;\n }\n\n /**\n * Update the previous gas values of a transaction.\n *\n * @param transactionId - The ID of the transaction to update.\n * @param previousGas - Previous gas values to update.\n * @param previousGas.gasLimit - Maxmimum number of units of gas to use for this transaction.\n * @param previousGas.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.\n * @param previousGas.maxPriorityFeePerGas - Maximum amount per gas to give to validator as incentive.\n * @returns The updated transactionMeta.\n */\n updatePreviousGasParams(\n transactionId: string,\n {\n gasLimit,\n maxFeePerGas,\n maxPriorityFeePerGas,\n }: {\n gasLimit?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: string;\n },\n ): TransactionMeta {\n const transactionMeta = this.getTransaction(transactionId);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update transaction as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(transactionMeta, 'updatePreviousGasParams');\n\n const transactionPreviousGas = {\n previousGas: {\n gasLimit,\n maxFeePerGas,\n maxPriorityFeePerGas,\n },\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any;\n\n // only update what is defined\n transactionPreviousGas.previousGas = pickBy(\n transactionPreviousGas.previousGas,\n );\n\n // merge updated previous gas values with existing transaction meta\n const updatedMeta = merge(transactionMeta, transactionPreviousGas);\n\n this.updateTransaction(\n updatedMeta,\n 'TransactionController:updatePreviousGasParams - Previous gas values updated',\n );\n\n return this.getTransaction(transactionId) as TransactionMeta;\n }\n\n /**\n * Gets the next nonce according to the nonce-tracker.\n * Ensure `releaseLock` is called once processing of the `nonce` value is complete.\n *\n * @param address - The hex string address for the transaction.\n * @returns object with the `nextNonce` `nonceDetails`, and the releaseLock.\n */\n async getNonceLock(address: string): Promise<NonceLock> {\n return this.nonceTracker.getNonceLock(address);\n }\n\n /**\n * Updates the editable parameters of a transaction.\n *\n * @param txId - The ID of the transaction to update.\n * @param params - The editable parameters to update.\n * @param params.data - Data to pass with the transaction.\n * @param params.gas - Maximum number of units of gas to use for the transaction.\n * @param params.gasPrice - Price per gas for legacy transactions.\n * @param params.from - Address to send the transaction from.\n * @param params.to - Address to send the transaction to.\n * @param params.value - Value associated with the transaction.\n * @returns The updated transaction metadata.\n */\n async updateEditableParams(\n txId: string,\n {\n data,\n gas,\n gasPrice,\n from,\n to,\n value,\n }: {\n data?: string;\n gas?: string;\n gasPrice?: string;\n from?: string;\n to?: string;\n value?: string;\n },\n ) {\n const transactionMeta = this.getTransaction(txId);\n if (!transactionMeta) {\n throw new Error(\n `Cannot update editable params as no transaction metadata found`,\n );\n }\n\n validateIfTransactionUnapproved(transactionMeta, 'updateEditableParams');\n\n const editableParams = {\n txParams: {\n data,\n from,\n to,\n value,\n gas,\n gasPrice,\n },\n } as Partial<TransactionMeta>;\n\n editableParams.txParams = pickBy(\n editableParams.txParams,\n ) as TransactionParams;\n\n const updatedTransaction = merge(transactionMeta, editableParams);\n const { type } = await determineTransactionType(\n updatedTransaction.txParams,\n this.ethQuery,\n );\n updatedTransaction.type = type;\n\n this.updateTransaction(\n updatedTransaction,\n `Update Editable Params for ${txId}`,\n );\n return this.getTransaction(txId);\n }\n\n /**\n * Signs and returns the raw transaction data for provided transaction params list.\n *\n * @param listOfTxParams - The list of transaction params to approve.\n * @returns The raw transactions.\n */\n async approveTransactionsWithSameNonce(\n listOfTxParams: TransactionParams[] = [],\n ): Promise<string | string[]> {\n log('Approving transactions with same nonce', {\n transactions: listOfTxParams,\n });\n\n if (listOfTxParams.length === 0) {\n return '';\n }\n\n const initialTx = listOfTxParams[0];\n const common = this.getCommonConfiguration();\n\n const initialTxAsEthTx = TransactionFactory.fromTxData(initialTx, {\n common,\n });\n\n const initialTxAsSerializedHex = bufferToHex(initialTxAsEthTx.serialize());\n\n if (this.inProcessOfSigning.has(initialTxAsSerializedHex)) {\n return '';\n }\n\n this.inProcessOfSigning.add(initialTxAsSerializedHex);\n\n let rawTransactions, nonceLock;\n try {\n // TODO: we should add a check to verify that all transactions have the same from address\n const fromAddress = initialTx.from;\n nonceLock = await this.nonceTracker.getNonceLock(fromAddress);\n const nonce = nonceLock.nextNonce;\n\n log('Using nonce from nonce tracker', nonce, nonceLock.nonceDetails);\n\n rawTransactions = await Promise.all(\n listOfTxParams.map((txParams) => {\n txParams.nonce = addHexPrefix(nonce.toString(16));\n return this.signExternalTransaction(txParams);\n }),\n );\n } catch (err) {\n log('Error while signing transactions with same nonce', err);\n // Must set transaction to submitted/failed before releasing lock\n // continue with error chain\n throw err;\n } finally {\n if (nonceLock) {\n nonceLock.releaseLock();\n }\n this.inProcessOfSigning.delete(initialTxAsSerializedHex);\n }\n return rawTransactions;\n }\n\n /**\n * Update a custodial transaction.\n *\n * @param transactionId - The ID of the transaction to update.\n * @param options - The custodial transaction options to update.\n * @param options.errorMessage - The error message to be assigned in case transaction status update to failed.\n * @param options.hash - The new hash value to be assigned.\n * @param options.status - The new status value to be assigned.\n */\n updateCustodialTransaction(\n transactionId: string,\n {\n errorMessage,\n hash,\n status,\n }: {\n errorMessage?: string;\n hash?: string;\n status?: TransactionStatus;\n },\n ) {\n const transactionMeta = this.getTransaction(transactionId);\n\n if (!transactionMeta) {\n throw new Error(\n `Cannot update custodial transaction as no transaction metadata found`,\n );\n }\n\n if (!transactionMeta.custodyId) {\n throw new Error('Transaction must be a custodian transaction');\n }\n\n if (\n status &&\n ![\n TransactionStatus.submitted,\n TransactionStatus.signed,\n TransactionStatus.failed,\n ].includes(status)\n ) {\n throw new Error(\n `Cannot update custodial transaction with status: ${status}`,\n );\n }\n\n const updatedTransactionMeta = merge(\n transactionMeta,\n pickBy({ hash, status }),\n );\n\n if (status === TransactionStatus.submitted) {\n updatedTransactionMeta.submittedTime = new Date().getTime();\n }\n\n if (status === TransactionStatus.failed) {\n updatedTransactionMeta.error = normalizeTxError(new Error(errorMessage));\n }\n\n this.updateTransaction(\n updatedTransactionMeta,\n `TransactionController:updateCustodialTransaction - Custodial transaction updated`,\n );\n\n if (\n [TransactionStatus.submitted, TransactionStatus.failed].includes(\n status as TransactionStatus,\n )\n ) {\n this.hub.emit(`${transactionMeta.id}:finished`, updatedTransactionMeta);\n }\n }\n\n /**\n * Creates approvals for all unapproved transactions persisted.\n */\n initApprovals() {\n const chainId = this.getChainId();\n const unapprovedTxs = this.state.transactions.filter(\n (transaction) =>\n transaction.status === TransactionStatus.unapproved &&\n transaction.chainId === chainId &&\n !transaction.isUserOperation,\n );\n\n for (const txMeta of unapprovedTxs) {\n this.processApproval(txMeta, {\n shouldShowRequest: false,\n }).catch((error) => {\n if (error?.code === errorCodes.provider.userRejectedRequest) {\n return;\n }\n console.error('Error during persisted transaction approval', error);\n });\n }\n }\n\n /**\n * Search transaction metadata for matching entries.\n *\n * @param opts - Options bag.\n * @param opts.searchCriteria - An object containing values or functions for transaction properties to filter transactions with.\n * @param opts.initialList - The transactions to search. Defaults to the current state.\n * @param opts.filterToCurrentNetwork - Whether to filter the results to the current network. Defaults to true.\n * @param opts.limit - The maximum number of transactions to return. No limit by default.\n * @returns An array of transactions matching the provided options.\n */\n getTransactions({\n searchCriteria = {},\n initialList,\n filterToCurrentNetwork = true,\n limit,\n }: {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n searchCriteria?: any;\n initialList?: TransactionMeta[];\n filterToCurrentNetwork?: boolean;\n limit?: number;\n } = {}): TransactionMeta[] {\n const chainId = this.getChainId();\n // searchCriteria is an object that might have values that aren't predicate\n // methods. When providing any other value type (string, number, etc), we\n // consider this shorthand for \"check the value at key for strict equality\n // with the provided value\". To conform this object to be only methods, we\n // mapValues (lodash) such that every value on the object is a method that\n // returns a boolean.\n const predicateMethods = mapValues(searchCriteria, (predicate) => {\n return typeof predicate === 'function'\n ? predicate\n : // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (v: any) => v === predicate;\n });\n\n const transactionsToFilter = initialList ?? this.state.transactions;\n\n // Combine sortBy and pickBy to transform our state object into an array of\n // matching transactions that are sorted by time.\n const filteredTransactions = sortBy(\n pickBy(transactionsToFilter, (transaction) => {\n if (filterToCurrentNetwork && transaction.chainId !== chainId) {\n return false;\n }\n // iterate over the predicateMethods keys to check if the transaction\n // matches the searchCriteria\n for (const [key, predicate] of Object.entries(predicateMethods)) {\n // We return false early as soon as we know that one of the specified\n // search criteria do not match the transaction. This prevents\n // needlessly checking all criteria when we already know the criteria\n // are not fully satisfied. We check both txParams and the base\n // object as predicate keys can be either.\n if (key in transaction.txParams) {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (predicate((transaction.txParams as any)[key]) === false) {\n return false;\n }\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } else if (predicate((transaction as any)[key]) === false) {\n return false;\n }\n }\n\n return true;\n }),\n 'time',\n );\n if (limit !== undefined) {\n // We need to have all transactions of a given nonce in order to display\n // necessary details in the UI. We use the size of this set to determine\n // whether we have reached the limit provided, thus ensuring that all\n // transactions of nonces we include will be sent to the UI.\n const nonces = new Set();\n const txs = [];\n // By default, the transaction list we filter from is sorted by time ASC.\n // To ensure that filtered results prefers the newest transactions we\n // iterate from right to left, inserting transactions into front of a new\n // array. The original order is preserved, but we ensure that newest txs\n // are preferred.\n for (let i = filteredTransactions.length - 1; i > -1; i--) {\n const txMeta = filteredTransactions[i];\n const { nonce } = txMeta.txParams;\n if (!nonces.has(nonce)) {\n if (nonces.size < limit) {\n nonces.add(nonce);\n } else {\n continue;\n }\n }\n // Push transaction into the beginning of our array to ensure the\n // original order is preserved.\n txs.unshift(txMeta);\n }\n return txs;\n }\n return filteredTransactions;\n }\n\n private async signExternalTransaction(\n transactionParams: TransactionParams,\n ): Promise<string> {\n if (!this.sign) {\n throw new Error('No sign method defined.');\n }\n\n const normalizedTransactionParams = normalizeTxParams(transactionParams);\n const chainId = this.getChainId();\n const type = isEIP1559Transaction(normalizedTransactionParams)\n ? TransactionEnvelopeType.feeMarket\n : TransactionEnvelopeType.legacy;\n const updatedTransactionParams = {\n ...normalizedTransactionParams,\n type,\n gasLimit: normalizedTransactionParams.gas,\n chainId,\n };\n\n const { from } = updatedTransactionParams;\n const common = this.getCommonConfiguration();\n const unsignedTransaction = TransactionFactory.fromTxData(\n updatedTransactionParams,\n { common },\n );\n const signedTransaction = await this.sign(unsignedTransaction, from);\n\n const rawTransaction = bufferToHex(signedTransaction.serialize());\n return rawTransaction;\n }\n\n /**\n * Removes unapproved transactions from state.\n */\n clearUnapprovedTransactions() {\n const transactions = this.state.transactions.filter(\n ({ status }) => status !== TransactionStatus.unapproved,\n );\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n }\n\n private addMetadata(transactionMeta: TransactionMeta) {\n const { transactions } = this.state;\n transactions.push(transactionMeta);\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n }\n\n private async updateGasProperties(transactionMeta: TransactionMeta) {\n const isEIP1559Compatible =\n (await this.getEIP1559Compatibility()) &&\n transactionMeta.txParams.type !== TransactionEnvelopeType.legacy;\n\n const chainId = this.getChainId();\n\n await updateGas({\n ethQuery: this.ethQuery,\n providerConfig: this.getNetworkState().providerConfig,\n txMeta: transactionMeta,\n });\n\n await updateGasFees({\n eip1559: isEIP1559Compatible,\n ethQuery: this.ethQuery,\n getSavedGasFees: this.getSavedGasFees.bind(this, chainId),\n getGasFeeEstimates: this.getGasFeeEstimates.bind(this),\n txMeta: transactionMeta,\n });\n }\n\n private getCurrentChainTransactionsByStatus(status: TransactionStatus) {\n const chainId = this.getChainId();\n return this.state.transactions.filter(\n (transaction) =>\n transaction.status === status && transaction.chainId === chainId,\n );\n }\n\n private onBootCleanup() {\n this.submitApprovedTransactions();\n }\n\n /**\n * Force to submit approved transactions on current chain.\n */\n private submitApprovedTransactions() {\n const approvedTransactions = this.getCurrentChainTransactionsByStatus(\n TransactionStatus.approved,\n );\n for (const transactionMeta of approvedTransactions) {\n if (this.beforeApproveOnInit(transactionMeta)) {\n this.approveTransaction(transactionMeta.id).catch((error) => {\n /* istanbul ignore next */\n console.error('Error while submitting persisted transaction', error);\n });\n }\n }\n }\n\n private async processApproval(\n transactionMeta: TransactionMeta,\n {\n isExisting = false,\n requireApproval,\n shouldShowRequest = true,\n actionId,\n }: {\n isExisting?: boolean;\n requireApproval?: boolean | undefined;\n shouldShowRequest?: boolean;\n actionId?: string;\n },\n ): Promise<string> {\n const transactionId = transactionMeta.id;\n let resultCallbacks: AcceptResultCallbacks | undefined;\n const { meta, isCompleted } = this.isTransactionCompleted(transactionId);\n const finishedPromise = isCompleted\n ? Promise.resolve(meta)\n : this.waitForTransactionFinished(transactionId);\n\n if (meta && !isExisting && !isCompleted) {\n try {\n if (requireApproval !== false) {\n const acceptResult = await this.requestApproval(transactionMeta, {\n shouldShowRequest,\n });\n\n resultCallbacks = acceptResult.resultCallbacks;\n\n if (resultCallbacks) {\n this.hub.once(`${transactionId}:publish-skip`, () => {\n resultCallbacks?.success();\n\n // Remove the reference to prevent additional reports once submitted.\n resultCallbacks = undefined;\n });\n }\n\n const approvalValue = acceptResult.value as\n | {\n txMeta?: TransactionMeta;\n }\n | undefined;\n\n const updatedTransaction = approvalValue?.txMeta;\n\n if (updatedTransaction) {\n log('Updating transaction with approval data', {\n customNonce: updatedTransaction.customNonceValue,\n params: updatedTransaction.txParams,\n });\n\n this.updateTransaction(\n updatedTransaction,\n 'TransactionController#processApproval - Updated with approval data',\n );\n }\n }\n\n const { isCompleted: isTxCompleted } =\n this.isTransactionCompleted(transactionId);\n\n if (!isTxCompleted) {\n await this.approveTransaction(transactionId);\n const updatedTransactionMeta = this.getTransaction(\n transactionId,\n ) as TransactionMeta;\n this.hub.emit('transaction-approved', {\n transactionMeta: updatedTransactionMeta,\n actionId,\n });\n }\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n const { isCompleted: isTxCompleted } =\n this.isTransactionCompleted(transactionId);\n if (!isTxCompleted) {\n if (error?.code === errorCodes.provider.userRejectedRequest) {\n this.cancelTransaction(transactionId, actionId);\n\n throw providerErrors.userRejectedRequest(\n 'MetaMask Tx Signature: User denied transaction signature.',\n );\n } else {\n this.failTransaction(meta, error, actionId);\n }\n }\n }\n }\n\n const finalMeta = await finishedPromise;\n\n switch (finalMeta?.status) {\n case TransactionStatus.failed:\n resultCallbacks?.error(finalMeta.error);\n throw rpcErrors.internal(finalMeta.error.message);\n\n case TransactionStatus.submitted:\n resultCallbacks?.success();\n return finalMeta.hash as string;\n\n default:\n const internalError = rpcErrors.internal(\n `MetaMask Tx Signature: Unknown problem: ${JSON.stringify(\n finalMeta || transactionId,\n )}`,\n );\n\n resultCallbacks?.error(internalError);\n throw internalError;\n }\n }\n\n /**\n * Approves a transaction and updates it's status in state. If this is not a\n * retry transaction, a nonce will be generated. The transaction is signed\n * using the sign configuration property, then published to the blockchain.\n * A `<tx.id>:finished` hub event is fired after success or failure.\n *\n * @param transactionId - The ID of the transaction to approve.\n */\n private async approveTransaction(transactionId: string) {\n const { transactions } = this.state;\n const releaseLock = await this.mutex.acquire();\n const chainId = this.getChainId();\n const index = transactions.findIndex(({ id }) => transactionId === id);\n const transactionMeta = transactions[index];\n\n const {\n txParams: { from },\n } = transactionMeta;\n\n let releaseNonceLock: (() => void) | undefined;\n\n try {\n if (!this.sign) {\n releaseLock();\n this.failTransaction(\n transactionMeta,\n new Error('No sign method defined.'),\n );\n return;\n } else if (!chainId) {\n releaseLock();\n this.failTransaction(transactionMeta, new Error('No chainId defined.'));\n return;\n }\n\n if (this.inProcessOfSigning.has(transactionId)) {\n log('Skipping approval as signing in progress', transactionId);\n return;\n }\n\n const [nonce, releaseNonce] = await getNextNonce(\n transactionMeta,\n this.nonceTracker,\n );\n\n releaseNonceLock = releaseNonce;\n\n transactionMeta.status = TransactionStatus.approved;\n transactionMeta.txParams.nonce = nonce;\n transactionMeta.txParams.chainId = chainId;\n\n const baseTxParams = {\n ...transactionMeta.txParams,\n gasLimit: transactionMeta.txParams.gas,\n };\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - Transaction approved',\n );\n\n this.onTransactionStatusChange(transactionMeta);\n\n const isEIP1559 = isEIP1559Transaction(transactionMeta.txParams);\n\n const txParams: TransactionParams = isEIP1559\n ? {\n ...baseTxParams,\n estimatedBaseFee: transactionMeta.txParams.estimatedBaseFee,\n type: TransactionEnvelopeType.feeMarket,\n }\n : baseTxParams;\n\n const rawTx = await this.signTransaction(transactionMeta, txParams);\n\n if (!this.beforePublish(transactionMeta)) {\n log('Skipping publishing transaction based on hook');\n this.hub.emit(`${transactionMeta.id}:publish-skip`, transactionMeta);\n return;\n }\n\n if (!rawTx) {\n return;\n }\n\n if (transactionMeta.type === TransactionType.swap) {\n log('Determining pre-transaction balance');\n\n const preTxBalance = await query(this.ethQuery, 'getBalance', [from]);\n\n transactionMeta.preTxBalance = preTxBalance;\n\n log('Updated pre-transaction balance', transactionMeta.preTxBalance);\n }\n\n log('Publishing transaction', txParams);\n\n const hash = await this.publishTransaction(rawTx);\n\n log('Publish successful', hash);\n\n transactionMeta.hash = hash;\n transactionMeta.status = TransactionStatus.submitted;\n transactionMeta.submittedTime = new Date().getTime();\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - Transaction submitted',\n );\n\n this.hub.emit('transaction-submitted', {\n transactionMeta,\n });\n\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n\n this.onTransactionStatusChange(transactionMeta);\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n this.failTransaction(transactionMeta, error);\n } finally {\n this.inProcessOfSigning.delete(transactionId);\n // must set transaction to submitted/failed before releasing lock\n releaseNonceLock?.();\n releaseLock();\n }\n }\n\n private async publishTransaction(rawTransaction: string): Promise<string> {\n return await query(this.ethQuery, 'sendRawTransaction', [rawTransaction]);\n }\n\n /**\n * Cancels a transaction based on its ID by setting its status to \"rejected\"\n * and emitting a `<tx.id>:finished` hub event.\n *\n * @param transactionId - The ID of the transaction to cancel.\n * @param actionId - The actionId passed from UI\n */\n private cancelTransaction(transactionId: string, actionId?: string) {\n const transactionMeta = this.state.transactions.find(\n ({ id }) => id === transactionId,\n );\n if (!transactionMeta) {\n return;\n }\n transactionMeta.status = TransactionStatus.rejected;\n const transactions = this.state.transactions.filter(\n ({ id }) => id !== transactionId,\n );\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n this.hub.emit('transaction-rejected', {\n transactionMeta,\n actionId,\n });\n this.onTransactionStatusChange(transactionMeta);\n }\n\n /**\n * Trim the amount of transactions that are set on the state. Checks\n * if the length of the tx history is longer then desired persistence\n * limit and then if it is removes the oldest confirmed or rejected tx.\n * Pending or unapproved transactions will not be removed by this\n * operation. For safety of presenting a fully functional transaction UI\n * representation, this function will not break apart transactions with the\n * same nonce, created on the same day, per network. Not accounting for transactions of the same\n * nonce, same day and network combo can result in confusing or broken experiences\n * in the UI. The transactions are then updated using the BaseControllerV1 update.\n *\n * @param transactions - The transactions to be applied to the state.\n * @returns The trimmed list of transactions.\n */\n private trimTransactionsForState(\n transactions: TransactionMeta[],\n ): TransactionMeta[] {\n const nonceNetworkSet = new Set();\n\n const txsToKeep = transactions\n .sort((a, b) => (a.time > b.time ? -1 : 1)) // Descending time order\n .filter((tx) => {\n const { chainId, status, txParams, time } = tx;\n\n if (txParams) {\n const key = `${txParams.nonce}-${convertHexToDecimal(\n chainId,\n )}-${new Date(time).toDateString()}`;\n\n if (nonceNetworkSet.has(key)) {\n return true;\n } else if (\n nonceNetworkSet.size < this.config.txHistoryLimit ||\n !this.isFinalState(status)\n ) {\n nonceNetworkSet.add(key);\n return true;\n }\n }\n\n return false;\n });\n\n txsToKeep.reverse(); // Ascending time order\n return txsToKeep;\n }\n\n /**\n * Determines if the transaction is in a final state.\n *\n * @param status - The transaction status.\n * @returns Whether the transaction is in a final state.\n */\n private isFinalState(status: TransactionStatus): boolean {\n return (\n status === TransactionStatus.rejected ||\n status === TransactionStatus.confirmed ||\n status === TransactionStatus.failed\n );\n }\n\n /**\n * Whether the transaction has at least completed all local processing.\n *\n * @param status - The transaction status.\n * @returns Whether the transaction is in a final state.\n */\n private isLocalFinalState(status: TransactionStatus): boolean {\n return [\n TransactionStatus.confirmed,\n TransactionStatus.failed,\n TransactionStatus.rejected,\n TransactionStatus.submitted,\n ].includes(status);\n }\n\n private async requestApproval(\n txMeta: TransactionMeta,\n { shouldShowRequest }: { shouldShowRequest: boolean },\n ): Promise<AddResult> {\n const id = this.getApprovalId(txMeta);\n const { origin } = txMeta;\n const type = ApprovalType.Transaction;\n const requestData = { txId: txMeta.id };\n\n return (await this.messagingSystem.call(\n 'ApprovalController:addRequest',\n {\n id,\n origin: origin || ORIGIN_METAMASK,\n type,\n requestData,\n expectsResult: true,\n },\n shouldShowRequest,\n )) as Promise<AddResult>;\n }\n\n private getTransaction(transactionId: string): TransactionMeta | undefined {\n const { transactions } = this.state;\n return transactions.find(({ id }) => id === transactionId);\n }\n\n private getApprovalId(txMeta: TransactionMeta) {\n return String(txMeta.id);\n }\n\n private isTransactionCompleted(transactionId: string): {\n meta?: TransactionMeta;\n isCompleted: boolean;\n } {\n const transaction = this.getTransaction(transactionId);\n\n if (!transaction) {\n return { meta: undefined, isCompleted: false };\n }\n\n const isCompleted = this.isLocalFinalState(transaction.status);\n\n return { meta: transaction, isCompleted };\n }\n\n private getChainId(): Hex {\n const { providerConfig } = this.getNetworkState();\n return providerConfig.chainId;\n }\n\n private prepareUnsignedEthTx(txParams: TransactionParams): TypedTransaction {\n return TransactionFactory.fromTxData(txParams, {\n common: this.getCommonConfiguration(),\n freeze: false,\n });\n }\n\n /**\n * `@ethereumjs/tx` uses `@ethereumjs/common` as a configuration tool for\n * specifying which chain, network, hardfork and EIPs to support for\n * a transaction. By referencing this configuration, and analyzing the fields\n * specified in txParams, @ethereumjs/tx is able to determine which EIP-2718\n * transaction type to use.\n *\n * @returns common configuration object\n */\n private getCommonConfiguration(): Common {\n const {\n providerConfig: { type: chain, chainId, nickname: name },\n } = this.getNetworkState();\n\n if (\n chain !== RPC &&\n chain !== NetworkType['linea-goerli'] &&\n chain !== NetworkType['linea-mainnet']\n ) {\n return new Common({ chain, hardfork: HARDFORK });\n }\n\n const customChainParams: Partial<ChainConfig> = {\n name,\n chainId: parseInt(chainId, 16),\n defaultHardfork: HARDFORK,\n };\n\n return Common.custom(customChainParams);\n }\n\n private onIncomingTransactions({\n added,\n updated,\n }: {\n added: TransactionMeta[];\n updated: TransactionMeta[];\n }) {\n const { transactions: currentTransactions } = this.state;\n\n const updatedTransactions = [\n ...added,\n ...currentTransactions.map((originalTransaction) => {\n const updatedTransaction = updated.find(\n ({ hash }) => hash === originalTransaction.hash,\n );\n\n return updatedTransaction ?? originalTransaction;\n }),\n ];\n\n this.update({\n transactions: this.trimTransactionsForState(updatedTransactions),\n });\n }\n\n private onUpdatedLastFetchedBlockNumbers({\n lastFetchedBlockNumbers,\n blockNumber,\n }: {\n lastFetchedBlockNumbers: {\n [key: string]: number;\n };\n blockNumber: number;\n }) {\n this.update({ lastFetchedBlockNumbers });\n this.hub.emit('incomingTransactionBlock', blockNumber);\n }\n\n private generateDappSuggestedGasFees(\n txParams: TransactionParams,\n origin?: string,\n ): DappSuggestedGasFees | undefined {\n if (!origin || origin === ORIGIN_METAMASK) {\n return undefined;\n }\n\n const { gasPrice, maxFeePerGas, maxPriorityFeePerGas, gas } = txParams;\n\n if (\n gasPrice === undefined &&\n maxFeePerGas === undefined &&\n maxPriorityFeePerGas === undefined &&\n gas === undefined\n ) {\n return undefined;\n }\n\n const dappSuggestedGasFees: DappSuggestedGasFees = {};\n\n if (gasPrice !== undefined) {\n dappSuggestedGasFees.gasPrice = gasPrice;\n } else if (\n maxFeePerGas !== undefined ||\n maxPriorityFeePerGas !== undefined\n ) {\n dappSuggestedGasFees.maxFeePerGas = maxFeePerGas;\n dappSuggestedGasFees.maxPriorityFeePerGas = maxPriorityFeePerGas;\n }\n\n if (gas !== undefined) {\n dappSuggestedGasFees.gas = gas;\n }\n\n return dappSuggestedGasFees;\n }\n\n /**\n * Validates and adds external provided transaction to state.\n *\n * @param transactionMeta - Nominated external transaction to be added to state.\n */\n private addExternalTransaction(transactionMeta: TransactionMeta) {\n const chainId = this.getChainId();\n const { transactions } = this.state;\n const fromAddress = transactionMeta?.txParams?.from;\n const sameFromAndNetworkTransactions = transactions.filter(\n (transaction) =>\n transaction.txParams.from === fromAddress &&\n transaction.chainId === chainId,\n );\n const confirmedTxs = sameFromAndNetworkTransactions.filter(\n (transaction) => transaction.status === TransactionStatus.confirmed,\n );\n const pendingTxs = sameFromAndNetworkTransactions.filter(\n (transaction) => transaction.status === TransactionStatus.submitted,\n );\n\n validateConfirmedExternalTransaction(\n transactionMeta,\n confirmedTxs,\n pendingTxs,\n );\n\n // Make sure provided external transaction has non empty history array\n if (!(transactionMeta.history ?? []).length) {\n if (!this.isHistoryDisabled) {\n addInitialHistorySnapshot(transactionMeta);\n }\n }\n\n const updatedTransactions = [...transactions, transactionMeta];\n this.update({\n transactions: this.trimTransactionsForState(updatedTransactions),\n });\n }\n\n /**\n * Sets other txMeta statuses to dropped if the txMeta that has been confirmed has other transactions\n * in the transactions have the same nonce.\n *\n * @param transactionId - Used to identify original transaction.\n */\n private markNonceDuplicatesDropped(transactionId: string) {\n const chainId = this.getChainId();\n const transactionMeta = this.getTransaction(transactionId);\n const nonce = transactionMeta?.txParams?.nonce;\n const from = transactionMeta?.txParams?.from;\n\n const sameNonceTxs = this.state.transactions.filter(\n (transaction) =>\n transaction.id !== transactionId &&\n transaction.txParams.from === from &&\n transaction.txParams.nonce === nonce &&\n transaction.chainId === chainId &&\n transaction.type !== TransactionType.incoming,\n );\n\n if (!sameNonceTxs.length) {\n return;\n }\n\n // Mark all same nonce transactions as dropped and give it a replacedBy hash\n for (const transaction of sameNonceTxs) {\n transaction.replacedBy = transactionMeta?.hash;\n transaction.replacedById = transactionMeta?.id;\n // Drop any transaction that wasn't previously failed (off chain failure)\n if (transaction.status !== TransactionStatus.failed) {\n this.setTransactionStatusDropped(transaction);\n }\n }\n }\n\n /**\n * Method to set transaction status to dropped.\n *\n * @param transactionMeta - TransactionMeta of transaction to be marked as dropped.\n */\n private setTransactionStatusDropped(transactionMeta: TransactionMeta) {\n transactionMeta.status = TransactionStatus.dropped;\n this.hub.emit('transaction-dropped', {\n transactionMeta,\n });\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#setTransactionStatusDropped - Transaction dropped',\n );\n this.onTransactionStatusChange(transactionMeta);\n }\n\n /**\n * Get transaction with provided actionId.\n *\n * @param actionId - Unique ID to prevent duplicate requests\n * @returns the filtered transaction\n */\n private getTransactionWithActionId(actionId?: string) {\n return this.state.transactions.find(\n (transaction) => actionId && transaction.actionId === actionId,\n );\n }\n\n private async waitForTransactionFinished(\n transactionId: string,\n ): Promise<TransactionMeta> {\n return new Promise((resolve) => {\n this.hub.once(`${transactionId}:finished`, (txMeta) => {\n resolve(txMeta);\n });\n });\n }\n\n /**\n * Updates the r, s, and v properties of a TransactionMeta object\n * with values from a signed transaction.\n *\n * @param transactionMeta - The TransactionMeta object to update.\n * @param signedTx - The encompassing type for all transaction types containing r, s, and v values.\n */\n private async updateTransactionMetaRSV(\n transactionMeta: TransactionMeta,\n signedTx: TypedTransaction,\n ): Promise<void> {\n for (const key of ['r', 's', 'v'] as const) {\n const value = signedTx[key];\n\n if (value === undefined || value === null) {\n continue;\n }\n\n transactionMeta[key] = addHexPrefix(value.toString(16));\n }\n }\n\n private async getEIP1559Compatibility() {\n const currentNetworkIsEIP1559Compatible =\n await this.getCurrentNetworkEIP1559Compatibility();\n\n const currentAccountIsEIP1559Compatible =\n await this.getCurrentAccountEIP1559Compatibility();\n\n return (\n currentNetworkIsEIP1559Compatible && currentAccountIsEIP1559Compatible\n );\n }\n\n private addPendingTransactionTrackerListeners() {\n this.pendingTransactionTracker.hub.on(\n 'transaction-confirmed',\n this.onConfirmedTransaction.bind(this),\n );\n\n this.pendingTransactionTracker.hub.on(\n 'transaction-dropped',\n this.setTransactionStatusDropped.bind(this),\n );\n\n this.pendingTransactionTracker.hub.on(\n 'transaction-failed',\n this.failTransaction.bind(this),\n );\n\n this.pendingTransactionTracker.hub.on(\n 'transaction-updated',\n this.updateTransaction.bind(this),\n );\n }\n\n private async signTransaction(\n transactionMeta: TransactionMeta,\n txParams: TransactionParams,\n ): Promise<string | undefined> {\n log('Signing transaction', txParams);\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n this.inProcessOfSigning.add(transactionMeta.id);\n\n const signedTx = await this.sign?.(\n unsignedEthTx,\n txParams.from,\n ...this.getAdditionalSignArguments(transactionMeta),\n );\n\n if (!signedTx) {\n log('Skipping signed status as no signed transaction');\n return undefined;\n }\n\n if (!this.afterSign(transactionMeta, signedTx)) {\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#signTransaction - Update after sign',\n );\n\n log('Skipping signed status based on hook');\n\n return undefined;\n }\n\n await this.updateTransactionMetaRSV(transactionMeta, signedTx);\n\n transactionMeta.status = TransactionStatus.signed;\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - Transaction signed',\n );\n\n this.onTransactionStatusChange(transactionMeta);\n\n const rawTx = bufferToHex(signedTx.serialize());\n\n transactionMeta.rawTx = rawTx;\n\n this.updateTransaction(\n transactionMeta,\n 'TransactionController#approveTransaction - RawTransaction added',\n );\n\n return rawTx;\n }\n\n private onTransactionStatusChange(transactionMeta: TransactionMeta) {\n this.hub.emit('transaction-status-update', { transactionMeta });\n }\n\n private getNonceTrackerPendingTransactions(address: string) {\n const standardPendingTransactions = this.getNonceTrackerTransactions(\n TransactionStatus.submitted,\n address,\n );\n\n const externalPendingTransactions =\n this.getExternalPendingTransactions(address);\n\n return [...standardPendingTransactions, ...externalPendingTransactions];\n }\n\n private getNonceTrackerTransactions(\n status: TransactionStatus,\n address: string,\n ) {\n const currentChainId = this.getChainId();\n\n return getAndFormatTransactionsForNonceTracker(\n currentChainId,\n address,\n status,\n this.state.transactions,\n );\n }\n\n private onConfirmedTransaction(transactionMeta: TransactionMeta) {\n log('Processing confirmed transaction', transactionMeta.id);\n\n this.markNonceDuplicatesDropped(transactionMeta.id);\n\n this.hub.emit('transaction-confirmed', { transactionMeta });\n this.hub.emit(`${transactionMeta.id}:confirmed`, transactionMeta);\n\n this.onTransactionStatusChange(transactionMeta);\n\n // Intentional given potential duration of process.\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n this.updatePostBalance(transactionMeta);\n }\n\n private async updatePostBalance(transactionMeta: TransactionMeta) {\n try {\n if (transactionMeta.type !== TransactionType.swap) {\n return;\n }\n\n const { updatedTransactionMeta, approvalTransactionMeta } =\n await updatePostTransactionBalance(transactionMeta, {\n ethQuery: this.ethQuery,\n getTransaction: this.getTransaction.bind(this),\n updateTransaction: this.updateTransaction.bind(this),\n });\n\n this.hub.emit('post-transaction-balance-updated', {\n transactionMeta: updatedTransactionMeta,\n approvalTransactionMeta,\n });\n } catch (error) {\n /* istanbul ignore next */\n log('Error while updating post transaction balance', error);\n }\n }\n}\n"]}
@@ -20,7 +20,7 @@ const NORMALIZERS = {
20
20
  maxFeePerGas: (maxFeePerGas) => (0, ethereumjs_util_1.addHexPrefix)(maxFeePerGas),
21
21
  maxPriorityFeePerGas: (maxPriorityFeePerGas) => (0, ethereumjs_util_1.addHexPrefix)(maxPriorityFeePerGas),
22
22
  estimatedBaseFee: (maxPriorityFeePerGas) => (0, ethereumjs_util_1.addHexPrefix)(maxPriorityFeePerGas),
23
- type: (type) => (type === '0x0' ? '0x0' : undefined),
23
+ type: (type) => (0, ethereumjs_util_1.addHexPrefix)(type),
24
24
  };
25
25
  /**
26
26
  * Normalizes properties on transaction params.
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,2CAAwD;AACxD,qDAA4D;AAM5D,oCAA6C;AAOhC,QAAA,kBAAkB,GAAG,kCAAkC,CAAC;AAErE,gCAAgC;AAChC,8DAA8D;AAC9D,MAAM,WAAW,GAAgD;IAC/D,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,8BAAY,EAAC,I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K,CACb,yCAAyC,MAAM;2BAC1B,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,EAAE,CAC/C,CAAC;KACH;AACH,CAAC;AAVD,0EAUC;AAED;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,KAAiD;IAEjD,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI;QACjB,GAAG,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;KAClB,CAAC;AACJ,CAAC;AAVD,4CAUC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,YAAoD;IAEpD,gCAAgC;IAChC,8DAA8D;IAC9D,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,EAAE,CAC/B,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,8BAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAE1D,IAAI,UAAU,IAAI,YAAY,EAAE;QAC9B,OAAO;YACL,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC;SAC3C,CAAC;KACH;IAED,OAAO;QACL,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC;QAClD,oBAAoB,EAAE,SAAS,CAAC,YAAY,CAAC,oBAAoB,CAAC;KACnE,CAAC;AACJ,CAAC;AAlBD,sDAkBC","sourcesContent":["import { convertHexToDecimal } from '@metamask/controller-utils';\nimport { getKnownPropertyNames } from '@metamask/utils';\nimport { addHexPrefix, isHexString } from 'ethereumjs-util';\n\nimport type {\n GasPriceValue,\n FeeMarketEIP1559Values,\n} from '../TransactionController';\nimport { TransactionStatus } from '../types';\nimport type {\n TransactionParams,\n TransactionMeta,\n TransactionError,\n} from '../types';\n\nexport const ESTIMATE_GAS_ERROR = 'eth_estimateGas rpc method error';\n\n// TODO: Replace `any` with type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst NORMALIZERS: { [param in keyof TransactionParams]: any } = {\n data: (data: string) => addHexPrefix(data),\n from: (from: string) => addHexPrefix(from).toLowerCase(),\n gas: (gas: string) => addHexPrefix(gas),\n gasLimit: (gas: string) => addHexPrefix(gas),\n gasPrice: (gasPrice: string) => addHexPrefix(gasPrice),\n nonce: (nonce: string) => addHexPrefix(nonce),\n to: (to: string) => addHexPrefix(to).toLowerCase(),\n value: (value: string) => addHexPrefix(value),\n maxFeePerGas: (maxFeePerGas: string) => addHexPrefix(maxFeePerGas),\n maxPriorityFeePerGas: (maxPriorityFeePerGas: string) =>\n addHexPrefix(maxPriorityFeePerGas),\n estimatedBaseFee: (maxPriorityFeePerGas: string) =>\n addHexPrefix(maxPriorityFeePerGas),\n type: (type: string) => (type === '0x0' ? '0x0' : undefined),\n};\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param txParams - The transaction params to normalize.\n * @returns Normalized transaction params.\n */\nexport function normalizeTxParams(txParams: TransactionParams) {\n const normalizedTxParams: TransactionParams = { from: '' };\n\n for (const key of getKnownPropertyNames(NORMALIZERS)) {\n if (txParams[key]) {\n normalizedTxParams[key] = NORMALIZERS[key](txParams[key]);\n }\n }\n\n if (!normalizedTxParams.value) {\n normalizedTxParams.value = '0x0';\n }\n\n return normalizedTxParams;\n}\n\n/**\n * Checks if a transaction is EIP-1559 by checking for the existence of\n * maxFeePerGas and maxPriorityFeePerGas within its parameters.\n *\n * @param txParams - Transaction params object to add.\n * @returns Boolean that is true if the transaction is EIP-1559 (has maxFeePerGas and maxPriorityFeePerGas), otherwise returns false.\n */\nexport function isEIP1559Transaction(txParams: TransactionParams): boolean {\n const hasOwnProp = (obj: TransactionParams, key: string) =>\n Object.prototype.hasOwnProperty.call(obj, key);\n return (\n hasOwnProp(txParams, 'maxFeePerGas') &&\n hasOwnProp(txParams, 'maxPriorityFeePerGas')\n );\n}\n\nexport const validateGasValues = (\n gasValues: GasPriceValue | FeeMarketEIP1559Values,\n) => {\n Object.keys(gasValues).forEach((key) => {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value = (gasValues as any)[key];\n if (typeof value !== 'string' || !isHexString(value)) {\n throw new TypeError(\n `expected hex string for ${key} but received: ${value}`,\n );\n }\n });\n};\n\nexport const isFeeMarketEIP1559Values = (\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n): gasValues is FeeMarketEIP1559Values =>\n (gasValues as FeeMarketEIP1559Values)?.maxFeePerGas !== undefined ||\n (gasValues as FeeMarketEIP1559Values)?.maxPriorityFeePerGas !== undefined;\n\nexport const isGasPriceValue = (\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n): gasValues is GasPriceValue =>\n (gasValues as GasPriceValue)?.gasPrice !== undefined;\n\nexport const getIncreasedPriceHex = (value: number, rate: number): string =>\n addHexPrefix(`${parseInt(`${value * rate}`, 10).toString(16)}`);\n\nexport const getIncreasedPriceFromExisting = (\n value: string | undefined,\n rate: number,\n): string => {\n return getIncreasedPriceHex(convertHexToDecimal(value), rate);\n};\n\n/**\n * Validates that the proposed value is greater than or equal to the minimum value.\n *\n * @param proposed - The proposed value.\n * @param min - The minimum value.\n * @returns The proposed value.\n * @throws Will throw if the proposed value is too low.\n */\nexport function validateMinimumIncrease(proposed: string, min: string) {\n const proposedDecimal = convertHexToDecimal(proposed);\n const minDecimal = convertHexToDecimal(min);\n if (proposedDecimal >= minDecimal) {\n return proposed;\n }\n const errorMsg = `The proposed value: ${proposedDecimal} should meet or exceed the minimum value: ${minDecimal}`;\n throw new Error(errorMsg);\n}\n\n/**\n * Validates that a transaction is unapproved.\n * Throws if the transaction is not unapproved.\n *\n * @param transactionMeta - The transaction metadata to check.\n * @param fnName - The name of the function calling this helper.\n */\nexport function validateIfTransactionUnapproved(\n transactionMeta: TransactionMeta | undefined,\n fnName: string,\n) {\n if (transactionMeta?.status !== TransactionStatus.unapproved) {\n throw new Error(\n `TransactionsController: Can only call ${fnName} on an unapproved transaction.\n Current tx status: ${transactionMeta?.status}`,\n );\n }\n}\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param error - The error to be normalize.\n * @returns Normalized transaction error.\n */\nexport function normalizeTxError(\n error: Error & { code?: string; value?: unknown },\n): TransactionError {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n code: error?.code,\n rpc: error?.value,\n };\n}\n\n/**\n * Normalize an object containing gas fee values.\n *\n * @param gasFeeValues - An object containing gas fee values.\n * @returns An object containing normalized gas fee values.\n */\nexport function normalizeGasFeeValues(\n gasFeeValues: GasPriceValue | FeeMarketEIP1559Values,\n): GasPriceValue | FeeMarketEIP1559Values {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const normalize = (value: any) =>\n typeof value === 'string' ? addHexPrefix(value) : value;\n\n if ('gasPrice' in gasFeeValues) {\n return {\n gasPrice: normalize(gasFeeValues.gasPrice),\n };\n }\n\n return {\n maxFeePerGas: normalize(gasFeeValues.maxFeePerGas),\n maxPriorityFeePerGas: normalize(gasFeeValues.maxPriorityFeePerGas),\n };\n}\n"]}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";;;AAAA,iEAAiE;AACjE,2CAAwD;AACxD,qDAA4D;AAM5D,oCAA6C;AAOhC,QAAA,kBAAkB,GAAG,kCAAkC,CAAC;AAErE,gCAAgC;AAChC,8DAA8D;AAC9D,MAAM,WAAW,GAAgD;IAC/D,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,8BAAY,EAAC,IAAI,CAAC;IAC1C,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,8BAAY,EAAC,IAAI,CAAC,CAAC,WAAW,EAAE;IACxD,GAAG,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,IAAA,8BAAY,EAAC,GAAG,CA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EAAE,KAAK,CAAC,OAAO;QACtB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI;QACjB,GAAG,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK;KAClB,CAAC;AACJ,CAAC;AAVD,4CAUC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,YAAoD;IAEpD,gCAAgC;IAChC,8DAA8D;IAC9D,MAAM,SAAS,GAAG,CAAC,KAAU,EAAE,EAAE,CAC/B,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAA,8BAAY,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAE1D,IAAI,UAAU,IAAI,YAAY,EAAE;QAC9B,OAAO;YACL,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC,QAAQ,CAAC;SAC3C,CAAC;KACH;IAED,OAAO;QACL,YAAY,EAAE,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC;QAClD,oBAAoB,EAAE,SAAS,CAAC,YAAY,CAAC,oBAAoB,CAAC;KACnE,CAAC;AACJ,CAAC;AAlBD,sDAkBC","sourcesContent":["import { convertHexToDecimal } from '@metamask/controller-utils';\nimport { getKnownPropertyNames } from '@metamask/utils';\nimport { addHexPrefix, isHexString } from 'ethereumjs-util';\n\nimport type {\n GasPriceValue,\n FeeMarketEIP1559Values,\n} from '../TransactionController';\nimport { TransactionStatus } from '../types';\nimport type {\n TransactionParams,\n TransactionMeta,\n TransactionError,\n} from '../types';\n\nexport const ESTIMATE_GAS_ERROR = 'eth_estimateGas rpc method error';\n\n// TODO: Replace `any` with type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst NORMALIZERS: { [param in keyof TransactionParams]: any } = {\n data: (data: string) => addHexPrefix(data),\n from: (from: string) => addHexPrefix(from).toLowerCase(),\n gas: (gas: string) => addHexPrefix(gas),\n gasLimit: (gas: string) => addHexPrefix(gas),\n gasPrice: (gasPrice: string) => addHexPrefix(gasPrice),\n nonce: (nonce: string) => addHexPrefix(nonce),\n to: (to: string) => addHexPrefix(to).toLowerCase(),\n value: (value: string) => addHexPrefix(value),\n maxFeePerGas: (maxFeePerGas: string) => addHexPrefix(maxFeePerGas),\n maxPriorityFeePerGas: (maxPriorityFeePerGas: string) =>\n addHexPrefix(maxPriorityFeePerGas),\n estimatedBaseFee: (maxPriorityFeePerGas: string) =>\n addHexPrefix(maxPriorityFeePerGas),\n type: (type: string) => addHexPrefix(type),\n};\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param txParams - The transaction params to normalize.\n * @returns Normalized transaction params.\n */\nexport function normalizeTxParams(txParams: TransactionParams) {\n const normalizedTxParams: TransactionParams = { from: '' };\n\n for (const key of getKnownPropertyNames(NORMALIZERS)) {\n if (txParams[key]) {\n normalizedTxParams[key] = NORMALIZERS[key](txParams[key]);\n }\n }\n\n if (!normalizedTxParams.value) {\n normalizedTxParams.value = '0x0';\n }\n\n return normalizedTxParams;\n}\n\n/**\n * Checks if a transaction is EIP-1559 by checking for the existence of\n * maxFeePerGas and maxPriorityFeePerGas within its parameters.\n *\n * @param txParams - Transaction params object to add.\n * @returns Boolean that is true if the transaction is EIP-1559 (has maxFeePerGas and maxPriorityFeePerGas), otherwise returns false.\n */\nexport function isEIP1559Transaction(txParams: TransactionParams): boolean {\n const hasOwnProp = (obj: TransactionParams, key: string) =>\n Object.prototype.hasOwnProperty.call(obj, key);\n return (\n hasOwnProp(txParams, 'maxFeePerGas') &&\n hasOwnProp(txParams, 'maxPriorityFeePerGas')\n );\n}\n\nexport const validateGasValues = (\n gasValues: GasPriceValue | FeeMarketEIP1559Values,\n) => {\n Object.keys(gasValues).forEach((key) => {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const value = (gasValues as any)[key];\n if (typeof value !== 'string' || !isHexString(value)) {\n throw new TypeError(\n `expected hex string for ${key} but received: ${value}`,\n );\n }\n });\n};\n\nexport const isFeeMarketEIP1559Values = (\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n): gasValues is FeeMarketEIP1559Values =>\n (gasValues as FeeMarketEIP1559Values)?.maxFeePerGas !== undefined ||\n (gasValues as FeeMarketEIP1559Values)?.maxPriorityFeePerGas !== undefined;\n\nexport const isGasPriceValue = (\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n): gasValues is GasPriceValue =>\n (gasValues as GasPriceValue)?.gasPrice !== undefined;\n\nexport const getIncreasedPriceHex = (value: number, rate: number): string =>\n addHexPrefix(`${parseInt(`${value * rate}`, 10).toString(16)}`);\n\nexport const getIncreasedPriceFromExisting = (\n value: string | undefined,\n rate: number,\n): string => {\n return getIncreasedPriceHex(convertHexToDecimal(value), rate);\n};\n\n/**\n * Validates that the proposed value is greater than or equal to the minimum value.\n *\n * @param proposed - The proposed value.\n * @param min - The minimum value.\n * @returns The proposed value.\n * @throws Will throw if the proposed value is too low.\n */\nexport function validateMinimumIncrease(proposed: string, min: string) {\n const proposedDecimal = convertHexToDecimal(proposed);\n const minDecimal = convertHexToDecimal(min);\n if (proposedDecimal >= minDecimal) {\n return proposed;\n }\n const errorMsg = `The proposed value: ${proposedDecimal} should meet or exceed the minimum value: ${minDecimal}`;\n throw new Error(errorMsg);\n}\n\n/**\n * Validates that a transaction is unapproved.\n * Throws if the transaction is not unapproved.\n *\n * @param transactionMeta - The transaction metadata to check.\n * @param fnName - The name of the function calling this helper.\n */\nexport function validateIfTransactionUnapproved(\n transactionMeta: TransactionMeta | undefined,\n fnName: string,\n) {\n if (transactionMeta?.status !== TransactionStatus.unapproved) {\n throw new Error(\n `TransactionsController: Can only call ${fnName} on an unapproved transaction.\n Current tx status: ${transactionMeta?.status}`,\n );\n }\n}\n\n/**\n * Normalizes properties on transaction params.\n *\n * @param error - The error to be normalize.\n * @returns Normalized transaction error.\n */\nexport function normalizeTxError(\n error: Error & { code?: string; value?: unknown },\n): TransactionError {\n return {\n name: error.name,\n message: error.message,\n stack: error.stack,\n code: error?.code,\n rpc: error?.value,\n };\n}\n\n/**\n * Normalize an object containing gas fee values.\n *\n * @param gasFeeValues - An object containing gas fee values.\n * @returns An object containing normalized gas fee values.\n */\nexport function normalizeGasFeeValues(\n gasFeeValues: GasPriceValue | FeeMarketEIP1559Values,\n): GasPriceValue | FeeMarketEIP1559Values {\n // TODO: Replace `any` with type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const normalize = (value: any) =>\n typeof value === 'string' ? addHexPrefix(value) : value;\n\n if ('gasPrice' in gasFeeValues) {\n return {\n gasPrice: normalize(gasFeeValues.gasPrice),\n };\n }\n\n return {\n maxFeePerGas: normalize(gasFeeValues.maxFeePerGas),\n maxPriorityFeePerGas: normalize(gasFeeValues.maxPriorityFeePerGas),\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/transaction-controller",
3
- "version": "20.0.0",
3
+ "version": "21.0.1",
4
4
  "description": "Stores transactions alongside their periodically updated statuses and manages interactions such as approval and cancellation",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -34,13 +34,13 @@
34
34
  "@ethereumjs/common": "^3.2.0",
35
35
  "@ethereumjs/tx": "^4.2.0",
36
36
  "@ethersproject/abi": "^5.7.0",
37
- "@metamask/approval-controller": "^5.1.1",
38
- "@metamask/base-controller": "^4.1.0",
39
- "@metamask/controller-utils": "^8.0.1",
37
+ "@metamask/approval-controller": "^5.1.2",
38
+ "@metamask/base-controller": "^4.1.1",
39
+ "@metamask/controller-utils": "^8.0.2",
40
40
  "@metamask/eth-query": "^4.0.0",
41
- "@metamask/gas-fee-controller": "^12.0.0",
41
+ "@metamask/gas-fee-controller": "^13.0.0",
42
42
  "@metamask/metamask-eth-abis": "^3.0.0",
43
- "@metamask/network-controller": "^17.1.0",
43
+ "@metamask/network-controller": "^17.2.0",
44
44
  "@metamask/rpc-errors": "^6.1.0",
45
45
  "@metamask/utils": "^8.3.0",
46
46
  "async-mutex": "^0.2.6",
@@ -66,9 +66,9 @@
66
66
  "typescript": "~4.8.4"
67
67
  },
68
68
  "peerDependencies": {
69
- "@metamask/approval-controller": "^5.1.1",
70
- "@metamask/gas-fee-controller": "^12.0.0",
71
- "@metamask/network-controller": "^17.1.0",
69
+ "@metamask/approval-controller": "^5.1.2",
70
+ "@metamask/gas-fee-controller": "^13.0.0",
71
+ "@metamask/network-controller": "^17.2.0",
72
72
  "babel-runtime": "^6.26.0"
73
73
  },
74
74
  "engines": {