@metamask/transaction-controller 48.2.0 → 49.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 +22 -1
- package/dist/TransactionController.cjs +8 -1
- package/dist/TransactionController.cjs.map +1 -1
- package/dist/TransactionController.d.cts +2 -0
- package/dist/TransactionController.d.cts.map +1 -1
- package/dist/TransactionController.d.mts +2 -0
- package/dist/TransactionController.d.mts.map +1 -1
- package/dist/TransactionController.mjs +8 -1
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/types.cjs +5 -0
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +15 -1
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +15 -1
- package/dist/types.d.mts.map +1 -1
- package/dist/types.mjs +5 -0
- package/dist/types.mjs.map +1 -1
- package/dist/utils/batch.cjs +15 -3
- package/dist/utils/batch.cjs.map +1 -1
- package/dist/utils/batch.d.cts +2 -2
- package/dist/utils/batch.d.cts.map +1 -1
- package/dist/utils/batch.d.mts +2 -2
- package/dist/utils/batch.d.mts.map +1 -1
- package/dist/utils/batch.mjs +16 -4
- package/dist/utils/batch.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [49.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add `revertDelegation` to `TransactionType` ([#5468](https://github.com/MetaMask/core/pull/5468))
|
|
15
|
+
- Add optional batch ID to metadata ([#5462](https://github.com/MetaMask/core/pull/5462))
|
|
16
|
+
- Add optional `batchId` property to `TransactionMeta`.
|
|
17
|
+
- Add optional `transactionHash` to `TransactionReceipt`.
|
|
18
|
+
- Add optional `data` to `Log`.
|
|
19
|
+
- Add optional `batchId` to `TransactionBatchRequest`.
|
|
20
|
+
- Add optional `batchId` to `addTransaction` options.
|
|
21
|
+
- Throw if `batchId` already exists on a transaction.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **BREAKING:** Add optional batch ID to metadata ([#5462](https://github.com/MetaMask/core/pull/5462))
|
|
26
|
+
- Change `batchId` in `TransactionBatchResult` to `Hex`.
|
|
27
|
+
- Return `batchId` from `addTransactionBatch` if provided.
|
|
28
|
+
- Generate random batch ID if no `batchId` provided.
|
|
29
|
+
|
|
10
30
|
## [48.2.0]
|
|
11
31
|
|
|
12
32
|
### Changed
|
|
@@ -1338,7 +1358,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1338
1358
|
|
|
1339
1359
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1340
1360
|
|
|
1341
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@
|
|
1361
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@49.0.0...HEAD
|
|
1362
|
+
[49.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.2.0...@metamask/transaction-controller@49.0.0
|
|
1342
1363
|
[48.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.1.0...@metamask/transaction-controller@48.2.0
|
|
1343
1364
|
[48.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.0.0...@metamask/transaction-controller@48.1.0
|
|
1344
1365
|
[48.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@47.0.0...@metamask/transaction-controller@48.0.0
|
|
@@ -344,6 +344,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
344
344
|
* @param txParams - Standard parameters for an Ethereum transaction.
|
|
345
345
|
* @param options - Additional options to control how the transaction is added.
|
|
346
346
|
* @param options.actionId - Unique ID to prevent duplicate requests.
|
|
347
|
+
* @param options.batchId - A custom ID for the batch this transaction belongs to.
|
|
347
348
|
* @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
|
|
348
349
|
* @param options.method - RPC method that requested the transaction.
|
|
349
350
|
* @param options.nestedTransactions - Params for any nested transactions encoded in the data.
|
|
@@ -361,7 +362,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
361
362
|
*/
|
|
362
363
|
async addTransaction(txParams, options) {
|
|
363
364
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
364
|
-
const { actionId, deviceConfirmedOn, method, nestedTransactions, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
365
|
+
const { actionId, batchId, deviceConfirmedOn, method, nestedTransactions, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
365
366
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
366
367
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
367
368
|
throw new Error(`Network client not found - ${networkClientId}`);
|
|
@@ -383,6 +384,11 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
383
384
|
});
|
|
384
385
|
const isEIP1559Compatible = await this.getEIP1559Compatibility(networkClientId);
|
|
385
386
|
(0, validation_1.validateTxParams)(txParams, isEIP1559Compatible);
|
|
387
|
+
const isDuplicateBatchId = batchId?.length &&
|
|
388
|
+
this.state.transactions.some((tx) => tx.batchId?.toLowerCase() === batchId?.toLowerCase());
|
|
389
|
+
if (isDuplicateBatchId) {
|
|
390
|
+
throw rpc_errors_1.rpcErrors.invalidInput('Batch ID already exists');
|
|
391
|
+
}
|
|
386
392
|
const dappSuggestedGasFees = this.generateDappSuggestedGasFees(txParams, origin);
|
|
387
393
|
const chainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId);
|
|
388
394
|
const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
|
|
@@ -396,6 +402,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
396
402
|
: {
|
|
397
403
|
// Add actionId to txMeta to check if same actionId is seen again
|
|
398
404
|
actionId,
|
|
405
|
+
batchId,
|
|
399
406
|
chainId,
|
|
400
407
|
dappSuggestedGasFees,
|
|
401
408
|
deviceConfirmedOn,
|