@metamask-previews/transaction-controller 49.0.0-preview-4a9f2de → 49.0.0-preview-401a9c00

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 CHANGED
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
19
19
  - **BREAKING:** Add additional metadata for batch metrics ([#5488](https://github.com/MetaMask/core/pull/5488))
20
20
  - Change `error` in `TransactionMetadata` to optional for all statuses.
21
21
  - Change `nestedTransactions` in `TransactionMetadata` to array of `NestedTransactionMetadata`.
22
+ - Throw if `addTransactionBatch` called with external origin and size limit exceeded ([#5489](https://github.com/MetaMask/core/pull/5489))
22
23
 
23
24
  ## [49.0.0]
24
25
 
@@ -371,6 +371,10 @@ class TransactionController extends base_controller_1.BaseController {
371
371
  if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
372
372
  throw new Error(`Network client not found - ${networkClientId}`);
373
373
  }
374
+ const chainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId);
375
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
376
+ networkClientId,
377
+ });
374
378
  const permittedAddresses = origin === undefined
375
379
  ? undefined
376
380
  : await this.getPermittedAccounts?.(origin);
@@ -386,6 +390,7 @@ class TransactionController extends base_controller_1.BaseController {
386
390
  txParams,
387
391
  type,
388
392
  });
393
+ const delegationAddressPromise = (0, eip7702_1.getDelegationAddress)(txParams.from, ethQuery).catch(() => undefined);
389
394
  const isEIP1559Compatible = await this.getEIP1559Compatibility(networkClientId);
390
395
  (0, validation_1.validateTxParams)(txParams, isEIP1559Compatible);
391
396
  const isDuplicateBatchId = batchId?.length &&
@@ -394,18 +399,8 @@ class TransactionController extends base_controller_1.BaseController {
394
399
  throw rpc_errors_1.rpcErrors.invalidInput('Batch ID already exists');
395
400
  }
396
401
  const dappSuggestedGasFees = this.generateDappSuggestedGasFees(txParams, origin);
397
- const chainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId);
398
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
399
- networkClientId,
400
- });
401
402
  const transactionType = type ?? (await (0, transaction_type_1.determineTransactionType)(txParams, ethQuery)).type;
402
- let delegationAddress;
403
- try {
404
- delegationAddress = await (0, eip7702_1.getDelegationAddress)(txParams.from, ethQuery);
405
- }
406
- catch (error) {
407
- (0, logger_1.projectLogger)('Error checking if account is upgraded to EIP-7702', error);
408
- }
403
+ const delegationAddress = await delegationAddressPromise;
409
404
  const existingTransactionMeta = this.getTransactionWithActionId(actionId);
410
405
  // If a request to add a transaction with the same actionId is submitted again, a new transaction will not be created for it.
411
406
  let addedTransactionMeta = existingTransactionMeta