@metamask/transaction-controller 52.1.0 → 52.3.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 +55 -4
- package/dist/TransactionController.cjs +111 -28
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +33 -5
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +33 -5
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +114 -31
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/constants.cjs +1 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +1 -0
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.mts +1 -0
- package/dist/constants.d.mts.map +1 -1
- package/dist/constants.mjs +1 -0
- package/dist/constants.mjs.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.cjs +1 -3
- package/dist/gas-flows/DefaultGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/DefaultGasFeeFlow.mjs +1 -3
- package/dist/gas-flows/DefaultGasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.cjs +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.cts +5 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.mts +5 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.mjs +1 -1
- package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts +5 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +5 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs +1 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts +5 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +5 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs +123 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts +28 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +28 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs +118 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts +5 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +5 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs +1 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.cjs +1 -1
- package/dist/gas-flows/TestGasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.d.cts +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.d.mts +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs +1 -1
- package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -1
- package/dist/helpers/GasFeePoller.cjs +11 -8
- package/dist/helpers/GasFeePoller.cjs.map +1 -1
- package/dist/helpers/GasFeePoller.d.cts +6 -5
- package/dist/helpers/GasFeePoller.d.cts.map +1 -1
- package/dist/helpers/GasFeePoller.d.mts +6 -5
- package/dist/helpers/GasFeePoller.d.mts.map +1 -1
- package/dist/helpers/GasFeePoller.mjs +11 -8
- package/dist/helpers/GasFeePoller.mjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.cjs +2 -1
- package/dist/helpers/IncomingTransactionHelper.cjs.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -1
- package/dist/helpers/IncomingTransactionHelper.mjs +2 -1
- package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.cjs +6 -2
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.cts +5 -2
- package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.d.mts +5 -2
- package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
- package/dist/helpers/PendingTransactionTracker.mjs +6 -2
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
- package/dist/helpers/TransactionPoller.cjs +12 -8
- package/dist/helpers/TransactionPoller.cjs.map +1 -1
- package/dist/helpers/TransactionPoller.d.cts +7 -3
- package/dist/helpers/TransactionPoller.d.cts.map +1 -1
- package/dist/helpers/TransactionPoller.d.mts +7 -3
- package/dist/helpers/TransactionPoller.d.mts.map +1 -1
- package/dist/helpers/TransactionPoller.mjs +11 -7
- package/dist/helpers/TransactionPoller.mjs.map +1 -1
- package/dist/hooks/CollectPublishHook.cjs +84 -0
- package/dist/hooks/CollectPublishHook.cjs.map +1 -0
- package/dist/hooks/CollectPublishHook.d.cts +29 -0
- package/dist/hooks/CollectPublishHook.d.cts.map +1 -0
- package/dist/hooks/CollectPublishHook.d.mts +29 -0
- package/dist/hooks/CollectPublishHook.d.mts.map +1 -0
- package/dist/hooks/CollectPublishHook.mjs +80 -0
- package/dist/hooks/CollectPublishHook.mjs.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.cjs +90 -0
- package/dist/hooks/ExtraTransactionsPublishHook.cjs.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.cts +18 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.cts.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts +18 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.mjs +86 -0
- package/dist/hooks/ExtraTransactionsPublishHook.mjs.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +161 -7
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +161 -7
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +142 -1
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.d.cts +7 -1
- package/dist/utils/batch.d.cts.map +1 -1
- package/dist/utils/batch.d.mts +7 -1
- package/dist/utils/batch.d.mts.map +1 -1
- package/dist/utils/batch.mjs +142 -1
- package/dist/utils/batch.mjs.map +1 -1
- package/dist/utils/eip7702.cjs +12 -0
- package/dist/utils/eip7702.cjs.map +1 -1
- package/dist/utils/eip7702.d.cts.map +1 -1
- package/dist/utils/eip7702.d.mts.map +1 -1
- package/dist/utils/eip7702.mjs +12 -0
- package/dist/utils/eip7702.mjs.map +1 -1
- package/dist/utils/feature-flags.cjs +39 -2
- package/dist/utils/feature-flags.cjs.map +1 -1
- package/dist/utils/feature-flags.d.cts +49 -0
- package/dist/utils/feature-flags.d.cts.map +1 -1
- package/dist/utils/feature-flags.d.mts +49 -0
- package/dist/utils/feature-flags.d.mts.map +1 -1
- package/dist/utils/feature-flags.mjs +36 -1
- package/dist/utils/feature-flags.mjs.map +1 -1
- package/dist/utils/gas-fees.cjs +21 -3
- package/dist/utils/gas-fees.cjs.map +1 -1
- package/dist/utils/gas-fees.d.cts +14 -0
- package/dist/utils/gas-fees.d.cts.map +1 -1
- package/dist/utils/gas-fees.d.mts +14 -0
- package/dist/utils/gas-fees.d.mts.map +1 -1
- package/dist/utils/gas-fees.mjs +19 -2
- package/dist/utils/gas-fees.mjs.map +1 -1
- package/dist/utils/gas-flow.cjs +3 -2
- package/dist/utils/gas-flow.cjs.map +1 -1
- package/dist/utils/gas-flow.d.cts +3 -1
- package/dist/utils/gas-flow.d.cts.map +1 -1
- package/dist/utils/gas-flow.d.mts +3 -1
- package/dist/utils/gas-flow.d.mts.map +1 -1
- package/dist/utils/gas-flow.mjs +3 -2
- package/dist/utils/gas-flow.mjs.map +1 -1
- package/dist/utils/gas.cjs +7 -3
- package/dist/utils/gas.cjs.map +1 -1
- package/dist/utils/gas.mjs +7 -3
- package/dist/utils/gas.mjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.cjs +9 -4
- package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.d.cts +4 -1
- package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.d.mts +4 -1
- package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -1
- package/dist/utils/layer1-gas-fee-flow.mjs +9 -4
- package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -1
- package/dist/utils/nonce.cjs +3 -3
- package/dist/utils/nonce.cjs.map +1 -1
- package/dist/utils/nonce.d.cts +2 -2
- package/dist/utils/nonce.d.cts.map +1 -1
- package/dist/utils/nonce.d.mts +2 -2
- package/dist/utils/nonce.d.mts.map +1 -1
- package/dist/utils/nonce.mjs +3 -3
- package/dist/utils/nonce.mjs.map +1 -1
- package/dist/utils/simulation-api.cjs.map +1 -1
- package/dist/utils/simulation-api.d.cts +37 -0
- package/dist/utils/simulation-api.d.cts.map +1 -1
- package/dist/utils/simulation-api.d.mts +37 -0
- package/dist/utils/simulation-api.d.mts.map +1 -1
- package/dist/utils/simulation-api.mjs.map +1 -1
- package/dist/utils/simulation.cjs +63 -9
- package/dist/utils/simulation.cjs.map +1 -1
- package/dist/utils/simulation.d.cts +7 -2
- package/dist/utils/simulation.d.cts.map +1 -1
- package/dist/utils/simulation.d.mts +7 -2
- package/dist/utils/simulation.d.mts.map +1 -1
- package/dist/utils/simulation.mjs +63 -9
- package/dist/utils/simulation.mjs.map +1 -1
- package/dist/utils/utils.cjs +23 -1
- package/dist/utils/utils.cjs.map +1 -1
- package/dist/utils/utils.d.cts +8 -0
- package/dist/utils/utils.d.cts.map +1 -1
- package/dist/utils/utils.d.mts +8 -0
- package/dist/utils/utils.d.mts.map +1 -1
- package/dist/utils/utils.mjs +22 -1
- package/dist/utils/utils.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [52.3.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Adds `RandomisedEstimationsGasFeeFlow` to gas fee flows in `TransactionController` ([#5511](https://github.com/MetaMask/core/pull/5511))
|
|
15
|
+
- Added flow only will be activated if chainId is defined in feature flags.
|
|
16
|
+
- Configure pending transaction polling intervals using remote feature flags ([#5549](https://github.com/MetaMask/core/pull/5549))
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- Fix EIP-7702 contract signature validation on chains with odd-length hexadecimal ID ([#5563](https://github.com/MetaMask/core/pull/5563))
|
|
21
|
+
- Fix simulation of type-4 transactions ([#5552](https://github.com/MetaMask/core/pull/5552))
|
|
22
|
+
- Display incoming transactions in active tab ([#5487](https://github.com/MetaMask/core/pull/5487))
|
|
23
|
+
- Fix bug in `updateTransactionGasFees` affecting `txParams` gas updates when `enableTxParamsGasFeeUpdates` is enabled. ([#5539](https://github.com/MetaMask/core/pull/5539))
|
|
24
|
+
|
|
25
|
+
## [52.2.0]
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
|
|
29
|
+
- Add `gasFeeTokens` to `TransactionMeta` ([#5524](https://github.com/MetaMask/core/pull/5524))
|
|
30
|
+
- Add `GasFeeToken` type.
|
|
31
|
+
- Add `selectedGasFeeToken` to `TransactionMeta`.
|
|
32
|
+
- Add `updateSelectedGasFeeToken` method.
|
|
33
|
+
- Support security validation of transaction batches ([#5526](https://github.com/MetaMask/core/pull/5526))
|
|
34
|
+
- Add `ValidateSecurityRequest` type.
|
|
35
|
+
- Add optional `securityAlertId` to `SecurityAlertResponse`.
|
|
36
|
+
- Add optional `securityAlertId` to `TransactionBatchRequest`.
|
|
37
|
+
- Add optional `validateSecurity` callback to `TransactionBatchRequest`.
|
|
38
|
+
- Support publish batch hook ([#5401](https://github.com/MetaMask/core/pull/5401))
|
|
39
|
+
- Add `hooks.publishBatch` option to constructor.
|
|
40
|
+
- Add `updateBatchTransactions` method.
|
|
41
|
+
- Add `maxFeePerGas` and `maxPriorityFeePerGas` to `updateEditableParams` options.
|
|
42
|
+
- Add types.
|
|
43
|
+
- `PublishBatchHook`
|
|
44
|
+
- `PublishBatchHookRequest`
|
|
45
|
+
- `PublishBatchHookResult`
|
|
46
|
+
- `PublishBatchHookTransaction`
|
|
47
|
+
- `PublishHook`
|
|
48
|
+
- `PublishHookResult`
|
|
49
|
+
- Add optional properties to `TransactionMeta`.
|
|
50
|
+
- `batchTransactions`
|
|
51
|
+
- `disableGasBuffer`
|
|
52
|
+
- Add optional properties to `BatchTransactionParams`.
|
|
53
|
+
- `gas`
|
|
54
|
+
- `maxFeePerGas`
|
|
55
|
+
- `maxPriorityFeePerGas`
|
|
56
|
+
- Add optional `existingTransaction` property to `TransactionBatchSingleRequest`.
|
|
57
|
+
- Add optional `useHook` property to `TransactionBatchRequest`.
|
|
58
|
+
|
|
10
59
|
## [52.1.0]
|
|
11
60
|
|
|
12
61
|
### Added
|
|
@@ -41,7 +90,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
41
90
|
### Added
|
|
42
91
|
|
|
43
92
|
- Add additional metadata for batch metrics ([#5488](https://github.com/MetaMask/core/pull/5488))
|
|
44
|
-
- Add `delegationAddress` to `
|
|
93
|
+
- Add `delegationAddress` to `TransactionMeta`.
|
|
45
94
|
- Add `NestedTransactionMetadata` type containing `BatchTransactionParams` and `type`.
|
|
46
95
|
- Add optional `type` to `TransactionBatchSingleRequest`.
|
|
47
96
|
- Verify EIP-7702 contract address using signatures ([#5472](https://github.com/MetaMask/core/pull/5472))
|
|
@@ -52,8 +101,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
52
101
|
|
|
53
102
|
- **BREAKING:** Bump `@metamask/accounts-controller` peer dependency to `^26.1.0` ([#5481](https://github.com/MetaMask/core/pull/5481))
|
|
54
103
|
- **BREAKING:** Add additional metadata for batch metrics ([#5488](https://github.com/MetaMask/core/pull/5488))
|
|
55
|
-
- Change `error` in `
|
|
56
|
-
- Change `nestedTransactions` in `
|
|
104
|
+
- Change `error` in `TransactionMeta` to optional for all statuses.
|
|
105
|
+
- Change `nestedTransactions` in `TransactionMeta` to array of `NestedTransactionMetadata`.
|
|
57
106
|
- Throw if `addTransactionBatch` called with external origin and size limit exceeded ([#5489](https://github.com/MetaMask/core/pull/5489))
|
|
58
107
|
- Verify EIP-7702 contract address using signatures ([#5472](https://github.com/MetaMask/core/pull/5472))
|
|
59
108
|
- Use new `contracts` property from feature flags instead of `contractAddresses`.
|
|
@@ -1409,7 +1458,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1409
1458
|
|
|
1410
1459
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1411
1460
|
|
|
1412
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.
|
|
1461
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.3.0...HEAD
|
|
1462
|
+
[52.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.2.0...@metamask/transaction-controller@52.3.0
|
|
1463
|
+
[52.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.1.0...@metamask/transaction-controller@52.2.0
|
|
1413
1464
|
[52.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.0.0...@metamask/transaction-controller@52.1.0
|
|
1414
1465
|
[52.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@51.0.0...@metamask/transaction-controller@52.0.0
|
|
1415
1466
|
[51.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@50.0.0...@metamask/transaction-controller@51.0.0
|
|
@@ -13,7 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
13
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
|
-
var _TransactionController_instances, _TransactionController_internalEvents, _TransactionController_methodDataHelper, _TransactionController_incomingTransactionHelper, _TransactionController_incomingTransactionOptions, _TransactionController_pendingTransactionOptions, _TransactionController_publicKeyEIP7702, _TransactionController_trace, _TransactionController_transactionHistoryLimit, _TransactionController_isFirstTimeInteractionEnabled, _TransactionController_isSimulationEnabled, _TransactionController_testGasFeeFlows, _TransactionController_multichainTrackingHelper, _TransactionController_retryTransaction, _TransactionController_rejectTransaction, _TransactionController_getChainId, _TransactionController_getNetworkClientId, _TransactionController_getEthQuery, _TransactionController_getProvider, _TransactionController_createNonceTracker, _TransactionController_createPendingTransactionTracker, _TransactionController_checkForPendingTransactionAndStartPolling, _TransactionController_stopAllTracking, _TransactionController_addIncomingTransactionHelperListeners, _TransactionController_removePendingTransactionTrackerListeners, _TransactionController_addPendingTransactionTrackerListeners, _TransactionController_getNonceTrackerPendingTransactions, _TransactionController_getGasFeeFlows, _TransactionController_getLayer1GasFeeFlows, _TransactionController_updateTransactionInternal, _TransactionController_updateFirstTimeInteraction, _TransactionController_updateSimulationData, _TransactionController_onGasFeePollerTransactionUpdate, _TransactionController_getSelectedAccount, _TransactionController_getInternalAccounts, _TransactionController_updateSubmitHistory, _TransactionController_updateGasEstimate, _TransactionController_deleteTransaction, _TransactionController_isRejectError, _TransactionController_rejectTransactionAndThrow;
|
|
16
|
+
var _TransactionController_instances, _TransactionController_internalEvents, _TransactionController_methodDataHelper, _TransactionController_incomingTransactionHelper, _TransactionController_incomingTransactionOptions, _TransactionController_pendingTransactionOptions, _TransactionController_publishBatchHook, _TransactionController_publicKeyEIP7702, _TransactionController_trace, _TransactionController_transactionHistoryLimit, _TransactionController_isFirstTimeInteractionEnabled, _TransactionController_isSimulationEnabled, _TransactionController_testGasFeeFlows, _TransactionController_multichainTrackingHelper, _TransactionController_retryTransaction, _TransactionController_rejectTransaction, _TransactionController_getChainId, _TransactionController_getNetworkClientId, _TransactionController_getEthQuery, _TransactionController_getProvider, _TransactionController_createNonceTracker, _TransactionController_createPendingTransactionTracker, _TransactionController_checkForPendingTransactionAndStartPolling, _TransactionController_stopAllTracking, _TransactionController_addIncomingTransactionHelperListeners, _TransactionController_removePendingTransactionTrackerListeners, _TransactionController_addPendingTransactionTrackerListeners, _TransactionController_getNonceTrackerPendingTransactions, _TransactionController_getGasFeeFlows, _TransactionController_getLayer1GasFeeFlows, _TransactionController_updateTransactionInternal, _TransactionController_updateFirstTimeInteraction, _TransactionController_updateSimulationData, _TransactionController_onGasFeePollerTransactionUpdate, _TransactionController_getSelectedAccount, _TransactionController_getInternalAccounts, _TransactionController_updateSubmitHistory, _TransactionController_updateGasEstimate, _TransactionController_deleteTransaction, _TransactionController_isRejectError, _TransactionController_rejectTransactionAndThrow;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.TransactionController = exports.ApprovalState = exports.SPEED_UP_RATE = exports.CANCEL_RATE = void 0;
|
|
19
19
|
const base_controller_1 = require("@metamask/base-controller");
|
|
@@ -23,7 +23,6 @@ const network_controller_1 = require("@metamask/network-controller");
|
|
|
23
23
|
const nonce_tracker_1 = require("@metamask/nonce-tracker");
|
|
24
24
|
const rpc_errors_1 = require("@metamask/rpc-errors");
|
|
25
25
|
const utils_1 = require("@metamask/utils");
|
|
26
|
-
const async_mutex_1 = require("async-mutex");
|
|
27
26
|
// This package purposefully relies on Node's EventEmitter module.
|
|
28
27
|
// eslint-disable-next-line import-x/no-nodejs-modules
|
|
29
28
|
const events_1 = require("events");
|
|
@@ -33,6 +32,7 @@ const accounts_api_1 = require("./api/accounts-api.cjs");
|
|
|
33
32
|
const DefaultGasFeeFlow_1 = require("./gas-flows/DefaultGasFeeFlow.cjs");
|
|
34
33
|
const LineaGasFeeFlow_1 = require("./gas-flows/LineaGasFeeFlow.cjs");
|
|
35
34
|
const OptimismLayer1GasFeeFlow_1 = require("./gas-flows/OptimismLayer1GasFeeFlow.cjs");
|
|
35
|
+
const RandomisedEstimationsGasFeeFlow_1 = require("./gas-flows/RandomisedEstimationsGasFeeFlow.cjs");
|
|
36
36
|
const ScrollLayer1GasFeeFlow_1 = require("./gas-flows/ScrollLayer1GasFeeFlow.cjs");
|
|
37
37
|
const TestGasFeeFlow_1 = require("./gas-flows/TestGasFeeFlow.cjs");
|
|
38
38
|
const AccountsApiRemoteTransactionSource_1 = require("./helpers/AccountsApiRemoteTransactionSource.cjs");
|
|
@@ -42,6 +42,7 @@ const MethodDataHelper_1 = require("./helpers/MethodDataHelper.cjs");
|
|
|
42
42
|
const MultichainTrackingHelper_1 = require("./helpers/MultichainTrackingHelper.cjs");
|
|
43
43
|
const PendingTransactionTracker_1 = require("./helpers/PendingTransactionTracker.cjs");
|
|
44
44
|
const ResimulateHelper_1 = require("./helpers/ResimulateHelper.cjs");
|
|
45
|
+
const ExtraTransactionsPublishHook_1 = require("./hooks/ExtraTransactionsPublishHook.cjs");
|
|
45
46
|
const logger_1 = require("./logger.cjs");
|
|
46
47
|
const types_1 = require("./types.cjs");
|
|
47
48
|
const batch_1 = require("./utils/batch.cjs");
|
|
@@ -170,10 +171,10 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
170
171
|
_TransactionController_internalEvents.set(this, new events_1.EventEmitter());
|
|
171
172
|
this.approvingTransactionIds = new Set();
|
|
172
173
|
_TransactionController_methodDataHelper.set(this, void 0);
|
|
173
|
-
this.mutex = new async_mutex_1.Mutex();
|
|
174
174
|
_TransactionController_incomingTransactionHelper.set(this, void 0);
|
|
175
175
|
_TransactionController_incomingTransactionOptions.set(this, void 0);
|
|
176
176
|
_TransactionController_pendingTransactionOptions.set(this, void 0);
|
|
177
|
+
_TransactionController_publishBatchHook.set(this, void 0);
|
|
177
178
|
_TransactionController_publicKeyEIP7702.set(this, void 0);
|
|
178
179
|
this.signAbortCallbacks = new Map();
|
|
179
180
|
_TransactionController_trace.set(this, void 0);
|
|
@@ -206,6 +207,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
206
207
|
this.securityProviderRequest = securityProviderRequest;
|
|
207
208
|
__classPrivateFieldSet(this, _TransactionController_incomingTransactionOptions, incomingTransactions, "f");
|
|
208
209
|
__classPrivateFieldSet(this, _TransactionController_pendingTransactionOptions, pendingTransactions, "f");
|
|
210
|
+
__classPrivateFieldSet(this, _TransactionController_publishBatchHook, hooks?.publishBatch, "f");
|
|
209
211
|
__classPrivateFieldSet(this, _TransactionController_publicKeyEIP7702, publicKeyEIP7702, "f");
|
|
210
212
|
__classPrivateFieldSet(this, _TransactionController_transactionHistoryLimit, transactionHistoryLimit, "f");
|
|
211
213
|
this.sign = sign;
|
|
@@ -247,6 +249,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
247
249
|
getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
|
|
248
250
|
getTransactions: () => this.state.transactions,
|
|
249
251
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
252
|
+
messenger: this.messagingSystem,
|
|
250
253
|
onStateChange: (listener) => {
|
|
251
254
|
this.messagingSystem.subscribe('TransactionController:stateChange', listener);
|
|
252
255
|
},
|
|
@@ -320,9 +323,12 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
320
323
|
getChainId: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).bind(this),
|
|
321
324
|
getEthQuery: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId }),
|
|
322
325
|
getInternalAccounts: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getInternalAccounts).bind(this),
|
|
326
|
+
getTransaction: (transactionId) => this.getTransactionOrThrow(transactionId),
|
|
323
327
|
messenger: this.messagingSystem,
|
|
328
|
+
publishBatchHook: __classPrivateFieldGet(this, _TransactionController_publishBatchHook, "f"),
|
|
324
329
|
publicKeyEIP7702: __classPrivateFieldGet(this, _TransactionController_publicKeyEIP7702, "f"),
|
|
325
330
|
request,
|
|
331
|
+
updateTransaction: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).bind(this),
|
|
326
332
|
});
|
|
327
333
|
}
|
|
328
334
|
/**
|
|
@@ -349,9 +355,11 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
349
355
|
* @param options.actionId - Unique ID to prevent duplicate requests.
|
|
350
356
|
* @param options.batchId - A custom ID for the batch this transaction belongs to.
|
|
351
357
|
* @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
|
|
358
|
+
* @param options.disableGasBuffer - Whether to disable the gas estimation buffer.
|
|
352
359
|
* @param options.method - RPC method that requested the transaction.
|
|
353
360
|
* @param options.nestedTransactions - Params for any nested transactions encoded in the data.
|
|
354
361
|
* @param options.origin - The origin of the transaction request, such as a dApp hostname.
|
|
362
|
+
* @param options.publishHook - Custom logic to publish the transaction.
|
|
355
363
|
* @param options.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.
|
|
356
364
|
* @param options.securityAlertResponse - Response from security validator.
|
|
357
365
|
* @param options.sendFlowHistory - The sendFlowHistory entries to add.
|
|
@@ -365,7 +373,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
365
373
|
*/
|
|
366
374
|
async addTransaction(txParams, options) {
|
|
367
375
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
368
|
-
const { actionId, batchId, deviceConfirmedOn, method, nestedTransactions, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
376
|
+
const { actionId, batchId, deviceConfirmedOn, disableGasBuffer, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
369
377
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
370
378
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
371
379
|
throw new Error(`Network client not found - ${networkClientId}`);
|
|
@@ -392,9 +400,13 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
392
400
|
const delegationAddressPromise = (0, eip7702_1.getDelegationAddress)(txParams.from, ethQuery).catch(() => undefined);
|
|
393
401
|
const isEIP1559Compatible = await this.getEIP1559Compatibility(networkClientId);
|
|
394
402
|
(0, validation_1.validateTxParams)(txParams, isEIP1559Compatible);
|
|
403
|
+
if (!txParams.type) {
|
|
404
|
+
// Determine transaction type based on transaction parameters and network compatibility
|
|
405
|
+
(0, utils_2.setEnvelopeType)(txParams, isEIP1559Compatible);
|
|
406
|
+
}
|
|
395
407
|
const isDuplicateBatchId = batchId?.length &&
|
|
396
408
|
this.state.transactions.some((tx) => tx.batchId?.toLowerCase() === batchId?.toLowerCase());
|
|
397
|
-
if (isDuplicateBatchId) {
|
|
409
|
+
if (isDuplicateBatchId && origin && origin !== controller_utils_1.ORIGIN_METAMASK) {
|
|
398
410
|
throw rpc_errors_1.rpcErrors.invalidInput('Batch ID already exists');
|
|
399
411
|
}
|
|
400
412
|
const dappSuggestedGasFees = this.generateDappSuggestedGasFees(txParams, origin);
|
|
@@ -412,6 +424,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
412
424
|
dappSuggestedGasFees,
|
|
413
425
|
delegationAddress,
|
|
414
426
|
deviceConfirmedOn,
|
|
427
|
+
disableGasBuffer,
|
|
415
428
|
id: (0, uuid_1.v1)(),
|
|
416
429
|
isFirstTimeInteraction: undefined,
|
|
417
430
|
nestedTransactions,
|
|
@@ -469,9 +482,10 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
469
482
|
}
|
|
470
483
|
return {
|
|
471
484
|
result: this.processApproval(addedTransactionMeta, {
|
|
485
|
+
actionId,
|
|
472
486
|
isExisting: Boolean(existingTransactionMeta),
|
|
487
|
+
publishHook,
|
|
473
488
|
requireApproval,
|
|
474
|
-
actionId,
|
|
475
489
|
traceContext,
|
|
476
490
|
}),
|
|
477
491
|
transactionMeta: addedTransactionMeta,
|
|
@@ -794,14 +808,16 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
794
808
|
* @param txId - The ID of the transaction to update.
|
|
795
809
|
* @param params - The editable parameters to update.
|
|
796
810
|
* @param params.data - Data to pass with the transaction.
|
|
811
|
+
* @param params.from - Address to send the transaction from.
|
|
797
812
|
* @param params.gas - Maximum number of units of gas to use for the transaction.
|
|
798
813
|
* @param params.gasPrice - Price per gas for legacy transactions.
|
|
799
|
-
* @param params.
|
|
814
|
+
* @param params.maxFeePerGas - Maximum amount per gas to pay for the transaction, including the priority fee.
|
|
815
|
+
* @param params.maxPriorityFeePerGas - Maximum amount per gas to give to validator as incentive.
|
|
800
816
|
* @param params.to - Address to send the transaction to.
|
|
801
817
|
* @param params.value - Value associated with the transaction.
|
|
802
818
|
* @returns The updated transaction metadata.
|
|
803
819
|
*/
|
|
804
|
-
async updateEditableParams(txId, { data, gas, gasPrice,
|
|
820
|
+
async updateEditableParams(txId, { data, from, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to, value, }) {
|
|
805
821
|
const transactionMeta = this.getTransaction(txId);
|
|
806
822
|
if (!transactionMeta) {
|
|
807
823
|
throw new Error(`Cannot update editable params as no transaction metadata found`);
|
|
@@ -815,6 +831,8 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
815
831
|
value,
|
|
816
832
|
gas,
|
|
817
833
|
gasPrice,
|
|
834
|
+
maxFeePerGas,
|
|
835
|
+
maxPriorityFeePerGas,
|
|
818
836
|
},
|
|
819
837
|
};
|
|
820
838
|
editableParams.txParams = (0, lodash_1.pickBy)(editableParams.txParams);
|
|
@@ -826,6 +844,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
826
844
|
updatedTransaction.type = type;
|
|
827
845
|
await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
|
|
828
846
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
847
|
+
messenger: this.messagingSystem,
|
|
829
848
|
provider,
|
|
830
849
|
transactionMeta: updatedTransaction,
|
|
831
850
|
});
|
|
@@ -1038,7 +1057,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1038
1057
|
networkClientId,
|
|
1039
1058
|
};
|
|
1040
1059
|
// Guaranteed as the default gas fee flow matches all transactions.
|
|
1041
|
-
const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows);
|
|
1060
|
+
const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows, this.messagingSystem);
|
|
1042
1061
|
const ethQuery = new eth_query_1.default(provider);
|
|
1043
1062
|
const gasFeeControllerData = await this.getGasFeeEstimates({
|
|
1044
1063
|
networkClientId,
|
|
@@ -1046,6 +1065,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1046
1065
|
return gasFeeFlow.getGasFees({
|
|
1047
1066
|
ethQuery,
|
|
1048
1067
|
gasFeeControllerData,
|
|
1068
|
+
messenger: this.messagingSystem,
|
|
1049
1069
|
transactionMeta,
|
|
1050
1070
|
});
|
|
1051
1071
|
}
|
|
@@ -1065,6 +1085,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1065
1085
|
});
|
|
1066
1086
|
return await (0, layer1_gas_fee_flow_1.getTransactionLayer1GasFee)({
|
|
1067
1087
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
1088
|
+
messenger: this.messagingSystem,
|
|
1068
1089
|
provider,
|
|
1069
1090
|
transactionMeta: {
|
|
1070
1091
|
txParams: transactionParams,
|
|
@@ -1167,6 +1188,38 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1167
1188
|
});
|
|
1168
1189
|
return updatedTransactionMeta.txParams.data;
|
|
1169
1190
|
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Update the batch transactions associated with a transaction.
|
|
1193
|
+
* These transactions will be submitted with the main transaction as a batch.
|
|
1194
|
+
*
|
|
1195
|
+
* @param request - The request object.
|
|
1196
|
+
* @param request.transactionId - The ID of the transaction to update.
|
|
1197
|
+
* @param request.batchTransactions - The new batch transactions.
|
|
1198
|
+
*/
|
|
1199
|
+
updateBatchTransactions({ transactionId, batchTransactions, }) {
|
|
1200
|
+
(0, logger_1.projectLogger)('Updating batch transactions', { transactionId, batchTransactions });
|
|
1201
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
1202
|
+
transactionId,
|
|
1203
|
+
note: 'TransactionController#updateBatchTransactions - Batch transactions updated',
|
|
1204
|
+
}, (transactionMeta) => {
|
|
1205
|
+
transactionMeta.batchTransactions = batchTransactions;
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Update the selected gas fee token for a transaction.
|
|
1210
|
+
*
|
|
1211
|
+
* @param transactionId - The ID of the transaction to update.
|
|
1212
|
+
* @param contractAddress - The contract address of the selected gas fee token.
|
|
1213
|
+
*/
|
|
1214
|
+
updateSelectedGasFeeToken(transactionId, contractAddress) {
|
|
1215
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, { transactionId }, (transactionMeta) => {
|
|
1216
|
+
const hasMatchingGasFeeToken = transactionMeta.gasFeeTokens?.some((token) => token.tokenAddress.toLowerCase() === contractAddress?.toLowerCase());
|
|
1217
|
+
if (contractAddress && !hasMatchingGasFeeToken) {
|
|
1218
|
+
throw new Error(`No matching gas fee token found with address - ${contractAddress}`);
|
|
1219
|
+
}
|
|
1220
|
+
transactionMeta.selectedGasFeeToken = contractAddress;
|
|
1221
|
+
});
|
|
1222
|
+
}
|
|
1170
1223
|
addMetadata(transactionMeta) {
|
|
1171
1224
|
(0, validation_1.validateTxParams)(transactionMeta.txParams);
|
|
1172
1225
|
this.update((state) => {
|
|
@@ -1191,10 +1244,12 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1191
1244
|
gasFeeFlows: this.gasFeeFlows,
|
|
1192
1245
|
getGasFeeEstimates: this.getGasFeeEstimates,
|
|
1193
1246
|
getSavedGasFees: this.getSavedGasFees.bind(this),
|
|
1247
|
+
messenger: this.messagingSystem,
|
|
1194
1248
|
txMeta: transactionMeta,
|
|
1195
1249
|
}));
|
|
1196
1250
|
await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Update Layer 1 Gas Fees', parentContext: traceContext }, async () => await (0, layer1_gas_fee_flow_1.updateTransactionLayer1GasFee)({
|
|
1197
1251
|
layer1GasFeeFlows: this.layer1GasFeeFlows,
|
|
1252
|
+
messenger: this.messagingSystem,
|
|
1198
1253
|
provider,
|
|
1199
1254
|
transactionMeta,
|
|
1200
1255
|
}));
|
|
@@ -1209,7 +1264,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1209
1264
|
this.failTransaction(transactionMeta, new Error('Transaction incomplete at startup'));
|
|
1210
1265
|
}
|
|
1211
1266
|
}
|
|
1212
|
-
async processApproval(transactionMeta, { isExisting = false, requireApproval, shouldShowRequest = true,
|
|
1267
|
+
async processApproval(transactionMeta, { actionId, isExisting = false, publishHook, requireApproval, shouldShowRequest = true, traceContext, }) {
|
|
1213
1268
|
const transactionId = transactionMeta.id;
|
|
1214
1269
|
let resultCallbacks;
|
|
1215
1270
|
const { meta, isCompleted } = this.isTransactionCompleted(transactionId);
|
|
@@ -1236,7 +1291,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1236
1291
|
}
|
|
1237
1292
|
const { isCompleted: isTxCompleted } = this.isTransactionCompleted(transactionId);
|
|
1238
1293
|
if (!isTxCompleted) {
|
|
1239
|
-
const approvalResult = await this.approveTransaction(transactionId, traceContext);
|
|
1294
|
+
const approvalResult = await this.approveTransaction(transactionId, traceContext, publishHook);
|
|
1240
1295
|
if (approvalResult === ApprovalState.SkippedViaBeforePublishHook &&
|
|
1241
1296
|
resultCallbacks) {
|
|
1242
1297
|
resultCallbacks.success();
|
|
@@ -1284,12 +1339,14 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1284
1339
|
*
|
|
1285
1340
|
* @param transactionId - The ID of the transaction to approve.
|
|
1286
1341
|
* @param traceContext - The parent context for any new traces.
|
|
1342
|
+
* @param publishHookOverride - Custom logic to publish the transaction.
|
|
1287
1343
|
* @returns The state of the approval.
|
|
1288
1344
|
*/
|
|
1289
|
-
async approveTransaction(transactionId, traceContext) {
|
|
1290
|
-
|
|
1291
|
-
|
|
1345
|
+
async approveTransaction(transactionId, traceContext, publishHookOverride) {
|
|
1346
|
+
let clearApprovingTransactionId;
|
|
1347
|
+
let clearNonceLock;
|
|
1292
1348
|
let transactionMeta = this.getTransactionOrThrow(transactionId);
|
|
1349
|
+
(0, logger_1.projectLogger)('Approving transaction', transactionMeta);
|
|
1293
1350
|
try {
|
|
1294
1351
|
if (!this.sign) {
|
|
1295
1352
|
this.failTransaction(transactionMeta, new Error('No sign method defined.'));
|
|
@@ -1304,10 +1361,9 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1304
1361
|
return ApprovalState.NotApproved;
|
|
1305
1362
|
}
|
|
1306
1363
|
this.approvingTransactionIds.add(transactionId);
|
|
1307
|
-
|
|
1364
|
+
clearApprovingTransactionId = () => this.approvingTransactionIds.delete(transactionId);
|
|
1308
1365
|
const [nonce, releaseNonce] = await (0, nonce_1.getNextNonce)(transactionMeta, (address) => __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNonceLock(address, transactionMeta.networkClientId));
|
|
1309
|
-
|
|
1310
|
-
releaseNonce && cleanupTasks.push(releaseNonce);
|
|
1366
|
+
clearNonceLock = releaseNonce;
|
|
1311
1367
|
transactionMeta = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
1312
1368
|
transactionId,
|
|
1313
1369
|
note: 'TransactionController#approveTransaction - Transaction approved',
|
|
@@ -1344,8 +1400,19 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1344
1400
|
}
|
|
1345
1401
|
(0, logger_1.projectLogger)('Publishing transaction', transactionMeta.txParams);
|
|
1346
1402
|
let hash;
|
|
1403
|
+
clearNonceLock?.();
|
|
1404
|
+
clearNonceLock = undefined;
|
|
1405
|
+
if (transactionMeta.batchTransactions?.length) {
|
|
1406
|
+
(0, logger_1.projectLogger)('Found batch transactions', transactionMeta.batchTransactions);
|
|
1407
|
+
const extraTransactionsPublishHook = new ExtraTransactionsPublishHook_1.ExtraTransactionsPublishHook({
|
|
1408
|
+
addTransactionBatch: this.addTransactionBatch.bind(this),
|
|
1409
|
+
transactions: transactionMeta.batchTransactions,
|
|
1410
|
+
});
|
|
1411
|
+
publishHookOverride = extraTransactionsPublishHook.getHook();
|
|
1412
|
+
}
|
|
1347
1413
|
await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Publish', parentContext: traceContext }, async () => {
|
|
1348
|
-
|
|
1414
|
+
const publishHook = publishHookOverride ?? this.publish;
|
|
1415
|
+
({ transactionHash: hash } = await publishHook(transactionMeta, rawTx));
|
|
1349
1416
|
if (hash === undefined) {
|
|
1350
1417
|
hash = await this.publishTransaction(ethQuery, {
|
|
1351
1418
|
...transactionMeta,
|
|
@@ -1381,7 +1448,8 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1381
1448
|
return ApprovalState.NotApproved;
|
|
1382
1449
|
}
|
|
1383
1450
|
finally {
|
|
1384
|
-
|
|
1451
|
+
clearApprovingTransactionId?.();
|
|
1452
|
+
clearNonceLock?.();
|
|
1385
1453
|
}
|
|
1386
1454
|
}
|
|
1387
1455
|
async publishTransaction(ethQuery, transactionMeta, { skipSubmitHistory } = {}) {
|
|
@@ -1708,8 +1776,8 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1708
1776
|
transactionMeta,
|
|
1709
1777
|
});
|
|
1710
1778
|
}
|
|
1711
|
-
getNonceTrackerTransactions(
|
|
1712
|
-
return (0, nonce_1.getAndFormatTransactionsForNonceTracker)(chainId, address,
|
|
1779
|
+
getNonceTrackerTransactions(statuses, address, chainId) {
|
|
1780
|
+
return (0, nonce_1.getAndFormatTransactionsForNonceTracker)(chainId, address, statuses, this.state.transactions);
|
|
1713
1781
|
}
|
|
1714
1782
|
onConfirmedTransaction(transactionMeta) {
|
|
1715
1783
|
(0, logger_1.projectLogger)('Processing confirmed transaction', transactionMeta.id);
|
|
@@ -1770,7 +1838,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1770
1838
|
}
|
|
1771
1839
|
}
|
|
1772
1840
|
exports.TransactionController = TransactionController;
|
|
1773
|
-
_TransactionController_internalEvents = new WeakMap(), _TransactionController_methodDataHelper = new WeakMap(), _TransactionController_incomingTransactionHelper = new WeakMap(), _TransactionController_incomingTransactionOptions = new WeakMap(), _TransactionController_pendingTransactionOptions = new WeakMap(), _TransactionController_publicKeyEIP7702 = new WeakMap(), _TransactionController_trace = new WeakMap(), _TransactionController_transactionHistoryLimit = new WeakMap(), _TransactionController_isFirstTimeInteractionEnabled = new WeakMap(), _TransactionController_isSimulationEnabled = new WeakMap(), _TransactionController_testGasFeeFlows = new WeakMap(), _TransactionController_multichainTrackingHelper = new WeakMap(), _TransactionController_checkForPendingTransactionAndStartPolling = new WeakMap(), _TransactionController_instances = new WeakSet(), _TransactionController_retryTransaction = async function _TransactionController_retryTransaction({ actionId, afterSubmit, estimatedBaseFee, gasValues, label, prepareTransactionParams, rate, transactionId, transactionType, }) {
|
|
1841
|
+
_TransactionController_internalEvents = new WeakMap(), _TransactionController_methodDataHelper = new WeakMap(), _TransactionController_incomingTransactionHelper = new WeakMap(), _TransactionController_incomingTransactionOptions = new WeakMap(), _TransactionController_pendingTransactionOptions = new WeakMap(), _TransactionController_publishBatchHook = new WeakMap(), _TransactionController_publicKeyEIP7702 = new WeakMap(), _TransactionController_trace = new WeakMap(), _TransactionController_transactionHistoryLimit = new WeakMap(), _TransactionController_isFirstTimeInteractionEnabled = new WeakMap(), _TransactionController_isSimulationEnabled = new WeakMap(), _TransactionController_testGasFeeFlows = new WeakMap(), _TransactionController_multichainTrackingHelper = new WeakMap(), _TransactionController_checkForPendingTransactionAndStartPolling = new WeakMap(), _TransactionController_instances = new WeakSet(), _TransactionController_retryTransaction = async function _TransactionController_retryTransaction({ actionId, afterSubmit, estimatedBaseFee, gasValues, label, prepareTransactionParams, rate, transactionId, transactionType, }) {
|
|
1774
1842
|
// If transaction is found for same action id, do not create a new transaction.
|
|
1775
1843
|
if (this.getTransactionWithActionId(actionId)) {
|
|
1776
1844
|
return;
|
|
@@ -1878,7 +1946,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
1878
1946
|
// TODO: Fix types
|
|
1879
1947
|
blockTracker,
|
|
1880
1948
|
getPendingTransactions: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNonceTrackerPendingTransactions).bind(this, chainId),
|
|
1881
|
-
getConfirmedTransactions: this.getNonceTrackerTransactions.bind(this, types_1.TransactionStatus.confirmed, chainId),
|
|
1949
|
+
getConfirmedTransactions: this.getNonceTrackerTransactions.bind(this, [types_1.TransactionStatus.confirmed], chainId),
|
|
1882
1950
|
});
|
|
1883
1951
|
}, _TransactionController_createPendingTransactionTracker = function _TransactionController_createPendingTransactionTracker({ provider, blockTracker, chainId, networkClientId, }) {
|
|
1884
1952
|
const ethQuery = new eth_query_1.default(provider);
|
|
@@ -1892,6 +1960,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
1892
1960
|
getGlobalLock: () => __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").acquireNonceLockForChainIdKey({
|
|
1893
1961
|
chainId,
|
|
1894
1962
|
}),
|
|
1963
|
+
messenger: this.messagingSystem,
|
|
1895
1964
|
publishTransaction: (_ethQuery, transactionMeta) => this.publishTransaction(_ethQuery, transactionMeta, {
|
|
1896
1965
|
skipSubmitHistory: true,
|
|
1897
1966
|
}),
|
|
@@ -1917,14 +1986,22 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
1917
1986
|
pendingTransactionTracker.hub.on('transaction-failed', this.failTransaction.bind(this));
|
|
1918
1987
|
pendingTransactionTracker.hub.on('transaction-updated', this.updateTransaction.bind(this));
|
|
1919
1988
|
}, _TransactionController_getNonceTrackerPendingTransactions = function _TransactionController_getNonceTrackerPendingTransactions(chainId, address) {
|
|
1920
|
-
const standardPendingTransactions = this.getNonceTrackerTransactions(
|
|
1989
|
+
const standardPendingTransactions = this.getNonceTrackerTransactions([
|
|
1990
|
+
types_1.TransactionStatus.approved,
|
|
1991
|
+
types_1.TransactionStatus.signed,
|
|
1992
|
+
types_1.TransactionStatus.submitted,
|
|
1993
|
+
], address, chainId);
|
|
1921
1994
|
const externalPendingTransactions = this.getExternalPendingTransactions(address, chainId);
|
|
1922
1995
|
return [...standardPendingTransactions, ...externalPendingTransactions];
|
|
1923
1996
|
}, _TransactionController_getGasFeeFlows = function _TransactionController_getGasFeeFlows() {
|
|
1924
1997
|
if (__classPrivateFieldGet(this, _TransactionController_testGasFeeFlows, "f")) {
|
|
1925
1998
|
return [new TestGasFeeFlow_1.TestGasFeeFlow()];
|
|
1926
1999
|
}
|
|
1927
|
-
return [
|
|
2000
|
+
return [
|
|
2001
|
+
new RandomisedEstimationsGasFeeFlow_1.RandomisedEstimationsGasFeeFlow(),
|
|
2002
|
+
new LineaGasFeeFlow_1.LineaGasFeeFlow(),
|
|
2003
|
+
new DefaultGasFeeFlow_1.DefaultGasFeeFlow(),
|
|
2004
|
+
];
|
|
1928
2005
|
}, _TransactionController_getLayer1GasFeeFlows = function _TransactionController_getLayer1GasFeeFlows() {
|
|
1929
2006
|
return [new OptimismLayer1GasFeeFlow_1.OptimismLayer1GasFeeFlow(), new ScrollLayer1GasFeeFlow_1.ScrollLayer1GasFeeFlow()];
|
|
1930
2007
|
}, _TransactionController_updateTransactionInternal = function _TransactionController_updateTransactionInternal({ transactionId, note, skipHistory, skipValidation, skipResimulateCheck, }, callback) {
|
|
@@ -2012,8 +2089,12 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2012
2089
|
},
|
|
2013
2090
|
tokenBalanceChanges: [],
|
|
2014
2091
|
};
|
|
2092
|
+
let gasFeeTokens = [];
|
|
2015
2093
|
if (__classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this)) {
|
|
2016
|
-
|
|
2094
|
+
const authorizationAddress = txParams?.authorizationList?.[0]?.address;
|
|
2095
|
+
const senderCode = authorizationAddress &&
|
|
2096
|
+
(eip7702_1.DELEGATION_PREFIX + (0, utils_1.remove0x)(authorizationAddress));
|
|
2097
|
+
const result = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Simulate', parentContext: traceContext }, () => (0, simulation_1.getSimulationData)({
|
|
2017
2098
|
chainId,
|
|
2018
2099
|
from: from,
|
|
2019
2100
|
to: to,
|
|
@@ -2021,7 +2102,10 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2021
2102
|
data: data,
|
|
2022
2103
|
}, {
|
|
2023
2104
|
blockTime,
|
|
2105
|
+
senderCode,
|
|
2024
2106
|
}));
|
|
2107
|
+
gasFeeTokens = result?.gasFeeTokens;
|
|
2108
|
+
simulationData = result?.simulationData;
|
|
2025
2109
|
if (blockTime &&
|
|
2026
2110
|
prevSimulationData &&
|
|
2027
2111
|
(0, ResimulateHelper_1.hasSimulationDataChanged)(prevSimulationData, simulationData)) {
|
|
@@ -2042,17 +2126,16 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2042
2126
|
note: 'TransactionController#updateSimulationData - Update simulation data',
|
|
2043
2127
|
skipResimulateCheck: Boolean(blockTime),
|
|
2044
2128
|
}, (txMeta) => {
|
|
2129
|
+
txMeta.gasFeeTokens = gasFeeTokens;
|
|
2045
2130
|
txMeta.simulationData = simulationData;
|
|
2046
2131
|
});
|
|
2047
2132
|
(0, logger_1.projectLogger)('Updated simulation data', transactionId, simulationData);
|
|
2048
2133
|
}, _TransactionController_onGasFeePollerTransactionUpdate = function _TransactionController_onGasFeePollerTransactionUpdate({ transactionId, gasFeeEstimates, gasFeeEstimatesLoaded, layer1GasFee, }) {
|
|
2049
2134
|
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, { transactionId, skipHistory: true }, (txMeta) => {
|
|
2050
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
2051
2135
|
(0, GasFeePoller_1.updateTransactionGasFees)({
|
|
2052
2136
|
txMeta,
|
|
2053
2137
|
gasFeeEstimates,
|
|
2054
2138
|
gasFeeEstimatesLoaded,
|
|
2055
|
-
getEIP1559Compatibility: this.getEIP1559Compatibility.bind(this),
|
|
2056
2139
|
isTxParamsGasFeeUpdatesEnabled: this.isTxParamsGasFeeUpdatesEnabled,
|
|
2057
2140
|
layer1GasFee,
|
|
2058
2141
|
});
|