@metamask-previews/transaction-controller 62.7.0-preview-e776a73 → 62.7.0-preview-749d0638
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 +3 -2
- package/dist/TransactionController.cjs +39 -1
- 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 +39 -1
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.cjs +27 -37
- 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 +28 -38
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/utils/feature-flags.cjs +1 -4
- package/dist/utils/feature-flags.cjs.map +1 -1
- package/dist/utils/feature-flags.d.cts +0 -5
- package/dist/utils/feature-flags.d.cts.map +1 -1
- package/dist/utils/feature-flags.d.mts +0 -5
- package/dist/utils/feature-flags.d.mts.map +1 -1
- package/dist/utils/feature-flags.mjs +1 -4
- package/dist/utils/feature-flags.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,10 +7,11 @@ 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))
|
|
10
13
|
### Changed
|
|
11
14
|
|
|
12
|
-
- Update transaction timeout to check time since submission or when transaction was last seen on network ([#7464](https://github.com/MetaMask/core/pull/7464))
|
|
13
|
-
- Uses `blockTime` from `acceleratedPolling` feature flag.
|
|
14
15
|
- Deprecate `history` and `sendFlowHistory` properties from `TransactionMeta` and `TransactionController` options ([#7326](https://github.com/MetaMask/core/pull/7326))
|
|
15
16
|
- Bump `@metamask/remote-feature-flag-controller` from `^3.0.0` to `^3.1.0` ([#7519](https://github.com/MetaMask/core/pull/7519))
|
|
16
17
|
- Bump `@metamask/network-controller` from `^27.0.0` to `^27.1.0` ([#7534](https://github.com/MetaMask/core/pull/7534))
|
|
@@ -462,12 +462,26 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
462
462
|
addedTransactionMeta.txParamsOriginal = (0, lodash_1.cloneDeep)(addedTransactionMeta.txParams);
|
|
463
463
|
updateTransaction(addedTransactionMeta);
|
|
464
464
|
}
|
|
465
|
-
// eslint-disable-next-line no-negated-condition
|
|
466
465
|
if (!skipInitialGasEstimate) {
|
|
467
466
|
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, {
|
|
468
467
|
traceContext: context,
|
|
469
468
|
}));
|
|
470
469
|
}
|
|
470
|
+
else if (isEIP1559Compatible &&
|
|
471
|
+
addedTransactionMeta.txParams.gasPrice &&
|
|
472
|
+
!addedTransactionMeta.txParams.maxFeePerGas) {
|
|
473
|
+
// Convert legacy gasPrice to EIP-1559 fees for intent transactions on EIP-1559 networks
|
|
474
|
+
addedTransactionMeta.txParams.maxFeePerGas =
|
|
475
|
+
addedTransactionMeta.txParams.gasPrice;
|
|
476
|
+
addedTransactionMeta.txParams.maxPriorityFeePerGas =
|
|
477
|
+
addedTransactionMeta.txParams.gasPrice;
|
|
478
|
+
addedTransactionMeta.txParams.type = types_1.TransactionEnvelopeType.feeMarket;
|
|
479
|
+
delete addedTransactionMeta.txParams.gasPrice; // Remove legacy gas price
|
|
480
|
+
}
|
|
481
|
+
else if (!isEIP1559Compatible && addedTransactionMeta.txParams.gasPrice) {
|
|
482
|
+
// Ensure legacy type for non-EIP-1559 networks
|
|
483
|
+
addedTransactionMeta.txParams.type = types_1.TransactionEnvelopeType.legacy;
|
|
484
|
+
}
|
|
471
485
|
else {
|
|
472
486
|
const newTransactionMeta = (0, lodash_1.cloneDeep)(addedTransactionMeta);
|
|
473
487
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateGasProperties).call(this, newTransactionMeta)
|
|
@@ -1551,6 +1565,30 @@ _TransactionController_afterAdd = new WeakMap(), _TransactionController_afterSig
|
|
|
1551
1565
|
this.updateTransaction(updatedTransaction, 'TransactionController#processApproval - Updated with approval data');
|
|
1552
1566
|
}
|
|
1553
1567
|
}
|
|
1568
|
+
// For intent-based transactions (e.g., CoW intents) that are not meant to be
|
|
1569
|
+
// published on-chain by the TransactionController, skip the approve/publish flow.
|
|
1570
|
+
// These are tracked externally and should not be signed or sent.
|
|
1571
|
+
const isIntentTransaction = Boolean(
|
|
1572
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1573
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getTransaction).call(this, transactionId)?.swapMetaData
|
|
1574
|
+
?.isIntentTx === true);
|
|
1575
|
+
if (requireApproval === false && isIntentTransaction) {
|
|
1576
|
+
const submittedTxMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
1577
|
+
transactionId,
|
|
1578
|
+
skipValidation: true,
|
|
1579
|
+
}, (draftTxMeta) => {
|
|
1580
|
+
draftTxMeta.status = types_1.TransactionStatus.submitted;
|
|
1581
|
+
draftTxMeta.submittedTime = new Date().getTime();
|
|
1582
|
+
});
|
|
1583
|
+
this.messenger.publish(`${controllerName}:transactionSubmitted`, {
|
|
1584
|
+
transactionMeta: submittedTxMeta,
|
|
1585
|
+
});
|
|
1586
|
+
this.messenger.publish(`${controllerName}:transactionFinished`, submittedTxMeta);
|
|
1587
|
+
__classPrivateFieldGet(this, _TransactionController_internalEvents, "f").emit(`${transactionId}:finished`, submittedTxMeta);
|
|
1588
|
+
// Short-circuit normal flow; result callbacks will be handled by the
|
|
1589
|
+
// finished promise below.
|
|
1590
|
+
return ApprovalState.Approved;
|
|
1591
|
+
}
|
|
1554
1592
|
const { isCompleted: isTxCompleted } = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_isTransactionCompleted).call(this, transactionId);
|
|
1555
1593
|
if (!isTxCompleted) {
|
|
1556
1594
|
const approvalResult = await __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_approveTransaction).call(this, transactionId, traceContext, publishHook);
|