@metamask-previews/transaction-controller 65.4.0-preview-b6651eda2 → 66.0.0-preview-1275d0fda

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 (56) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/TransactionController.cjs +7 -5
  3. package/dist/TransactionController.cjs.map +1 -1
  4. package/dist/TransactionController.d.cts.map +1 -1
  5. package/dist/TransactionController.d.mts.map +1 -1
  6. package/dist/TransactionController.mjs +7 -5
  7. package/dist/TransactionController.mjs.map +1 -1
  8. package/dist/helpers/GasFeePoller.d.cts +2 -0
  9. package/dist/helpers/GasFeePoller.d.cts.map +1 -1
  10. package/dist/helpers/GasFeePoller.d.mts +2 -0
  11. package/dist/helpers/GasFeePoller.d.mts.map +1 -1
  12. package/dist/helpers/IncomingTransactionHelper.d.cts +2 -0
  13. package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -1
  14. package/dist/helpers/IncomingTransactionHelper.d.mts +2 -0
  15. package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -1
  16. package/dist/helpers/MethodDataHelper.d.cts +2 -0
  17. package/dist/helpers/MethodDataHelper.d.cts.map +1 -1
  18. package/dist/helpers/MethodDataHelper.d.mts +2 -0
  19. package/dist/helpers/MethodDataHelper.d.mts.map +1 -1
  20. package/dist/helpers/PendingTransactionTracker.d.cts +2 -0
  21. package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
  22. package/dist/helpers/PendingTransactionTracker.d.mts +2 -0
  23. package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
  24. package/dist/types.cjs.map +1 -1
  25. package/dist/types.d.cts +8 -0
  26. package/dist/types.d.cts.map +1 -1
  27. package/dist/types.d.mts +8 -0
  28. package/dist/types.d.mts.map +1 -1
  29. package/dist/types.mjs.map +1 -1
  30. package/dist/utils/batch.cjs +7 -3
  31. package/dist/utils/batch.cjs.map +1 -1
  32. package/dist/utils/batch.d.cts.map +1 -1
  33. package/dist/utils/batch.d.mts.map +1 -1
  34. package/dist/utils/batch.mjs +7 -3
  35. package/dist/utils/batch.mjs.map +1 -1
  36. package/dist/utils/gas-fee-tokens.cjs +13 -10
  37. package/dist/utils/gas-fee-tokens.cjs.map +1 -1
  38. package/dist/utils/gas-fee-tokens.d.cts.map +1 -1
  39. package/dist/utils/gas-fee-tokens.d.mts.map +1 -1
  40. package/dist/utils/gas-fee-tokens.mjs +13 -10
  41. package/dist/utils/gas-fee-tokens.mjs.map +1 -1
  42. package/dist/utils/gas-fees.cjs +2 -2
  43. package/dist/utils/gas-fees.cjs.map +1 -1
  44. package/dist/utils/gas-fees.d.cts.map +1 -1
  45. package/dist/utils/gas-fees.d.mts.map +1 -1
  46. package/dist/utils/gas-fees.mjs +3 -3
  47. package/dist/utils/gas-fees.mjs.map +1 -1
  48. package/dist/utils/validation.cjs +15 -14
  49. package/dist/utils/validation.cjs.map +1 -1
  50. package/dist/utils/validation.d.cts +6 -2
  51. package/dist/utils/validation.d.cts.map +1 -1
  52. package/dist/utils/validation.d.mts +6 -2
  53. package/dist/utils/validation.d.mts.map +1 -1
  54. package/dist/utils/validation.mjs +16 -15
  55. package/dist/utils/validation.mjs.map +1 -1
  56. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [66.0.0]
