@metamask-previews/transaction-controller 65.4.0-preview-784cc181c → 65.4.0-preview-3b99fcf40

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
@@ -9,7 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9
9
 
10
10
  ### Changed
11
11
 
12
+ - **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))
12
13
  - Bump `@metamask/core-backend` from `^6.2.2` to `^6.3.0` ([#8813](https://github.com/MetaMask/core/pull/8813))
14
+ - Bump `@metamask/gas-fee-controller` from `^26.2.1` to `^26.2.2` ([#8834](https://github.com/MetaMask/core/pull/8834))
13
15
 
14
16
  ### Fixed
15
17
 
@@ -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;