@metamask/transaction-controller 60.1.0 → 60.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 +21 -1
- package/dist/TransactionController.cjs +19 -2
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +4 -0
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +4 -0
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +19 -2
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/hooks/CollectPublishHook.cjs +26 -16
- package/dist/hooks/CollectPublishHook.cjs.map +1 -1
- package/dist/hooks/CollectPublishHook.d.cts.map +1 -1
- package/dist/hooks/CollectPublishHook.d.mts.map +1 -1
- package/dist/hooks/CollectPublishHook.mjs +27 -16
- package/dist/hooks/CollectPublishHook.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +14 -6
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +14 -6
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs.map +1 -1
- package/dist/utils/balance-changes.cjs +9 -5
- package/dist/utils/balance-changes.cjs.map +1 -1
- package/dist/utils/balance-changes.d.cts +4 -1
- package/dist/utils/balance-changes.d.cts.map +1 -1
- package/dist/utils/balance-changes.d.mts +4 -1
- package/dist/utils/balance-changes.d.mts.map +1 -1
- package/dist/utils/balance-changes.mjs +9 -5
- package/dist/utils/balance-changes.mjs.map +1 -1
- package/dist/utils/batch.cjs +36 -7
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.d.cts +1 -0
- package/dist/utils/batch.d.cts.map +1 -1
- package/dist/utils/batch.d.mts +1 -0
- package/dist/utils/batch.d.mts.map +1 -1
- package/dist/utils/batch.mjs +37 -8
- package/dist/utils/batch.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [60.3.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add two new controller state metadata properties: `includeInStateLogs` and `usedInUi` ([#6473](https://github.com/MetaMask/core/pull/6473))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Update nonce of existing transaction if converted to batch via `batchTransactions` but not first transaction ([#6528](https://github.com/MetaMask/core/pull/6528))
|
|
19
|
+
- Bump `@metamask/base-controller` from `^8.2.0` to `^8.3.0` ([#6465](https://github.com/MetaMask/core/pull/6465))
|
|
20
|
+
|
|
21
|
+
## [60.2.0]
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- Add `isGasFeeIncluded` to `TransactionMeta`, `TransactionBatchRequest` and `addTransaction` options so the client can signal that MetaMask is compensated for the gas fee by the transaction ([#6428](https://github.com/MetaMask/core/pull/6428))
|
|
26
|
+
- Add optional `gasUsed` property to `TransactionMeta`, returned by the transaction simulation result ([#6410](https://github.com/MetaMask/core/pull/6410))
|
|
27
|
+
|
|
10
28
|
## [60.1.0]
|
|
11
29
|
|
|
12
30
|
### Added
|
|
@@ -1782,7 +1800,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1782
1800
|
|
|
1783
1801
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1784
1802
|
|
|
1785
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@60.
|
|
1803
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@60.3.0...HEAD
|
|
1804
|
+
[60.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@60.2.0...@metamask/transaction-controller@60.3.0
|
|
1805
|
+
[60.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@60.1.0...@metamask/transaction-controller@60.2.0
|
|
1786
1806
|
[60.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@60.0.0...@metamask/transaction-controller@60.1.0
|
|
1787
1807
|
[60.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.2.0...@metamask/transaction-controller@60.0.0
|
|
1788
1808
|
[59.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@59.1.0...@metamask/transaction-controller@59.2.0
|
|
@@ -68,24 +68,34 @@ const validation_1 = require("./utils/validation.cjs");
|
|
|
68
68
|
*/
|
|
69
69
|
const metadata = {
|
|
70
70
|
transactions: {
|
|
71
|
+
includeInStateLogs: true,
|
|
71
72
|
persist: true,
|
|
72
73
|
anonymous: false,
|
|
74
|
+
usedInUi: true,
|
|
73
75
|
},
|
|
74
76
|
transactionBatches: {
|
|
77
|
+
includeInStateLogs: true,
|
|
75
78
|
persist: true,
|
|
76
79
|
anonymous: false,
|
|
80
|
+
usedInUi: true,
|
|
77
81
|
},
|
|
78
82
|
methodData: {
|
|
83
|
+
includeInStateLogs: true,
|
|
79
84
|
persist: true,
|
|
80
85
|
anonymous: false,
|
|
86
|
+
usedInUi: true,
|
|
81
87
|
},
|
|
82
88
|
lastFetchedBlockNumbers: {
|
|
89
|
+
includeInStateLogs: true,
|
|
83
90
|
persist: true,
|
|
84
91
|
anonymous: false,
|
|
92
|
+
usedInUi: false,
|
|
85
93
|
},
|
|
86
94
|
submitHistory: {
|
|
95
|
+
includeInStateLogs: true,
|
|
87
96
|
persist: true,
|
|
88
97
|
anonymous: false,
|
|
98
|
+
usedInUi: false,
|
|
89
99
|
},
|
|
90
100
|
};
|
|
91
101
|
const SUBMIT_HISTORY_LIMIT = 100;
|
|
@@ -337,6 +347,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
337
347
|
publicKeyEIP7702: __classPrivateFieldGet(this, _TransactionController_publicKeyEIP7702, "f"),
|
|
338
348
|
publishTransaction: (ethQuery, transactionMeta) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_publishTransaction).call(this, ethQuery, transactionMeta),
|
|
339
349
|
request,
|
|
350
|
+
signTransaction: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_signTransaction).bind(this),
|
|
340
351
|
update: this.update.bind(this),
|
|
341
352
|
updateTransaction: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_updateTransactionInternal).bind(this),
|
|
342
353
|
});
|
|
@@ -367,6 +378,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
367
378
|
* @param options.batchId - A custom ID for the batch this transaction belongs to.
|
|
368
379
|
* @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
|
|
369
380
|
* @param options.disableGasBuffer - Whether to disable the gas estimation buffer.
|
|
381
|
+
* @param options.isGasFeeIncluded - Whether MetaMask will be compensated for the gas fee by the transaction.
|
|
370
382
|
* @param options.method - RPC method that requested the transaction.
|
|
371
383
|
* @param options.nestedTransactions - Params for any nested transactions encoded in the data.
|
|
372
384
|
* @param options.origin - The origin of the transaction request, such as a dApp hostname.
|
|
@@ -384,7 +396,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
384
396
|
*/
|
|
385
397
|
async addTransaction(txParams, options) {
|
|
386
398
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
387
|
-
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
399
|
+
const { actionId, assetsFiatValues, batchId, deviceConfirmedOn, disableGasBuffer, isGasFeeIncluded, method, nestedTransactions, networkClientId, origin, publishHook, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
388
400
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
389
401
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
390
402
|
throw new Error(`Network client not found - ${networkClientId}`);
|
|
@@ -436,6 +448,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
436
448
|
deviceConfirmedOn,
|
|
437
449
|
disableGasBuffer,
|
|
438
450
|
id: (0, uuid_1.v1)(),
|
|
451
|
+
isGasFeeIncluded,
|
|
439
452
|
isFirstTimeInteraction: undefined,
|
|
440
453
|
nestedTransactions,
|
|
441
454
|
networkClientId,
|
|
@@ -2120,11 +2133,12 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
2120
2133
|
},
|
|
2121
2134
|
tokenBalanceChanges: [],
|
|
2122
2135
|
};
|
|
2136
|
+
let gasUsed;
|
|
2123
2137
|
let gasFeeTokens = [];
|
|
2124
2138
|
let isGasFeeSponsored = false;
|
|
2125
2139
|
const isBalanceChangesSkipped = __classPrivateFieldGet(this, _TransactionController_skipSimulationTransactionIds, "f").has(transactionId);
|
|
2126
2140
|
if (__classPrivateFieldGet(this, _TransactionController_isSimulationEnabled, "f").call(this) && !isBalanceChangesSkipped) {
|
|
2127
|
-
|
|
2141
|
+
const balanceChangesResult = await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Simulate', parentContext: traceContext }, () => (0, balance_changes_1.getBalanceChanges)({
|
|
2128
2142
|
blockTime,
|
|
2129
2143
|
chainId,
|
|
2130
2144
|
ethQuery: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId }),
|
|
@@ -2132,6 +2146,8 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
2132
2146
|
nestedTransactions,
|
|
2133
2147
|
txParams,
|
|
2134
2148
|
}));
|
|
2149
|
+
simulationData = balanceChangesResult.simulationData;
|
|
2150
|
+
gasUsed = balanceChangesResult.gasUsed;
|
|
2135
2151
|
if (blockTime &&
|
|
2136
2152
|
prevSimulationData &&
|
|
2137
2153
|
(0, ResimulateHelper_1.hasSimulationDataChanged)(prevSimulationData, simulationData)) {
|
|
@@ -2164,6 +2180,7 @@ async function _TransactionController_approveTransaction(transactionId, traceCon
|
|
|
2164
2180
|
}, (txMeta) => {
|
|
2165
2181
|
txMeta.gasFeeTokens = gasFeeTokens;
|
|
2166
2182
|
txMeta.isGasFeeSponsored = isGasFeeSponsored;
|
|
2183
|
+
txMeta.gasUsed = gasUsed;
|
|
2167
2184
|
if (!isBalanceChangesSkipped) {
|
|
2168
2185
|
txMeta.simulationData = simulationData;
|
|
2169
2186
|
}
|