@metamask-previews/transaction-controller 45.1.0-preview-ee98fad1 → 45.1.0-preview-df91d059

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 (64) hide show
  1. package/CHANGELOG.md +0 -21
  2. package/dist/TransactionController.cjs +4 -45
  3. package/dist/TransactionController.cjs.map +1 -1
  4. package/dist/TransactionController.d.cts +3 -20
  5. package/dist/TransactionController.d.cts.map +1 -1
  6. package/dist/TransactionController.d.mts +3 -20
  7. package/dist/TransactionController.d.mts.map +1 -1
  8. package/dist/TransactionController.mjs +4 -45
  9. package/dist/TransactionController.mjs.map +1 -1
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.cts +1 -1
  12. package/dist/index.d.cts.map +1 -1
  13. package/dist/index.d.mts +1 -1
  14. package/dist/index.d.mts.map +1 -1
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/types.cjs +0 -5
  17. package/dist/types.cjs.map +1 -1
  18. package/dist/types.d.cts +0 -51
  19. package/dist/types.d.cts.map +1 -1
  20. package/dist/types.d.mts +0 -51
  21. package/dist/types.d.mts.map +1 -1
  22. package/dist/types.mjs +0 -5
  23. package/dist/types.mjs.map +1 -1
  24. package/dist/utils/eip7702.cjs +1 -74
  25. package/dist/utils/eip7702.cjs.map +1 -1
  26. package/dist/utils/eip7702.d.cts +1 -38
  27. package/dist/utils/eip7702.d.cts.map +1 -1
  28. package/dist/utils/eip7702.d.mts +1 -38
  29. package/dist/utils/eip7702.d.mts.map +1 -1
  30. package/dist/utils/eip7702.mjs +2 -72
  31. package/dist/utils/eip7702.mjs.map +1 -1
  32. package/dist/utils/validation.cjs +4 -15
  33. package/dist/utils/validation.cjs.map +1 -1
  34. package/dist/utils/validation.d.cts +3 -7
  35. package/dist/utils/validation.d.cts.map +1 -1
  36. package/dist/utils/validation.d.mts +3 -7
  37. package/dist/utils/validation.d.mts.map +1 -1
  38. package/dist/utils/validation.mjs +5 -16
  39. package/dist/utils/validation.mjs.map +1 -1
  40. package/package.json +3 -5
  41. package/dist/abi/IERC7821.cjs +0 -23
  42. package/dist/abi/IERC7821.cjs.map +0 -1
  43. package/dist/abi/IERC7821.d.cts +0 -16
  44. package/dist/abi/IERC7821.d.cts.map +0 -1
  45. package/dist/abi/IERC7821.d.mts +0 -16
  46. package/dist/abi/IERC7821.d.mts.map +0 -1
  47. package/dist/abi/IERC7821.mjs +0 -20
  48. package/dist/abi/IERC7821.mjs.map +0 -1
  49. package/dist/utils/batch.cjs +0 -84
  50. package/dist/utils/batch.cjs.map +0 -1
  51. package/dist/utils/batch.d.cts +0 -32
  52. package/dist/utils/batch.d.cts.map +0 -1
  53. package/dist/utils/batch.d.mts +0 -32
  54. package/dist/utils/batch.d.mts.map +0 -1
  55. package/dist/utils/batch.mjs +0 -79
  56. package/dist/utils/batch.mjs.map +0 -1
  57. package/dist/utils/feature-flags.cjs +0 -53
  58. package/dist/utils/feature-flags.cjs.map +0 -1
  59. package/dist/utils/feature-flags.d.cts +0 -34
  60. package/dist/utils/feature-flags.d.cts.map +0 -1
  61. package/dist/utils/feature-flags.d.mts +0 -34
  62. package/dist/utils/feature-flags.d.mts.map +0 -1
  63. package/dist/utils/feature-flags.mjs +0 -47
  64. package/dist/utils/feature-flags.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,27 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
