@metamask/transaction-controller 45.1.0 → 46.0.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 +15 -1
- package/dist/TransactionController.cjs +31 -3
- 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 +29 -1
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/{utils/resimulate.cjs → helpers/ResimulateHelper.cjs} +93 -4
- package/dist/helpers/ResimulateHelper.cjs.map +1 -0
- package/dist/{utils/resimulate.d.cts → helpers/ResimulateHelper.d.cts} +13 -1
- package/dist/helpers/ResimulateHelper.d.cts.map +1 -0
- package/dist/{utils/resimulate.d.mts → helpers/ResimulateHelper.d.mts} +13 -1
- package/dist/helpers/ResimulateHelper.d.mts.map +1 -0
- package/dist/{utils/resimulate.mjs → helpers/ResimulateHelper.mjs} +93 -5
- package/dist/helpers/ResimulateHelper.mjs.map +1 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +4 -0
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +4 -0
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/package.json +3 -3
- package/dist/utils/resimulate.cjs.map +0 -1
- package/dist/utils/resimulate.d.cts.map +0 -1
- package/dist/utils/resimulate.d.mts.map +0 -1
- package/dist/utils/resimulate.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [46.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Adds ability of re-simulating transaction depending on the `isActive` property on `transactionMeta` ([#5189](https://github.com/MetaMask/core/pull/5189))
|
|
15
|
+
- `isActive` property is expected to set by client.
|
|
16
|
+
- Re-simulation of transactions will occur every 3 seconds if `isActive` is `true`.
|
|
17
|
+
- Adds `setTransactionActive` function to update the `isActive` property on `transactionMeta`. ([#5189](https://github.com/MetaMask/core/pull/5189))
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- **BREAKING:** Bump `@metamask/accounts-controller` peer dependency from `^23.0.0` to `^24.0.0` ([#5318](https://github.com/MetaMask/core/pull/5318))
|
|
22
|
+
|
|
10
23
|
## [45.1.0]
|
|
11
24
|
|
|
12
25
|
### Added
|
|
@@ -1277,7 +1290,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1277
1290
|
|
|
1278
1291
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1279
1292
|
|
|
1280
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@
|
|
1293
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@46.0.0...HEAD
|
|
1294
|
+
[46.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@45.1.0...@metamask/transaction-controller@46.0.0
|
|
1281
1295
|
[45.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@45.0.0...@metamask/transaction-controller@45.1.0
|
|
1282
1296
|
[45.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@44.1.0...@metamask/transaction-controller@45.0.0
|
|
1283
1297
|
[44.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@44.0.0...@metamask/transaction-controller@44.1.0
|
|
@@ -41,6 +41,7 @@ const IncomingTransactionHelper_1 = require("./helpers/IncomingTransactionHelper
|
|
|
41
41
|
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
|
+
const ResimulateHelper_1 = require("./helpers/ResimulateHelper.cjs");
|
|
44
45
|
const logger_1 = require("./logger.cjs");
|
|
45
46
|
const types_1 = require("./types.cjs");
|
|
46
47
|
const eip7702_1 = require("./utils/eip7702.cjs");
|
|
@@ -52,7 +53,6 @@ const history_1 = require("./utils/history.cjs");
|
|
|
52
53
|
const layer1_gas_fee_flow_1 = require("./utils/layer1-gas-fee-flow.cjs");
|
|
53
54
|
const nonce_1 = require("./utils/nonce.cjs");
|
|
54
55
|
const prepare_1 = require("./utils/prepare.cjs");
|
|
55
|
-
const resimulate_1 = require("./utils/resimulate.cjs");
|
|
56
56
|
const retry_1 = require("./utils/retry.cjs");
|
|
57
57
|
const simulation_1 = require("./utils/simulation.cjs");
|
|
58
58
|
const swaps_1 = require("./utils/swaps.cjs");
|
|
@@ -302,6 +302,13 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
302
302
|
// when transactionsController state changes
|
|
303
303
|
// check for pending transactions and start polling if there are any
|
|
304
304
|
this.messagingSystem.subscribe('TransactionController:stateChange', __classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f"));
|
|
305
|
+
new ResimulateHelper_1.ResimulateHelper({
|
|
306
|
+
simulateTransaction: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateSimulationData).bind(this),
|
|
307
|
+
onTransactionsUpdate: (listener) => {
|
|
308
|
+
this.messagingSystem.subscribe('TransactionController:stateChange', listener, (controllerState) => controllerState.transactions);
|
|
309
|
+
},
|
|
310
|
+
getTransactions: () => this.state.transactions,
|
|
311
|
+
});
|
|
305
312
|
this.onBootCleanup();
|
|
306
313
|
__classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f").call(this);
|
|
307
314
|
}
|
|
@@ -795,6 +802,27 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
795
802
|
this.updateTransaction(updatedTransaction, `Update Editable Params for ${txId}`);
|
|
796
803
|
return this.getTransaction(txId);
|
|
797
804
|
}
|
|
805
|
+
/**
|
|
806
|
+
* Update the isActive state of a transaction.
|
|
807
|
+
*
|
|
808
|
+
* @param transactionId - The ID of the transaction to update.
|
|
809
|
+
* @param isActive - The active state.
|
|
810
|
+
*/
|
|
811
|
+
setTransactionActive(transactionId, isActive) {
|
|
812
|
+
const transactionMeta = this.getTransaction(transactionId);
|
|
813
|
+
if (!transactionMeta) {
|
|
814
|
+
throw new Error(`Transaction with id ${transactionId} not found`);
|
|
815
|
+
}
|
|
816
|
+
__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).call(this, {
|
|
817
|
+
transactionId,
|
|
818
|
+
note: 'TransactionController#setTransactionActive - Transaction isActive updated',
|
|
819
|
+
skipHistory: true,
|
|
820
|
+
skipValidation: true,
|
|
821
|
+
skipResimulateCheck: true,
|
|
822
|
+
}, (updatedTransactionMeta) => {
|
|
823
|
+
updatedTransactionMeta.isActive = isActive;
|
|
824
|
+
});
|
|
825
|
+
}
|
|
798
826
|
/**
|
|
799
827
|
* Signs and returns the raw transaction data for provided transaction params list.
|
|
800
828
|
*
|
|
@@ -1847,7 +1875,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
1847
1875
|
(0, validation_1.validateTxParams)(transactionMeta.txParams);
|
|
1848
1876
|
}
|
|
1849
1877
|
if (!skipResimulateCheck && __classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this)) {
|
|
1850
|
-
resimulateResponse = (0,
|
|
1878
|
+
resimulateResponse = (0, ResimulateHelper_1.shouldResimulate)(originalTransactionMeta, transactionMeta);
|
|
1851
1879
|
}
|
|
1852
1880
|
const shouldSkipHistory = this.isHistoryDisabled || skipHistory;
|
|
1853
1881
|
if (!shouldSkipHistory) {
|
|
@@ -1929,7 +1957,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_me
|
|
|
1929
1957
|
}));
|
|
1930
1958
|
if (blockTime &&
|
|
1931
1959
|
prevSimulationData &&
|
|
1932
|
-
(0,
|
|
1960
|
+
(0, ResimulateHelper_1.hasSimulationDataChanged)(prevSimulationData, simulationData)) {
|
|
1933
1961
|
simulationData = {
|
|
1934
1962
|
...simulationData,
|
|
1935
1963
|
isUpdatedAfterSecurityCheck: true,
|