@metamask-previews/transaction-controller 63.0.0-preview-e9620906a → 63.0.0-preview-222195b7a
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 +5 -0
- package/dist/TransactionController.cjs +10 -2
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +10 -2
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +14 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +14 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +3 -1
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.mjs +3 -1
- package/dist/utils/batch.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
10
10
|
### Changed
|
|
11
11
|
|
|
12
12
|
- Bump `@metamask/core-backend` from `^6.1.1` to `^6.2.0` ([#8232](https://github.com/MetaMask/core/pull/8232))
|
|
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`.
|
|
13
18
|
|
|
14
19
|
## [63.0.0]
|
|
15
20
|
|
|
@@ -415,7 +415,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
415
415
|
*/
|
|
416
416
|
async addTransaction(txParams, options) {
|
|
417
417
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
418
|
-
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, isGasFeeIncluded, isGasFeeSponsored, isStateOnly, method, nestedTransactions, networkClientId, origin, publishHook, requestId, requiredAssets, requireApproval, securityAlertResponse, skipInitialGasEstimate, swaps = {}, traceContext, type, } = options;
|
|
418
|
+
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;
|
|
419
419
|
// eslint-disable-next-line no-param-reassign
|
|
420
420
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
421
421
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
@@ -453,6 +453,10 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
453
453
|
const dappSuggestedGasFees = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_generateDappSuggestedGasFees).call(this, txParams, origin);
|
|
454
454
|
const transactionType = type ?? (await (0, transaction_type_1.determineTransactionType)(txParams, ethQuery)).type;
|
|
455
455
|
const existingTransactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransactionWithActionId).call(this, actionId);
|
|
456
|
+
// Original behavior was that this was set to 'true' whenever a gasFeeToken was passed.
|
|
457
|
+
// 'excludeNativeTokenForFee' optionnally overrides this behavior to prevent native token from
|
|
458
|
+
// being used when another gasFeeToken is set.
|
|
459
|
+
const isGasFeeTokenIgnoredIfBalance = Boolean(gasFeeToken) && !excludeNativeTokenForFee;
|
|
456
460
|
// If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.
|
|
457
461
|
let addedTransactionMeta = existingTransactionMeta
|
|
458
462
|
? (0, lodash_1.cloneDeep)(existingTransactionMeta)
|
|
@@ -466,9 +470,13 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
466
470
|
deviceConfirmedOn,
|
|
467
471
|
disableGasBuffer,
|
|
468
472
|
id: (0, uuid_1.v1)(),
|
|
469
|
-
isGasFeeTokenIgnoredIfBalance
|
|
473
|
+
isGasFeeTokenIgnoredIfBalance,
|
|
470
474
|
isGasFeeIncluded,
|
|
471
475
|
isGasFeeSponsored,
|
|
476
|
+
// To avoid the property to be set as undefined.
|
|
477
|
+
...(excludeNativeTokenForFee === undefined
|
|
478
|
+
? {}
|
|
479
|
+
: { excludeNativeTokenForFee }),
|
|
472
480
|
isFirstTimeInteraction: undefined,
|
|
473
481
|
isStateOnly,
|
|
474
482
|
nestedTransactions,
|