11
-
12
- - Support atomic batch transactions ([#5306](https://github.com/MetaMask/core/pull/5306))
13
- - Add methods:
14
- - `addTransactionBatch`
15
- - `isAtomicBatchSupported`
16
- - Add `batch` to `TransactionType`.
17
- - Add `nestedTransactions` to `TransactionMeta`.
18
- - Add new types:
19
- - `BatchTransactionParams`
20
- - `TransactionBatchSingleRequest`
21
- - `TransactionBatchRequest`
22
- - `TransactionBatchResult`
23
- - Add dependency on `@metamask/remote-feature-flag-controller:^1.4.0`.
24
-
25
- ### Changed
26
-
27
- - **BREAKING:** Support atomic batch transactions ([#5306](https://github.com/MetaMask/core/pull/5306))
28
- - Require `AccountsController:getState` action permission in messenger.
29
- - Require `RemoteFeatureFlagController:getState` action permission in messenger.
30
-
31
10
  ## [45.1.0]
32
11
 
33
12
  ### Added
@@ -13,7 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _TransactionController_instances, _TransactionController_internalEvents, _TransactionController_methodDataHelper, _TransactionController_incomingTransactionChainIds, _TransactionController_incomingTransactionHelper, _TransactionController_incomingTransactionOptions, _TransactionController_pendingTransactionOptions, _TransactionController_trace, _TransactionController_transactionHistoryLimit, _TransactionController_isFirstTimeInteractionEnabled, _TransactionController_isSimulationEnabled, _TransactionController_testGasFeeFlows, _TransactionController_multichainTrackingHelper, _TransactionController_retryTransaction, _TransactionController_getChainId, _TransactionController_getNetworkClientId, _TransactionController_getEthQuery, _TransactionController_getProvider, _TransactionController_createNonceTracker, _TransactionController_createPendingTransactionTracker, _TransactionController_checkForPendingTransactionAndStartPolling, _TransactionController_stopAllTracking, _TransactionController_addIncomingTransactionHelperListeners, _TransactionController_removePendingTransactionTrackerListeners, _TransactionController_addPendingTransactionTrackerListeners, _TransactionController_getNonceTrackerPendingTransactions, _TransactionController_getGasFeeFlows, _TransactionController_getLayer1GasFeeFlows, _TransactionController_updateTransactionInternal, _TransactionController_updateFirstTimeInteraction, _TransactionController_updateSimulationData, _TransactionController_onGasFeePollerTransactionUpdate, _TransactionController_getSelectedAccount, _TransactionController_getInternalAccounts, _TransactionController_updateSubmitHistory;
16
+ var _TransactionController_instances, _TransactionController_internalEvents, _TransactionController_methodDataHelper, _TransactionController_incomingTransactionChainIds, _TransactionController_incomingTransactionHelper, _TransactionController_incomingTransactionOptions, _TransactionController_pendingTransactionOptions, _TransactionController_trace, _TransactionController_transactionHistoryLimit, _TransactionController_isFirstTimeInteractionEnabled, _TransactionController_isSimulationEnabled, _TransactionController_testGasFeeFlows, _TransactionController_multichainTrackingHelper, _TransactionController_retryTransaction, _TransactionController_getChainId, _TransactionController_getNetworkClientId, _TransactionController_getEthQuery, _TransactionController_getProvider, _TransactionController_createNonceTracker, _TransactionController_createPendingTransactionTracker, _TransactionController_checkForPendingTransactionAndStartPolling, _TransactionController_stopAllTracking, _TransactionController_addIncomingTransactionHelperListeners, _TransactionController_removePendingTransactionTrackerListeners, _TransactionController_addPendingTransactionTrackerListeners, _TransactionController_getNonceTrackerPendingTransactions, _TransactionController_getGasFeeFlows, _TransactionController_getLayer1GasFeeFlows, _TransactionController_updateTransactionInternal, _TransactionController_updateFirstTimeInteraction, _TransactionController_updateSimulationData, _TransactionController_onGasFeePollerTransactionUpdate, _TransactionController_getSelectedAccount, _TransactionController_updateSubmitHistory;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.TransactionController = exports.ApprovalState = exports.SPEED_UP_RATE = exports.CANCEL_RATE = void 0;
19
19
  const base_controller_1 = require("@metamask/base-controller");
@@ -43,7 +43,6 @@ const MultichainTrackingHelper_1 = require("./helpers/MultichainTrackingHelper.c
43
43
  const PendingTransactionTracker_1 = require("./helpers/PendingTransactionTracker.cjs");
44
44
  const logger_1 = require("./logger.cjs");
45
45
  const types_1 = require("./types.cjs");
46
- const batch_1 = require("./utils/batch.cjs");
47
46
  const eip7702_1 = require("./utils/eip7702.cjs");
48
47
  const external_transactions_1 = require("./utils/external-transactions.cjs");
49
48
  const gas_1 = require("./utils/gas.cjs");
@@ -322,34 +321,6 @@ class TransactionController extends base_controller_1.BaseController {
322
321
  async handleMethodData(fourBytePrefix, networkClientId) {
323
322
  return __classPrivateFieldGet(this, _TransactionController_methodDataHelper, "f").lookup(fourBytePrefix, networkClientId);
324
323
  }
325
- /**
326
- * Add a batch of transactions to be submitted after approval.
327
- *
328
- * @param request - Request object containing the transactions to add.
329
- * @returns Result object containing the generated batch ID.
330
- */
331
- async addTransactionBatch(request) {
332
- return await (0, batch_1.addTransactionBatch)({
333
- addTransaction: this.addTransaction.bind(this),
334
- getChainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).bind(this),
335
- getEthQuery: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId }),
336
- messenger: this.messagingSystem,
337
- request,
338
- });
339
- }
340
- /**
341
- * Determine which chains support atomic batch transactions with the given account address.
342
- *
343
- * @param address - The address of the account to check.
344
- * @returns The supported chain IDs.
345
- */
346
- async isAtomicBatchSupported(address) {
347
- return (0, batch_1.isAtomicBatchSupported)({
348
- address,
349
- getEthQuery: (chainId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { chainId }),
350
- messenger: this.messagingSystem,
351
- });
352
- }
353
324
  /**
354
325
  * Add a new unapproved transaction to state. Parameters will be validated, a
355
326
  * unique transaction id will be generated, and gas and gasPrice will be calculated
@@ -360,7 +331,6 @@ class TransactionController extends base_controller_1.BaseController {
360
331
  * @param options.actionId - Unique ID to prevent duplicate requests.
361
332
  * @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
362
333
  * @param options.method - RPC method that requested the transaction.
363
- * @param options.nestedTransactions - Params for any nested transactions encoded in the data.
364
334
  * @param options.origin - The origin of the transaction request, such as a dApp hostname.
365
335
  * @param options.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.
366
336
  * @param options.securityAlertResponse - Response from security validator.
@@ -375,7 +345,7 @@ class TransactionController extends base_controller_1.BaseController {
375
345
  */
376
346
  async addTransaction(txParams, options) {
377
347
  (0, logger_1.projectLogger)('Adding transaction', txParams, options);
378
- const { actionId, deviceConfirmedOn, method, nestedTransactions, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
348
+ const { actionId, deviceConfirmedOn, method, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
379
349
  txParams = (0, utils_2.normalizeTransactionParams)(txParams);
380
350
  if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
381
351
  throw new Error(`Network client not found - ${networkClientId}`);
@@ -384,15 +354,12 @@ class TransactionController extends base_controller_1.BaseController {
384
354
  ? undefined
385
355
  : await this.getPermittedAccounts?.(origin);
386
356
  const selectedAddress = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getSelectedAccount).call(this).address;
387
- const internalAccounts = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getInternalAccounts).call(this);
388
357
  await (0, validation_1.validateTransactionOrigin)({
389
358
  from: txParams.from,
390
- internalAccounts,
391
359
  origin,
392
360
  permittedAddresses,
393
361
  selectedAddress,
394
362
  txParams,
395
- type,
396
363
  });
397
364
  const isEIP1559Compatible = await this.getEIP1559Compatibility(networkClientId);
398
365
  (0, validation_1.validateTxParams)(txParams, isEIP1559Compatible);
@@ -414,7 +381,6 @@ class TransactionController extends base_controller_1.BaseController {
414
381
  deviceConfirmedOn,
415
382
  id: (0, uuid_1.v1)(),
416
383
  isFirstTimeInteraction: undefined,
417
- nestedTransactions,
418
384
  networkClientId,
419
385
  origin,
420
386
  securityAlertResponse,
@@ -1257,7 +1223,7 @@ class TransactionController extends base_controller_1.BaseController {
1257
1223
  }
1258
1224
  });
1259
1225
  this.onTransactionStatusChange(transactionMeta);
1260
- const rawTx = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Sign', parentContext: traceContext }, () => this.signTransaction(transactionMeta));
1226
+ const rawTx = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Sign', parentContext: traceContext }, () => this.signTransaction(transactionMeta, transactionMeta.txParams));
1261
1227
  if (!this.beforePublish(transactionMeta)) {
1262
1228
  (0, logger_1.projectLogger)('Skipping publishing transaction based on hook');
1263
1229
  this.messagingSystem.publish(`${controllerName}:transactionPublishingSkipped`, transactionMeta);
@@ -1624,8 +1590,7 @@ class TransactionController extends base_controller_1.BaseController {
1624
1590
  const currentAccountIsEIP1559Compatible = await this.getCurrentAccountEIP1559Compatibility();
1625
1591
  return (currentNetworkIsEIP1559Compatible && currentAccountIsEIP1559Compatible);
1626
1592
  }
1627
- async signTransaction(transactionMeta) {
1628
- const { txParams } = transactionMeta;
1593
+ async signTransaction(transactionMeta, txParams) {
1629
1594
  (0, logger_1.projectLogger)('Signing transaction', txParams);
1630
1595
  const { authorizationList, from } = txParams;
1631
1596
  const finalTxParams = { ...txParams };
@@ -1654,7 +1619,6 @@ class TransactionController extends base_controller_1.BaseController {
1654
1619
  const transactionMetaWithRsv = {
1655
1620
  ...this.updateTransactionMetaRSV(transactionMetaFromHook, signedTx),
1656
1621
  status: types_1.TransactionStatus.signed,
1657
- txParams: finalTxParams,
1658
1622
  };
1659
1623
  this.updateTransaction(transactionMetaWithRsv, 'TransactionController#approveTransaction - Transaction signed');
1660
1624
  this.onTransactionStatusChange(transactionMetaWithRsv);
@@ -2000,11 +1964,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
2000
1964
  });
2001
1965
  }, _TransactionController_getSelectedAccount = function _TransactionController_getSelectedAccount() {
2002
1966
  return this.messagingSystem.call('AccountsController:getSelectedAccount');
2003
- }, _TransactionController_getInternalAccounts = function _TransactionController_getInternalAccounts() {
2004
- const state = this.messagingSystem.call('AccountsController:getState');
2005
- return Object.values(state.internalAccounts?.accounts ?? {})
2006
- .filter((account) => account.type === 'eip155:eoa')
2007
- .map((account) => account.address);
2008
1967
  }, _TransactionController_updateSubmitHistory = function _TransactionController_updateSubmitHistory(transactionMeta, hash) {
2009
1968
  const { chainId, networkClientId, origin, rawTx, txParams } = transactionMeta;
2010
1969
  const { networkConfigurationsByChainId } = this.getNetworkState();