@metamask/transaction-controller 62.0.0 → 62.1.0
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 +10 -1
- package/dist/TransactionController.cjs +40 -6
- 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 +41 -7
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +6 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +6 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +19 -9
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.mjs +19 -9
- package/dist/utils/batch.mjs.map +1 -1
- package/dist/utils/first-time-interaction.cjs +7 -2
- package/dist/utils/first-time-interaction.cjs.map +1 -1
- package/dist/utils/first-time-interaction.d.cts +1 -1
- package/dist/utils/first-time-interaction.d.cts.map +1 -1
- package/dist/utils/first-time-interaction.d.mts +1 -1
- package/dist/utils/first-time-interaction.d.mts.map +1 -1
- package/dist/utils/first-time-interaction.mjs +7 -2
- package/dist/utils/first-time-interaction.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [62.1.0]
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Performance optimisations in `addTransaction` and `addTransactionBatch` methods ([#7205](https://github.com/MetaMask/core/pull/7205))
|
|
15
|
+
- Add `skipInitialGasEstimate` option to `addTransaction` and `addTransactionBatch` methods.
|
|
16
|
+
- Add `disableUpgrade` option to `addTransactionBatch` method.
|
|
17
|
+
|
|
10
18
|
## [62.0.0]
|
|
11
19
|
|
|
12
20
|
### Added
|
|
@@ -1952,7 +1960,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1952
1960
|
|
|
1953
1961
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1954
1962
|
|
|
1955
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@62.
|
|
1963
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@62.1.0...HEAD
|
|
1964
|
+
[62.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@62.0.0...@metamask/transaction-controller@62.1.0
|
|
1956
1965
|
[62.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@61.3.0...@metamask/transaction-controller@62.0.0
|
|
1957
1966
|
[61.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@61.2.0...@metamask/transaction-controller@61.3.0
|
|
1958
1967
|
[61.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@61.1.0...@metamask/transaction-controller@61.2.0
|
|
@@ -378,7 +378,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
378
378
|
*/
|
|
379
379
|
async addTransaction(txParams, options) {
|
|
380
380
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
381
|
-
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, isGasFeeIncluded, isGasFeeSponsored, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
381
|
+
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, isGasFeeIncluded, isGasFeeSponsored, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, skipInitialGasEstimate, swaps = {}, traceContext, type, } = options;
|
|
382
382
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
383
383
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
384
384
|
throw new Error(`Network client not found - ${networkClientId}`);
|
|
@@ -414,7 +414,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
414
414
|
}
|
|
415
415
|
const dappSuggestedGasFees = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_generateDappSuggestedGasFees).call(this, txParams, origin);
|
|
416
416
|
const transactionType = type ?? (await (0, transaction_type_1.determineTransactionType)(txParams, ethQuery)).type;
|
|
417
|
-
const delegationAddress = await delegationAddressPromise;
|
|
418
417
|
const existingTransactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransactionWithActionId).call(this, actionId);
|
|
419
418
|
// If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.
|
|
420
419
|
let addedTransactionMeta = existingTransactionMeta
|
|
@@ -426,7 +425,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
426
425
|
batchId,
|
|
427
426
|
chainId,
|
|
428
427
|
dappSuggestedGasFees,
|
|
429
|
-
delegationAddress,
|
|
430
428
|
deviceConfirmedOn,
|
|
431
429
|
disableGasBuffer,
|
|
432
430
|
id: (0, uuid_1.v1)(),
|
|
@@ -454,9 +452,32 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
454
452
|
addedTransactionMeta.txParamsOriginal = (0, lodash_1.cloneDeep)(addedTransactionMeta.txParams);
|
|
455
453
|
updateTransaction(addedTransactionMeta);
|
|
456
454
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
455
|
+
if (!skipInitialGasEstimate) {
|
|
456
|
+
await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Estimate Gas Properties', parentContext: traceContext }, (context) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateGasProperties).call(this, addedTransactionMeta, {
|
|
457
|
+
traceContext: context,
|
|
458
|
+
}));
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
const newTransactionMeta = (0, lodash_1.cloneDeep)(addedTransactionMeta);
|
|
462
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateGasProperties).call(this, newTransactionMeta)
|
|
463
|
+
.then(() => {
|
|
464
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
465
|
+
transactionId: newTransactionMeta.id,
|
|
466
|
+
skipHistory: true,
|
|
467
|
+
skipResimulateCheck: true,
|
|
468
|
+
skipValidation: true,
|
|
469
|
+
}, (tx) => {
|
|
470
|
+
tx.txParams.gas = newTransactionMeta.txParams.gas;
|
|
471
|
+
tx.txParams.gasPrice = newTransactionMeta.txParams.gasPrice;
|
|
472
|
+
tx.txParams.maxFeePerGas =
|
|
473
|
+
newTransactionMeta.txParams.maxFeePerGas;
|
|
474
|
+
tx.txParams.maxPriorityFeePerGas =
|
|
475
|
+
newTransactionMeta.txParams.maxPriorityFeePerGas;
|
|
476
|
+
});
|
|
477
|
+
return undefined;
|
|
478
|
+
})
|
|
479
|
+
.catch(lodash_1.noop);
|
|
480
|
+
}
|
|
460
481
|
// Checks if a transaction already exists with a given actionId
|
|
461
482
|
if (!existingTransactionMeta) {
|
|
462
483
|
// Set security provider response
|
|
@@ -478,6 +499,19 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
478
499
|
messenger: this.messenger,
|
|
479
500
|
});
|
|
480
501
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addMetadata).call(this, addedTransactionMeta);
|
|
502
|
+
delegationAddressPromise
|
|
503
|
+
.then((delegationAddress) => {
|
|
504
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
505
|
+
transactionId: addedTransactionMeta.id,
|
|
506
|
+
skipHistory: true,
|
|
507
|
+
skipResimulateCheck: true,
|
|
508
|
+
skipValidation: true,
|
|
509
|
+
}, (tx) => {
|
|
510
|
+
tx.delegationAddress = delegationAddress;
|
|
511
|
+
});
|
|
512
|
+
return undefined;
|
|
513
|
+
})
|
|
514
|
+
.catch(lodash_1.noop);
|
|
481
515
|
if (requireApproval !== false) {
|
|
482
516
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateSimulationData).call(this, addedTransactionMeta, {
|
|
483
517
|
traceContext,
|