@metamask-previews/transaction-controller 60.2.0-preview-661f11a → 60.2.0-preview-331bec5d
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/dist/TransactionController.cjs +47 -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 +47 -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/package.json +1 -1
|
@@ -458,9 +458,28 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
458
458
|
addedTransactionMeta.txParamsOriginal = (0, lodash_1.cloneDeep)(addedTransactionMeta.txParams);
|
|
459
459
|
updateTransaction(addedTransactionMeta);
|
|
460
460
|
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
461
|
+
// Skip gas estimation for intent transactions as they are not executed on-chain
|
|
462
|
+
const isIntentTransaction = swaps?.meta?.swapMetaData?.isIntentTx === true;
|
|
463
|
+
if (!isIntentTransaction) {
|
|
464
|
+
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, {
|
|
465
|
+
traceContext: context,
|
|
466
|
+
}));
|
|
467
|
+
}
|
|
468
|
+
else if (isEIP1559Compatible &&
|
|
469
|
+
addedTransactionMeta.txParams.gasPrice &&
|
|
470
|
+
!addedTransactionMeta.txParams.maxFeePerGas) {
|
|
471
|
+
// Convert legacy gasPrice to EIP-1559 fees for intent transactions on EIP-1559 networks
|
|
472
|
+
addedTransactionMeta.txParams.maxFeePerGas =
|
|
473
|
+
addedTransactionMeta.txParams.gasPrice;
|
|
474
|
+
addedTransactionMeta.txParams.maxPriorityFeePerGas =
|
|
475
|
+
addedTransactionMeta.txParams.gasPrice;
|
|
476
|
+
addedTransactionMeta.txParams.type = types_1.TransactionEnvelopeType.feeMarket;
|
|
477
|
+
delete addedTransactionMeta.txParams.gasPrice; // Remove legacy gas price
|
|
478
|
+
}
|
|
479
|
+
else if (!isEIP1559Compatible && addedTransactionMeta.txParams.gasPrice) {
|
|
480
|
+
// Ensure legacy type for non-EIP-1559 networks
|
|
481
|
+
addedTransactionMeta.txParams.type = types_1.TransactionEnvelopeType.legacy;
|
|
482
|
+
}
|
|
464
483
|
// Checks if a transaction already exists with a given actionId
|
|
465
484
|
if (!existingTransactionMeta) {
|
|
466
485
|
// Set security provider response
|
|
@@ -1455,6 +1474,31 @@ _TransactionController_afterAdd = new WeakMap(), _TransactionController_afterSig
|
|
|
1455
1474
|
this.updateTransaction(updatedTransaction, 'TransactionController#processApproval - Updated with approval data');
|
|
1456
1475
|
}
|
|
1457
1476
|
}
|
|
1477
|
+
// For intent-based transactions (e.g., CoW intents) that are not meant to be
|
|
1478
|
+
// published on-chain by the TransactionController, skip the approve/publish flow.
|
|
1479
|
+
// These are tracked externally and should not be signed or sent.
|
|
1480
|
+
const isIntentTransaction = Boolean(
|
|
1481
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1482
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, transactionId)?.swapMetaData
|
|
1483
|
+
?.isIntentTx === true);
|
|
1484
|
+
if (requireApproval === false && isIntentTransaction) {
|
|
1485
|
+
const submittedTxMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
1486
|
+
transactionId,
|
|
1487
|
+
note: 'TransactionController#processApproval - Intent transaction auto-submitted',
|
|
1488
|
+
skipValidation: true,
|
|
1489
|
+
}, (draftTxMeta) => {
|
|
1490
|
+
draftTxMeta.status = types_1.TransactionStatus.submitted;
|
|
1491
|
+
draftTxMeta.submittedTime = new Date().getTime();
|
|
1492
|
+
});
|
|
1493
|
+
this.messagingSystem.publish(`${controllerName}:transactionSubmitted`, {
|
|
1494
|
+
transactionMeta: submittedTxMeta,
|
|
1495
|
+
});
|
|
1496
|
+
this.messagingSystem.publish(`${controllerName}:transactionFinished`, submittedTxMeta);
|
|
1497
|
+
__classPrivateFieldGet(this, _TransactionController_internalEvents, "f").emit(`${transactionId}:finished`, submittedTxMeta);
|
|
1498
|
+
// Short-circuit normal flow; result callbacks will be handled by the
|
|
1499
|
+
// finished promise below.
|
|
1500
|
+
return ApprovalState.Approved;
|
|
1501
|
+
}
|
|
1458
1502
|
const { isCompleted: isTxCompleted } = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_isTransactionCompleted).call(this, transactionId);
|
|
1459
1503
|
if (!isTxCompleted) {
|
|
1460
1504
|
const approvalResult = await __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_approveTransaction).call(this, transactionId, traceContext, publishHook);
|