@metamask-previews/transaction-controller 52.1.0-preview-8a8331b2 → 52.2.0-preview-9838d8a5
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 +15 -4
- package/dist/TransactionController.cjs +24 -1
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +7 -0
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +7 -0
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +26 -3
- package/dist/TransactionController.mjs.map +1 -1
- 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 +30 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +30 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,8 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Fix simulation of type-4 transactions ([#5552](https://github.com/MetaMask/core/pull/5552))
|
|
13
|
+
|
|
14
|
+
## [52.2.0]
|
|
15
|
+
|
|
10
16
|
### Added
|
|
11
17
|
|
|
18
|
+
- Add `gasFeeTokens` to `TransactionMeta` ([#5524](https://github.com/MetaMask/core/pull/5524))
|
|
19
|
+
- Add `GasFeeToken` type.
|
|
20
|
+
- Add `selectedGasFeeToken` to `TransactionMeta`.
|
|
21
|
+
- Add `updateSelectedGasFeeToken` method.
|
|
12
22
|
- Support security validation of transaction batches ([#5526](https://github.com/MetaMask/core/pull/5526))
|
|
13
23
|
- Add `ValidateSecurityRequest` type.
|
|
14
24
|
- Add optional `securityAlertId` to `SecurityAlertResponse`.
|
|
@@ -69,7 +79,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
69
79
|
### Added
|
|
70
80
|
|
|
71
81
|
- Add additional metadata for batch metrics ([#5488](https://github.com/MetaMask/core/pull/5488))
|
|
72
|
-
- Add `delegationAddress` to `
|
|
82
|
+
- Add `delegationAddress` to `TransactionMeta`.
|
|
73
83
|
- Add `NestedTransactionMetadata` type containing `BatchTransactionParams` and `type`.
|
|
74
84
|
- Add optional `type` to `TransactionBatchSingleRequest`.
|
|
75
85
|
- Verify EIP-7702 contract address using signatures ([#5472](https://github.com/MetaMask/core/pull/5472))
|
|
@@ -80,8 +90,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
80
90
|
|
|
81
91
|
- **BREAKING:** Bump `@metamask/accounts-controller` peer dependency to `^26.1.0` ([#5481](https://github.com/MetaMask/core/pull/5481))
|
|
82
92
|
- **BREAKING:** Add additional metadata for batch metrics ([#5488](https://github.com/MetaMask/core/pull/5488))
|
|
83
|
-
- Change `error` in `
|
|
84
|
-
- Change `nestedTransactions` in `
|
|
93
|
+
- Change `error` in `TransactionMeta` to optional for all statuses.
|
|
94
|
+
- Change `nestedTransactions` in `TransactionMeta` to array of `NestedTransactionMetadata`.
|
|
85
95
|
- Throw if `addTransactionBatch` called with external origin and size limit exceeded ([#5489](https://github.com/MetaMask/core/pull/5489))
|
|
86
96
|
- Verify EIP-7702 contract address using signatures ([#5472](https://github.com/MetaMask/core/pull/5472))
|
|
87
97
|
- Use new `contracts` property from feature flags instead of `contractAddresses`.
|
|
@@ -1437,7 +1447,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1437
1447
|
|
|
1438
1448
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1439
1449
|
|
|
1440
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.
|
|
1450
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.2.0...HEAD
|
|
1451
|
+
[52.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.1.0...@metamask/transaction-controller@52.2.0
|
|
1441
1452
|
[52.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@52.0.0...@metamask/transaction-controller@52.1.0
|
|
1442
1453
|
[52.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@51.0.0...@metamask/transaction-controller@52.0.0
|
|
1443
1454
|
[51.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@50.0.0...@metamask/transaction-controller@51.0.0
|
|
@@ -1196,6 +1196,21 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1196
1196
|
transactionMeta.batchTransactions = batchTransactions;
|
|
1197
1197
|
});
|
|
1198
1198
|
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Update the selected gas fee token for a transaction.
|
|
1201
|
+
*
|
|
1202
|
+
* @param transactionId - The ID of the transaction to update.
|
|
1203
|
+
* @param contractAddress - The contract address of the selected gas fee token.
|
|
1204
|
+
*/
|
|
1205
|
+
updateSelectedGasFeeToken(transactionId, contractAddress) {
|
|
1206
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, { transactionId }, (transactionMeta) => {
|
|
1207
|
+
const hasMatchingGasFeeToken = transactionMeta.gasFeeTokens?.some((token) => token.tokenAddress.toLowerCase() === contractAddress?.toLowerCase());
|
|
1208
|
+
if (contractAddress && !hasMatchingGasFeeToken) {
|
|
1209
|
+
throw new Error(`No matching gas fee token found with address - ${contractAddress}`);
|
|
1210
|
+
}
|
|
1211
|
+
transactionMeta.selectedGasFeeToken = contractAddress;
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1199
1214
|
addMetadata(transactionMeta) {
|
|
1200
1215
|
(0, validation_1.validateTxParams)(transactionMeta.txParams);
|
|
1201
1216
|
this.update((state) => {
|
|
@@ -2058,8 +2073,12 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2058
2073
|
},
|
|
2059
2074
|
tokenBalanceChanges: [],
|
|
2060
2075
|
};
|
|
2076
|
+
let gasFeeTokens = [];
|
|
2061
2077
|
if (__classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this)) {
|
|
2062
|
-
|
|
2078
|
+
const authorizationAddress = txParams?.authorizationList?.[0]?.address;
|
|
2079
|
+
const senderCode = authorizationAddress &&
|
|
2080
|
+
(eip7702_1.DELEGATION_PREFIX + (0, utils_1.remove0x)(authorizationAddress));
|
|
2081
|
+
const result = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Simulate', parentContext: traceContext }, () => (0, simulation_1.getSimulationData)({
|
|
2063
2082
|
chainId,
|
|
2064
2083
|
from: from,
|
|
2065
2084
|
to: to,
|
|
@@ -2067,7 +2086,10 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2067
2086
|
data: data,
|
|
2068
2087
|
}, {
|
|
2069
2088
|
blockTime,
|
|
2089
|
+
senderCode,
|
|
2070
2090
|
}));
|
|
2091
|
+
gasFeeTokens = result?.gasFeeTokens;
|
|
2092
|
+
simulationData = result?.simulationData;
|
|
2071
2093
|
if (blockTime &&
|
|
2072
2094
|
prevSimulationData &&
|
|
2073
2095
|
(0, ResimulateHelper_1.hasSimulationDataChanged)(prevSimulationData, simulationData)) {
|
|
@@ -2088,6 +2110,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2088
2110
|
note: 'TransactionController#updateSimulationData - Update simulation data',
|
|
2089
2111
|
skipResimulateCheck: Boolean(blockTime),
|
|
2090
2112
|
}, (txMeta) => {
|
|
2113
|
+
txMeta.gasFeeTokens = gasFeeTokens;
|
|
2091
2114
|
txMeta.simulationData = simulationData;
|
|
2092
2115
|
});
|
|
2093
2116
|
(0, logger_1.projectLogger)('Updated simulation data', transactionId, simulationData);
|