@metamask/transaction-controller 62.0.0 → 62.2.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 +30 -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 +4 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +10 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +10 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +4 -0
- 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 +7 -12
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [62.2.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `musdConversion` transaction type ([#7218](https://github.com/MetaMask/core/pull/7218))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Move peer dependencies for controller and service packages to direct dependencies ([#7209](https://github.com/MetaMask/core/pull/7209))
|
|
19
|
+
- The dependencies moved are:
|
|
20
|
+
- `@metamask/accounts-controller` (^35.0.0)
|
|
21
|
+
- `@metamask/approval-controller` (^8.0.0)
|
|
22
|
+
- `@metamask/gas-fee-controller` (^26.0.0)
|
|
23
|
+
- `@metamask/network-controller` (^26.0.0)
|
|
24
|
+
- `@metamask/remote-feature-flag-controller` (^2.0.1)
|
|
25
|
+
- In clients, it is now possible for multiple versions of these packages to exist in the dependency tree.
|
|
26
|
+
- For example, this scenario would be valid: a client relies on `@metamask/controller-a` 1.0.0 and `@metamask/controller-b` 1.0.0, and `@metamask/controller-b` depends on `@metamask/controller-a` 1.1.0.
|
|
27
|
+
- Note, however, that the versions specified in the client's `package.json` always "win", and you are expected to keep them up to date so as not to break controller and service intercommunication.
|
|
28
|
+
|
|
29
|
+
## [62.1.0]
|
|
30
|
+
|
|
31
|
+
### Changed
|
|
32
|
+
|
|
33
|
+
- Performance optimisations in `addTransaction` and `addTransactionBatch` methods ([#7205](https://github.com/MetaMask/core/pull/7205))
|
|
34
|
+
- Add `skipInitialGasEstimate` option to `addTransaction` and `addTransactionBatch` methods.
|
|
35
|
+
- Add `disableUpgrade` option to `addTransactionBatch` method.
|
|
36
|
+
|
|
10
37
|
## [62.0.0]
|
|
11
38
|
|
|
12
39
|
### Added
|
|
@@ -1952,7 +1979,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1952
1979
|
|
|
1953
1980
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1954
1981
|
|
|
1955
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@62.
|
|
1982
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@62.2.0...HEAD
|
|
1983
|
+
[62.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@62.1.0...@metamask/transaction-controller@62.2.0
|
|
1984
|
+
[62.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@62.0.0...@metamask/transaction-controller@62.1.0
|
|
1956
1985
|
[62.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@61.3.0...@metamask/transaction-controller@62.0.0
|
|
1957
1986
|
[61.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@61.2.0...@metamask/transaction-controller@61.3.0
|
|
1958
1987
|
[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,
|