11
+
12
+ ### Changed
13
+
14
+ - **BREAKING:** Replace implicit `origin === 'metamask'` trust checks with an explicit `isInternal` flag on `AddTransactionOptions`, `TransactionBatchRequest`, `TransactionMeta`, and `TransactionBatchMeta`; internal callers must now pass `isInternal: true` ([#8633](https://github.com/MetaMask/core/pull/8633))
15
+ - Bump `@metamask/core-backend` from `^6.2.2` to `^6.3.0` ([#8813](https://github.com/MetaMask/core/pull/8813))
16
+ - Bump `@metamask/gas-fee-controller` from `^26.2.1` to `^26.2.2` ([#8834](https://github.com/MetaMask/core/pull/8834))
17
+
18
+ ### Fixed
19
+
20
+ - Respect `excludeNativeTokenForFee` when publishing transactions with a selected gas fee token ([#8762](https://github.com/MetaMask/core/pull/8762))
21
+
10
22
  ## [65.4.0]
11
23
 
12
24
  ### Added
@@ -2431,7 +2443,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2431
2443
 
2432
2444
  All changes listed after this point were applied to this package following the monorepo conversion.
2433
2445
 
2434
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@65.4.0...HEAD
2446
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@66.0.0...HEAD
2447
+ [66.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@65.4.0...@metamask/transaction-controller@66.0.0
2435
2448
  [65.4.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@65.3.0...@metamask/transaction-controller@65.4.0
2436
2449
  [65.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@65.2.0...@metamask/transaction-controller@65.3.0
2437
2450
  [65.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@65.1.0...@metamask/transaction-controller@65.2.0
@@ -412,7 +412,7 @@ class TransactionController extends base_controller_1.BaseController {
412
412
  */
413
413
  async addTransaction(txParams, options) {
414
414
  (0, logger_1.projectLogger)('Adding transaction', txParams, options);
415
- const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, excludeNativeTokenForFee, isGasFeeIncluded, isGasFeeSponsored, isStateOnly, method, nestedTransactions, networkClientId, origin, publishHook, requestId, requiredAssets, requireApproval, securityAlertResponse, skipInitialGasEstimate, swaps = {}, traceContext, type, } = options;
415
+ const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, excludeNativeTokenForFee, isGasFeeIncluded, isGasFeeSponsored, isInternal = false, isStateOnly, method, nestedTransactions, networkClientId, origin, publishHook, requestId, requiredAssets, requireApproval, securityAlertResponse, skipInitialGasEstimate, swaps = {}, traceContext, type, } = options;
416
416
  // eslint-disable-next-line no-param-reassign
417
417
  txParams = (0, utils_2.normalizeTransactionParams)(txParams);
418
418
  if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
@@ -427,6 +427,7 @@ class TransactionController extends base_controller_1.BaseController {
427
427
  data: txParams.data,
428
428
  from: txParams.from,
429
429
  internalAccounts,
430
+ isInternal,
430
431
  origin,
431
432
  permittedAddresses,
432
433
  txParams,
@@ -441,10 +442,10 @@ class TransactionController extends base_controller_1.BaseController {
441
442
  }
442
443
  const isDuplicateBatchId = batchId?.length &&
443
444
  this.state.transactions.some((tx) => tx.batchId?.toLowerCase() === batchId?.toLowerCase());
444
- if (isDuplicateBatchId && origin && origin !== controller_utils_1.ORIGIN_METAMASK) {
445
+ if (isDuplicateBatchId && !isInternal) {
445
446
  throw new rpc_errors_1.JsonRpcError(validation_1.ErrorCode.DuplicateBundleId, 'Batch ID already exists');
446
447
  }
447
- const dappSuggestedGasFees = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_generateDappSuggestedGasFees).call(this, txParams, origin);
448
+ const dappSuggestedGasFees = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_generateDappSuggestedGasFees).call(this, txParams, origin, isInternal);
448
449
  const transactionType = type ??
449
450
  (await (0, transaction_type_1.determineTransactionType)(txParams, {
450
451
  messenger: this.messenger,
@@ -473,6 +474,7 @@ class TransactionController extends base_controller_1.BaseController {
473
474
  ? {}
474
475
  : { excludeNativeTokenForFee }),
475
476
  isFirstTimeInteraction: undefined,
477
+ isInternal,
476
478
  isStateOnly,
477
479
  nestedTransactions,
478
480
  networkClientId,
@@ -1947,8 +1949,8 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
1947
1949
  (0, logger_1.projectLogger)('Added incoming transactions to state', finalTransactions.length, finalTransactions);
1948
1950
  });
1949
1951
  this.messenger.publish(`${controllerName}:incomingTransactionsReceived`, finalTransactions);
1950
- }, _TransactionController_generateDappSuggestedGasFees = function _TransactionController_generateDappSuggestedGasFees(txParams, origin) {
1951
- if (!origin || origin === controller_utils_1.ORIGIN_METAMASK) {
1952
+ }, _TransactionController_generateDappSuggestedGasFees = function _TransactionController_generateDappSuggestedGasFees(txParams, origin, isInternal) {
1953
+ if (isInternal || !origin) {
1952
1954
  return undefined;
1953
1955
  }
1954
1956
  const { gasPrice, maxFeePerGas, maxPriorityFeePerGas, gas } = txParams;