@metamask-previews/transaction-controller 43.0.0-preview-bd04b248 → 43.0.0-preview-455ba549

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +5 -5
  2. package/dist/TransactionController.cjs +3 -27
  3. package/dist/TransactionController.cjs.map +1 -1
  4. package/dist/TransactionController.d.cts +0 -6
  5. package/dist/TransactionController.d.cts.map +1 -1
  6. package/dist/TransactionController.d.mts +0 -6
  7. package/dist/TransactionController.d.mts.map +1 -1
  8. package/dist/TransactionController.mjs +1 -25
  9. package/dist/TransactionController.mjs.map +1 -1
  10. package/dist/constants.cjs +71 -1
  11. package/dist/constants.cjs.map +1 -1
  12. package/dist/constants.d.cts +35 -0
  13. package/dist/constants.d.cts.map +1 -1
  14. package/dist/constants.d.mts +35 -0
  15. package/dist/constants.d.mts.map +1 -1
  16. package/dist/constants.mjs +70 -0
  17. package/dist/constants.mjs.map +1 -1
  18. package/dist/helpers/MethodDataHelper.cjs +25 -22
  19. package/dist/helpers/MethodDataHelper.cjs.map +1 -1
  20. package/dist/helpers/MethodDataHelper.d.cts +2 -3
  21. package/dist/helpers/MethodDataHelper.d.cts.map +1 -1
  22. package/dist/helpers/MethodDataHelper.d.mts +2 -3
  23. package/dist/helpers/MethodDataHelper.d.mts.map +1 -1
  24. package/dist/helpers/MethodDataHelper.mjs +25 -22
  25. package/dist/helpers/MethodDataHelper.mjs.map +1 -1
  26. package/dist/types.cjs.map +1 -1
  27. package/dist/types.d.cts +0 -4
  28. package/dist/types.d.cts.map +1 -1
  29. package/dist/types.d.mts +0 -4
  30. package/dist/types.d.mts.map +1 -1
  31. package/dist/types.mjs.map +1 -1
  32. package/dist/{helpers/ResimulateHelper.cjs → utils/resimulate.cjs} +4 -99
  33. package/dist/utils/resimulate.cjs.map +1 -0
  34. package/dist/{helpers/ResimulateHelper.d.cts → utils/resimulate.d.cts} +1 -13
  35. package/dist/utils/resimulate.d.cts.map +1 -0
  36. package/dist/{helpers/ResimulateHelper.d.mts → utils/resimulate.d.mts} +1 -13
  37. package/dist/utils/resimulate.d.mts.map +1 -0
  38. package/dist/{helpers/ResimulateHelper.mjs → utils/resimulate.mjs} +5 -99
  39. package/dist/utils/resimulate.mjs.map +1 -0
  40. package/package.json +1 -2
  41. package/dist/helpers/ResimulateHelper.cjs.map +0 -1
  42. package/dist/helpers/ResimulateHelper.d.cts.map +0 -1
  43. package/dist/helpers/ResimulateHelper.d.mts.map +0 -1
  44. package/dist/helpers/ResimulateHelper.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,12 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
10
+ ### Changed
11
11
 
