@metamask-previews/transaction-controller 45.1.0-preview-1a21f764 → 45.1.0-preview-12ba192

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 (61) hide show
  1. package/dist/TransactionController.cjs +4 -44
  2. package/dist/TransactionController.cjs.map +1 -1
  3. package/dist/TransactionController.d.cts +3 -20
  4. package/dist/TransactionController.d.cts.map +1 -1
  5. package/dist/TransactionController.d.mts +3 -20
  6. package/dist/TransactionController.d.mts.map +1 -1
  7. package/dist/TransactionController.mjs +4 -44
  8. package/dist/TransactionController.mjs.map +1 -1
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.cts.map +1 -1
  12. package/dist/index.d.mts +1 -1
  13. package/dist/index.d.mts.map +1 -1
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/types.cjs.map +1 -1
  16. package/dist/types.d.cts +0 -46
  17. package/dist/types.d.cts.map +1 -1
  18. package/dist/types.d.mts +0 -46
  19. package/dist/types.d.mts.map +1 -1
  20. package/dist/types.mjs.map +1 -1
  21. package/dist/utils/eip7702.cjs +1 -71
  22. package/dist/utils/eip7702.cjs.map +1 -1
  23. package/dist/utils/eip7702.d.cts +1 -38
  24. package/dist/utils/eip7702.d.cts.map +1 -1
  25. package/dist/utils/eip7702.d.mts +1 -38
  26. package/dist/utils/eip7702.d.mts.map +1 -1
  27. package/dist/utils/eip7702.mjs +2 -69
  28. package/dist/utils/eip7702.mjs.map +1 -1
  29. package/dist/utils/validation.cjs +3 -11
  30. package/dist/utils/validation.cjs.map +1 -1
  31. package/dist/utils/validation.d.cts +2 -4
  32. package/dist/utils/validation.d.cts.map +1 -1
  33. package/dist/utils/validation.d.mts +2 -4
  34. package/dist/utils/validation.d.mts.map +1 -1
  35. package/dist/utils/validation.mjs +3 -11
  36. package/dist/utils/validation.mjs.map +1 -1
  37. package/package.json +2 -4
  38. package/dist/abi/SimpleDelegateContract.cjs +0 -50
  39. package/dist/abi/SimpleDelegateContract.cjs.map +0 -1
  40. package/dist/abi/SimpleDelegateContract.d.cts +0 -37
  41. package/dist/abi/SimpleDelegateContract.d.cts.map +0 -1
  42. package/dist/abi/SimpleDelegateContract.d.mts +0 -37
  43. package/dist/abi/SimpleDelegateContract.d.mts.map +0 -1
  44. package/dist/abi/SimpleDelegateContract.mjs +0 -47
  45. package/dist/abi/SimpleDelegateContract.mjs.map +0 -1
  46. package/dist/utils/batch.cjs +0 -83
  47. package/dist/utils/batch.cjs.map +0 -1
  48. package/dist/utils/batch.d.cts +0 -32
  49. package/dist/utils/batch.d.cts.map +0 -1
  50. package/dist/utils/batch.d.mts +0 -32
  51. package/dist/utils/batch.d.mts.map +0 -1
  52. package/dist/utils/batch.mjs +0 -78
  53. package/dist/utils/batch.mjs.map +0 -1
  54. package/dist/utils/feature-flags.cjs +0 -53
  55. package/dist/utils/feature-flags.cjs.map +0 -1
  56. package/dist/utils/feature-flags.d.cts +0 -34
  57. package/dist/utils/feature-flags.d.cts.map +0 -1
  58. package/dist/utils/feature-flags.d.mts +0 -34
  59. package/dist/utils/feature-flags.d.mts.map +0 -1
  60. package/dist/utils/feature-flags.mjs +0 -47
  61. package/dist/utils/feature-flags.mjs.map +0 -1
@@ -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,10 +354,8 @@ 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,
@@ -413,7 +381,6 @@ class TransactionController extends base_controller_1.BaseController {
413
381
  deviceConfirmedOn,
414
382
  id: (0, uuid_1.v1)(),
415
383
  isFirstTimeInteraction: undefined,
416
- nestedTransactions,
417
384
  networkClientId,
418
385
  origin,
419
386
  securityAlertResponse,
@@ -1256,7 +1223,7 @@ class TransactionController extends base_controller_1.BaseController {
1256
1223
  }
1257
1224
  });
1258
1225
  this.onTransactionStatusChange(transactionMeta);
1259
- 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));
1260
1227
  if (!this.beforePublish(transactionMeta)) {
1261
1228
  (0, logger_1.projectLogger)('Skipping publishing transaction based on hook');
1262
1229
  this.messagingSystem.publish(`${controllerName}:transactionPublishingSkipped`, transactionMeta);
@@ -1623,8 +1590,7 @@ class TransactionController extends base_controller_1.BaseController {
1623
1590
  const currentAccountIsEIP1559Compatible = await this.getCurrentAccountEIP1559Compatibility();
1624
1591
  return (currentNetworkIsEIP1559Compatible && currentAccountIsEIP1559Compatible);
1625
1592
  }
1626
- async signTransaction(transactionMeta) {
1627
- const { txParams } = transactionMeta;
1593
+ async signTransaction(transactionMeta, txParams) {
1628
1594
  (0, logger_1.projectLogger)('Signing transaction', txParams);
1629
1595
  const { authorizationList, from } = txParams;
1630
1596
  const finalTxParams = { ...txParams };
@@ -1653,7 +1619,6 @@ class TransactionController extends base_controller_1.BaseController {
1653
1619
  const transactionMetaWithRsv = {
1654
1620
  ...this.updateTransactionMetaRSV(transactionMetaFromHook, signedTx),
1655
1621
  status: types_1.TransactionStatus.signed,
1656
- txParams: finalTxParams,
1657
1622
  };
1658
1623
  this.updateTransaction(transactionMetaWithRsv, 'TransactionController#approveTransaction - Transaction signed');
1659
1624
  this.onTransactionStatusChange(transactionMetaWithRsv);
@@ -1999,11 +1964,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
1999
1964
  });
2000
1965
  }, _TransactionController_getSelectedAccount = function _TransactionController_getSelectedAccount() {
2001
1966
  return this.messagingSystem.call('AccountsController:getSelectedAccount');
2002
- }, _TransactionController_getInternalAccounts = function _TransactionController_getInternalAccounts() {
2003
- const state = this.messagingSystem.call('AccountsController:getState');
2004
- return Object.values(state.internalAccounts?.accounts ?? {})
2005
- .filter((account) => account.type === 'eip155:eoa')
2006
- .map((account) => account.address);
2007
1967
  }, _TransactionController_updateSubmitHistory = function _TransactionController_updateSubmitHistory(transactionMeta, hash) {
2008
1968
  const { chainId, networkClientId, origin, rawTx, txParams } = transactionMeta;
2009
1969
  const { networkConfigurationsByChainId } = this.getNetworkState();