@metamask/transaction-controller 5.0.0 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [6.1.0]
10
+ ### Changed
11
+ - Relax types of `provider` and `blockTracker` options ([#1443](https://github.com/MetaMask/core/pull/1443))
12
+ - 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.
13
+
14
+ ## [6.0.0]
15
+ ### Added
16
+ - Update transaction controller to automatically initiate, finalize, and cancel approval requests as transactions move through states ([#1241](https://github.com/MetaMask/core/pull/1241))
17
+ - The `ApprovalController:addRequest` action will be called when a new transaction is initiated
18
+ - The `ApprovalController:rejectRequest` action will be called if a transaction fails
19
+ - The `ApprovalController:acceptRequest` action will be called when a transaction is approved
20
+
21
+ ### Changed
22
+ - **BREAKING:** Bump to Node 16 ([#1262](https://github.com/MetaMask/core/pull/1262))
23
+ - **BREAKING:** Update `@metamask/network-controller` dependency and peer dependency ([#1367](https://github.com/MetaMask/core/pull/1367))
24
+ - This affects the `getNetworkState` and `onNetworkStateChange` constructor parameters
25
+ - **BREAKING:** Change format of chain ID in state to `Hex` ([#1367](https://github.com/MetaMask/core/pull/1367))
26
+ - The `chainId` property of the `Transaction` type has been changed from `number` to `Hex`
27
+ - The `chainId` property of the `TransactionMeta` type has been changed from a decimal `string` to `Hex`, and the `transaction` property has been updated along with the `Transaction` type (as described above).
28
+ - The state property `transactions` is an array of `TransactionMeta` objects, so it has changed according to the description above.
29
+ - This requires a state migration: each entry should have the `chainId` property converted from a decimal `string` to `Hex`, and the `transaction.chainId` property changed from `number` to `Hex`.
30
+ - The `addTransaction` and `estimateGas` methods now expect the first parameter (`transaction`) to use type `Hex` for the `chainId` property.
31
+ - The `updateTransaction` method now expects the `transactionMeta` parameter to use type `Hex` for the `chainId` property (and for the nested `transaction.chainId` property)
32
+ - **BREAKING:** Add `messenger` as required constructor parameter ([#1241](https://github.com/MetaMask/core/pull/1241))
33
+ - **BREAKING:** Add `@metamask/approval-controller` as a dependency and peer dependency ([#1241](https://github.com/MetaMask/core/pull/1241), [#1393](https://github.com/MetaMask/core/pull/1393))
34
+ - Add `@metamask/utils` dependency ([#1367](https://github.com/MetaMask/core/pull/1367))
35
+
36
+ ### Fixed
37
+ - Fix inaccurate hard-coded `chainId` on incoming token transactions ([#1366](https://github.com/MetaMask/core/pull/1366))
38
+
9
39
  ## [5.0.0]
10
40
  ### Changed
11
41
  - **BREAKING**: peerDeps: @metamask/network-controller@6.0.0->8.0.0 ([#1196](https://github.com/MetaMask/core/pull/1196))
@@ -48,7 +78,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
48
78
 
49
79
  All changes listed after this point were applied to this package following the monorepo conversion.
50
80
 
51
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@5.0.0...HEAD
81
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@6.1.0...HEAD
82
+ [6.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@6.0.0...@metamask/transaction-controller@6.1.0
83
+ [6.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@5.0.0...@metamask/transaction-controller@6.0.0
52
84
  [5.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@4.0.1...@metamask/transaction-controller@5.0.0
53
85
  [4.0.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@4.0.0...@metamask/transaction-controller@4.0.1
54
86
  [4.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@3.0.0...@metamask/transaction-controller@4.0.0
@@ -2,8 +2,10 @@
2
2
  import { EventEmitter } from 'events';
3
3
  import Common from '@ethereumjs/common';
4
4
  import { TypedTransaction } from '@ethereumjs/tx';
5
- import { BaseController, BaseConfig, BaseState } from '@metamask/base-controller';
6
- import type { NetworkState, ProviderProxy, BlockTrackerProxy } from '@metamask/network-controller';
5
+ import type { Hex } from '@metamask/utils';
6
+ import { BaseController, BaseConfig, BaseState, RestrictedControllerMessenger } from '@metamask/base-controller';
7
+ import type { BlockTracker, NetworkState, Provider } from '@metamask/network-controller';
8
+ import { AcceptRequest as AcceptApprovalRequest, AddApprovalRequest, RejectRequest as RejectApprovalRequest } from '@metamask/approval-controller';
7
9
  /**
8
10
  * @type Result
9
11
  * @property result - Promise resolving to a new transaction hash
@@ -37,7 +39,7 @@ export interface FetchAllOptions {
37
39
  * @property value - Value associated with this transaction
38
40
  */
39
41
  export interface Transaction {
40
- chainId?: number;
42
+ chainId?: Hex;
41
43
  data?: string;
42
44
  from: string;
43
45
  gas?: string;
@@ -90,7 +92,7 @@ declare type TransactionMetaBase = {
90
92
  };
91
93
  id: string;
92
94
  networkID?: string;
93
- chainId?: string;
95
+ chainId?: Hex;
94
96
  origin?: string;
95
97
  rawTransaction?: string;
96
98
  time: number;
@@ -212,6 +214,18 @@ export declare const CANCEL_RATE = 1.5;
212
214
  * Multiplier used to determine a transaction's increased gas fee during speed up
213
215
  */
214
216
  export declare const SPEED_UP_RATE = 1.1;
217
+ /**
218
+ * The name of the {@link TransactionController}.
219
+ */
220
+ declare const controllerName = "TransactionController";
221
+ /**
222
+ * The external actions available to the {@link TransactionController}.
223
+ */
224
+ declare type AllowedActions = AddApprovalRequest | AcceptApprovalRequest | RejectApprovalRequest;
225
+ /**
226
+ * The messenger of the {@link TransactionController}.
227
+ */
228
+ export declare type TransactionControllerMessenger = RestrictedControllerMessenger<typeof controllerName, AllowedActions, never, AllowedActions['type'], never>;
215
229
  /**
216
230
  * Controller responsible for submitting and managing transactions.
217
231
  */
@@ -223,6 +237,7 @@ export declare class TransactionController extends BaseController<TransactionCon
223
237
  private handle?;
224
238
  private mutex;
225
239
  private getNetworkState;
240
+ private messagingSystem;
226
241
  private failTransaction;
227
242
  private registryLookup;
228
243
  /**
@@ -256,14 +271,16 @@ export declare class TransactionController extends BaseController<TransactionCon
256
271
  * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.
257
272
  * @param options.provider - The provider used to create the underlying EthQuery instance.
258
273
  * @param options.blockTracker - The block tracker used to poll for new blocks data.
274
+ * @param options.messenger - The controller messenger.
259
275
  * @param config - Initial options used to configure this controller.
260
276
  * @param state - Initial state to set on this controller.
261
277
  */
262
- constructor({ getNetworkState, onNetworkStateChange, provider, blockTracker, }: {
278
+ constructor({ getNetworkState, onNetworkStateChange, provider, blockTracker, messenger, }: {
263
279
  getNetworkState: () => NetworkState;
264
280
  onNetworkStateChange: (listener: (state: NetworkState) => void) => void;
265
- provider: ProviderProxy;
266
- blockTracker: BlockTrackerProxy;
281
+ provider: Provider;
282
+ blockTracker: BlockTracker;
283
+ messenger: TransactionControllerMessenger;
267
284
  }, config?: Partial<TransactionConfig>, state?: Partial<TransactionState>);
268
285
  /**
269
286
  * Starts a new polling interval.
@@ -321,7 +338,7 @@ export declare class TransactionController extends BaseController<TransactionCon
321
338
  * and emitting a `<tx.id>:finished` hub event.
322
339
  *
323
340
  * @param transactionID - The ID of the transaction to cancel.
324
- * @param gasValues - The gas values to use for the cancellation transation.
341
+ * @param gasValues - The gas values to use for the cancellation transaction.
325
342
  */
326
343
  stopTransaction(transactionID: string, gasValues?: GasPriceValue | FeeMarketEIP1559Values): Promise<void>;
327
344
  /**
@@ -466,6 +483,10 @@ export declare class TransactionController extends BaseController<TransactionCon
466
483
  * @returns Whether the gas data is outdated.
467
484
  */
468
485
  private isGasDataOutdated;
486
+ private requestApproval;
487
+ private acceptApproval;
488
+ private rejectApproval;
489
+ private getApprovalId;
469
490
  }
470
491
  export default TransactionController;
471
492
  //# sourceMappingURL=TransactionController.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionController.d.ts","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAA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BAAqB;IAiB7B;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;CAM1B;AAED,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"TransactionController.d.ts","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAKtC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAsB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGtE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,UAAU,EACV,SAAS,EACT,6BAA6B,EAC9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,QAAQ,EACT,MAAM,8BAA8B,CAAC;AActC,OAAO,EACL,aAAa,IAAI,qBAAqB,EACtC,kBAAkB,EAClB,aAAa,IAAI,qBAAqB,EACvC,MAAM,+BAA+B,CAAC;AAkBvC;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,EAAE,eAAe,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,E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IACG,kBAAkB,CACtB,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,aAAa,GAAG,sBAAsB;IAoHpD;;;;;OAKG;IACG,WAAW,CAAC,WAAW,EAAE,WAAW;;;;;;;;;IA6E1C;;;OAGG;IACG,wBAAwB;IAmC9B;;;;OAIG;IACH,iBAAiB,CAAC,eAAe,EAAE,eAAe;IAWlD;;;;;OAKG;IACH,gBAAgB,CAAC,aAAa,CAAC,EAAE,OAAO;IAwBxC;;;;;;;;OAQG;IACG,QAAQ,CACZ,OAAO,EAAE,MAAM,EACf,GAAG,CAAC,EAAE,eAAe,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAoFzB;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,wBAAwB;IA0BhC;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IASpB;;;;;OAKG;YACW,oCAAoC;IA4DlD;;;;;;;;OAQG;YACW,4BAA4B;IAa1C;;;;;;OAMG;IACH,OAAO,CAAC,mCAAmC;IA0B3C;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB;IAY1B;;;;;;;;OAQG;IACH,OAAO,CAAC,sBAAsB;IAe9B;;;;;;OAMG;IACH,OAAO,CAAC,qBAAqB;IAiB7B;;;;;;;;OAQG;IACH,OAAO,CAAC,gBAAgB;IASxB;;;;;;OAMG;IACH,OAAO,CAAC,iBAAiB;YAOX,eAAe;IAyB7B,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,aAAa;CAGtB;AAED,eAAe,qBAAqB,CAAC"}
@@ -60,6 +60,10 @@ exports.CANCEL_RATE = 1.5;
60
60
  * Multiplier used to determine a transaction's increased gas fee during speed up
61
61
  */
62
62
  exports.SPEED_UP_RATE = 1.1;
63
+ /**
64
+ * The name of the {@link TransactionController}.
65
+ */
66
+ const controllerName = 'TransactionController';
63
67
  /**
64
68
  * Controller responsible for submitting and managing transactions.
65
69
  */
@@ -72,10 +76,11 @@ class TransactionController extends base_controller_1.BaseController {
72
76
  * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.
73
77
  * @param options.provider - The provider used to create the underlying EthQuery instance.
74
78
  * @param options.blockTracker - The block tracker used to poll for new blocks data.
79
+ * @param options.messenger - The controller messenger.
75
80
  * @param config - Initial options used to configure this controller.
76
81
  * @param state - Initial state to set on this controller.
77
82
  */
78
- constructor({ getNetworkState, onNetworkStateChange, provider, blockTracker, }, config, state) {
83
+ constructor({ getNetworkState, onNetworkStateChange, provider, blockTracker, messenger, }, config, state) {
79
84
  super(config, state);
80
85
  this.mutex = new async_mutex_1.Mutex();
81
86
  this.normalizeTokenTx = (txMeta, currentNetworkID, currentChainId) => {
@@ -89,7 +94,7 @@ class TransactionController extends base_controller_1.BaseController {
89
94
  status: TransactionStatus.confirmed,
90
95
  time,
91
96
  transaction: {
92
- chainId: 1,
97
+ chainId: currentChainId,
93
98
  from,
94
99
  gas,
95
100
  gasPrice,
@@ -124,6 +129,7 @@ class TransactionController extends base_controller_1.BaseController {
124
129
  };
125
130
  this.initialize();
126
131
  this.provider = provider;
132
+ this.messagingSystem = messenger;
127
133
  this.getNetworkState = getNetworkState;
128
134
  this.ethQuery = new eth_query_1.default(provider);
129
135
  this.registry = new eth_method_registry_1.default({ provider });
@@ -285,6 +291,7 @@ class TransactionController extends base_controller_1.BaseController {
285
291
  transactions.push(transactionMeta);
286
292
  this.update({ transactions: this.trimTransactionsForState(transactions) });
287
293
  this.hub.emit(`unapprovedTransaction`, transactionMeta);
294
+ this.requestApproval(transactionMeta);
288
295
  return { result, transactionMeta };
289
296
  });
290
297
  }
@@ -310,7 +317,7 @@ class TransactionController extends base_controller_1.BaseController {
310
317
  }
311
318
  const customChainParams = {
312
319
  name,
313
- chainId: parseInt(chainId, undefined),
320
+ chainId: parseInt(chainId, 16),
314
321
  networkId: networkId === null ? NaN : parseInt(networkId, undefined),
315
322
  };
316
323
  return common_1.default.forCustomChain(controller_utils_1.NetworkType.mainnet, customChainParams, HARDFORK);
@@ -328,7 +335,7 @@ class TransactionController extends base_controller_1.BaseController {
328
335
  const { transactions } = this.state;
329
336
  const releaseLock = yield this.mutex.acquire();
330
337
  const { providerConfig } = this.getNetworkState();
331
- const { chainId: currentChainId } = providerConfig;
338
+ const { chainId } = providerConfig;
332
339
  const index = transactions.findIndex(({ id }) => transactionID === id);
333
340
  const transactionMeta = transactions[index];
334
341
  const { transaction: { nonce, from }, } = transactionMeta;
@@ -337,14 +344,15 @@ class TransactionController extends base_controller_1.BaseController {
337
344
  if (!this.sign) {
338
345
  releaseLock();
339
346
  this.failTransaction(transactionMeta, new Error('No sign method defined.'));
347
+ this.rejectApproval(transactionMeta);
340
348
  return;
341
349
  }
342
- else if (!currentChainId) {
350
+ else if (!chainId) {
343
351
  releaseLock();
344
352
  this.failTransaction(transactionMeta, new Error('No chainId defined.'));
353
+ this.rejectApproval(transactionMeta);
345
354
  return;
346
355
  }
347
- const chainId = parseInt(currentChainId, undefined);
348
356
  const { approved: status } = TransactionStatus;
349
357
  let nonceToUse = nonce;
350
358
  // if a nonce already exists on the transactionMeta it means this is a speedup or cancel transaction
@@ -380,9 +388,11 @@ class TransactionController extends base_controller_1.BaseController {
380
388
  transactionMeta.status = TransactionStatus.submitted;
381
389
  this.updateTransaction(transactionMeta);
382
390
  this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
391
+ this.acceptApproval(transactionMeta);
383
392
  }
384
393
  catch (error) {
385
394
  this.failTransaction(transactionMeta, error);
395
+ this.rejectApproval(transactionMeta);
386
396
  }
387
397
  finally {
388
398
  // must set transaction to submitted/failed before releasing lock
@@ -408,13 +418,14 @@ class TransactionController extends base_controller_1.BaseController {
408
418
  this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
409
419
  const transactions = this.state.transactions.filter(({ id }) => id !== transactionID);
410
420
  this.update({ transactions: this.trimTransactionsForState(transactions) });
421
+ this.rejectApproval(transactionMeta);
411
422
  }
412
423
  /**
413
424
  * Attempts to cancel a transaction based on its ID by setting its status to "rejected"
414
425
  * and emitting a `<tx.id>:finished` hub event.
415
426
  *
416
427
  * @param transactionID - The ID of the transaction to cancel.
417
- * @param gasValues - The gas values to use for the cancellation transation.
428
+ * @param gasValues - The gas values to use for the cancellation transaction.
418
429
  */
419
430
  stopTransaction(transactionID, gasValues) {
420
431
  var _a, _b;
@@ -474,6 +485,7 @@ class TransactionController extends base_controller_1.BaseController {
474
485
  yield (0, controller_utils_1.query)(this.ethQuery, 'sendRawTransaction', [rawTransaction]);
475
486
  transactionMeta.status = TransactionStatus.cancelled;
476
487
  this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);
488
+ this.rejectApproval(transactionMeta);
477
489
  });
478
490
  }
479
491
  /**
@@ -756,7 +768,7 @@ class TransactionController extends base_controller_1.BaseController {
756
768
  const txsToKeep = transactions.reverse().filter((tx) => {
757
769
  const { chainId, networkID, status, transaction, time } = tx;
758
770
  if (transaction) {
759
- const key = `${transaction.nonce}-${chainId !== null && chainId !== void 0 ? chainId : networkID}-${new Date(time).toDateString()}`;
771
+ const key = `${transaction.nonce}-${chainId ? (0, controller_utils_1.convertHexToDecimal)(chainId) : networkID}-${new Date(time).toDateString()}`;
760
772
  if (nonceNetworkSet.has(key)) {
761
773
  return true;
762
774
  }
@@ -939,6 +951,46 @@ class TransactionController extends base_controller_1.BaseController {
939
951
  isGasDataOutdated(remoteGasUsed, localGasUsed) {
940
952
  return remoteGasUsed !== localGasUsed;
941
953
  }
954
+ requestApproval(txMeta, { shouldShowRequest } = { shouldShowRequest: true }) {
955
+ return __awaiter(this, void 0, void 0, function* () {
956
+ const id = this.getApprovalId(txMeta);
957
+ const { origin } = txMeta;
958
+ const type = controller_utils_1.ApprovalType.Transaction;
959
+ const requestData = { txId: txMeta.id };
960
+ try {
961
+ yield this.messagingSystem.call('ApprovalController:addRequest', {
962
+ id,
963
+ origin: origin || controller_utils_1.ORIGIN_METAMASK,
964
+ type,
965
+ requestData,
966
+ }, shouldShowRequest);
967
+ }
968
+ catch (error) {
969
+ console.info('Failed to request transaction approval', error);
970
+ }
971
+ });
972
+ }
973
+ acceptApproval(txMeta) {
974
+ const id = this.getApprovalId(txMeta);
975
+ try {
976
+ this.messagingSystem.call('ApprovalController:acceptRequest', id);
977
+ }
978
+ catch (error) {
979
+ console.info('Failed to accept transaction approval request', error);
980
+ }
981
+ }
982
+ rejectApproval(txMeta) {
983
+ const id = this.getApprovalId(txMeta);
984
+ try {
985
+ this.messagingSystem.call('ApprovalController:rejectRequest', id, new Error('Rejected'));
986
+ }
987
+ catch (error) {
988
+ console.info('Failed to reject transaction approval request', error);
989
+ }
990
+ }
991
+ getApprovalId(txMeta) {
992
+ return String(txMeta.id);
993
+ }
942
994
  }
943
995
  exports.TransactionController = TransactionController;
944
996
  exports.default = TransactionController;
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionController.js","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAsC;AACtC,qDAAgE;AAChE,mDAA2C;AAC3C,8EAAiD;AACjD,0DAAiC;AACjC,gEAAwC;AACxC,uCAAsE;AACtE,+BAAoC;AACpC,6CAAoC;AACpC,+DAImC;AAMnC,iEASoC;AACpC,kEAAyC;AACzC,mCAYiB;AAEjB,MAAM,QAAQ,GAAG,QAAQ,CAAC;AA6D1B;;;;GAIG;AACH,IAAY,iBASX;AATD,WAAY,iBAAiB;IAC3B,0CAAqB,CAAA;IACrB,4CAAuB,CAAA;IACvB,4CAAuB,CAAA;IACvB,sCAAiB,CAAA;IACjB,0CAAqB,CAAA;IACrB,sCAAiB,CAAA;IACjB,4CAAuB,CAAA;IACvB,8CAAyB,CAAA;AAC3B,CAAC,EATW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAS5B;AAED;;GAEG;AACH,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,mDAAmC,CAAA;IACnC,sCAAsB,CAAA;AACxB,CAAC,EAJW,YAAY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AAO,EAC5B,OAAO,CAAC,WAAW,CAAC,OAAO,CAC5B,CAAC;QACF,OAAO,cAAc,IAAI,eAAe,CAAC;IAC3C,CAAC;IAED;;;;;;;;OAQG;IACK,gBAAgB,CACtB,YAAgC,EAChC,WAA+B,EAC/B,cAAiC,EACjC,aAAgC;QAEhC,OAAO,YAAY,KAAK,WAAW,IAAI,cAAc,KAAK,aAAa,CAAC;IAC1E,CAAC;IAED;;;;;;OAMG;IACK,iBAAiB,CACvB,aAAiC,EACjC,YAAgC;QAEhC,OAAO,aAAa,KAAK,YAAY,CAAC;IACxC,CAAC;CACF;AAtuCD,sDAsuCC;AAED,kBAAe,qBAAqB,CAAC","sourcesContent":["import { EventEmitter } from 'events';\nimport { addHexPrefix, bufferToHex, BN } from 'ethereumjs-util';\nimport { ethErrors } from 'eth-rpc-errors';\nimport MethodRegistry from 'eth-method-registry';\nimport EthQuery from 'eth-query';\nimport Common from '@ethereumjs/common';\nimport { TransactionFactory, TypedTransaction } from '@ethereumjs/tx';\nimport { v1 as random } from 'uuid';\nimport { Mutex } from 'async-mutex';\nimport {\n BaseController,\n BaseConfig,\n BaseState,\n} from '@metamask/base-controller';\nimport type {\n NetworkState,\n ProviderProxy,\n BlockTrackerProxy,\n} from '@metamask/network-controller';\nimport {\n BNToHex,\n fractionBN,\n hexToBN,\n safelyExecute,\n isSmartContractCode,\n query,\n NetworkType,\n RPC,\n} from '@metamask/controller-utils';\nimport NonceTracker from 'nonce-tracker';\nimport {\n getAndFormatTransactionsForNonceTracker,\n normalizeTransaction,\n validateTransaction,\n handleTransactionFetch,\n getIncreasedPriceFromExisting,\n isEIP1559Transaction,\n isGasPriceValue,\n isFeeMarketEIP1559Values,\n validateGasValues,\n validateMinimumIncrease,\n ESTIMATE_GAS_ERROR,\n} from './utils';\n\nconst 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 */\nexport interface Result {\n result: Promise<string>;\n transactionMeta: TransactionMeta;\n}\n\n/**\n * @type Fetch All Options\n * @property fromBlock - String containing a specific block decimal number\n * @property etherscanApiKey - API key to be used to fetch token transactions\n */\nexport interface FetchAllOptions {\n fromBlock?: string;\n etherscanApiKey?: string;\n}\n\n/**\n * @type Transaction\n *\n * Transaction representation\n * @property chainId - Network ID as per EIP-155\n * @property data - Data to pass with this transaction\n * @property from - Address to send this transaction from\n * @property gas - Gas to send with this transaction\n * @property gasPrice - Price of gas with this transaction\n * @property gasUsed - Gas used in the transaction\n * @property nonce - Unique number to prevent replay attacks\n * @property to - Address to send this transaction to\n * @property value - Value associated with this transaction\n */\nexport interface Transaction {\n chainId?: number;\n data?: string;\n from: string;\n gas?: string;\n gasPrice?: string;\n gasUsed?: string;\n nonce?: string;\n to?: string;\n value?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: string;\n estimatedBaseFee?: string;\n estimateGasError?: string;\n}\n\nexport interface GasPriceValue {\n gasPrice: string;\n}\n\nexport interface FeeMarketEIP1559Values {\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n}\n\n/**\n * The status of the transaction. Each status represents the state of the transaction internally\n * in the wallet. Some of these correspond with the state of the transaction on the network, but\n * some are wallet-specific.\n */\nexport enum TransactionStatus {\n approved = 'approved',\n cancelled = 'cancelled',\n confirmed = 'confirmed',\n failed = 'failed',\n rejected = 'rejected',\n signed = 'signed',\n submitted = 'submitted',\n unapproved = 'unapproved',\n}\n\n/**\n * Options for wallet device.\n */\nexport enum WalletDevice {\n MM_MOBILE = 'metamask_mobile',\n MM_EXTENSION = 'metamask_extension',\n OTHER = 'other_device',\n}\n\ntype TransactionMetaBase = {\n isTransfer?: boolean;\n transferInformation?: {\n symbol: string;\n contractAddress: string;\n decimals: number;\n };\n id: string;\n networkID?: string;\n chainId?: string;\n origin?: string;\n rawTransaction?: string;\n time: number;\n toSmartContract?: boolean;\n transaction: Transaction;\n transactionHash?: string;\n blockNumber?: string;\n deviceConfirmedOn?: WalletDevice;\n verifiedOnBlockchain?: boolean;\n};\n\n/**\n * @type TransactionMeta\n *\n * TransactionMeta representation\n * @property error - Synthesized error information for failed transactions\n * @property id - Generated UUID associated with this transaction\n * @property networkID - Network code as per EIP-155 for this transaction\n * @property origin - Origin this transaction was sent from\n * @property deviceConfirmedOn - string to indicate what device the transaction was confirmed\n * @property rawTransaction - Hex representation of the underlying transaction\n * @property status - String status of this transaction\n * @property time - Timestamp associated with this transaction\n * @property toSmartContract - Whether transaction recipient is a smart contract\n * @property transaction - Underlying Transaction object\n * @property transactionHash - Hash of a successful transaction\n * @property blockNumber - Number of the block where the transaction has been included\n */\nexport type TransactionMeta =\n | ({\n status: Exclude<TransactionStatus, TransactionStatus.failed>;\n } & TransactionMetaBase)\n | ({ status: TransactionStatus.failed; error: Error } & TransactionMetaBase);\n\n/**\n * @type EtherscanTransactionMeta\n *\n * EtherscanTransactionMeta representation\n * @property blockNumber - Number of the block where the transaction has been included\n * @property timeStamp - Timestamp associated with this transaction\n * @property hash - Hash of a successful transaction\n * @property nonce - Nonce of the transaction\n * @property blockHash - Hash of the block where the transaction has been included\n * @property transactionIndex - Etherscan internal index for this transaction\n * @property from - Address to send this transaction from\n * @property to - Address to send this transaction to\n * @property gas - Gas to send with this transaction\n * @property gasPrice - Price of gas with this transaction\n * @property isError - Synthesized error information for failed transactions\n * @property txreceipt_status - Receipt status for this transaction\n * @property input - input of the transaction\n * @property contractAddress - Address of the contract\n * @property cumulativeGasUsed - Amount of gas used\n * @property confirmations - Number of confirmations\n */\nexport interface EtherscanTransactionMeta {\n blockNumber: string;\n timeStamp: string;\n hash: string;\n nonce: string;\n blockHash: string;\n transactionIndex: string;\n from: string;\n to: string;\n value: string;\n gas: string;\n gasPrice: string;\n cumulativeGasUsed: string;\n gasUsed: string;\n isError: string;\n txreceipt_status: string;\n input: string;\n contractAddress: string;\n confirmations: string;\n tokenDecimal: string;\n tokenSymbol: string;\n}\n\n/**\n * @type TransactionConfig\n *\n * Transaction controller configuration\n * @property interval - Polling interval used to fetch new currency rate\n * @property provider - Provider used to create a new underlying EthQuery instance\n * @property sign - Method used to sign transactions\n */\nexport interface TransactionConfig extends BaseConfig {\n interval: number;\n sign?: (transaction: Transaction, 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 */\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 */\nexport interface TransactionState extends BaseState {\n transactions: TransactionMeta[];\n methodData: { [key: string]: MethodData };\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 * Controller responsible for submitting and managing transactions.\n */\nexport class TransactionController extends BaseController<\n TransactionConfig,\n TransactionState\n> {\n private ethQuery: any;\n\n private nonceTracker: NonceTracker;\n\n private registry: any;\n\n private provider: ProviderProxy;\n\n private handle?: ReturnType<typeof setTimeout>;\n\n private mutex = new Mutex();\n\n private getNetworkState: () => NetworkState;\n\n private failTransaction(transactionMeta: TransactionMeta, error: Error) {\n const newTransactionMeta = {\n ...transactionMeta,\n error,\n status: TransactionStatus.failed,\n };\n this.updateTransaction(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 * Normalizes the transaction information from etherscan\n * to be compatible with the TransactionMeta interface.\n *\n * @param txMeta - The transaction.\n * @param currentNetworkID - The current network ID.\n * @param currentChainId - The current chain ID.\n * @returns The normalized transaction.\n */\n private normalizeTx(\n txMeta: EtherscanTransactionMeta,\n currentNetworkID: string,\n currentChainId: string,\n ): TransactionMeta {\n const time = parseInt(txMeta.timeStamp, 10) * 1000;\n const normalizedTransactionBase = {\n blockNumber: txMeta.blockNumber,\n id: random({ msecs: time }),\n networkID: currentNetworkID,\n chainId: currentChainId,\n time,\n transaction: {\n data: txMeta.input,\n from: txMeta.from,\n gas: BNToHex(new BN(txMeta.gas)),\n gasPrice: BNToHex(new BN(txMeta.gasPrice)),\n gasUsed: BNToHex(new BN(txMeta.gasUsed)),\n nonce: BNToHex(new BN(txMeta.nonce)),\n to: txMeta.to,\n value: BNToHex(new BN(txMeta.value)),\n },\n transactionHash: txMeta.hash,\n verifiedOnBlockchain: false,\n };\n\n /* istanbul ignore else */\n if (txMeta.isError === '0') {\n return {\n ...normalizedTransactionBase,\n status: TransactionStatus.confirmed,\n };\n }\n\n /* istanbul ignore next */\n return {\n ...normalizedTransactionBase,\n error: new Error('Transaction failed'),\n status: TransactionStatus.failed,\n };\n }\n\n private normalizeTokenTx = (\n txMeta: EtherscanTransactionMeta,\n currentNetworkID: string,\n currentChainId: string,\n ): TransactionMeta => {\n const time = parseInt(txMeta.timeStamp, 10) * 1000;\n const {\n to,\n from,\n gas,\n gasPrice,\n gasUsed,\n hash,\n contractAddress,\n tokenDecimal,\n tokenSymbol,\n value,\n } = txMeta;\n return {\n id: random({ msecs: time }),\n isTransfer: true,\n networkID: currentNetworkID,\n chainId: currentChainId,\n status: TransactionStatus.confirmed,\n time,\n transaction: {\n chainId: 1,\n from,\n gas,\n gasPrice,\n gasUsed,\n to,\n value,\n },\n transactionHash: hash,\n transferInformation: {\n contractAddress,\n decimals: Number(tokenDecimal),\n symbol: tokenSymbol,\n },\n verifiedOnBlockchain: false,\n };\n };\n\n /**\n * EventEmitter instance used to listen to specific transactional events\n */\n hub = new EventEmitter();\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 ) => Promise<TypedTransaction>;\n\n /**\n * Creates a TransactionController instance.\n *\n * @param options - The controller options.\n * @param options.getNetworkState - Gets the state of the network controller.\n * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.\n * @param options.provider - The provider used to create the underlying EthQuery instance.\n * @param options.blockTracker - The block tracker used to poll for new blocks data.\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 getNetworkState,\n onNetworkStateChange,\n provider,\n blockTracker,\n }: {\n getNetworkState: () => NetworkState;\n onNetworkStateChange: (listener: (state: NetworkState) => void) => void;\n provider: ProviderProxy;\n blockTracker: BlockTrackerProxy;\n },\n config?: Partial<TransactionConfig>,\n state?: Partial<TransactionState>,\n ) {\n super(config, state);\n this.defaultConfig = {\n interval: 15000,\n txHistoryLimit: 40,\n };\n\n this.defaultState = {\n methodData: {},\n transactions: [],\n };\n this.initialize();\n this.provider = provider;\n this.getNetworkState = getNetworkState;\n this.ethQuery = new EthQuery(provider);\n this.registry = new MethodRegistry({ provider });\n this.nonceTracker = new NonceTracker({\n provider,\n blockTracker,\n getPendingTransactions: (address) =>\n getAndFormatTransactionsForNonceTracker(\n address,\n TransactionStatus.submitted,\n this.state.transactions,\n ),\n getConfirmedTransactions: (address) =>\n getAndFormatTransactionsForNonceTracker(\n address,\n TransactionStatus.confirmed,\n this.state.transactions,\n ),\n });\n\n onNetworkStateChange(() => {\n this.ethQuery = new EthQuery(this.provider);\n this.registry = new MethodRegistry({ provider: this.provider });\n });\n this.poll();\n }\n\n /**\n * Starts a new polling interval.\n *\n * @param interval - The polling interval used to fetch new transaction statuses.\n */\n async poll(interval?: number): Promise<void> {\n interval && this.configure({ interval }, false, false);\n this.handle && clearTimeout(this.handle);\n await safelyExecute(() => this.queryTransactionStatuses());\n this.handle = setTimeout(() => {\n this.poll(this.config.interval);\n }, this.config.interval);\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 transaction - The transaction object to add.\n * @param origin - The domain origin to append to the generated TransactionMeta.\n * @param deviceConfirmedOn - An enum to indicate what device the transaction was confirmed to append to the generated TransactionMeta.\n * @returns Object containing a promise resolving to the transaction hash if approved.\n */\n async addTransaction(\n transaction: Transaction,\n origin?: string,\n deviceConfirmedOn?: WalletDevice,\n ): Promise<Result> {\n const { providerConfig, networkId } = this.getNetworkState();\n const { transactions } = this.state;\n transaction = normalizeTransaction(transaction);\n validateTransaction(transaction);\n\n const transactionMeta: TransactionMeta = {\n id: random(),\n networkID: networkId ?? undefined,\n chainId: providerConfig.chainId,\n origin,\n status: TransactionStatus.unapproved as TransactionStatus.unapproved,\n time: Date.now(),\n transaction,\n deviceConfirmedOn,\n verifiedOnBlockchain: false,\n };\n\n try {\n const { gas, estimateGasError } = await this.estimateGas(transaction);\n transaction.gas = gas;\n transaction.estimateGasError = estimateGasError;\n } catch (error: any) {\n this.failTransaction(transactionMeta, error);\n return Promise.reject(error);\n }\n\n const result: Promise<string> = new Promise((resolve, reject) => {\n this.hub.once(\n `${transactionMeta.id}:finished`,\n (meta: TransactionMeta) => {\n switch (meta.status) {\n case TransactionStatus.submitted:\n return resolve(meta.transactionHash as string);\n case TransactionStatus.rejected:\n return reject(\n ethErrors.provider.userRejectedRequest(\n 'User rejected the transaction',\n ),\n );\n case TransactionStatus.cancelled:\n return reject(\n ethErrors.rpc.internal('User cancelled the transaction'),\n );\n case TransactionStatus.failed:\n return reject(ethErrors.rpc.internal(meta.error.message));\n /* istanbul ignore next */\n default:\n return reject(\n ethErrors.rpc.internal(\n `MetaMask Tx Signature: Unknown problem: ${JSON.stringify(\n meta,\n )}`,\n ),\n );\n }\n },\n );\n });\n\n transactions.push(transactionMeta);\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n this.hub.emit(`unapprovedTransaction`, transactionMeta);\n return { result, transactionMeta };\n }\n\n prepareUnsignedEthTx(txParams: Record<string, unknown>): 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} common configuration object\n */\n\n getCommonConfiguration(): Common {\n const {\n networkId,\n providerConfig: { type: chain, chainId, nickname: name },\n } = this.getNetworkState();\n\n if (chain !== RPC) {\n return new Common({ chain, hardfork: HARDFORK });\n }\n\n const customChainParams = {\n name,\n chainId: parseInt(chainId, undefined),\n networkId: networkId === null ? NaN : parseInt(networkId, undefined),\n };\n\n return Common.forCustomChain(\n NetworkType.mainnet,\n customChainParams,\n HARDFORK,\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 async approveTransaction(transactionID: string) {\n const { transactions } = this.state;\n const releaseLock = await this.mutex.acquire();\n const { providerConfig } = this.getNetworkState();\n const { chainId: currentChainId } = providerConfig;\n const index = transactions.findIndex(({ id }) => transactionID === id);\n const transactionMeta = transactions[index];\n const {\n transaction: { nonce, from },\n } = transactionMeta;\n let nonceLock;\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 (!currentChainId) {\n releaseLock();\n this.failTransaction(transactionMeta, new Error('No chainId defined.'));\n return;\n }\n\n const chainId = parseInt(currentChainId, undefined);\n const { approved: status } = TransactionStatus;\n let nonceToUse = nonce;\n // if a nonce already exists on the transactionMeta it means this is a speedup or cancel transaction\n // so we want to reuse that nonce and hope that it beats the previous attempt to chain. Otherwise use a new locked nonce\n if (!nonceToUse) {\n nonceLock = await this.nonceTracker.getNonceLock(from);\n nonceToUse = addHexPrefix(nonceLock.nextNonce.toString(16));\n }\n\n transactionMeta.status = status;\n transactionMeta.transaction.nonce = nonceToUse;\n transactionMeta.transaction.chainId = chainId;\n\n const baseTxParams = {\n ...transactionMeta.transaction,\n gasLimit: transactionMeta.transaction.gas,\n };\n\n const isEIP1559 = isEIP1559Transaction(transactionMeta.transaction);\n\n const txParams = isEIP1559\n ? {\n ...baseTxParams,\n maxFeePerGas: transactionMeta.transaction.maxFeePerGas,\n maxPriorityFeePerGas:\n transactionMeta.transaction.maxPriorityFeePerGas,\n estimatedBaseFee: transactionMeta.transaction.estimatedBaseFee,\n // specify type 2 if maxFeePerGas and maxPriorityFeePerGas are set\n type: 2,\n }\n : baseTxParams;\n\n // delete gasPrice if maxFeePerGas and maxPriorityFeePerGas are set\n if (isEIP1559) {\n delete txParams.gasPrice;\n }\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n const signedTx = await this.sign(unsignedEthTx, from);\n transactionMeta.status = TransactionStatus.signed;\n this.updateTransaction(transactionMeta);\n const rawTransaction = bufferToHex(signedTx.serialize());\n\n transactionMeta.rawTransaction = rawTransaction;\n this.updateTransaction(transactionMeta);\n const transactionHash = await query(this.ethQuery, 'sendRawTransaction', [\n rawTransaction,\n ]);\n transactionMeta.transactionHash = transactionHash;\n transactionMeta.status = TransactionStatus.submitted;\n this.updateTransaction(transactionMeta);\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n } catch (error: any) {\n this.failTransaction(transactionMeta, error);\n } finally {\n // must set transaction to submitted/failed before releasing lock\n if (nonceLock) {\n nonceLock.releaseLock();\n }\n releaseLock();\n }\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 */\n cancelTransaction(transactionID: 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 this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n const transactions = this.state.transactions.filter(\n ({ id }) => id !== transactionID,\n );\n this.update({ transactions: this.trimTransactionsForState(transactions) });\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 transation.\n */\n async stopTransaction(\n transactionID: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n ) {\n if (gasValues) {\n validateGasValues(gasValues);\n }\n const transactionMeta = this.state.transactions.find(\n ({ id }) => id === transactionID,\n );\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.transaction.gasPrice,\n CANCEL_RATE,\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.transaction?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n CANCEL_RATE,\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.transaction?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n CANCEL_RATE,\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 =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n from: transactionMeta.transaction.from,\n gasLimit: transactionMeta.transaction.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: 2,\n nonce: transactionMeta.transaction.nonce,\n to: transactionMeta.transaction.from,\n value: '0x0',\n }\n : {\n from: transactionMeta.transaction.from,\n gasLimit: transactionMeta.transaction.gas,\n gasPrice: newGasPrice,\n nonce: transactionMeta.transaction.nonce,\n to: transactionMeta.transaction.from,\n value: '0x0',\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.transaction.from,\n );\n const rawTransaction = bufferToHex(signedTx.serialize());\n await query(this.ethQuery, 'sendRawTransaction', [rawTransaction]);\n transactionMeta.status = TransactionStatus.cancelled;\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\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 transation.\n */\n async speedUpTransaction(\n transactionID: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n ) {\n if (gasValues) {\n validateGasValues(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 const { transactions } = this.state;\n\n // gasPrice (legacy non EIP1559)\n const minGasPrice = getIncreasedPriceFromExisting(\n transactionMeta.transaction.gasPrice,\n SPEED_UP_RATE,\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.transaction?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n SPEED_UP_RATE,\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.transaction?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n SPEED_UP_RATE,\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 =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...transactionMeta.transaction,\n gasLimit: transactionMeta.transaction.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: 2,\n }\n : {\n ...transactionMeta.transaction,\n gasLimit: transactionMeta.transaction.gas,\n gasPrice: newGasPrice,\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.transaction.from,\n );\n const rawTransaction = bufferToHex(signedTx.serialize());\n const transactionHash = await query(this.ethQuery, 'sendRawTransaction', [\n rawTransaction,\n ]);\n const baseTransactionMeta = {\n ...transactionMeta,\n id: random(),\n time: Date.now(),\n transactionHash,\n };\n const newTransactionMeta =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...baseTransactionMeta,\n transaction: {\n ...transactionMeta.transaction,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n },\n }\n : {\n ...baseTransactionMeta,\n transaction: {\n ...transactionMeta.transaction,\n gasPrice: newGasPrice,\n },\n };\n transactions.push(newTransactionMeta);\n this.update({ transactions: this.trimTransactionsForState(transactions) });\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: Transaction) {\n const estimatedTransaction = { ...transaction };\n const {\n gas,\n gasPrice: providedGasPrice,\n to,\n value,\n data,\n } = estimatedTransaction;\n const gasPrice =\n typeof providedGasPrice === 'undefined'\n ? await query(this.ethQuery, 'gasPrice')\n : providedGasPrice;\n const { providerConfig } = this.getNetworkState();\n const isCustomNetwork = providerConfig.type === NetworkType.rpc;\n // 1. If gas is already defined on the transaction, use it\n if (typeof gas !== 'undefined') {\n return { gas, gasPrice };\n }\n const { gasLimit } = await query(this.ethQuery, 'getBlockByNumber', [\n 'latest',\n false,\n ]);\n\n // 2. If to is not defined or this is not a contract address, and there is no data use 0x5208 / 21000.\n // If the newtwork is a custom network then bypass this check and fetch 'estimateGas'.\n /* istanbul ignore next */\n const code = to ? await query(this.ethQuery, 'getCode', [to]) : undefined;\n /* istanbul ignore next */\n if (\n !isCustomNetwork &&\n (!to || (to && !data && (!code || code === '0x')))\n ) {\n return { gas: '0x5208', gasPrice };\n }\n\n // if data, should be hex string format\n estimatedTransaction.data = !data\n ? data\n : /* istanbul ignore next */ addHexPrefix(data);\n\n // 3. If this is a contract address, safely estimate gas using RPC\n estimatedTransaction.value =\n typeof value === 'undefined' ? '0x0' : /* istanbul ignore next */ value;\n const gasLimitBN = hexToBN(gasLimit);\n estimatedTransaction.gas = BNToHex(fractionBN(gasLimitBN, 19, 20));\n\n let gasHex;\n let estimateGasError;\n try {\n gasHex = await query(this.ethQuery, 'estimateGas', [\n estimatedTransaction,\n ]);\n } catch (error) {\n estimateGasError = ESTIMATE_GAS_ERROR;\n }\n // 4. Pad estimated gas without exceeding the most recent block gasLimit. If the network is a\n // a custom network then return the eth_estimateGas value.\n const gasBN = hexToBN(gasHex);\n const maxGasBN = gasLimitBN.muln(0.9);\n const paddedGasBN = gasBN.muln(1.5);\n /* istanbul ignore next */\n if (gasBN.gt(maxGasBN) || isCustomNetwork) {\n return { gas: addHexPrefix(gasHex), gasPrice, estimateGasError };\n }\n\n /* istanbul ignore next */\n if (paddedGasBN.lt(maxGasBN)) {\n return {\n gas: addHexPrefix(BNToHex(paddedGasBN)),\n gasPrice,\n estimateGasError,\n };\n }\n return { gas: addHexPrefix(BNToHex(maxGasBN)), gasPrice };\n }\n\n /**\n * Check the status of submitted transactions on the network to determine whether they have\n * been included in a block. Any that have been included in a block are marked as confirmed.\n */\n async queryTransactionStatuses() {\n const { transactions } = this.state;\n const { providerConfig, networkId: currentNetworkID } =\n this.getNetworkState();\n const { chainId: currentChainId } = providerConfig;\n let gotUpdates = false;\n await safelyExecute(() =>\n Promise.all(\n transactions.map(async (meta, index) => {\n // Using fallback to networkID only when there is no chainId present.\n // Should be removed when networkID is completely removed.\n const txBelongsToCurrentChain =\n meta.chainId === currentChainId ||\n (!meta.chainId && meta.networkID === currentNetworkID);\n\n if (!meta.verifiedOnBlockchain && txBelongsToCurrentChain) {\n const [reconciledTx, updateRequired] =\n await this.blockchainTransactionStateReconciler(meta);\n if (updateRequired) {\n transactions[index] = reconciledTx;\n gotUpdates = updateRequired;\n }\n }\n }),\n ),\n );\n\n /* istanbul ignore else */\n if (gotUpdates) {\n this.update({\n transactions: this.trimTransactionsForState(transactions),\n });\n }\n }\n\n /**\n * Updates an existing transaction in state.\n *\n * @param transactionMeta - The new transaction to store in state.\n */\n updateTransaction(transactionMeta: TransactionMeta) {\n const { transactions } = this.state;\n transactionMeta.transaction = normalizeTransaction(\n transactionMeta.transaction,\n );\n validateTransaction(transactionMeta.transaction);\n const index = transactions.findIndex(({ id }) => transactionMeta.id === id);\n transactions[index] = transactionMeta;\n this.update({ transactions: this.trimTransactionsForState(transactions) });\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 */\n wipeTransactions(ignoreNetwork?: boolean) {\n /* istanbul ignore next */\n if (ignoreNetwork) {\n this.update({ transactions: [] });\n return;\n }\n const { providerConfig, networkId: currentNetworkID } =\n this.getNetworkState();\n const { chainId: currentChainId } = providerConfig;\n const newTransactions = this.state.transactions.filter(\n ({ networkID, chainId }) => {\n // Using fallback to networkID only when there is no chainId present. Should be removed when networkID is completely removed.\n const isCurrentNetwork =\n chainId === currentChainId ||\n (!chainId && networkID === currentNetworkID);\n return !isCurrentNetwork;\n },\n );\n\n this.update({\n transactions: this.trimTransactionsForState(newTransactions),\n });\n }\n\n /**\n * Get transactions from Etherscan for the given address. By default all transactions are\n * returned, but the `fromBlock` option can be given to filter just for transactions from a\n * specific block onward.\n *\n * @param address - The address to fetch the transactions for.\n * @param opt - Object containing optional data, fromBlock and Etherscan API key.\n * @returns The block number of the latest incoming transaction.\n */\n async fetchAll(\n address: string,\n opt?: FetchAllOptions,\n ): Promise<string | void> {\n const { providerConfig, networkId: currentNetworkID } =\n this.getNetworkState();\n const { chainId: currentChainId, type: networkType } = providerConfig;\n const { transactions } = this.state;\n\n const supportedNetworkIds = ['1', '5', '11155111'];\n /* istanbul ignore next */\n if (\n currentNetworkID === null ||\n supportedNetworkIds.indexOf(currentNetworkID) === -1\n ) {\n return undefined;\n }\n\n const [etherscanTxResponse, etherscanTokenResponse] =\n await handleTransactionFetch(\n networkType,\n address,\n this.config.txHistoryLimit,\n opt,\n );\n\n const normalizedTxs = etherscanTxResponse.result.map(\n (tx: EtherscanTransactionMeta) =>\n this.normalizeTx(tx, currentNetworkID, currentChainId),\n );\n const normalizedTokenTxs = etherscanTokenResponse.result.map(\n (tx: EtherscanTransactionMeta) =>\n this.normalizeTokenTx(tx, currentNetworkID, currentChainId),\n );\n\n const [updateRequired, allTxs] = this.etherscanTransactionStateReconciler(\n [...normalizedTxs, ...normalizedTokenTxs],\n transactions,\n );\n\n allTxs.sort((a, b) => (a.time < b.time ? -1 : 1));\n\n let latestIncomingTxBlockNumber: string | undefined;\n allTxs.forEach(async (tx) => {\n /* istanbul ignore next */\n if (\n // Using fallback to networkID only when there is no chainId present. Should be removed when networkID is completely removed.\n (tx.chainId === currentChainId ||\n (!tx.chainId && tx.networkID === currentNetworkID)) &&\n tx.transaction.to &&\n tx.transaction.to.toLowerCase() === address.toLowerCase()\n ) {\n if (\n tx.blockNumber &&\n (!latestIncomingTxBlockNumber ||\n parseInt(latestIncomingTxBlockNumber, 10) <\n parseInt(tx.blockNumber, 10))\n ) {\n latestIncomingTxBlockNumber = tx.blockNumber;\n }\n }\n\n /* istanbul ignore else */\n if (tx.toSmartContract === undefined) {\n // If not `to` is a contract deploy, if not `data` is send eth\n if (\n tx.transaction.to &&\n (!tx.transaction.data || tx.transaction.data !== '0x')\n ) {\n const code = await query(this.ethQuery, 'getCode', [\n tx.transaction.to,\n ]);\n tx.toSmartContract = isSmartContractCode(code);\n } else {\n tx.toSmartContract = false;\n }\n }\n });\n\n // Update state only if new transactions were fetched or\n // the status or gas data of a transaction has changed\n if (updateRequired) {\n this.update({ transactions: this.trimTransactionsForState(allTxs) });\n }\n return latestIncomingTxBlockNumber;\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 BaseController 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 const txsToKeep = transactions.reverse().filter((tx) => {\n const { chainId, networkID, status, transaction, time } = tx;\n if (transaction) {\n const key = `${transaction.nonce}-${chainId ?? networkID}-${new Date(\n time,\n ).toDateString()}`;\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 return false;\n });\n txsToKeep.reverse();\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 status === TransactionStatus.cancelled\n );\n }\n\n /**\n * Method to verify the state of a transaction using the Blockchain as a source of truth.\n *\n * @param meta - The local transaction to verify on the blockchain.\n * @returns A tuple containing the updated transaction, and whether or not an update was required.\n */\n private async blockchainTransactionStateReconciler(\n meta: TransactionMeta,\n ): Promise<[TransactionMeta, boolean]> {\n const { status, transactionHash } = meta;\n switch (status) {\n case TransactionStatus.confirmed:\n const txReceipt = await query(this.ethQuery, 'getTransactionReceipt', [\n transactionHash,\n ]);\n\n if (!txReceipt) {\n return [meta, false];\n }\n\n meta.verifiedOnBlockchain = true;\n meta.transaction.gasUsed = txReceipt.gasUsed;\n\n // According to the Web3 docs:\n // TRUE if the transaction was successful, FALSE if the EVM reverted the transaction.\n if (Number(txReceipt.status) === 0) {\n const error: Error = new Error(\n 'Transaction failed. The transaction was reversed',\n );\n this.failTransaction(meta, error);\n return [meta, false];\n }\n\n return [meta, true];\n case TransactionStatus.submitted:\n const txObj = await query(this.ethQuery, 'getTransactionByHash', [\n transactionHash,\n ]);\n\n if (!txObj) {\n const receiptShowsFailedStatus =\n await this.checkTxReceiptStatusIsFailed(transactionHash);\n\n // Case the txObj is evaluated as false, a second check will\n // determine if the tx failed or it is pending or confirmed\n if (receiptShowsFailedStatus) {\n const error: Error = new Error(\n 'Transaction failed. The transaction was dropped or replaced by a new one',\n );\n this.failTransaction(meta, error);\n }\n }\n\n /* istanbul ignore next */\n if (txObj?.blockNumber) {\n meta.status = TransactionStatus.confirmed;\n this.hub.emit(`${meta.id}:confirmed`, meta);\n return [meta, true];\n }\n\n return [meta, false];\n default:\n return [meta, false];\n }\n }\n\n /**\n * Method to check if a tx has failed according to their receipt\n * According to the Web3 docs:\n * TRUE if the transaction was successful, FALSE if the EVM reverted the transaction.\n * The receipt is not available for pending transactions and returns null.\n *\n * @param txHash - The transaction hash.\n * @returns Whether the transaction has failed.\n */\n private async checkTxReceiptStatusIsFailed(\n txHash: string | undefined,\n ): Promise<boolean> {\n const txReceipt = await query(this.ethQuery, 'getTransactionReceipt', [\n txHash,\n ]);\n if (!txReceipt) {\n // Transaction is pending\n return false;\n }\n return Number(txReceipt.status) === 0;\n }\n\n /**\n * Method to verify the state of transactions using Etherscan as a source of truth.\n *\n * @param remoteTxs - Transactions to reconcile that are from a remote source.\n * @param localTxs - Transactions to reconcile that are local.\n * @returns A tuple containing a boolean indicating whether or not an update was required, and the updated transaction.\n */\n private etherscanTransactionStateReconciler(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): [boolean, TransactionMeta[]] {\n const updatedTxs: TransactionMeta[] = this.getUpdatedTransactions(\n remoteTxs,\n localTxs,\n );\n\n const newTxs: TransactionMeta[] = this.getNewTransactions(\n remoteTxs,\n localTxs,\n );\n\n const updatedLocalTxs = localTxs.map((tx: TransactionMeta) => {\n const txIdx = updatedTxs.findIndex(\n ({ transactionHash }) => transactionHash === tx.transactionHash,\n );\n return txIdx === -1 ? tx : updatedTxs[txIdx];\n });\n\n const updateRequired = newTxs.length > 0 || updatedLocalTxs.length > 0;\n\n return [updateRequired, [...newTxs, ...updatedLocalTxs]];\n }\n\n /**\n * Get all transactions that are in the remote transactions array\n * but not in the local transactions array.\n *\n * @param remoteTxs - Array of transactions from remote source.\n * @param localTxs - Array of transactions stored locally.\n * @returns The new transactions.\n */\n private getNewTransactions(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): TransactionMeta[] {\n return remoteTxs.filter((tx) => {\n const alreadyInTransactions = localTxs.find(\n ({ transactionHash }) => transactionHash === tx.transactionHash,\n );\n return !alreadyInTransactions;\n });\n }\n\n /**\n * Get all the transactions that are locally outdated with respect\n * to a remote source (etherscan or blockchain). The returned array\n * contains the transactions with the updated data.\n *\n * @param remoteTxs - Array of transactions from remote source.\n * @param localTxs - Array of transactions stored locally.\n * @returns The updated transactions.\n */\n private getUpdatedTransactions(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): TransactionMeta[] {\n return remoteTxs.filter((remoteTx) => {\n const isTxOutdated = localTxs.find((localTx) => {\n return (\n remoteTx.transactionHash === localTx.transactionHash &&\n this.isTransactionOutdated(remoteTx, localTx)\n );\n });\n return isTxOutdated;\n });\n }\n\n /**\n * Verifies if a local transaction is outdated with respect to the remote transaction.\n *\n * @param remoteTx - The remote transaction from Etherscan.\n * @param localTx - The local transaction.\n * @returns Whether the transaction is outdated.\n */\n private isTransactionOutdated(\n remoteTx: TransactionMeta,\n localTx: TransactionMeta,\n ): boolean {\n const statusOutdated = this.isStatusOutdated(\n remoteTx.transactionHash,\n localTx.transactionHash,\n remoteTx.status,\n localTx.status,\n );\n const gasDataOutdated = this.isGasDataOutdated(\n remoteTx.transaction.gasUsed,\n localTx.transaction.gasUsed,\n );\n return statusOutdated || gasDataOutdated;\n }\n\n /**\n * Verifies if the status of a local transaction is outdated with respect to the remote transaction.\n *\n * @param remoteTxHash - Remote transaction hash.\n * @param localTxHash - Local transaction hash.\n * @param remoteTxStatus - Remote transaction status.\n * @param localTxStatus - Local transaction status.\n * @returns Whether the status is outdated.\n */\n private isStatusOutdated(\n remoteTxHash: string | undefined,\n localTxHash: string | undefined,\n remoteTxStatus: TransactionStatus,\n localTxStatus: TransactionStatus,\n ): boolean {\n return remoteTxHash === localTxHash && remoteTxStatus !== localTxStatus;\n }\n\n /**\n * Verifies if the gas data of a local transaction is outdated with respect to the remote transaction.\n *\n * @param remoteGasUsed - Remote gas used in the transaction.\n * @param localGasUsed - Local gas used in the transaction.\n * @returns Whether the gas data is outdated.\n */\n private isGasDataOutdated(\n remoteGasUsed: string | undefined,\n localGasUsed: string | undefined,\n ): boolean {\n return remoteGasUsed !== localGasUsed;\n }\n}\n\nexport default TransactionController;\n"]}
1
+ {"version":3,"file":"TransactionController.js","sourceRoot":"","sources":["../src/TransactionController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mCAAsC;AACtC,qDAAgE;AAChE,mDAA2C;AAC3C,8EAAiD;AACjD,0DAAiC;AACjC,gEAAwC;AACxC,uCAAsE;AACtE,+BAAoC;AACpC,6CAAoC;AAEpC,+DAKmC;AAMnC,iEAYoC;AAMpC,kEAAyC;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AC,CAAC;SACtE;IACH,CAAC;IAEO,aAAa,CAAC,MAAuB;QAC3C,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;CACF;AAvyCD,sDAuyCC;AAED,kBAAe,qBAAqB,CAAC","sourcesContent":["import { EventEmitter } from 'events';\nimport { addHexPrefix, bufferToHex, BN } from 'ethereumjs-util';\nimport { ethErrors } from 'eth-rpc-errors';\nimport MethodRegistry from 'eth-method-registry';\nimport EthQuery from 'eth-query';\nimport Common from '@ethereumjs/common';\nimport { TransactionFactory, TypedTransaction } from '@ethereumjs/tx';\nimport { v1 as random } from 'uuid';\nimport { Mutex } from 'async-mutex';\nimport type { Hex } from '@metamask/utils';\nimport {\n BaseController,\n BaseConfig,\n BaseState,\n RestrictedControllerMessenger,\n} from '@metamask/base-controller';\nimport type {\n BlockTracker,\n NetworkState,\n Provider,\n} from '@metamask/network-controller';\nimport {\n BNToHex,\n fractionBN,\n hexToBN,\n safelyExecute,\n isSmartContractCode,\n query,\n NetworkType,\n RPC,\n ApprovalType,\n ORIGIN_METAMASK,\n convertHexToDecimal,\n} from '@metamask/controller-utils';\nimport {\n AcceptRequest as AcceptApprovalRequest,\n AddApprovalRequest,\n RejectRequest as RejectApprovalRequest,\n} from '@metamask/approval-controller';\nimport NonceTracker from 'nonce-tracker';\nimport {\n getAndFormatTransactionsForNonceTracker,\n normalizeTransaction,\n validateTransaction,\n handleTransactionFetch,\n getIncreasedPriceFromExisting,\n isEIP1559Transaction,\n isGasPriceValue,\n isFeeMarketEIP1559Values,\n validateGasValues,\n validateMinimumIncrease,\n ESTIMATE_GAS_ERROR,\n} from './utils';\n\nconst 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 */\nexport interface Result {\n result: Promise<string>;\n transactionMeta: TransactionMeta;\n}\n\n/**\n * @type Fetch All Options\n * @property fromBlock - String containing a specific block decimal number\n * @property etherscanApiKey - API key to be used to fetch token transactions\n */\nexport interface FetchAllOptions {\n fromBlock?: string;\n etherscanApiKey?: string;\n}\n\n/**\n * @type Transaction\n *\n * Transaction representation\n * @property chainId - Network ID as per EIP-155\n * @property data - Data to pass with this transaction\n * @property from - Address to send this transaction from\n * @property gas - Gas to send with this transaction\n * @property gasPrice - Price of gas with this transaction\n * @property gasUsed - Gas used in the transaction\n * @property nonce - Unique number to prevent replay attacks\n * @property to - Address to send this transaction to\n * @property value - Value associated with this transaction\n */\nexport interface Transaction {\n chainId?: Hex;\n data?: string;\n from: string;\n gas?: string;\n gasPrice?: string;\n gasUsed?: string;\n nonce?: string;\n to?: string;\n value?: string;\n maxFeePerGas?: string;\n maxPriorityFeePerGas?: string;\n estimatedBaseFee?: string;\n estimateGasError?: string;\n}\n\nexport interface GasPriceValue {\n gasPrice: string;\n}\n\nexport interface FeeMarketEIP1559Values {\n maxFeePerGas: string;\n maxPriorityFeePerGas: string;\n}\n\n/**\n * The status of the transaction. Each status represents the state of the transaction internally\n * in the wallet. Some of these correspond with the state of the transaction on the network, but\n * some are wallet-specific.\n */\nexport enum TransactionStatus {\n approved = 'approved',\n cancelled = 'cancelled',\n confirmed = 'confirmed',\n failed = 'failed',\n rejected = 'rejected',\n signed = 'signed',\n submitted = 'submitted',\n unapproved = 'unapproved',\n}\n\n/**\n * Options for wallet device.\n */\nexport enum WalletDevice {\n MM_MOBILE = 'metamask_mobile',\n MM_EXTENSION = 'metamask_extension',\n OTHER = 'other_device',\n}\n\ntype TransactionMetaBase = {\n isTransfer?: boolean;\n transferInformation?: {\n symbol: string;\n contractAddress: string;\n decimals: number;\n };\n id: string;\n networkID?: string;\n chainId?: Hex;\n origin?: string;\n rawTransaction?: string;\n time: number;\n toSmartContract?: boolean;\n transaction: Transaction;\n transactionHash?: string;\n blockNumber?: string;\n deviceConfirmedOn?: WalletDevice;\n verifiedOnBlockchain?: boolean;\n};\n\n/**\n * @type TransactionMeta\n *\n * TransactionMeta representation\n * @property error - Synthesized error information for failed transactions\n * @property id - Generated UUID associated with this transaction\n * @property networkID - Network code as per EIP-155 for this transaction\n * @property origin - Origin this transaction was sent from\n * @property deviceConfirmedOn - string to indicate what device the transaction was confirmed\n * @property rawTransaction - Hex representation of the underlying transaction\n * @property status - String status of this transaction\n * @property time - Timestamp associated with this transaction\n * @property toSmartContract - Whether transaction recipient is a smart contract\n * @property transaction - Underlying Transaction object\n * @property transactionHash - Hash of a successful transaction\n * @property blockNumber - Number of the block where the transaction has been included\n */\nexport type TransactionMeta =\n | ({\n status: Exclude<TransactionStatus, TransactionStatus.failed>;\n } & TransactionMetaBase)\n | ({ status: TransactionStatus.failed; error: Error } & TransactionMetaBase);\n\n/**\n * @type EtherscanTransactionMeta\n *\n * EtherscanTransactionMeta representation\n * @property blockNumber - Number of the block where the transaction has been included\n * @property timeStamp - Timestamp associated with this transaction\n * @property hash - Hash of a successful transaction\n * @property nonce - Nonce of the transaction\n * @property blockHash - Hash of the block where the transaction has been included\n * @property transactionIndex - Etherscan internal index for this transaction\n * @property from - Address to send this transaction from\n * @property to - Address to send this transaction to\n * @property gas - Gas to send with this transaction\n * @property gasPrice - Price of gas with this transaction\n * @property isError - Synthesized error information for failed transactions\n * @property txreceipt_status - Receipt status for this transaction\n * @property input - input of the transaction\n * @property contractAddress - Address of the contract\n * @property cumulativeGasUsed - Amount of gas used\n * @property confirmations - Number of confirmations\n */\nexport interface EtherscanTransactionMeta {\n blockNumber: string;\n timeStamp: string;\n hash: string;\n nonce: string;\n blockHash: string;\n transactionIndex: string;\n from: string;\n to: string;\n value: string;\n gas: string;\n gasPrice: string;\n cumulativeGasUsed: string;\n gasUsed: string;\n isError: string;\n txreceipt_status: string;\n input: string;\n contractAddress: string;\n confirmations: string;\n tokenDecimal: string;\n tokenSymbol: string;\n}\n\n/**\n * @type TransactionConfig\n *\n * Transaction controller configuration\n * @property interval - Polling interval used to fetch new currency rate\n * @property provider - Provider used to create a new underlying EthQuery instance\n * @property sign - Method used to sign transactions\n */\nexport interface TransactionConfig extends BaseConfig {\n interval: number;\n sign?: (transaction: Transaction, 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 */\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 */\nexport interface TransactionState extends BaseState {\n transactions: TransactionMeta[];\n methodData: { [key: string]: MethodData };\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 =\n | AddApprovalRequest\n | AcceptApprovalRequest\n | RejectApprovalRequest;\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/**\n * Controller responsible for submitting and managing transactions.\n */\nexport class TransactionController extends BaseController<\n TransactionConfig,\n TransactionState\n> {\n private ethQuery: EthQuery;\n\n private nonceTracker: NonceTracker;\n\n private registry: any;\n\n private provider: Provider;\n\n private handle?: ReturnType<typeof setTimeout>;\n\n private mutex = new Mutex();\n\n private getNetworkState: () => NetworkState;\n\n private messagingSystem: TransactionControllerMessenger;\n\n private failTransaction(transactionMeta: TransactionMeta, error: Error) {\n const newTransactionMeta = {\n ...transactionMeta,\n error,\n status: TransactionStatus.failed,\n };\n this.updateTransaction(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 * Normalizes the transaction information from etherscan\n * to be compatible with the TransactionMeta interface.\n *\n * @param txMeta - The transaction.\n * @param currentNetworkID - The current network ID.\n * @param currentChainId - The current chain ID.\n * @returns The normalized transaction.\n */\n private normalizeTx(\n txMeta: EtherscanTransactionMeta,\n currentNetworkID: string,\n currentChainId: Hex,\n ): TransactionMeta {\n const time = parseInt(txMeta.timeStamp, 10) * 1000;\n const normalizedTransactionBase = {\n blockNumber: txMeta.blockNumber,\n id: random({ msecs: time }),\n networkID: currentNetworkID,\n chainId: currentChainId,\n time,\n transaction: {\n data: txMeta.input,\n from: txMeta.from,\n gas: BNToHex(new BN(txMeta.gas)),\n gasPrice: BNToHex(new BN(txMeta.gasPrice)),\n gasUsed: BNToHex(new BN(txMeta.gasUsed)),\n nonce: BNToHex(new BN(txMeta.nonce)),\n to: txMeta.to,\n value: BNToHex(new BN(txMeta.value)),\n },\n transactionHash: txMeta.hash,\n verifiedOnBlockchain: false,\n };\n\n /* istanbul ignore else */\n if (txMeta.isError === '0') {\n return {\n ...normalizedTransactionBase,\n status: TransactionStatus.confirmed,\n };\n }\n\n /* istanbul ignore next */\n return {\n ...normalizedTransactionBase,\n error: new Error('Transaction failed'),\n status: TransactionStatus.failed,\n };\n }\n\n private normalizeTokenTx = (\n txMeta: EtherscanTransactionMeta,\n currentNetworkID: string,\n currentChainId: Hex,\n ): TransactionMeta => {\n const time = parseInt(txMeta.timeStamp, 10) * 1000;\n const {\n to,\n from,\n gas,\n gasPrice,\n gasUsed,\n hash,\n contractAddress,\n tokenDecimal,\n tokenSymbol,\n value,\n } = txMeta;\n return {\n id: random({ msecs: time }),\n isTransfer: true,\n networkID: currentNetworkID,\n chainId: currentChainId,\n status: TransactionStatus.confirmed,\n time,\n transaction: {\n chainId: currentChainId,\n from,\n gas,\n gasPrice,\n gasUsed,\n to,\n value,\n },\n transactionHash: hash,\n transferInformation: {\n contractAddress,\n decimals: Number(tokenDecimal),\n symbol: tokenSymbol,\n },\n verifiedOnBlockchain: false,\n };\n };\n\n /**\n * EventEmitter instance used to listen to specific transactional events\n */\n hub = new EventEmitter();\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 ) => Promise<TypedTransaction>;\n\n /**\n * Creates a TransactionController instance.\n *\n * @param options - The controller options.\n * @param options.getNetworkState - Gets the state of the network controller.\n * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.\n * @param options.provider - The provider used to create the underlying EthQuery instance.\n * @param options.blockTracker - The block tracker used to poll for new blocks data.\n * @param options.messenger - The controller messenger.\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 getNetworkState,\n onNetworkStateChange,\n provider,\n blockTracker,\n messenger,\n }: {\n getNetworkState: () => NetworkState;\n onNetworkStateChange: (listener: (state: NetworkState) => void) => void;\n provider: Provider;\n blockTracker: BlockTracker;\n messenger: TransactionControllerMessenger;\n },\n config?: Partial<TransactionConfig>,\n state?: Partial<TransactionState>,\n ) {\n super(config, state);\n this.defaultConfig = {\n interval: 15000,\n txHistoryLimit: 40,\n };\n\n this.defaultState = {\n methodData: {},\n transactions: [],\n };\n this.initialize();\n this.provider = provider;\n this.messagingSystem = messenger;\n this.getNetworkState = getNetworkState;\n this.ethQuery = new EthQuery(provider);\n this.registry = new MethodRegistry({ provider });\n this.nonceTracker = new NonceTracker({\n provider,\n blockTracker,\n getPendingTransactions: (address) =>\n getAndFormatTransactionsForNonceTracker(\n address,\n TransactionStatus.submitted,\n this.state.transactions,\n ),\n getConfirmedTransactions: (address) =>\n getAndFormatTransactionsForNonceTracker(\n address,\n TransactionStatus.confirmed,\n this.state.transactions,\n ),\n });\n\n onNetworkStateChange(() => {\n this.ethQuery = new EthQuery(this.provider);\n this.registry = new MethodRegistry({ provider: this.provider });\n });\n this.poll();\n }\n\n /**\n * Starts a new polling interval.\n *\n * @param interval - The polling interval used to fetch new transaction statuses.\n */\n async poll(interval?: number): Promise<void> {\n interval && this.configure({ interval }, false, false);\n this.handle && clearTimeout(this.handle);\n await safelyExecute(() => this.queryTransactionStatuses());\n this.handle = setTimeout(() => {\n this.poll(this.config.interval);\n }, this.config.interval);\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 transaction - The transaction object to add.\n * @param origin - The domain origin to append to the generated TransactionMeta.\n * @param deviceConfirmedOn - An enum to indicate what device the transaction was confirmed to append to the generated TransactionMeta.\n * @returns Object containing a promise resolving to the transaction hash if approved.\n */\n async addTransaction(\n transaction: Transaction,\n origin?: string,\n deviceConfirmedOn?: WalletDevice,\n ): Promise<Result> {\n const { providerConfig, networkId } = this.getNetworkState();\n const { transactions } = this.state;\n transaction = normalizeTransaction(transaction);\n validateTransaction(transaction);\n\n const transactionMeta: TransactionMeta = {\n id: random(),\n networkID: networkId ?? undefined,\n chainId: providerConfig.chainId,\n origin,\n status: TransactionStatus.unapproved as TransactionStatus.unapproved,\n time: Date.now(),\n transaction,\n deviceConfirmedOn,\n verifiedOnBlockchain: false,\n };\n\n try {\n const { gas, estimateGasError } = await this.estimateGas(transaction);\n transaction.gas = gas;\n transaction.estimateGasError = estimateGasError;\n } catch (error: any) {\n this.failTransaction(transactionMeta, error);\n return Promise.reject(error);\n }\n\n const result: Promise<string> = new Promise((resolve, reject) => {\n this.hub.once(\n `${transactionMeta.id}:finished`,\n (meta: TransactionMeta) => {\n switch (meta.status) {\n case TransactionStatus.submitted:\n return resolve(meta.transactionHash as string);\n case TransactionStatus.rejected:\n return reject(\n ethErrors.provider.userRejectedRequest(\n 'User rejected the transaction',\n ),\n );\n case TransactionStatus.cancelled:\n return reject(\n ethErrors.rpc.internal('User cancelled the transaction'),\n );\n case TransactionStatus.failed:\n return reject(ethErrors.rpc.internal(meta.error.message));\n /* istanbul ignore next */\n default:\n return reject(\n ethErrors.rpc.internal(\n `MetaMask Tx Signature: Unknown problem: ${JSON.stringify(\n meta,\n )}`,\n ),\n );\n }\n },\n );\n });\n\n transactions.push(transactionMeta);\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n this.hub.emit(`unapprovedTransaction`, transactionMeta);\n this.requestApproval(transactionMeta);\n return { result, transactionMeta };\n }\n\n prepareUnsignedEthTx(txParams: Record<string, unknown>): 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} common configuration object\n */\n\n getCommonConfiguration(): Common {\n const {\n networkId,\n providerConfig: { type: chain, chainId, nickname: name },\n } = this.getNetworkState();\n\n if (chain !== RPC) {\n return new Common({ chain, hardfork: HARDFORK });\n }\n\n const customChainParams = {\n name,\n chainId: parseInt(chainId, 16),\n networkId: networkId === null ? NaN : parseInt(networkId, undefined),\n };\n\n return Common.forCustomChain(\n NetworkType.mainnet,\n customChainParams,\n HARDFORK,\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 async approveTransaction(transactionID: string) {\n const { transactions } = this.state;\n const releaseLock = await this.mutex.acquire();\n const { providerConfig } = this.getNetworkState();\n const { chainId } = providerConfig;\n const index = transactions.findIndex(({ id }) => transactionID === id);\n const transactionMeta = transactions[index];\n const {\n transaction: { nonce, from },\n } = transactionMeta;\n let nonceLock;\n try {\n if (!this.sign) {\n releaseLock();\n this.failTransaction(\n transactionMeta,\n new Error('No sign method defined.'),\n );\n this.rejectApproval(transactionMeta);\n return;\n } else if (!chainId) {\n releaseLock();\n this.failTransaction(transactionMeta, new Error('No chainId defined.'));\n this.rejectApproval(transactionMeta);\n return;\n }\n\n const { approved: status } = TransactionStatus;\n let nonceToUse = nonce;\n // if a nonce already exists on the transactionMeta it means this is a speedup or cancel transaction\n // so we want to reuse that nonce and hope that it beats the previous attempt to chain. Otherwise use a new locked nonce\n if (!nonceToUse) {\n nonceLock = await this.nonceTracker.getNonceLock(from);\n nonceToUse = addHexPrefix(nonceLock.nextNonce.toString(16));\n }\n\n transactionMeta.status = status;\n transactionMeta.transaction.nonce = nonceToUse;\n transactionMeta.transaction.chainId = chainId;\n\n const baseTxParams = {\n ...transactionMeta.transaction,\n gasLimit: transactionMeta.transaction.gas,\n };\n\n const isEIP1559 = isEIP1559Transaction(transactionMeta.transaction);\n\n const txParams = isEIP1559\n ? {\n ...baseTxParams,\n maxFeePerGas: transactionMeta.transaction.maxFeePerGas,\n maxPriorityFeePerGas:\n transactionMeta.transaction.maxPriorityFeePerGas,\n estimatedBaseFee: transactionMeta.transaction.estimatedBaseFee,\n // specify type 2 if maxFeePerGas and maxPriorityFeePerGas are set\n type: 2,\n }\n : baseTxParams;\n\n // delete gasPrice if maxFeePerGas and maxPriorityFeePerGas are set\n if (isEIP1559) {\n delete txParams.gasPrice;\n }\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n const signedTx = await this.sign(unsignedEthTx, from);\n transactionMeta.status = TransactionStatus.signed;\n this.updateTransaction(transactionMeta);\n const rawTransaction = bufferToHex(signedTx.serialize());\n\n transactionMeta.rawTransaction = rawTransaction;\n this.updateTransaction(transactionMeta);\n const transactionHash = await query(this.ethQuery, 'sendRawTransaction', [\n rawTransaction,\n ]);\n transactionMeta.transactionHash = transactionHash;\n transactionMeta.status = TransactionStatus.submitted;\n this.updateTransaction(transactionMeta);\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n this.acceptApproval(transactionMeta);\n } catch (error: any) {\n this.failTransaction(transactionMeta, error);\n this.rejectApproval(transactionMeta);\n } finally {\n // must set transaction to submitted/failed before releasing lock\n if (nonceLock) {\n nonceLock.releaseLock();\n }\n releaseLock();\n }\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 */\n cancelTransaction(transactionID: 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 this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n const transactions = this.state.transactions.filter(\n ({ id }) => id !== transactionID,\n );\n this.update({ transactions: this.trimTransactionsForState(transactions) });\n this.rejectApproval(transactionMeta);\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 */\n async stopTransaction(\n transactionID: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n ) {\n if (gasValues) {\n validateGasValues(gasValues);\n }\n const transactionMeta = this.state.transactions.find(\n ({ id }) => id === transactionID,\n );\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.transaction.gasPrice,\n CANCEL_RATE,\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.transaction?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n CANCEL_RATE,\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.transaction?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n CANCEL_RATE,\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 =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n from: transactionMeta.transaction.from,\n gasLimit: transactionMeta.transaction.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: 2,\n nonce: transactionMeta.transaction.nonce,\n to: transactionMeta.transaction.from,\n value: '0x0',\n }\n : {\n from: transactionMeta.transaction.from,\n gasLimit: transactionMeta.transaction.gas,\n gasPrice: newGasPrice,\n nonce: transactionMeta.transaction.nonce,\n to: transactionMeta.transaction.from,\n value: '0x0',\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.transaction.from,\n );\n const rawTransaction = bufferToHex(signedTx.serialize());\n await query(this.ethQuery, 'sendRawTransaction', [rawTransaction]);\n transactionMeta.status = TransactionStatus.cancelled;\n this.hub.emit(`${transactionMeta.id}:finished`, transactionMeta);\n this.rejectApproval(transactionMeta);\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 transation.\n */\n async speedUpTransaction(\n transactionID: string,\n gasValues?: GasPriceValue | FeeMarketEIP1559Values,\n ) {\n if (gasValues) {\n validateGasValues(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 const { transactions } = this.state;\n\n // gasPrice (legacy non EIP1559)\n const minGasPrice = getIncreasedPriceFromExisting(\n transactionMeta.transaction.gasPrice,\n SPEED_UP_RATE,\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.transaction?.maxFeePerGas;\n const minMaxFeePerGas = getIncreasedPriceFromExisting(\n existingMaxFeePerGas,\n SPEED_UP_RATE,\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.transaction?.maxPriorityFeePerGas;\n const minMaxPriorityFeePerGas = getIncreasedPriceFromExisting(\n existingMaxPriorityFeePerGas,\n SPEED_UP_RATE,\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 =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...transactionMeta.transaction,\n gasLimit: transactionMeta.transaction.gas,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n type: 2,\n }\n : {\n ...transactionMeta.transaction,\n gasLimit: transactionMeta.transaction.gas,\n gasPrice: newGasPrice,\n };\n\n const unsignedEthTx = this.prepareUnsignedEthTx(txParams);\n\n const signedTx = await this.sign(\n unsignedEthTx,\n transactionMeta.transaction.from,\n );\n const rawTransaction = bufferToHex(signedTx.serialize());\n const transactionHash = await query(this.ethQuery, 'sendRawTransaction', [\n rawTransaction,\n ]);\n const baseTransactionMeta = {\n ...transactionMeta,\n id: random(),\n time: Date.now(),\n transactionHash,\n };\n const newTransactionMeta =\n newMaxFeePerGas && newMaxPriorityFeePerGas\n ? {\n ...baseTransactionMeta,\n transaction: {\n ...transactionMeta.transaction,\n maxFeePerGas: newMaxFeePerGas,\n maxPriorityFeePerGas: newMaxPriorityFeePerGas,\n },\n }\n : {\n ...baseTransactionMeta,\n transaction: {\n ...transactionMeta.transaction,\n gasPrice: newGasPrice,\n },\n };\n transactions.push(newTransactionMeta);\n this.update({ transactions: this.trimTransactionsForState(transactions) });\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: Transaction) {\n const estimatedTransaction = { ...transaction };\n const {\n gas,\n gasPrice: providedGasPrice,\n to,\n value,\n data,\n } = estimatedTransaction;\n const gasPrice =\n typeof providedGasPrice === 'undefined'\n ? await query(this.ethQuery, 'gasPrice')\n : providedGasPrice;\n const { providerConfig } = this.getNetworkState();\n const isCustomNetwork = providerConfig.type === NetworkType.rpc;\n // 1. If gas is already defined on the transaction, use it\n if (typeof gas !== 'undefined') {\n return { gas, gasPrice };\n }\n const { gasLimit } = await query(this.ethQuery, 'getBlockByNumber', [\n 'latest',\n false,\n ]);\n\n // 2. If to is not defined or this is not a contract address, and there is no data use 0x5208 / 21000.\n // If the newtwork is a custom network then bypass this check and fetch 'estimateGas'.\n /* istanbul ignore next */\n const code = to ? await query(this.ethQuery, 'getCode', [to]) : undefined;\n /* istanbul ignore next */\n if (\n !isCustomNetwork &&\n (!to || (to && !data && (!code || code === '0x')))\n ) {\n return { gas: '0x5208', gasPrice };\n }\n\n // if data, should be hex string format\n estimatedTransaction.data = !data\n ? data\n : /* istanbul ignore next */ addHexPrefix(data);\n\n // 3. If this is a contract address, safely estimate gas using RPC\n estimatedTransaction.value =\n typeof value === 'undefined' ? '0x0' : /* istanbul ignore next */ value;\n const gasLimitBN = hexToBN(gasLimit);\n estimatedTransaction.gas = BNToHex(fractionBN(gasLimitBN, 19, 20));\n\n let gasHex;\n let estimateGasError;\n try {\n gasHex = await query(this.ethQuery, 'estimateGas', [\n estimatedTransaction,\n ]);\n } catch (error) {\n estimateGasError = ESTIMATE_GAS_ERROR;\n }\n // 4. Pad estimated gas without exceeding the most recent block gasLimit. If the network is a\n // a custom network then return the eth_estimateGas value.\n const gasBN = hexToBN(gasHex);\n const maxGasBN = gasLimitBN.muln(0.9);\n const paddedGasBN = gasBN.muln(1.5);\n /* istanbul ignore next */\n if (gasBN.gt(maxGasBN) || isCustomNetwork) {\n return { gas: addHexPrefix(gasHex), gasPrice, estimateGasError };\n }\n\n /* istanbul ignore next */\n if (paddedGasBN.lt(maxGasBN)) {\n return {\n gas: addHexPrefix(BNToHex(paddedGasBN)),\n gasPrice,\n estimateGasError,\n };\n }\n return { gas: addHexPrefix(BNToHex(maxGasBN)), gasPrice };\n }\n\n /**\n * Check the status of submitted transactions on the network to determine whether they have\n * been included in a block. Any that have been included in a block are marked as confirmed.\n */\n async queryTransactionStatuses() {\n const { transactions } = this.state;\n const { providerConfig, networkId: currentNetworkID } =\n this.getNetworkState();\n const { chainId: currentChainId } = providerConfig;\n let gotUpdates = false;\n await safelyExecute(() =>\n Promise.all(\n transactions.map(async (meta, index) => {\n // Using fallback to networkID only when there is no chainId present.\n // Should be removed when networkID is completely removed.\n const txBelongsToCurrentChain =\n meta.chainId === currentChainId ||\n (!meta.chainId && meta.networkID === currentNetworkID);\n\n if (!meta.verifiedOnBlockchain && txBelongsToCurrentChain) {\n const [reconciledTx, updateRequired] =\n await this.blockchainTransactionStateReconciler(meta);\n if (updateRequired) {\n transactions[index] = reconciledTx;\n gotUpdates = updateRequired;\n }\n }\n }),\n ),\n );\n\n /* istanbul ignore else */\n if (gotUpdates) {\n this.update({\n transactions: this.trimTransactionsForState(transactions),\n });\n }\n }\n\n /**\n * Updates an existing transaction in state.\n *\n * @param transactionMeta - The new transaction to store in state.\n */\n updateTransaction(transactionMeta: TransactionMeta) {\n const { transactions } = this.state;\n transactionMeta.transaction = normalizeTransaction(\n transactionMeta.transaction,\n );\n validateTransaction(transactionMeta.transaction);\n const index = transactions.findIndex(({ id }) => transactionMeta.id === id);\n transactions[index] = transactionMeta;\n this.update({ transactions: this.trimTransactionsForState(transactions) });\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 */\n wipeTransactions(ignoreNetwork?: boolean) {\n /* istanbul ignore next */\n if (ignoreNetwork) {\n this.update({ transactions: [] });\n return;\n }\n const { providerConfig, networkId: currentNetworkID } =\n this.getNetworkState();\n const { chainId: currentChainId } = providerConfig;\n const newTransactions = this.state.transactions.filter(\n ({ networkID, chainId }) => {\n // Using fallback to networkID only when there is no chainId present. Should be removed when networkID is completely removed.\n const isCurrentNetwork =\n chainId === currentChainId ||\n (!chainId && networkID === currentNetworkID);\n return !isCurrentNetwork;\n },\n );\n\n this.update({\n transactions: this.trimTransactionsForState(newTransactions),\n });\n }\n\n /**\n * Get transactions from Etherscan for the given address. By default all transactions are\n * returned, but the `fromBlock` option can be given to filter just for transactions from a\n * specific block onward.\n *\n * @param address - The address to fetch the transactions for.\n * @param opt - Object containing optional data, fromBlock and Etherscan API key.\n * @returns The block number of the latest incoming transaction.\n */\n async fetchAll(\n address: string,\n opt?: FetchAllOptions,\n ): Promise<string | void> {\n const { providerConfig, networkId: currentNetworkID } =\n this.getNetworkState();\n const { chainId: currentChainId, type: networkType } = providerConfig;\n const { transactions } = this.state;\n\n const supportedNetworkIds = ['1', '5', '11155111'];\n /* istanbul ignore next */\n if (\n currentNetworkID === null ||\n supportedNetworkIds.indexOf(currentNetworkID) === -1\n ) {\n return undefined;\n }\n\n const [etherscanTxResponse, etherscanTokenResponse] =\n await handleTransactionFetch(\n networkType,\n address,\n this.config.txHistoryLimit,\n opt,\n );\n\n const normalizedTxs = etherscanTxResponse.result.map(\n (tx: EtherscanTransactionMeta) =>\n this.normalizeTx(tx, currentNetworkID, currentChainId),\n );\n const normalizedTokenTxs = etherscanTokenResponse.result.map(\n (tx: EtherscanTransactionMeta) =>\n this.normalizeTokenTx(tx, currentNetworkID, currentChainId),\n );\n\n const [updateRequired, allTxs] = this.etherscanTransactionStateReconciler(\n [...normalizedTxs, ...normalizedTokenTxs],\n transactions,\n );\n\n allTxs.sort((a, b) => (a.time < b.time ? -1 : 1));\n\n let latestIncomingTxBlockNumber: string | undefined;\n allTxs.forEach(async (tx) => {\n /* istanbul ignore next */\n if (\n // Using fallback to networkID only when there is no chainId present. Should be removed when networkID is completely removed.\n (tx.chainId === currentChainId ||\n (!tx.chainId && tx.networkID === currentNetworkID)) &&\n tx.transaction.to &&\n tx.transaction.to.toLowerCase() === address.toLowerCase()\n ) {\n if (\n tx.blockNumber &&\n (!latestIncomingTxBlockNumber ||\n parseInt(latestIncomingTxBlockNumber, 10) <\n parseInt(tx.blockNumber, 10))\n ) {\n latestIncomingTxBlockNumber = tx.blockNumber;\n }\n }\n\n /* istanbul ignore else */\n if (tx.toSmartContract === undefined) {\n // If not `to` is a contract deploy, if not `data` is send eth\n if (\n tx.transaction.to &&\n (!tx.transaction.data || tx.transaction.data !== '0x')\n ) {\n const code = await query(this.ethQuery, 'getCode', [\n tx.transaction.to,\n ]);\n tx.toSmartContract = isSmartContractCode(code);\n } else {\n tx.toSmartContract = false;\n }\n }\n });\n\n // Update state only if new transactions were fetched or\n // the status or gas data of a transaction has changed\n if (updateRequired) {\n this.update({ transactions: this.trimTransactionsForState(allTxs) });\n }\n return latestIncomingTxBlockNumber;\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 BaseController 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 const txsToKeep = transactions.reverse().filter((tx) => {\n const { chainId, networkID, status, transaction, time } = tx;\n if (transaction) {\n const key = `${transaction.nonce}-${\n chainId ? convertHexToDecimal(chainId) : networkID\n }-${new Date(time).toDateString()}`;\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 return false;\n });\n txsToKeep.reverse();\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 status === TransactionStatus.cancelled\n );\n }\n\n /**\n * Method to verify the state of a transaction using the Blockchain as a source of truth.\n *\n * @param meta - The local transaction to verify on the blockchain.\n * @returns A tuple containing the updated transaction, and whether or not an update was required.\n */\n private async blockchainTransactionStateReconciler(\n meta: TransactionMeta,\n ): Promise<[TransactionMeta, boolean]> {\n const { status, transactionHash } = meta;\n switch (status) {\n case TransactionStatus.confirmed:\n const txReceipt = await query(this.ethQuery, 'getTransactionReceipt', [\n transactionHash,\n ]);\n\n if (!txReceipt) {\n return [meta, false];\n }\n\n meta.verifiedOnBlockchain = true;\n meta.transaction.gasUsed = txReceipt.gasUsed;\n\n // According to the Web3 docs:\n // TRUE if the transaction was successful, FALSE if the EVM reverted the transaction.\n if (Number(txReceipt.status) === 0) {\n const error: Error = new Error(\n 'Transaction failed. The transaction was reversed',\n );\n this.failTransaction(meta, error);\n return [meta, false];\n }\n\n return [meta, true];\n case TransactionStatus.submitted:\n const txObj = await query(this.ethQuery, 'getTransactionByHash', [\n transactionHash,\n ]);\n\n if (!txObj) {\n const receiptShowsFailedStatus =\n await this.checkTxReceiptStatusIsFailed(transactionHash);\n\n // Case the txObj is evaluated as false, a second check will\n // determine if the tx failed or it is pending or confirmed\n if (receiptShowsFailedStatus) {\n const error: Error = new Error(\n 'Transaction failed. The transaction was dropped or replaced by a new one',\n );\n this.failTransaction(meta, error);\n }\n }\n\n /* istanbul ignore next */\n if (txObj?.blockNumber) {\n meta.status = TransactionStatus.confirmed;\n this.hub.emit(`${meta.id}:confirmed`, meta);\n return [meta, true];\n }\n\n return [meta, false];\n default:\n return [meta, false];\n }\n }\n\n /**\n * Method to check if a tx has failed according to their receipt\n * According to the Web3 docs:\n * TRUE if the transaction was successful, FALSE if the EVM reverted the transaction.\n * The receipt is not available for pending transactions and returns null.\n *\n * @param txHash - The transaction hash.\n * @returns Whether the transaction has failed.\n */\n private async checkTxReceiptStatusIsFailed(\n txHash: string | undefined,\n ): Promise<boolean> {\n const txReceipt = await query(this.ethQuery, 'getTransactionReceipt', [\n txHash,\n ]);\n if (!txReceipt) {\n // Transaction is pending\n return false;\n }\n return Number(txReceipt.status) === 0;\n }\n\n /**\n * Method to verify the state of transactions using Etherscan as a source of truth.\n *\n * @param remoteTxs - Transactions to reconcile that are from a remote source.\n * @param localTxs - Transactions to reconcile that are local.\n * @returns A tuple containing a boolean indicating whether or not an update was required, and the updated transaction.\n */\n private etherscanTransactionStateReconciler(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): [boolean, TransactionMeta[]] {\n const updatedTxs: TransactionMeta[] = this.getUpdatedTransactions(\n remoteTxs,\n localTxs,\n );\n\n const newTxs: TransactionMeta[] = this.getNewTransactions(\n remoteTxs,\n localTxs,\n );\n\n const updatedLocalTxs = localTxs.map((tx: TransactionMeta) => {\n const txIdx = updatedTxs.findIndex(\n ({ transactionHash }) => transactionHash === tx.transactionHash,\n );\n return txIdx === -1 ? tx : updatedTxs[txIdx];\n });\n\n const updateRequired = newTxs.length > 0 || updatedLocalTxs.length > 0;\n\n return [updateRequired, [...newTxs, ...updatedLocalTxs]];\n }\n\n /**\n * Get all transactions that are in the remote transactions array\n * but not in the local transactions array.\n *\n * @param remoteTxs - Array of transactions from remote source.\n * @param localTxs - Array of transactions stored locally.\n * @returns The new transactions.\n */\n private getNewTransactions(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): TransactionMeta[] {\n return remoteTxs.filter((tx) => {\n const alreadyInTransactions = localTxs.find(\n ({ transactionHash }) => transactionHash === tx.transactionHash,\n );\n return !alreadyInTransactions;\n });\n }\n\n /**\n * Get all the transactions that are locally outdated with respect\n * to a remote source (etherscan or blockchain). The returned array\n * contains the transactions with the updated data.\n *\n * @param remoteTxs - Array of transactions from remote source.\n * @param localTxs - Array of transactions stored locally.\n * @returns The updated transactions.\n */\n private getUpdatedTransactions(\n remoteTxs: TransactionMeta[],\n localTxs: TransactionMeta[],\n ): TransactionMeta[] {\n return remoteTxs.filter((remoteTx) => {\n const isTxOutdated = localTxs.find((localTx) => {\n return (\n remoteTx.transactionHash === localTx.transactionHash &&\n this.isTransactionOutdated(remoteTx, localTx)\n );\n });\n return isTxOutdated;\n });\n }\n\n /**\n * Verifies if a local transaction is outdated with respect to the remote transaction.\n *\n * @param remoteTx - The remote transaction from Etherscan.\n * @param localTx - The local transaction.\n * @returns Whether the transaction is outdated.\n */\n private isTransactionOutdated(\n remoteTx: TransactionMeta,\n localTx: TransactionMeta,\n ): boolean {\n const statusOutdated = this.isStatusOutdated(\n remoteTx.transactionHash,\n localTx.transactionHash,\n remoteTx.status,\n localTx.status,\n );\n const gasDataOutdated = this.isGasDataOutdated(\n remoteTx.transaction.gasUsed,\n localTx.transaction.gasUsed,\n );\n return statusOutdated || gasDataOutdated;\n }\n\n /**\n * Verifies if the status of a local transaction is outdated with respect to the remote transaction.\n *\n * @param remoteTxHash - Remote transaction hash.\n * @param localTxHash - Local transaction hash.\n * @param remoteTxStatus - Remote transaction status.\n * @param localTxStatus - Local transaction status.\n * @returns Whether the status is outdated.\n */\n private isStatusOutdated(\n remoteTxHash: string | undefined,\n localTxHash: string | undefined,\n remoteTxStatus: TransactionStatus,\n localTxStatus: TransactionStatus,\n ): boolean {\n return remoteTxHash === localTxHash && remoteTxStatus !== localTxStatus;\n }\n\n /**\n * Verifies if the gas data of a local transaction is outdated with respect to the remote transaction.\n *\n * @param remoteGasUsed - Remote gas used in the transaction.\n * @param localGasUsed - Local gas used in the transaction.\n * @returns Whether the gas data is outdated.\n */\n private isGasDataOutdated(\n remoteGasUsed: string | undefined,\n localGasUsed: string | undefined,\n ): boolean {\n return remoteGasUsed !== localGasUsed;\n }\n\n private async requestApproval(\n txMeta: TransactionMeta,\n { shouldShowRequest } = { shouldShowRequest: true },\n ) {\n const id = this.getApprovalId(txMeta);\n const { origin } = txMeta;\n const type = ApprovalType.Transaction;\n const requestData = { txId: txMeta.id };\n\n try {\n await this.messagingSystem.call(\n 'ApprovalController:addRequest',\n {\n id,\n origin: origin || ORIGIN_METAMASK,\n type,\n requestData,\n },\n shouldShowRequest,\n );\n } catch (error) {\n console.info('Failed to request transaction approval', error);\n }\n }\n\n private acceptApproval(txMeta: TransactionMeta) {\n const id = this.getApprovalId(txMeta);\n\n try {\n this.messagingSystem.call('ApprovalController:acceptRequest', id);\n } catch (error) {\n console.info('Failed to accept transaction approval request', error);\n }\n }\n\n private rejectApproval(txMeta: TransactionMeta) {\n const id = this.getApprovalId(txMeta);\n\n try {\n this.messagingSystem.call(\n 'ApprovalController:rejectRequest',\n id,\n new Error('Rejected'),\n );\n } catch (error) {\n console.info('Failed to reject transaction approval request', error);\n }\n }\n\n private getApprovalId(txMeta: TransactionMeta) {\n return String(txMeta.id);\n }\n}\n\nexport default TransactionController;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"txsMock.d.ts","sourceRoot":"","sources":["../../src/mocks/txsMock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAqB,MAAM,0BAA0B,CAAC;AAE9E,eAAO,MAAM,UAAU,cAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4E3C,CAAC;AAEF,eAAO,MAAM,YAAY,gBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;GA+R/C,CAAC;AAEF,eAAO,MAAM,cAAc,cACd,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC;AAEF,eAAO,MAAM,gCAAgC,cAChC,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC;AAEF,eAAO,MAAM,iCAAiC,cACjC,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC;AAEF,eAAO,MAAM,0CAA0C,cAC1C,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC"}
1
+ {"version":3,"file":"txsMock.d.ts","sourceRoot":"","sources":["../../src/mocks/txsMock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAqB,MAAM,0BAA0B,CAAC;AAE9E,eAAO,MAAM,UAAU,cAAe,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4E3C,CAAC;AAEF,eAAO,MAAM,YAAY,gBAAiB,MAAM;;;;;;;;;;;;;;;;;;;;GA+R/C,CAAC;AAEF,eAAO,MAAM,cAAc,cACd,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC;AAEF,eAAO,MAAM,gCAAgC,cAChC,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC;AAEF,eAAO,MAAM,iCAAiC,cACjC,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC;AAEF,eAAO,MAAM,0CAA0C,cAC1C,MAAM,eACJ,MAAM,KAClB,eAAe,EAqCjB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.txsInStateWithOutdatedStatusAndGasDataMock = exports.txsInStateWithOutdatedGasDataMock = exports.txsInStateWithOutdatedStatusMock = exports.txsInStateMock = exports.tokenTxsMock = exports.ethTxsMock = void 0;
4
+ const controller_utils_1 = require("@metamask/controller-utils");
4
5
  const TransactionController_1 = require("../TransactionController");
5
6
  const ethTxsMock = (ethTxHash) => [
6
7
  {
@@ -359,7 +360,7 @@ exports.tokenTxsMock = tokenTxsMock;
359
360
  const txsInStateMock = (ethTxHash, tokenTxHash) => [
360
361
  {
361
362
  id: 'token-transaction-id',
362
- chainId: '1',
363
+ chainId: (0, controller_utils_1.toHex)(1),
363
364
  status: TransactionController_1.TransactionStatus.confirmed,
364
365
  time: 1615497996125,
365
366
  transaction: {
@@ -377,7 +378,7 @@ const txsInStateMock = (ethTxHash, tokenTxHash) => [
377
378
  },
378
379
  {
379
380
  id: 'eth-transaction-id',
380
- chainId: '1',
381
+ chainId: (0, controller_utils_1.toHex)(1),
381
382
  status: TransactionController_1.TransactionStatus.confirmed,
382
383
  time: 1615497996125,
383
384
  transaction: {
@@ -398,7 +399,7 @@ exports.txsInStateMock = txsInStateMock;
398
399
  const txsInStateWithOutdatedStatusMock = (ethTxHash, tokenTxHash) => [
399
400
  {
400
401
  id: 'token-transaction-id',
401
- chainId: '1',
402
+ chainId: (0, controller_utils_1.toHex)(1),
402
403
  status: TransactionController_1.TransactionStatus.rejected,
403
404
  time: 1615497996125,
404
405
  transaction: {
@@ -416,7 +417,7 @@ const txsInStateWithOutdatedStatusMock = (ethTxHash, tokenTxHash) => [
416
417
  },
417
418
  {
418
419
  id: 'eth-transaction-id',
419
- chainId: '1',
420
+ chainId: (0, controller_utils_1.toHex)(1),
420
421
  status: TransactionController_1.TransactionStatus.rejected,
421
422
  time: 1615497996125,
422
423
  transaction: {
@@ -437,7 +438,7 @@ exports.txsInStateWithOutdatedStatusMock = txsInStateWithOutdatedStatusMock;
437
438
  const txsInStateWithOutdatedGasDataMock = (ethTxHash, tokenTxHash) => [
438
439
  {
439
440
  id: 'token-transaction-id',
440
- chainId: '1',
441
+ chainId: (0, controller_utils_1.toHex)(1),
441
442
  status: TransactionController_1.TransactionStatus.confirmed,
442
443
  time: 1615497996125,
443
444
  transaction: {
@@ -455,7 +456,7 @@ const txsInStateWithOutdatedGasDataMock = (ethTxHash, tokenTxHash) => [
455
456
  },
456
457
  {
457
458
  id: 'eth-transaction-id',
458
- chainId: '1',
459
+ chainId: (0, controller_utils_1.toHex)(1),
459
460
  status: TransactionController_1.TransactionStatus.confirmed,
460
461
  time: 1615497996125,
461
462
  transaction: {
@@ -476,7 +477,7 @@ exports.txsInStateWithOutdatedGasDataMock = txsInStateWithOutdatedGasDataMock;
476
477
  const txsInStateWithOutdatedStatusAndGasDataMock = (ethTxHash, tokenTxHash) => [
477
478
  {
478
479
  id: 'token-transaction-id',
479
- chainId: '1',
480
+ chainId: (0, controller_utils_1.toHex)(1),
480
481
  status: TransactionController_1.TransactionStatus.rejected,
481
482
  time: 1615497996125,
482
483
  transaction: {
@@ -494,7 +495,7 @@ const txsInStateWithOutdatedStatusAndGasDataMock = (ethTxHash, tokenTxHash) => [
494
495
  },
495
496
  {
496
497
  id: 'eth-transaction-id',
497
- chainId: '1',
498
+ chainId: (0, controller_utils_1.toHex)(1),
498
499
  status: TransactionController_1.TransactionStatus.rejected,
499
500
  time: 1615497996125,
500
501
  transaction: {
@@ -1 +1 @@
1
- {"version":3,"file":"txsMock.js","sourceRoot":"","sources":["../../src/mocks/txsMock.ts"],"names":[],"mappings":";;;AAAA,oEAA8E;AAEvE,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC;IAC/C;QACE,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,QAAQ;QAC3B,IAAI,EAAE,4CAA4C;QAClD,GAAG,EAAE,QAAQ;QACb,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,GAAG;QACZ,KAAK,EAAE,GAAG;QACV,SAAS,EAAE,YAAY;QACvB,EAAE,EAAE,4CAA4C;QAChD,gBAAgB,EAAE,GAAG;QACrB,gBAAgB,EAAE,GAAG;QACrB,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,GAAG;QAClB,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,QAAQ;QAC3B,IAAI,EAAE,4CAA4C;QAClD,GA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AE,4CAA4C;YAChD,KAAK,EAAE,oBAAoB;SAC5B;QACD,eAAe,EAAE,SAAS;QAC1B,eAAe,EAAE,KAAK;KACvB;CACF,CAAC;AAxCW,QAAA,0CAA0C,8CAwCrD","sourcesContent":["import { TransactionMeta, TransactionStatus } from '../TransactionController';\n\nexport const ethTxsMock = (ethTxHash: string) => [\n {\n blockNumber: '4535101',\n confirmations: '10',\n contractAddress: '',\n cumulativeGasUsed: '120607',\n from: '0xe46abaf75cfbff815c0b7ffed6f02b0760ea27f1',\n gas: '335208',\n gasPrice: '10000000000',\n gasUsed: '21000',\n hash: ethTxHash,\n input: '0x',\n isError: '0',\n nonce: '9',\n timeStamp: '1543596286',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n transactionIndex: '2',\n txreceipt_status: '1',\n value: '100000000000000000',\n },\n {\n blockNumber: '4535108',\n confirmations: '3',\n contractAddress: '',\n cumulativeGasUsed: '693910',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n gas: '335208',\n gasPrice: '20000000000',\n gasUsed: '21000',\n hash: '0x342e9d73e10004af41d04973339fc7219dbadcbb5629730cfe65e9f9cb15ff92',\n input: '0x',\n isError: '0',\n nonce: '0',\n timeStamp: '1543596378',\n to: '0xb2d191b6fe03c5b8a1ab249cfe88c37553357a23',\n transactionIndex: '12',\n txreceipt_status: '1',\n value: '50000000000000000',\n },\n {\n blockNumber: '4535105',\n confirmations: '4',\n contractAddress: '',\n cumulativeGasUsed: '693910',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n gas: '335208',\n gasPrice: '20000000000',\n gasUsed: '21000',\n hash: '0x342e9d73e10004af41d04973339fc7219dbadcbb5629730cfe65e9f9cb15ff91',\n input: '0x',\n isError: '0',\n nonce: '1',\n timeStamp: '1543596356',\n transactionIndex: '13',\n txreceipt_status: '1',\n value: '50000000000000000',\n },\n {\n blockNumber: '4535106',\n confirmations: '4',\n contractAddress: '',\n cumulativeGasUsed: '693910',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n gas: '335208',\n gasPrice: '20000000000',\n gasUsed: '21000',\n hash: '0x342e9d73e10004af41d04973139fc7219dbadcbb5629730cfe65e9f9cb15ff91',\n input: '0x11',\n isError: '0',\n nonce: '3',\n timeStamp: '1543596356',\n to: '0xb2d191b6fe03c5b8a1ab249cfe88c37553357a23',\n transactionIndex: '13',\n txreceipt_status: '1',\n value: '50000000000000000',\n },\n];\n\nexport const tokenTxsMock = (tokenTxHash: string) => [\n {\n blockNumber: '8222239',\n timeStamp: '1564091067',\n hash: tokenTxHash,\n nonce: '2329',\n blockHash:\n '0x3c30a9be9aea7be13caad419444140c11839d72e70479ec7e9c6d8bd08c533bc',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '69',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: '21000',\n cumulativeGasUsed: '3203881',\n input: 'deprecated',\n confirmations: '3659676',\n },\n {\n blockNumber: '8222250',\n timeStamp: '1564091247',\n hash: '0xdcd1c8bee545d3f76d80b20a23ad44276ba2e376681228eb4570cf3518491279',\n nonce: '2330',\n blockHash:\n '0x16986dd66bedb20a5b846ec2b6c0ecaa62f1c4b51fac58c1326101fd9126dd82',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '40',\n gas: '594268',\n gasPrice: '20000000000',\n gasUsed: '579268',\n cumulativeGasUsed: '2009011',\n input: 'deprecated',\n confirmations: '3659665',\n },\n {\n blockNumber: '8223771',\n timeStamp: '1564111652',\n hash: '0x070369e6f560b0deca52e050ff1a961fa7b688bbec5cea08435921c9d9b0f52e',\n nonce: '2333',\n blockHash:\n '0x0aff8b36881be99df6d176d7c64c2171672c0483684a10c112d2c90fefe30a0a',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '132',\n gas: '583810',\n gasPrice: '6000000000',\n gasUsed: '568810',\n cumulativeGasUsed: '6956245',\n input: 'deprecated',\n confirmations: '3658144',\n },\n {\n blockNumber: '8224850',\n timeStamp: '1564126442',\n hash: '0x8ef20ec9597c8c2e945bcc76d2668e5d3bb088b081fe8c5b5af2e1cbd315a20f',\n nonce: '31',\n blockHash:\n '0xb80d4d861ecb7a3cb14e591c0aaeb226842d0267772affa2acc1a590c7535647',\n from: '0x6c70e3563cef0c6835703bb2664c9f59a92353e4',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '10000000000000000000',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '169',\n gas: '78447',\n gasPrice: '2000000000',\n gasUsed: '52298',\n cumulativeGasUsed: '7047823',\n input: 'deprecated',\n confirmations: '3657065',\n },\n {\n blockNumber: '8228053',\n timeStamp: '1564168901',\n hash: '0xa0f2d7b558bb3cc28fa568f6feb8ed30eb28a01a674d7c0d4ae603fc691e6020',\n nonce: '2368',\n blockHash:\n '0x62c515ea049842c968ca67499f47a32a11394364d319d9c9cc0a0211652a7294',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '43',\n gas: '567156',\n gasPrice: '3000000000',\n gasUsed: '552156',\n cumulativeGasUsed: '3048261',\n input: 'deprecated',\n confirmations: '3653862',\n },\n {\n blockNumber: '8315335',\n timeStamp: '1565339223',\n hash: '0x464df60fe00b6dd04c9e8ab341d02af9b10a619d2fcd60fd2971f10edf12118f',\n nonce: '206760',\n blockHash:\n '0x98275388ef6708debe35ac7bf2e30143c9b1fd9e0e457ca03598fc1f4209e273',\n from: '0x00cfbbaf7ddb3a1476767101c12a0162e241fbad',\n contractAddress: '0x4dc3643dbc642b72c158e7f3d2ff232df61cb6ce',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n tokenName: 'Amber',\n tokenSymbol: 'AMB',\n tokenDecimal: '18',\n transactionIndex: '186',\n gas: '60000',\n gasPrice: '2000000000',\n gasUsed: '52108',\n cumulativeGasUsed: '7490707',\n input: 'deprecated',\n confirmations: '3566580',\n },\n {\n blockNumber: '8350846',\n timeStamp: '1565815049',\n hash: '0xc0682327ad3efd56dfa33e8206b4e09efad4e419a6191076069d217e3ee2341f',\n nonce: '2506',\n blockHash:\n '0xd0aa3c0e319fdfeb21b0192cf77b9760b8668060a5977a5f10f8413531083afa',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '4',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '48',\n gas: '578737',\n gasPrice: '3000000000',\n gasUsed: '518737',\n cumulativeGasUsed: '2848015',\n input: 'deprecated',\n confirmations: '3531069',\n },\n {\n blockNumber: '8350859',\n timeStamp: '1565815221',\n hash: '0x989ea9f3ee576fa43957f44363e839adf1a4a397c3d8392a4f7cbbf7949fd0ae',\n nonce: '2',\n blockHash:\n '0xb9cf1d29c665c052e3831b5754903e539c5b0b1d33b8bcab6cd2d450764d601f',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x09cabec1ead1c0ba254b09efb3ee13841712be14',\n value: '10000000000000000000',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '31',\n gas: '60734',\n gasPrice: '1000000000',\n gasUsed: '54745',\n cumulativeGasUsed: '7833857',\n input: 'deprecated',\n confirmations: '3531056',\n },\n {\n blockNumber: '8679548',\n timeStamp: '1570244087',\n hash: '0xc0016b89b3b525b30d73f242653b0d80ec3ebf285376dff5bb52cef3261498b2',\n nonce: '3',\n blockHash:\n '0x1ceb2f8b83087f010773e2acf63d1526633c8a884bd1980f118a1bba576be69f',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '56',\n gas: '993379',\n gasPrice: '1440000000',\n gasUsed: '647253',\n cumulativeGasUsed: '3562204',\n input: 'deprecated',\n confirmations: '3202367',\n },\n {\n blockNumber: '8679548',\n timeStamp: '1570244087',\n hash: '0xc0016b89b3b525b30d73f242653b0d80ec3ebf285376dff5bb52cef3261498b2',\n nonce: '3',\n blockHash:\n '0x1ceb2f8b83087f010773e2acf63d1526633c8a884bd1980f118a1bba576be69f',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '56',\n gas: '993379',\n gasPrice: '1440000000',\n gasUsed: '647253',\n cumulativeGasUsed: '3562204',\n input: 'deprecated',\n confirmations: '3202367',\n },\n {\n blockNumber: '8694142',\n timeStamp: '1570440625',\n hash: '0xd8397138bb93d56e50d01e92a9eae99ebd3ae28844acdaa4663976a5501116cf',\n nonce: '2837',\n blockHash:\n '0xba45dd64e71e146066af9b6d2dd3bc5d72f4a3399148c155dced74c139fc3c51',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '217',\n gas: '600632',\n gasPrice: '9000000000',\n gasUsed: '570632',\n cumulativeGasUsed: '9023725',\n input: 'deprecated',\n confirmations: '3187773',\n },\n {\n blockNumber: '10877041',\n timeStamp: '1600310867',\n hash: '0xc8bd16b6b41b4c24849eb6869702e1489c808cb5b125b01f084e38fefcb5ea77',\n nonce: '4',\n blockHash:\n '0x7fa16a022bcf1f69c2d7adf6bd7d3f058e808eec5c66aaa910dfa8016a5333d1',\n from: '0x090d4613473dee047c3f2706764f49e0821d256e',\n contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '400000000000000000000',\n tokenName: 'Uniswap',\n tokenSymbol: 'UNI',\n tokenDecimal: '18',\n transactionIndex: '42',\n gas: '90038',\n gasPrice: '550000000000',\n gasUsed: '81853',\n cumulativeGasUsed: '3163540',\n input: 'deprecated',\n confirmations: '1004874',\n },\n {\n blockNumber: '10877897',\n timeStamp: '1600321973',\n hash: '0xa7162489faef826ee77862ed5210b01726524f09428f69842118dad394842d62',\n nonce: '6',\n blockHash:\n '0xa74eb9d16f65f307dde4ce58c813c981b28f242edf1090ee2ac42caac9dccaca',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',\n to: '0x5e736f1f25992b2cad20ded179a52823d3d24b26',\n value: '400000000000000000000',\n tokenName: 'Uniswap',\n tokenSymbol: 'UNI',\n tokenDecimal: '18',\n transactionIndex: '86',\n gas: '60759',\n gasPrice: '640000000000',\n gasUsed: '25506',\n cumulativeGasUsed: '4408393',\n input: 'deprecated',\n confirmations: '1004018',\n },\n];\n\nexport const txsInStateMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: '1',\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: '21000',\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: '1',\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: '0x5208',\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n\nexport const txsInStateWithOutdatedStatusMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: '1',\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: '21000',\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: '1',\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: '0x5208',\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n\nexport const txsInStateWithOutdatedGasDataMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: '1',\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: '1',\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n\nexport const txsInStateWithOutdatedStatusAndGasDataMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: '1',\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: '1',\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n"]}
1
+ {"version":3,"file":"txsMock.js","sourceRoot":"","sources":["../../src/mocks/txsMock.ts"],"names":[],"mappings":";;;AAAA,iEAAmD;AACnD,oEAA8E;AAEvE,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC;IAC/C;QACE,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,IAAI;QACnB,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,QAAQ;QAC3B,IAAI,EAAE,4CAA4C;QAClD,GAAG,EAAE,QAAQ;QACb,QAAQ,EAAE,aAAa;QACvB,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,GAAG;QACZ,KAAK,EAAE,GAAG;QACV,SAAS,EAAE,YAAY;QACvB,EAAE,EAAE,4CAA4C;QAChD,gBAAgB,EAAE,GAAG;QACrB,gBAAgB,EAAE,GAAG;QACrB,KAAK,EAAE,oBAAoB;KAC5B;IACD;QACE,WAAW,EAAE,SAAS;QACtB,aAAa,EAAE,GAAG;QAClB,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,QAAQ;QAC3B,IAAI,EAAE,4CAA4C;QAClD,GA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;QAClC,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE;YACX,IAAI,EAAE,4CAA4C;YAClD,IAAI,EAAE,IAAI;YACV,GAAG,EAAE,SAAS;YACd,QAAQ,EAAE,aAAa;YACvB,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,MAAM;YACb,EAAE,EAAE,4CAA4C;YAChD,KAAK,EAAE,oBAAoB;SAC5B;QACD,eAAe,EAAE,SAAS;QAC1B,eAAe,EAAE,KAAK;KACvB;CACF,CAAC;AAxCW,QAAA,0CAA0C,8CAwCrD","sourcesContent":["import { toHex } from '@metamask/controller-utils';\nimport { TransactionMeta, TransactionStatus } from '../TransactionController';\n\nexport const ethTxsMock = (ethTxHash: string) => [\n {\n blockNumber: '4535101',\n confirmations: '10',\n contractAddress: '',\n cumulativeGasUsed: '120607',\n from: '0xe46abaf75cfbff815c0b7ffed6f02b0760ea27f1',\n gas: '335208',\n gasPrice: '10000000000',\n gasUsed: '21000',\n hash: ethTxHash,\n input: '0x',\n isError: '0',\n nonce: '9',\n timeStamp: '1543596286',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n transactionIndex: '2',\n txreceipt_status: '1',\n value: '100000000000000000',\n },\n {\n blockNumber: '4535108',\n confirmations: '3',\n contractAddress: '',\n cumulativeGasUsed: '693910',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n gas: '335208',\n gasPrice: '20000000000',\n gasUsed: '21000',\n hash: '0x342e9d73e10004af41d04973339fc7219dbadcbb5629730cfe65e9f9cb15ff92',\n input: '0x',\n isError: '0',\n nonce: '0',\n timeStamp: '1543596378',\n to: '0xb2d191b6fe03c5b8a1ab249cfe88c37553357a23',\n transactionIndex: '12',\n txreceipt_status: '1',\n value: '50000000000000000',\n },\n {\n blockNumber: '4535105',\n confirmations: '4',\n contractAddress: '',\n cumulativeGasUsed: '693910',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n gas: '335208',\n gasPrice: '20000000000',\n gasUsed: '21000',\n hash: '0x342e9d73e10004af41d04973339fc7219dbadcbb5629730cfe65e9f9cb15ff91',\n input: '0x',\n isError: '0',\n nonce: '1',\n timeStamp: '1543596356',\n transactionIndex: '13',\n txreceipt_status: '1',\n value: '50000000000000000',\n },\n {\n blockNumber: '4535106',\n confirmations: '4',\n contractAddress: '',\n cumulativeGasUsed: '693910',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n gas: '335208',\n gasPrice: '20000000000',\n gasUsed: '21000',\n hash: '0x342e9d73e10004af41d04973139fc7219dbadcbb5629730cfe65e9f9cb15ff91',\n input: '0x11',\n isError: '0',\n nonce: '3',\n timeStamp: '1543596356',\n to: '0xb2d191b6fe03c5b8a1ab249cfe88c37553357a23',\n transactionIndex: '13',\n txreceipt_status: '1',\n value: '50000000000000000',\n },\n];\n\nexport const tokenTxsMock = (tokenTxHash: string) => [\n {\n blockNumber: '8222239',\n timeStamp: '1564091067',\n hash: tokenTxHash,\n nonce: '2329',\n blockHash:\n '0x3c30a9be9aea7be13caad419444140c11839d72e70479ec7e9c6d8bd08c533bc',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '69',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: '21000',\n cumulativeGasUsed: '3203881',\n input: 'deprecated',\n confirmations: '3659676',\n },\n {\n blockNumber: '8222250',\n timeStamp: '1564091247',\n hash: '0xdcd1c8bee545d3f76d80b20a23ad44276ba2e376681228eb4570cf3518491279',\n nonce: '2330',\n blockHash:\n '0x16986dd66bedb20a5b846ec2b6c0ecaa62f1c4b51fac58c1326101fd9126dd82',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '40',\n gas: '594268',\n gasPrice: '20000000000',\n gasUsed: '579268',\n cumulativeGasUsed: '2009011',\n input: 'deprecated',\n confirmations: '3659665',\n },\n {\n blockNumber: '8223771',\n timeStamp: '1564111652',\n hash: '0x070369e6f560b0deca52e050ff1a961fa7b688bbec5cea08435921c9d9b0f52e',\n nonce: '2333',\n blockHash:\n '0x0aff8b36881be99df6d176d7c64c2171672c0483684a10c112d2c90fefe30a0a',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '132',\n gas: '583810',\n gasPrice: '6000000000',\n gasUsed: '568810',\n cumulativeGasUsed: '6956245',\n input: 'deprecated',\n confirmations: '3658144',\n },\n {\n blockNumber: '8224850',\n timeStamp: '1564126442',\n hash: '0x8ef20ec9597c8c2e945bcc76d2668e5d3bb088b081fe8c5b5af2e1cbd315a20f',\n nonce: '31',\n blockHash:\n '0xb80d4d861ecb7a3cb14e591c0aaeb226842d0267772affa2acc1a590c7535647',\n from: '0x6c70e3563cef0c6835703bb2664c9f59a92353e4',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '10000000000000000000',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '169',\n gas: '78447',\n gasPrice: '2000000000',\n gasUsed: '52298',\n cumulativeGasUsed: '7047823',\n input: 'deprecated',\n confirmations: '3657065',\n },\n {\n blockNumber: '8228053',\n timeStamp: '1564168901',\n hash: '0xa0f2d7b558bb3cc28fa568f6feb8ed30eb28a01a674d7c0d4ae603fc691e6020',\n nonce: '2368',\n blockHash:\n '0x62c515ea049842c968ca67499f47a32a11394364d319d9c9cc0a0211652a7294',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '43',\n gas: '567156',\n gasPrice: '3000000000',\n gasUsed: '552156',\n cumulativeGasUsed: '3048261',\n input: 'deprecated',\n confirmations: '3653862',\n },\n {\n blockNumber: '8315335',\n timeStamp: '1565339223',\n hash: '0x464df60fe00b6dd04c9e8ab341d02af9b10a619d2fcd60fd2971f10edf12118f',\n nonce: '206760',\n blockHash:\n '0x98275388ef6708debe35ac7bf2e30143c9b1fd9e0e457ca03598fc1f4209e273',\n from: '0x00cfbbaf7ddb3a1476767101c12a0162e241fbad',\n contractAddress: '0x4dc3643dbc642b72c158e7f3d2ff232df61cb6ce',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n tokenName: 'Amber',\n tokenSymbol: 'AMB',\n tokenDecimal: '18',\n transactionIndex: '186',\n gas: '60000',\n gasPrice: '2000000000',\n gasUsed: '52108',\n cumulativeGasUsed: '7490707',\n input: 'deprecated',\n confirmations: '3566580',\n },\n {\n blockNumber: '8350846',\n timeStamp: '1565815049',\n hash: '0xc0682327ad3efd56dfa33e8206b4e09efad4e419a6191076069d217e3ee2341f',\n nonce: '2506',\n blockHash:\n '0xd0aa3c0e319fdfeb21b0192cf77b9760b8668060a5977a5f10f8413531083afa',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '4',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '48',\n gas: '578737',\n gasPrice: '3000000000',\n gasUsed: '518737',\n cumulativeGasUsed: '2848015',\n input: 'deprecated',\n confirmations: '3531069',\n },\n {\n blockNumber: '8350859',\n timeStamp: '1565815221',\n hash: '0x989ea9f3ee576fa43957f44363e839adf1a4a397c3d8392a4f7cbbf7949fd0ae',\n nonce: '2',\n blockHash:\n '0xb9cf1d29c665c052e3831b5754903e539c5b0b1d33b8bcab6cd2d450764d601f',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x09cabec1ead1c0ba254b09efb3ee13841712be14',\n value: '10000000000000000000',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '31',\n gas: '60734',\n gasPrice: '1000000000',\n gasUsed: '54745',\n cumulativeGasUsed: '7833857',\n input: 'deprecated',\n confirmations: '3531056',\n },\n {\n blockNumber: '8679548',\n timeStamp: '1570244087',\n hash: '0xc0016b89b3b525b30d73f242653b0d80ec3ebf285376dff5bb52cef3261498b2',\n nonce: '3',\n blockHash:\n '0x1ceb2f8b83087f010773e2acf63d1526633c8a884bd1980f118a1bba576be69f',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '56',\n gas: '993379',\n gasPrice: '1440000000',\n gasUsed: '647253',\n cumulativeGasUsed: '3562204',\n input: 'deprecated',\n confirmations: '3202367',\n },\n {\n blockNumber: '8679548',\n timeStamp: '1570244087',\n hash: '0xc0016b89b3b525b30d73f242653b0d80ec3ebf285376dff5bb52cef3261498b2',\n nonce: '3',\n blockHash:\n '0x1ceb2f8b83087f010773e2acf63d1526633c8a884bd1980f118a1bba576be69f',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '56',\n gas: '993379',\n gasPrice: '1440000000',\n gasUsed: '647253',\n cumulativeGasUsed: '3562204',\n input: 'deprecated',\n confirmations: '3202367',\n },\n {\n blockNumber: '8694142',\n timeStamp: '1570440625',\n hash: '0xd8397138bb93d56e50d01e92a9eae99ebd3ae28844acdaa4663976a5501116cf',\n nonce: '2837',\n blockHash:\n '0xba45dd64e71e146066af9b6d2dd3bc5d72f4a3399148c155dced74c139fc3c51',\n from: '0xdfa6edae2ec0cf1d4a60542422724a48195a5071',\n contractAddress: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '0',\n tokenName: 'Sai Stablecoin v1.0',\n tokenSymbol: 'SAI',\n tokenDecimal: '18',\n transactionIndex: '217',\n gas: '600632',\n gasPrice: '9000000000',\n gasUsed: '570632',\n cumulativeGasUsed: '9023725',\n input: 'deprecated',\n confirmations: '3187773',\n },\n {\n blockNumber: '10877041',\n timeStamp: '1600310867',\n hash: '0xc8bd16b6b41b4c24849eb6869702e1489c808cb5b125b01f084e38fefcb5ea77',\n nonce: '4',\n blockHash:\n '0x7fa16a022bcf1f69c2d7adf6bd7d3f058e808eec5c66aaa910dfa8016a5333d1',\n from: '0x090d4613473dee047c3f2706764f49e0821d256e',\n contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '400000000000000000000',\n tokenName: 'Uniswap',\n tokenSymbol: 'UNI',\n tokenDecimal: '18',\n transactionIndex: '42',\n gas: '90038',\n gasPrice: '550000000000',\n gasUsed: '81853',\n cumulativeGasUsed: '3163540',\n input: 'deprecated',\n confirmations: '1004874',\n },\n {\n blockNumber: '10877897',\n timeStamp: '1600321973',\n hash: '0xa7162489faef826ee77862ed5210b01726524f09428f69842118dad394842d62',\n nonce: '6',\n blockHash:\n '0xa74eb9d16f65f307dde4ce58c813c981b28f242edf1090ee2ac42caac9dccaca',\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n contractAddress: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',\n to: '0x5e736f1f25992b2cad20ded179a52823d3d24b26',\n value: '400000000000000000000',\n tokenName: 'Uniswap',\n tokenSymbol: 'UNI',\n tokenDecimal: '18',\n transactionIndex: '86',\n gas: '60759',\n gasPrice: '640000000000',\n gasUsed: '25506',\n cumulativeGasUsed: '4408393',\n input: 'deprecated',\n confirmations: '1004018',\n },\n];\n\nexport const txsInStateMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: '21000',\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: '0x5208',\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n\nexport const txsInStateWithOutdatedStatusMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: '21000',\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: '0x5208',\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n\nexport const txsInStateWithOutdatedGasDataMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.confirmed,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n\nexport const txsInStateWithOutdatedStatusAndGasDataMock = (\n ethTxHash: string,\n tokenTxHash: string,\n): TransactionMeta[] => [\n {\n id: 'token-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '624874',\n gasPrice: '20000000000',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x881d40237659c251811cec9c364ef91dc08d300c',\n value: '0x0',\n },\n transactionHash: tokenTxHash,\n toSmartContract: true,\n },\n {\n id: 'eth-transaction-id',\n chainId: toHex(1),\n status: TransactionStatus.rejected,\n time: 1615497996125,\n transaction: {\n from: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n data: '0x',\n gas: '0x51d68',\n gasPrice: '0x2540be400',\n gasUsed: undefined,\n nonce: '0x12',\n to: '0x6bf137f335ea1b8f193b8f6ea92561a60d23a207',\n value: '100000000000000000',\n },\n transactionHash: ethTxHash,\n toSmartContract: false,\n },\n];\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/transaction-controller",
3
- "version": "5.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Stores transactions alongside their periodically updated statuses and manages interactions such as approval and cancellation",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -31,9 +31,11 @@
31
31
  "dependencies": {
32
32
  "@ethereumjs/common": "^2.6.1",
33
33
  "@ethereumjs/tx": "^3.5.2",
34
- "@metamask/base-controller": "^2.0.0",
35
- "@metamask/controller-utils": "^3.4.0",
36
- "@metamask/network-controller": "^8.0.0",
34
+ "@metamask/approval-controller": "^3.3.0",
35
+ "@metamask/base-controller": "^3.0.0",
36
+ "@metamask/controller-utils": "^4.0.1",
37
+ "@metamask/network-controller": "^10.2.0",
38
+ "@metamask/utils": "^5.0.2",
37
39
  "async-mutex": "^0.2.6",
38
40
  "babel-runtime": "^6.26.0",
39
41
  "eth-method-registry": "1.1.0",
@@ -46,7 +48,7 @@
46
48
  "devDependencies": {
47
49
  "@metamask/auto-changelog": "^3.1.0",
48
50
  "@types/jest": "^27.4.1",
49
- "@types/node": "^14.14.31",
51
+ "@types/node": "^16.18.24",
50
52
  "deepmerge": "^4.2.2",
51
53
  "ethjs-provider-http": "^0.1.6",
52
54
  "jest": "^27.5.1",
@@ -56,8 +58,12 @@
56
58
  "typedoc-plugin-missing-exports": "^0.22.6",
57
59
  "typescript": "~4.6.3"
58
60
  },
61
+ "peerDependencies": {
62
+ "@metamask/approval-controller": "^3.3.0",
63
+ "@metamask/network-controller": "^10.2.0"
64
+ },
59
65
  "engines": {
60
- "node": ">=14.0.0"
66
+ "node": ">=16.0.0"
61
67
  },
62
68
  "publishConfig": {
63
69
  "access": "public",