@metamask-previews/transaction-controller 62.6.0-preview-eb60826c → 62.6.0-preview-565dfca2
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 +4 -1
- package/dist/TransactionController.cjs +41 -3
- 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 -3
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.cjs +3 -1
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs +3 -1
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -12
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +0 -12
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +1 -2
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.d.cts +0 -1
- package/dist/utils/batch.d.cts.map +1 -1
- package/dist/utils/batch.d.mts +0 -1
- package/dist/utils/batch.d.mts.map +1 -1
- package/dist/utils/batch.mjs +1 -2
- package/dist/utils/batch.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,10 @@ 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 intent based transaction support ([#6547](https://github.com/MetaMask/core/pull/6547))
|
|
13
|
+
|
|
10
14
|
## [62.6.0]
|
|
11
15
|
|
|
12
16
|
### Added
|
|
@@ -17,7 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
17
21
|
- Add optional `isTimeoutEnabled` callback to disable for specific transactions.
|
|
18
22
|
- Ignores transactions with future nonce.
|
|
19
23
|
- Threshold determined by feature flag.
|
|
20
|
-
- Adding a new transaction meta property `requestId`. It is supported for both simple and batched transactions ([#7415](https://github.com/MetaMask/core/pull/7415))
|
|
21
24
|
|
|
22
25
|
### Changed
|
|
23
26
|
|
|
@@ -391,7 +391,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
391
391
|
*/
|
|
392
392
|
async addTransaction(txParams, options) {
|
|
393
393
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
394
|
-
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, isGasFeeIncluded, isGasFeeSponsored, method, nestedTransactions, networkClientId, origin, publishHook,
|
|
394
|
+
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, gasFeeToken, isGasFeeIncluded, isGasFeeSponsored, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, skipInitialGasEstimate, swaps = {}, traceContext, type, } = options;
|
|
395
395
|
// eslint-disable-next-line no-param-reassign
|
|
396
396
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
397
397
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
@@ -449,7 +449,6 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
449
449
|
nestedTransactions,
|
|
450
450
|
networkClientId,
|
|
451
451
|
origin,
|
|
452
|
-
requestId,
|
|
453
452
|
securityAlertResponse,
|
|
454
453
|
selectedGasFeeToken: gasFeeToken,
|
|
455
454
|
status: types_1.TransactionStatus.unapproved,
|
|
@@ -467,12 +466,26 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
467
466
|
addedTransactionMeta.txParamsOriginal = (0, lodash_1.cloneDeep)(addedTransactionMeta.txParams);
|
|
468
467
|
updateTransaction(addedTransactionMeta);
|
|
469
468
|
}
|
|
470
|
-
// eslint-disable-next-line no-negated-condition
|
|
471
469
|
if (!skipInitialGasEstimate) {
|
|
472
470
|
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, {
|
|
473
471
|
traceContext: context,
|
|
474
472
|
}));
|
|
475
473
|
}
|
|
474
|
+
else if (isEIP1559Compatible &&
|
|
475
|
+
addedTransactionMeta.txParams.gasPrice &&
|
|
476
|
+
!addedTransactionMeta.txParams.maxFeePerGas) {
|
|
477
|
+
// Convert legacy gasPrice to EIP-1559 fees for intent transactions on EIP-1559 networks
|
|
478
|
+
addedTransactionMeta.txParams.maxFeePerGas =
|
|
479
|
+
addedTransactionMeta.txParams.gasPrice;
|
|
480
|
+
addedTransactionMeta.txParams.maxPriorityFeePerGas =
|
|
481
|
+
addedTransactionMeta.txParams.gasPrice;
|
|
482
|
+
addedTransactionMeta.txParams.type = types_1.TransactionEnvelopeType.feeMarket;
|
|
483
|
+
delete addedTransactionMeta.txParams.gasPrice; // Remove legacy gas price
|
|
484
|
+
}
|
|
485
|
+
else if (!isEIP1559Compatible && addedTransactionMeta.txParams.gasPrice) {
|
|
486
|
+
// Ensure legacy type for non-EIP-1559 networks
|
|
487
|
+
addedTransactionMeta.txParams.type = types_1.TransactionEnvelopeType.legacy;
|
|
488
|
+
}
|
|
476
489
|
else {
|
|
477
490
|
const newTransactionMeta = (0, lodash_1.cloneDeep)(addedTransactionMeta);
|
|
478
491
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateGasProperties).call(this, newTransactionMeta)
|
|
@@ -1587,6 +1600,31 @@ _TransactionController_afterAdd = new WeakMap(), _TransactionController_afterSig
|
|
|
1587
1600
|
this.updateTransaction(updatedTransaction, 'TransactionController#processApproval - Updated with approval data');
|
|
1588
1601
|
}
|
|
1589
1602
|
}
|
|
1603
|
+
// For intent-based transactions (e.g., CoW intents) that are not meant to be
|
|
1604
|
+
// published on-chain by the TransactionController, skip the approve/publish flow.
|
|
1605
|
+
// These are tracked externally and should not be signed or sent.
|
|
1606
|
+
const isIntentTransaction = Boolean(
|
|
1607
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1608
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, transactionId)?.swapMetaData
|
|
1609
|
+
?.isIntentTx === true);
|
|
1610
|
+
if (requireApproval === false && isIntentTransaction) {
|
|
1611
|
+
const submittedTxMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
1612
|
+
transactionId,
|
|
1613
|
+
note: 'TransactionController#processApproval - Intent transaction auto-submitted',
|
|
1614
|
+
skipValidation: true,
|
|
1615
|
+
}, (draftTxMeta) => {
|
|
1616
|
+
draftTxMeta.status = types_1.TransactionStatus.submitted;
|
|
1617
|
+
draftTxMeta.submittedTime = new Date().getTime();
|
|
1618
|
+
});
|
|
1619
|
+
this.messenger.publish(`${controllerName}:transactionSubmitted`, {
|
|
1620
|
+
transactionMeta: submittedTxMeta,
|
|
1621
|
+
});
|
|
1622
|
+
this.messenger.publish(`${controllerName}:transactionFinished`, submittedTxMeta);
|
|
1623
|
+
__classPrivateFieldGet(this, _TransactionController_internalEvents, "f").emit(`${transactionId}:finished`, submittedTxMeta);
|
|
1624
|
+
// Short-circuit normal flow; result callbacks will be handled by the
|
|
1625
|
+
// finished promise below.
|
|
1626
|
+
return ApprovalState.Approved;
|
|
1627
|
+
}
|
|
1590
1628
|
const { isCompleted: isTxCompleted } = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_isTransactionCompleted).call(this, transactionId);
|
|
1591
1629
|
if (!isTxCompleted) {
|
|
1592
1630
|
const approvalResult = await __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_approveTransaction).call(this, transactionId, traceContext, publishHook);
|