12
- - Adds ability of re-simulating transaction depending on the `isFocused` property on `transactionMeta` ([#5189](https://github.com/MetaMask/core/pull/5189))
13
- - `isFocused` property is expected to set by client.
14
- - Re-simulation of transactions will occur every 3 seconds if `isFocused` is `true`.
15
- - Adds `updateTransactionFocus` function to update the `isFocused` property on `transactionMeta`. ([#5189](https://github.com/MetaMask/core/pull/5189))
12
+ - Replaced `eth-method-registry` dependency with `@ethersproject/abi` for ABI method lookups ([#5203](https://github.com/MetaMask/core/pull/5203))
13
+ - The `MethodDataHelper` class now uses ethers.js `Interface` class to parse and lookup method signatures
14
+ - Method data is now derived directly from the ABI interface
15
+ - The structure of returned method data remains compatible with previous implementation
16
16
 
17
17
  ## [43.0.0]
18
18
 
@@ -44,7 +44,6 @@ const IncomingTransactionHelper_1 = require("./helpers/IncomingTransactionHelper
44
44
  const MethodDataHelper_1 = require("./helpers/MethodDataHelper.cjs");
45
45
  const MultichainTrackingHelper_1 = require("./helpers/MultichainTrackingHelper.cjs");
46
46
  const PendingTransactionTracker_1 = require("./helpers/PendingTransactionTracker.cjs");
47
- const ResimulateHelper_1 = require("./helpers/ResimulateHelper.cjs");
48
47
  const logger_1 = require("./logger.cjs");
49
48
  const types_1 = require("./types.cjs");
50
49
  const external_transactions_1 = require("./utils/external-transactions.cjs");
@@ -54,6 +53,7 @@ const gas_flow_1 = require("./utils/gas-flow.cjs");
54
53
  const history_1 = require("./utils/history.cjs");
55
54
  const layer1_gas_fee_flow_1 = require("./utils/layer1-gas-fee-flow.cjs");
56
55
  const nonce_1 = require("./utils/nonce.cjs");
56
+ const resimulate_1 = require("./utils/resimulate.cjs");
57
57
  const retry_1 = require("./utils/retry.cjs");
58
58
  const simulation_1 = require("./utils/simulation.cjs");
59
59
  const swaps_1 = require("./utils/swaps.cjs");
@@ -274,7 +274,6 @@ class TransactionController extends base_controller_1.BaseController {
274
274
  });
275
275
  gasFeePoller.hub.on('transaction-updated', __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_onGasFeePollerTransactionUpdate).bind(this));
276
276
  __classPrivateFieldSet(this, _TransactionController_methodDataHelper, new MethodDataHelper_1.MethodDataHelper({
277
- getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
278
277
  getState: () => this.state.methodData,
279
278
  }), "f");
280
279
  __classPrivateFieldGet(this, _TransactionController_methodDataHelper, "f").hub.on('update', ({ fourBytePrefix, methodData }) => {
@@ -304,13 +303,6 @@ class TransactionController extends base_controller_1.BaseController {
304
303
  // when transactionsController state changes
305
304
  // check for pending transactions and start polling if there are any
306
305
  this.messagingSystem.subscribe('TransactionController:stateChange', __classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f"));
307
- new ResimulateHelper_1.ResimulateHelper({
308
- updateSimulationData: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateSimulationData).bind(this),
309
- onStateChange: (listener) => {
310
- this.messagingSystem.subscribe('TransactionController:stateChange', listener);
311
- },
312
- getTransactions: () => this.state.transactions,
313
- });
314
306
  this.onBootCleanup();
315
307
  __classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f").call(this);
316
308
  }
@@ -796,22 +788,6 @@ class TransactionController extends base_controller_1.BaseController {
796
788
  this.updateTransaction(updatedTransaction, `Update Editable Params for ${txId}`);
797
789
  return this.getTransaction(txId);
798
790
  }
799
- /**
800
- * Update the isFocus state of a transaction.
801
- * @param transactionId - The ID of the transaction to update.
802
- * @param isFocused - The new focus state.
803
- */
804
- updateTransactionFocus(transactionId, isFocused) {
805
- const transactionMeta = this.getTransaction(transactionId);
806
- if (!transactionMeta) {
807
- throw new Error(`Transaction with id ${transactionId} not found`);
808
- }
809
- const updatedTransactionMeta = {
810
- ...transactionMeta,
811
- isFocused,
812
- };
813
- this.updateTransaction(updatedTransactionMeta, 'TransactionController#updateTransactionFocus - Transaction focus updated');
814
- }
815
791
  /**
816
792
  * Signs and returns the raw transaction data for provided transaction params list.
817
793
  *
@@ -1892,7 +1868,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1892
1868
  (0, validation_1.validateTxParams)(transactionMeta.txParams);
1893
1869
  }
1894
1870
  if (!skipResimulateCheck && __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this)) {
1895
- resimulateResponse = (0, ResimulateHelper_1.shouldResimulate)(originalTransactionMeta, transactionMeta);
1871
+ resimulateResponse = (0, resimulate_1.shouldResimulate)(originalTransactionMeta, transactionMeta);
1896
1872
  }
1897
1873
  const shouldSkipHistory = this.isHistoryDisabled || skipHistory;
1898
1874
  if (!shouldSkipHistory) {
@@ -1974,7 +1950,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1974
1950
  }));
1975
1951
  if (blockTime &&
1976
1952
  prevSimulationData &&
1977
- (0, ResimulateHelper_1.hasSimulationDataChanged)(prevSimulationData, simulationData)) {
1953
+ (0, resimulate_1.hasSimulationDataChanged)(prevSimulationData, simulationData)) {
1978
1954
  simulationData = {
1979
1955
  ...simulationData,
1980
1956
  isUpdatedAfterSecurityCheck: true,