@metamask-previews/transaction-controller 48.0.0-preview-a615cdf2 → 48.2.0-preview-c37ee1c7
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 +32 -1
- package/dist/TransactionController.cjs +9 -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 +9 -1
- package/dist/TransactionController.mjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs +1 -2
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs +1 -3
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +14 -3
- package/dist/types.d.cts.map +1 -1
- package/dist/types.d.mts +14 -3
- package/dist/types.d.mts.map +1 -1
- 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/dist/utils/utils.cjs +3 -0
- package/dist/utils/utils.cjs.map +1 -1
- package/dist/utils/utils.d.cts.map +1 -1
- package/dist/utils/utils.d.mts.map +1 -1
- package/dist/utils/utils.mjs +3 -0
- package/dist/utils/utils.mjs.map +1 -1
- package/dist/utils/validation.cjs +6 -3
- package/dist/utils/validation.cjs.map +1 -1
- package/dist/utils/validation.d.cts +3 -1
- package/dist/utils/validation.d.cts.map +1 -1
- package/dist/utils/validation.d.mts +3 -1
- package/dist/utils/validation.d.mts.map +1 -1
- package/dist/utils/validation.mjs +6 -3
- package/dist/utils/validation.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,35 @@ 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 optional batch ID to metadata ([#5462](https://github.com/MetaMask/core/pull/5462))
|
|
13
|
+
- Add optional `batchId` property to `TransactionMeta`.
|
|
14
|
+
- Add optional `transactionHash` to `TransactionReceipt`.
|
|
15
|
+
- Add optional `data` to `Log`.
|
|
16
|
+
- Add optional `batchId` to `TransactionBatchRequest`.
|
|
17
|
+
- Add optional `batchId` to `addTransaction` options.
|
|
18
|
+
- Throw if `batchId` already exists on a transaction.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- **BREAKING:** Add optional batch ID to metadata ([#5462](https://github.com/MetaMask/core/pull/5462))
|
|
23
|
+
- Change `batchId` in `TransactionBatchResult` to `Hex`.
|
|
24
|
+
- Return `batchId` from `addTransactionBatch` if provided.
|
|
25
|
+
- Generate random batch ID if no `batchId` provided.
|
|
26
|
+
|
|
27
|
+
## [48.2.0]
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Normalize gas limit using `gas` and `gasLimit` properties ([#5396](https://github.com/MetaMask/core/pull/5396))
|
|
32
|
+
|
|
33
|
+
## [48.1.0]
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Prevent external transactions to internal accounts if `data` included ([#5418](https://github.com/MetaMask/core/pull/5418))
|
|
38
|
+
|
|
10
39
|
## [48.0.0]
|
|
11
40
|
|
|
12
41
|
### Changed
|
|
@@ -1326,7 +1355,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
1326
1355
|
|
|
1327
1356
|
All changes listed after this point were applied to this package following the monorepo conversion.
|
|
1328
1357
|
|
|
1329
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.
|
|
1358
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.2.0...HEAD
|
|
1359
|
+
[48.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.1.0...@metamask/transaction-controller@48.2.0
|
|
1360
|
+
[48.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@48.0.0...@metamask/transaction-controller@48.1.0
|
|
1330
1361
|
[48.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@47.0.0...@metamask/transaction-controller@48.0.0
|
|
1331
1362
|
[47.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@46.0.0...@metamask/transaction-controller@47.0.0
|
|
1332
1363
|
[46.0.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-controller@45.1.0...@metamask/transaction-controller@46.0.0
|
|
@@ -342,6 +342,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
342
342
|
* @param txParams - Standard parameters for an Ethereum transaction.
|
|
343
343
|
* @param options - Additional options to control how the transaction is added.
|
|
344
344
|
* @param options.actionId - Unique ID to prevent duplicate requests.
|
|
345
|
+
* @param options.batchId - A custom ID for the batch this transaction belongs to.
|
|
345
346
|
* @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
|
|
346
347
|
* @param options.method - RPC method that requested the transaction.
|
|
347
348
|
* @param options.nestedTransactions - Params for any nested transactions encoded in the data.
|
|
@@ -359,7 +360,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
359
360
|
*/
|
|
360
361
|
async addTransaction(txParams, options) {
|
|
361
362
|
(0, logger_1.projectLogger)('Adding transaction', txParams, options);
|
|
362
|
-
const { actionId, deviceConfirmedOn, method, nestedTransactions, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
363
|
+
const { actionId, batchId, deviceConfirmedOn, method, nestedTransactions, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
|
|
363
364
|
txParams = (0, utils_2.normalizeTransactionParams)(txParams);
|
|
364
365
|
if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
|
|
365
366
|
throw new Error(`Network client not found - ${networkClientId}`);
|
|
@@ -370,6 +371,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
370
371
|
const selectedAddress = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getSelectedAccount).call(this).address;
|
|
371
372
|
const internalAccounts = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getInternalAccounts).call(this);
|
|
372
373
|
await (0, validation_1.validateTransactionOrigin)({
|
|
374
|
+
data: txParams.data,
|
|
373
375
|
from: txParams.from,
|
|
374
376
|
internalAccounts,
|
|
375
377
|
origin,
|
|
@@ -380,6 +382,11 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
380
382
|
});
|
|
381
383
|
const isEIP1559Compatible = await this.getEIP1559Compatibility(networkClientId);
|
|
382
384
|
(0, validation_1.validateTxParams)(txParams, isEIP1559Compatible);
|
|
385
|
+
const isDuplicateBatchId = batchId?.length &&
|
|
386
|
+
this.state.transactions.some((tx) => tx.batchId?.toLowerCase() === batchId?.toLowerCase());
|
|
387
|
+
if (isDuplicateBatchId) {
|
|
388
|
+
throw rpc_errors_1.rpcErrors.invalidInput('Batch ID already exists');
|
|
389
|
+
}
|
|
383
390
|
const dappSuggestedGasFees = this.generateDappSuggestedGasFees(txParams, origin);
|
|
384
391
|
const chainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId);
|
|
385
392
|
const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
|
|
@@ -393,6 +400,7 @@ class TransactionController extends base_controller_1.BaseController {
|
|
|
393
400
|
: {
|
|
394
401
|
// Add actionId to txMeta to check if same actionId is seen again
|
|
395
402
|
actionId,
|
|
403
|
+
batchId,
|
|
396
404
|
chainId,
|
|
397
405
|
dappSuggestedGasFees,
|
|
398
406
|
deviceConfirmedOn,
|