@metamask-previews/transaction-controller 52.0.0-preview-e7013a54 → 52.0.0-preview-e56c504a
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 +10 -3
- package/dist/TransactionController.cjs +20 -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 +20 -1
- 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 +36 -2
- package/dist/utils/simulation-api.d.cts.map +1 -1
- package/dist/utils/simulation-api.d.mts +36 -2
- package/dist/utils/simulation-api.d.mts.map +1 -1
- package/dist/utils/simulation-api.mjs.map +1 -1
- package/dist/utils/simulation.cjs +43 -5
- package/dist/utils/simulation.cjs.map +1 -1
- package/dist/utils/simulation.d.cts +6 -2
- package/dist/utils/simulation.d.cts.map +1 -1
- package/dist/utils/simulation.d.mts +6 -2
- package/dist/utils/simulation.d.mts.map +1 -1
- package/dist/utils/simulation.mjs +43 -5
- package/dist/utils/simulation.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ 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 `gasFeeTokens` to `TransactionMeta` ([#5524](https://github.com/MetaMask/core/pull/5524))
|
|
13
|
+
- Add `GasFeeToken` type.
|
|
14
|
+
- Add `selectedGasFeeToken` to `TransactionMeta`.
|
|
15
|
+
- Add `updateSelectedGasFeeToken` method.
|
|
16
|
+
|
|
10
17
|
## [52.0.0]
|
|
11
18
|
|
|
12
19
|
### Changed
|
|
@@ -29,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
29
36
|
### Added
|
|
30
37
|
|
|
31
38
|
- Add additional metadata for batch metrics ([#5488](https://github.com/MetaMask/core/pull/5488))
|
|
32
|
-
- Add `delegationAddress` to `
|
|
39
|
+
- Add `delegationAddress` to `TransactionMeta`.
|
|
33
40
|
- Add `NestedTransactionMetadata` type containing `BatchTransactionParams` and `type`.
|
|
34
41
|
- Add optional `type` to `TransactionBatchSingleRequest`.
|
|
35
42
|
- Verify EIP-7702 contract address using signatures ([#5472](https://github.com/MetaMask/core/pull/5472))
|
|
@@ -40,8 +47,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
40
47
|
|
|
41
48
|
- **BREAKING:** Bump `@metamask/accounts-controller` peer dependency to `^26.1.0` ([#5481](https://github.com/MetaMask/core/pull/5481))
|
|
42
49
|
- **BREAKING:** Add additional metadata for batch metrics ([#5488](https://github.com/MetaMask/core/pull/5488))
|
|
43
|
-
- Change `error` in `
|
|
44
|
-
- Change `nestedTransactions` in `
|
|
50
|
+
- Change `error` in `TransactionMeta` to optional for all statuses.
|
|
51
|
+
- Change `nestedTransactions` in `TransactionMeta` to array of `NestedTransactionMetadata`.
|
|
45
52
|
- Throw if `addTransactionBatch` called with external origin and size limit exceeded ([#5489](https://github.com/MetaMask/core/pull/5489))
|
|
46
53
|
- Verify EIP-7702 contract address using signatures ([#5472](https://github.com/MetaMask/core/pull/5472))
|
|
47
54
|
- Use new `contracts` property from feature flags instead of `contractAddresses`.
|
|
@@ -1156,6 +1156,21 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
1156
1156
|
});
|
|
1157
1157
|
return updatedTransactionMeta.txParams.data;
|
|
1158
1158
|
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Update the selected gas fee token for a transaction.
|
|
1161
|
+
*
|
|
1162
|
+
* @param transactionId - The ID of the transaction to update.
|
|
1163
|
+
* @param contractAddress - The contract address of the selected gas fee token.
|
|
1164
|
+
*/
|
|
1165
|
+
updateSelectedGasFeeToken(transactionId, contractAddress) {
|
|
1166
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, { transactionId }, (transactionMeta) => {
|
|
1167
|
+
const hasMatchingGasFeeToken = transactionMeta.gasFeeTokens?.some((token) => token.tokenAddress.toLowerCase() === contractAddress.toLowerCase());
|
|
1168
|
+
if (!hasMatchingGasFeeToken) {
|
|
1169
|
+
throw new Error(`No matching gas fee token found with address - ${contractAddress}`);
|
|
1170
|
+
}
|
|
1171
|
+
transactionMeta.selectedGasFeeToken = contractAddress;
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1159
1174
|
addMetadata(transactionMeta) {
|
|
1160
1175
|
(0, validation_1.validateTxParams)(transactionMeta.txParams);
|
|
1161
1176
|
this.update((state) => {
|
|
@@ -2001,8 +2016,9 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2001
2016
|
},
|
|
2002
2017
|
tokenBalanceChanges: [],
|
|
2003
2018
|
};
|
|
2019
|
+
let gasFeeTokens = [];
|
|
2004
2020
|
if (__classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this)) {
|
|
2005
|
-
|
|
2021
|
+
const result = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Simulate', parentContext: traceContext }, () => (0, simulation_1.getSimulationData)({
|
|
2006
2022
|
chainId,
|
|
2007
2023
|
from: from,
|
|
2008
2024
|
to: to,
|
|
@@ -2011,6 +2027,8 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2011
2027
|
}, {
|
|
2012
2028
|
blockTime,
|
|
2013
2029
|
}));
|
|
2030
|
+
gasFeeTokens = result?.gasFeeTokens;
|
|
2031
|
+
simulationData = result?.simulationData;
|
|
2014
2032
|
if (blockTime &&
|
|
2015
2033
|
prevSimulationData &&
|
|
2016
2034
|
(0, ResimulateHelper_1.hasSimulationDataChanged)(prevSimulationData, simulationData)) {
|
|
@@ -2031,6 +2049,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
2031
2049
|
note: 'TransactionController#updateSimulationData - Update simulation data',
|
|
2032
2050
|
skipResimulateCheck: Boolean(blockTime),
|
|
2033
2051
|
}, (txMeta) => {
|
|
2052
|
+
txMeta.gasFeeTokens = gasFeeTokens;
|
|
2034
2053
|
txMeta.simulationData = simulationData;
|
|
2035
2054
|
});
|
|
2036
2055
|
(0, logger_1.projectLogger)('Updated simulation data', transactionId, simulationData);
|