@metamask-previews/transaction-controller 63.3.1-preview-de55719 → 63.3.1-preview-27fa5d81d

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
@@ -7,13 +7,14 @@ 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
- - Add optional `atomic` property to `TransactionBatchRequest` to configure whether EIP-7702 batch calls revert together or can fail independently ([#8320](https://github.com/MetaMask/core/pull/8320))
13
-
14
10
  ### Changed
15
11
 
16
12
  - Bump `@metamask/accounts-controller` from `^37.1.0` to `^37.1.1` ([#8325](https://github.com/MetaMask/core/pull/8325))
13
+ - Add extra parameters in types and change `addTransaction` behavior ([#8052](https://github.com/MetaMask/core/pull/8052))
14
+ - Add optional `excludeNativeTokenForFee` in `TransactionMeta` type.
15
+ - Add optional `actionId` and optional `excludeNativeTokenForFee` in `TransactionBatchRequest` type.
16
+ - Add optional `excludeNativeTokenForFee` to `AddTransactionOptions` type.
17
+ - Changed `isGasFeeTokenIgnoredIfBalance` to be false if `excludeNativeTokenForFee` is passed in `addTransaction`.
17
18
 
18
19
  ### Removed
19
20
 
@@ -405,7 +405,7 @@ class TransactionController extends base_controller_1.BaseController {
405
405
  */
406
406
  async addTransaction(txParams, options) {
407
407
  (0, logger_1.projectLogger)('Adding transaction', txParams, options);
408
- const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, isGasFeeIncluded, isGasFeeSponsored, isStateOnly, method, nestedTransactions, networkClientId, origin, publishHook, requestId, requiredAssets, requireApproval, securityAlertResponse, skipInitialGasEstimate, swaps = {}, traceContext, type, } = options;
408
+ 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;
409
409
  // eslint-disable-next-line no-param-reassign
410
410
  txParams = (0, utils_2.normalizeTransactionParams)(txParams);
411
411
  if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
@@ -443,6 +443,12 @@ class TransactionController extends base_controller_1.BaseController {
443
443
  messenger: this.messenger,
444
444
  networkClientId,
445
445
  })).type;
446
+ /**
447
+ * Original behavior was that this was set to 'true' whenever a gasFeeToken was passed.
448
+ * 'excludeNativeTokenForFee' optionally overrides this behavior to prevent native token from
449
+ * being used when another gasFeeToken is set.
450
+ */
451
+ const isGasFeeTokenIgnoredIfBalance = Boolean(gasFeeToken) && !excludeNativeTokenForFee;
446
452
  let addedTransactionMeta = {
447
453
  actionId,
448
454
  assetsFiatValues,
@@ -452,9 +458,13 @@ class TransactionController extends base_controller_1.BaseController {
452
458
  deviceConfirmedOn,
453
459
  disableGasBuffer,
454
460
  id: (0, uuid_1.v1)(),
455
- isGasFeeTokenIgnoredIfBalance: Boolean(gasFeeToken),
461
+ isGasFeeTokenIgnoredIfBalance,
456
462
  isGasFeeIncluded,
457
463
  isGasFeeSponsored,
464
+ // To avoid the property to be set as undefined.
465
+ ...(excludeNativeTokenForFee === undefined
466
+ ? {}
467
+ : { excludeNativeTokenForFee }),
458
468
  isFirstTimeInteraction: undefined,
459
469
  isStateOnly,
460
470
  nestedTransactions,