@metamask-previews/transaction-controller 62.0.0-preview-4ed214fa → 62.0.0-preview-e3eb8eca
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 +0 -6
- package/dist/TransactionController.cjs +6 -40
- 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 +7 -41
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -6
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -6
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +9 -19
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.mjs +9 -19
- package/dist/utils/batch.mjs.map +1 -1
- package/dist/utils/first-time-interaction.cjs +2 -7
- 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 +2 -7
- package/dist/utils/first-time-interaction.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,12 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
-
### Changed
|
|
11
|
-
|
|
12
|
-
- Performance optimisations in `addTransaction` and `addTransactionBatch` methods ([#7205](https://github.com/MetaMask/core/pull/7205))
|
|
13
|
-
- Add `skipInitialGasEstimate` option to `addTransaction` and `addTransactionBatch` methods.
|
|
14
|
-
- Add `disableUpgrade` option to `addTransactionBatch` method.
|
|
15
|
-
|
|
16
10
|
## [62.0.0]
|
|
17
11
|
|
|
18
12
|
### Added
|
|
@@ -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,
|
|
381
|
+
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, isGasFeeIncluded, isGasFeeSponsored, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, 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,6 +414,7 @@ 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;
|
|
417
418
|
const existingTransactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransactionWithActionId).call(this, actionId);
|
|
418
419
|
// If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.
|
|
419
420
|
let addedTransactionMeta = existingTransactionMeta
|
|
@@ -425,6 +426,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
425
426
|
batchId,
|
|
426
427
|
chainId,
|
|
427
428
|
dappSuggestedGasFees,
|
|
429
|
+
delegationAddress,
|
|
428
430
|
deviceConfirmedOn,
|
|
429
431
|
disableGasBuffer,
|
|
430
432
|
id: (0, uuid_1.v1)(),
|
|
@@ -452,32 +454,9 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
452
454
|
addedTransactionMeta.txParamsOriginal = (0, lodash_1.cloneDeep)(addedTransactionMeta.txParams);
|
|
453
455
|
updateTransaction(addedTransactionMeta);
|
|
454
456
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
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
|
-
}
|
|
457
|
+
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, {
|
|
458
|
+
traceContext: context,
|
|
459
|
+
}));
|
|
481
460
|
// Checks if a transaction already exists with a given actionId
|
|
482
461
|
if (!existingTransactionMeta) {
|
|
483
462
|
// Set security provider response
|
|
@@ -499,19 +478,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
499
478
|
messenger: this.messenger,
|
|
500
479
|
});
|
|
501
480
|
__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);
|
|
515
481
|
if (requireApproval !== false) {
|
|
516
482
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateSimulationData).call(this, addedTransactionMeta, {
|
|
517
483
|
traceContext,
|