@metamask-previews/transaction-controller 38.3.0-preview-1b536ac → 39.0.0-preview-e6757fdb

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/TransactionController.cjs +95 -217
  3. package/dist/TransactionController.cjs.map +1 -1
  4. package/dist/TransactionController.d.cts +34 -53
  5. package/dist/TransactionController.d.cts.map +1 -1
  6. package/dist/TransactionController.d.mts +34 -53
  7. package/dist/TransactionController.d.mts.map +1 -1
  8. package/dist/TransactionController.mjs +96 -218
  9. package/dist/TransactionController.mjs.map +1 -1
  10. package/dist/helpers/EtherscanRemoteTransactionSource.cjs +1 -0
  11. package/dist/helpers/EtherscanRemoteTransactionSource.cjs.map +1 -1
  12. package/dist/helpers/EtherscanRemoteTransactionSource.d.cts.map +1 -1
  13. package/dist/helpers/EtherscanRemoteTransactionSource.d.mts.map +1 -1
  14. package/dist/helpers/EtherscanRemoteTransactionSource.mjs +1 -0
  15. package/dist/helpers/EtherscanRemoteTransactionSource.mjs.map +1 -1
  16. package/dist/helpers/GasFeePoller.cjs +4 -4
  17. package/dist/helpers/GasFeePoller.cjs.map +1 -1
  18. package/dist/helpers/GasFeePoller.d.cts +1 -1
  19. package/dist/helpers/GasFeePoller.d.cts.map +1 -1
  20. package/dist/helpers/GasFeePoller.d.mts +1 -1
  21. package/dist/helpers/GasFeePoller.d.mts.map +1 -1
  22. package/dist/helpers/GasFeePoller.mjs +4 -4
  23. package/dist/helpers/GasFeePoller.mjs.map +1 -1
  24. package/dist/helpers/IncomingTransactionHelper.cjs +12 -5
  25. package/dist/helpers/IncomingTransactionHelper.cjs.map +1 -1
  26. package/dist/helpers/IncomingTransactionHelper.d.cts.map +1 -1
  27. package/dist/helpers/IncomingTransactionHelper.d.mts.map +1 -1
  28. package/dist/helpers/IncomingTransactionHelper.mjs +13 -6
  29. package/dist/helpers/IncomingTransactionHelper.mjs.map +1 -1
  30. package/dist/helpers/MultichainTrackingHelper.cjs +70 -84
  31. package/dist/helpers/MultichainTrackingHelper.cjs.map +1 -1
  32. package/dist/helpers/MultichainTrackingHelper.d.cts +12 -18
  33. package/dist/helpers/MultichainTrackingHelper.d.cts.map +1 -1
  34. package/dist/helpers/MultichainTrackingHelper.d.mts +12 -18
  35. package/dist/helpers/MultichainTrackingHelper.d.mts.map +1 -1
  36. package/dist/helpers/MultichainTrackingHelper.mjs +70 -88
  37. package/dist/helpers/MultichainTrackingHelper.mjs.map +1 -1
  38. package/dist/helpers/PendingTransactionTracker.cjs +24 -22
  39. package/dist/helpers/PendingTransactionTracker.cjs.map +1 -1
  40. package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -1
  41. package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -1
  42. package/dist/helpers/PendingTransactionTracker.mjs +24 -22
  43. package/dist/helpers/PendingTransactionTracker.mjs.map +1 -1
  44. package/dist/types.cjs.map +1 -1
  45. package/dist/types.d.cts +1 -1
  46. package/dist/types.d.cts.map +1 -1
  47. package/dist/types.d.mts +1 -1
  48. package/dist/types.d.mts.map +1 -1
  49. package/dist/types.mjs.map +1 -1
  50. package/dist/utils/etherscan.cjs +2 -1
  51. package/dist/utils/etherscan.cjs.map +1 -1
  52. package/dist/utils/etherscan.d.cts.map +1 -1
  53. package/dist/utils/etherscan.d.mts.map +1 -1
  54. package/dist/utils/etherscan.mjs +3 -2
  55. package/dist/utils/etherscan.mjs.map +1 -1
  56. package/package.json +6 -6
@@ -13,7 +13,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _TransactionController_instances, _TransactionController_internalEvents, _TransactionController_incomingTransactionOptions, _TransactionController_pendingTransactionOptions, _TransactionController_trace, _TransactionController_transactionHistoryLimit, _TransactionController_isSimulationEnabled, _TransactionController_testGasFeeFlows, _TransactionController_multichainTrackingHelper, _TransactionController_retryTransaction, _TransactionController_createNonceTracker, _TransactionController_createIncomingTransactionHelper, _TransactionController_createPendingTransactionTracker, _TransactionController_checkForPendingTransactionAndStartPolling, _TransactionController_stopAllTracking, _TransactionController_removeIncomingTransactionHelperListeners, _TransactionController_addIncomingTransactionHelperListeners, _TransactionController_removePendingTransactionTrackerListeners, _TransactionController_addPendingTransactionTrackerListeners, _TransactionController_getNonceTrackerPendingTransactions, _TransactionController_getGasFeeFlows, _TransactionController_getLayer1GasFeeFlows, _TransactionController_updateTransactionInternal, _TransactionController_updateSimulationData, _TransactionController_onGasFeePollerTransactionUpdate, _TransactionController_getNetworkClientId, _TransactionController_getGlobalNetworkClientId, _TransactionController_getGlobalChainId, _TransactionController_isCustomNetwork, _TransactionController_getSelectedAccount, _TransactionController_updateSubmitHistory;
16
+ var _TransactionController_instances, _TransactionController_internalEvents, _TransactionController_incomingTransactionOptions, _TransactionController_pendingTransactionOptions, _TransactionController_trace, _TransactionController_transactionHistoryLimit, _TransactionController_isSimulationEnabled, _TransactionController_testGasFeeFlows, _TransactionController_multichainTrackingHelper, _TransactionController_retryTransaction, _TransactionController_getChainId, _TransactionController_getNetworkClientId, _TransactionController_getEthQuery, _TransactionController_getProvider, _TransactionController_createNonceTracker, _TransactionController_createIncomingTransactionHelper, _TransactionController_createPendingTransactionTracker, _TransactionController_checkForPendingTransactionAndStartPolling, _TransactionController_stopAllTracking, _TransactionController_removeIncomingTransactionHelperListeners, _TransactionController_addIncomingTransactionHelperListeners, _TransactionController_removePendingTransactionTrackerListeners, _TransactionController_addPendingTransactionTrackerListeners, _TransactionController_getNonceTrackerPendingTransactions, _TransactionController_getGasFeeFlows, _TransactionController_getLayer1GasFeeFlows, _TransactionController_updateTransactionInternal, _TransactionController_updateSimulationData, _TransactionController_onGasFeePollerTransactionUpdate, _TransactionController_getSelectedAccount, _TransactionController_updateSubmitHistory;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.TransactionController = exports.ApprovalState = exports.SPEED_UP_RATE = exports.CANCEL_RATE = exports.HARDFORK = void 0;
19
19
  const common_1 = require("@ethereumjs/common");
@@ -27,7 +27,6 @@ const nonce_tracker_1 = require("@metamask/nonce-tracker");
27
27
  const rpc_errors_1 = require("@metamask/rpc-errors");
28
28
  const utils_1 = require("@metamask/utils");
29
29
  const async_mutex_1 = require("async-mutex");
30
- const eth_method_registry_1 = require("eth-method-registry");
31
30
  const events_1 = require("events");
32
31
  const lodash_1 = require("lodash");
33
32
  const uuid_1 = require("uuid");
@@ -36,7 +35,6 @@ const LineaGasFeeFlow_1 = require("./gas-flows/LineaGasFeeFlow.cjs");
36
35
  const OptimismLayer1GasFeeFlow_1 = require("./gas-flows/OptimismLayer1GasFeeFlow.cjs");
37
36
  const ScrollLayer1GasFeeFlow_1 = require("./gas-flows/ScrollLayer1GasFeeFlow.cjs");
38
37
  const TestGasFeeFlow_1 = require("./gas-flows/TestGasFeeFlow.cjs");
39
- const EtherscanRemoteTransactionSource_1 = require("./helpers/EtherscanRemoteTransactionSource.cjs");
40
38
  const GasFeePoller_1 = require("./helpers/GasFeePoller.cjs");
41
39
  const IncomingTransactionHelper_1 = require("./helpers/IncomingTransactionHelper.cjs");
42
40
  const MultichainTrackingHelper_1 = require("./helpers/MultichainTrackingHelper.cjs");
@@ -148,22 +146,10 @@ class TransactionController extends base_controller_1.BaseController {
148
146
  this.messagingSystem.publish(`${controllerName}:transactionFinished`, newTransactionMeta);
149
147
  __classPrivateFieldGet(this, _TransactionController_internalEvents, "f").emit(`${transactionMeta.id}:finished`, newTransactionMeta);
150
148
  }
151
- async registryLookup(fourBytePrefix) {
152
- const registryMethod = await this.registry.lookup(fourBytePrefix);
153
- if (!registryMethod) {
154
- return {
155
- registryMethod: '',
156
- parsedRegistryMethod: { name: undefined, args: undefined },
157
- };
158
- }
159
- const parsedRegistryMethod = this.registry.parse(registryMethod);
160
- return { registryMethod, parsedRegistryMethod };
161
- }
162
149
  /**
163
150
  * Constructs a TransactionController.
164
151
  *
165
152
  * @param options - The controller options.
166
- * @param options.blockTracker - The block tracker used to poll for new blocks data.
167
153
  * @param options.disableHistory - Whether to disable storing history in transaction metadata.
168
154
  * @param options.disableSendFlowHistory - Explicitly disable transaction metadata history.
169
155
  * @param options.disableSwaps - Whether to disable additional processing on swaps transactions.
@@ -176,12 +162,9 @@ class TransactionController extends base_controller_1.BaseController {
176
162
  * @param options.getPermittedAccounts - Get accounts that a given origin has permissions for.
177
163
  * @param options.getSavedGasFees - Gets the saved gas fee config.
178
164
  * @param options.incomingTransactions - Configuration options for incoming transaction support.
179
- * @param options.isMultichainEnabled - Enable multichain support.
180
165
  * @param options.isSimulationEnabled - Whether new transactions will be automatically simulated.
181
166
  * @param options.messenger - The controller messenger.
182
- * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.
183
167
  * @param options.pendingTransactions - Configuration options for pending transaction support.
184
- * @param options.provider - The provider used to create the underlying EthQuery instance.
185
168
  * @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.
186
169
  * @param options.sign - Function used to sign transactions.
187
170
  * @param options.state - Initial state to set on this controller.
@@ -190,7 +173,7 @@ class TransactionController extends base_controller_1.BaseController {
190
173
  * @param options.transactionHistoryLimit - Transaction history limit.
191
174
  * @param options.hooks - The controller hooks.
192
175
  */
193
- constructor({ blockTracker, disableHistory, disableSendFlowHistory, disableSwaps, getCurrentAccountEIP1559Compatibility, getCurrentNetworkEIP1559Compatibility, getExternalPendingTransactions, getGasFeeEstimates, getNetworkClientRegistry, getNetworkState, getPermittedAccounts, getSavedGasFees, incomingTransactions = {}, isMultichainEnabled = false, isSimulationEnabled, messenger, onNetworkStateChange, pendingTransactions = {}, provider, securityProviderRequest, sign, state, testGasFeeFlows, trace, transactionHistoryLimit = 40, hooks, }) {
176
+ constructor({ disableHistory, disableSendFlowHistory, disableSwaps, getCurrentAccountEIP1559Compatibility, getCurrentNetworkEIP1559Compatibility, getExternalPendingTransactions, getGasFeeEstimates, getNetworkClientRegistry, getNetworkState, getPermittedAccounts, getSavedGasFees, incomingTransactions = {}, isSimulationEnabled, messenger, pendingTransactions = {}, securityProviderRequest, sign, state, testGasFeeFlows, trace, transactionHistoryLimit = 40, hooks, }) {
194
177
  super({
195
178
  name: controllerName,
196
179
  metadata,
@@ -211,10 +194,19 @@ class TransactionController extends base_controller_1.BaseController {
211
194
  _TransactionController_transactionHistoryLimit.set(this, void 0);
212
195
  _TransactionController_isSimulationEnabled.set(this, void 0);
213
196
  _TransactionController_testGasFeeFlows.set(this, void 0);
197
+ // private async registryLookup(fourBytePrefix: string): Promise<MethodData> {
198
+ // const registryMethod = await this.registry.lookup(fourBytePrefix);
199
+ // if (!registryMethod) {
200
+ // return {
201
+ // registryMethod: '',
202
+ // parsedRegistryMethod: { name: undefined, args: undefined },
203
+ // };
204
+ // }
205
+ // const parsedRegistryMethod = this.registry.parse(registryMethod);
206
+ // return { registryMethod, parsedRegistryMethod };
207
+ // }
214
208
  _TransactionController_multichainTrackingHelper.set(this, void 0);
215
209
  _TransactionController_checkForPendingTransactionAndStartPolling.set(this, () => {
216
- // PendingTransactionTracker reads state through its getTransactions hook
217
- this.pendingTransactionTracker.startIfPendingTransactions();
218
210
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").checkForPendingTransactionAndStartPolling();
219
211
  });
220
212
  this.messagingSystem = messenger;
@@ -223,8 +215,6 @@ class TransactionController extends base_controller_1.BaseController {
223
215
  this.isHistoryDisabled = disableHistory ?? false;
224
216
  this.isSwapsDisabled = disableSwaps ?? false;
225
217
  __classPrivateFieldSet(this, _TransactionController_isSimulationEnabled, isSimulationEnabled ?? (() => true), "f");
226
- // @ts-expect-error the type in eth-method-registry is inappropriate and should be changed
227
- this.registry = new eth_method_registry_1.MethodRegistry({ provider });
228
218
  this.getSavedGasFees = getSavedGasFees ?? ((_chainId) => undefined);
229
219
  this.getCurrentAccountEIP1559Compatibility =
230
220
  getCurrentAccountEIP1559Compatibility ?? (() => Promise.resolve(true));
@@ -252,17 +242,10 @@ class TransactionController extends base_controller_1.BaseController {
252
242
  hooks?.getAdditionalSignArguments ?? (() => []);
253
243
  this.publish =
254
244
  hooks?.publish ?? (() => Promise.resolve({ transactionHash: undefined }));
255
- this.nonceTracker = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_createNonceTracker).call(this, {
256
- provider,
257
- blockTracker,
258
- });
259
245
  const findNetworkClientIdByChainId = (chainId) => {
260
246
  return this.messagingSystem.call(`NetworkController:findNetworkClientIdByChainId`, chainId);
261
247
  };
262
248
  __classPrivateFieldSet(this, _TransactionController_multichainTrackingHelper, new MultichainTrackingHelper_1.MultichainTrackingHelper({
263
- isMultichainEnabled,
264
- provider,
265
- nonceTracker: this.nonceTracker,
266
249
  incomingTransactionOptions: incomingTransactions,
267
250
  findNetworkClientIdByChainId,
268
251
  getNetworkClientById: ((networkClientId) => {
@@ -279,28 +262,13 @@ class TransactionController extends base_controller_1.BaseController {
279
262
  },
280
263
  }), "f");
281
264
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").initialize();
282
- const etherscanRemoteTransactionSource = new EtherscanRemoteTransactionSource_1.EtherscanRemoteTransactionSource({
283
- apiKeysByChainId: incomingTransactions.etherscanApiKeysByChainId,
284
- includeTokenTransfers: incomingTransactions.includeTokenTransfers,
285
- });
286
- this.incomingTransactionHelper = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_createIncomingTransactionHelper).call(this, {
287
- blockTracker,
288
- etherscanRemoteTransactionSource,
289
- });
290
- this.pendingTransactionTracker = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_createPendingTransactionTracker).call(this, {
291
- provider,
292
- blockTracker,
293
- });
294
265
  this.gasFeeFlows = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGasFeeFlows).call(this);
295
266
  this.layer1GasFeeFlows = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getLayer1GasFeeFlows).call(this);
296
267
  const gasFeePoller = new GasFeePoller_1.GasFeePoller({
297
268
  findNetworkClientIdByChainId,
298
269
  gasFeeFlows: this.gasFeeFlows,
299
270
  getGasFeeControllerEstimates: this.getGasFeeEstimates,
300
- getProvider: (chainId, networkClientId) => __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
301
- networkClientId,
302
- chainId,
303
- }),
271
+ getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
304
272
  getTransactions: () => this.state.transactions,
305
273
  layer1GasFeeFlows: this.layer1GasFeeFlows,
306
274
  onStateChange: (listener) => {
@@ -311,12 +279,6 @@ class TransactionController extends base_controller_1.BaseController {
311
279
  // when transactionsController state changes
312
280
  // check for pending transactions and start polling if there are any
313
281
  this.messagingSystem.subscribe('TransactionController:stateChange', __classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f"));
314
- // TODO once v2 is merged make sure this only runs when
315
- // selectedNetworkClientId changes
316
- onNetworkStateChange(() => {
317
- (0, logger_1.projectLogger)('Detected network change', this.getChainId());
318
- this.pendingTransactionTracker.startIfPendingTransactions();
319
- });
320
282
  this.onBootCleanup();
321
283
  __classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f").call(this);
322
284
  }
@@ -329,26 +291,11 @@ class TransactionController extends base_controller_1.BaseController {
329
291
  /**
330
292
  * Handle new method data request.
331
293
  *
332
- * @param fourBytePrefix - The method prefix.
294
+ * @param _fourBytePrefix - The method prefix.
333
295
  * @returns The method data object corresponding to the given signature prefix.
334
296
  */
335
- async handleMethodData(fourBytePrefix) {
336
- const releaseLock = await this.mutex.acquire();
337
- try {
338
- const { methodData } = this.state;
339
- const knownMethod = Object.keys(methodData).find((knownFourBytePrefix) => fourBytePrefix === knownFourBytePrefix);
340
- if (knownMethod) {
341
- return methodData[fourBytePrefix];
342
- }
343
- const registry = await this.registryLookup(fourBytePrefix);
344
- this.update((state) => {
345
- state.methodData[fourBytePrefix] = registry;
346
- });
347
- return registry;
348
- }
349
- finally {
350
- releaseLock();
351
- }
297
+ async handleMethodData(_fourBytePrefix) {
298
+ throw new Error('Method not implemented.');
352
299
  }
353
300
  /**
354
301
  * Add a new unapproved transaction to state. Parameters will be validated, a
@@ -356,40 +303,38 @@ class TransactionController extends base_controller_1.BaseController {
356
303
  * if not provided. If A `<tx.id>:unapproved` hub event will be emitted once added.
357
304
  *
358
305
  * @param txParams - Standard parameters for an Ethereum transaction.
359
- * @param opts - Additional options to control how the transaction is added.
360
- * @param opts.actionId - Unique ID to prevent duplicate requests.
361
- * @param opts.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
362
- * @param opts.method - RPC method that requested the transaction.
363
- * @param opts.origin - The origin of the transaction request, such as a dApp hostname.
364
- * @param opts.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.
365
- * @param opts.securityAlertResponse - Response from security validator.
366
- * @param opts.sendFlowHistory - The sendFlowHistory entries to add.
367
- * @param opts.type - Type of transaction to add, such as 'cancel' or 'swap'.
368
- * @param opts.swaps - Options for swaps transactions.
369
- * @param opts.swaps.hasApproveTx - Whether the transaction has an approval transaction.
370
- * @param opts.swaps.meta - Metadata for swap transaction.
371
- * @param opts.networkClientId - The id of the network client for this transaction.
372
- * @param opts.traceContext - The parent context for any new traces.
306
+ * @param options - Additional options to control how the transaction is added.
307
+ * @param options.actionId - Unique ID to prevent duplicate requests.
308
+ * @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
309
+ * @param options.method - RPC method that requested the transaction.
310
+ * @param options.origin - The origin of the transaction request, such as a dApp hostname.
311
+ * @param options.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.
312
+ * @param options.securityAlertResponse - Response from security validator.
313
+ * @param options.sendFlowHistory - The sendFlowHistory entries to add.
314
+ * @param options.type - Type of transaction to add, such as 'cancel' or 'swap'.
315
+ * @param options.swaps - Options for swaps transactions.
316
+ * @param options.swaps.hasApproveTx - Whether the transaction has an approval transaction.
317
+ * @param options.swaps.meta - Metadata for swap transaction.
318
+ * @param options.networkClientId - The id of the network client for this transaction.
319
+ * @param options.traceContext - The parent context for any new traces.
373
320
  * @returns Object containing a promise resolving to the transaction hash if approved.
374
321
  */
375
- async addTransaction(txParams, { actionId, deviceConfirmedOn, method, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, networkClientId: requestNetworkClientId, } = {}) {
376
- (0, logger_1.projectLogger)('Adding transaction', txParams);
322
+ async addTransaction(txParams, options) {
323
+ (0, logger_1.projectLogger)('Adding transaction', txParams, options);
324
+ const { actionId, deviceConfirmedOn, method, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
377
325
  txParams = (0, utils_2.normalizeTransactionParams)(txParams);
378
- if (requestNetworkClientId &&
379
- !__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(requestNetworkClientId)) {
380
- throw new Error('The networkClientId for this transaction could not be found');
326
+ if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
327
+ throw new Error(`Network client not found - ${networkClientId}`);
381
328
  }
382
- const networkClientId = requestNetworkClientId ?? __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
383
329
  const isEIP1559Compatible = await this.getEIP1559Compatibility(networkClientId);
384
330
  (0, validation_1.validateTxParams)(txParams, isEIP1559Compatible);
385
331
  if (origin && this.getPermittedAccounts) {
386
332
  await (0, validation_1.validateTransactionOrigin)(await this.getPermittedAccounts(origin), __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getSelectedAccount).call(this).address, txParams.from, origin);
387
333
  }
388
334
  const dappSuggestedGasFees = this.generateDappSuggestedGasFees(txParams, origin);
389
- const chainId = this.getChainId(networkClientId);
390
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
335
+ const chainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId);
336
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
391
337
  networkClientId,
392
- chainId,
393
338
  });
394
339
  const transactionType = type ?? (await (0, transaction_type_1.determineTransactionType)(txParams, ethQuery)).type;
395
340
  const existingTransactionMeta = this.getTransactionWithActionId(actionId);
@@ -460,29 +405,13 @@ class TransactionController extends base_controller_1.BaseController {
460
405
  transactionMeta: addedTransactionMeta,
461
406
  };
462
407
  }
463
- startIncomingTransactionPolling(networkClientIds = []) {
464
- if (networkClientIds.length === 0) {
465
- this.incomingTransactionHelper.start();
466
- return;
467
- }
408
+ startIncomingTransactionPolling(networkClientIds) {
468
409
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").startIncomingTransactionPolling(networkClientIds);
469
410
  }
470
- stopIncomingTransactionPolling(networkClientIds = []) {
471
- if (networkClientIds.length === 0) {
472
- this.incomingTransactionHelper.stop();
473
- return;
474
- }
411
+ stopIncomingTransactionPolling(networkClientIds) {
475
412
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").stopIncomingTransactionPolling(networkClientIds);
476
413
  }
477
- stopAllIncomingTransactionPolling() {
478
- this.incomingTransactionHelper.stop();
479
- __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").stopAllIncomingTransactionPolling();
480
- }
481
414
  async updateIncomingTransactions(networkClientIds = []) {
482
- if (networkClientIds.length === 0) {
483
- await this.incomingTransactionHelper.update();
484
- return;
485
- }
486
415
  await __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").updateIncomingTransactions(networkClientIds);
487
416
  }
488
417
  /**
@@ -546,7 +475,7 @@ class TransactionController extends base_controller_1.BaseController {
546
475
  * @returns The gas and gas price.
547
476
  */
548
477
  async estimateGas(transaction, networkClientId) {
549
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
478
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
550
479
  networkClientId,
551
480
  });
552
481
  const { estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(transaction, ethQuery);
@@ -560,7 +489,7 @@ class TransactionController extends base_controller_1.BaseController {
560
489
  * @param networkClientId - The network client id to use for the estimate.
561
490
  */
562
491
  async estimateGasBuffered(transaction, multiplier, networkClientId) {
563
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
492
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
564
493
  networkClientId,
565
494
  });
566
495
  const { blockGasLimit, estimatedGas, simulationFails } = await (0, gas_1.estimateGas)(transaction, ethQuery);
@@ -603,24 +532,21 @@ class TransactionController extends base_controller_1.BaseController {
603
532
  this.updateTransaction(updatedTransactionMeta, `${controllerName}:updatesecurityAlertResponse - securityAlertResponse updated`);
604
533
  }
605
534
  /**
606
- * Removes all transactions from state, optionally based on the current network.
535
+ * Remove transactions from state.
607
536
  *
608
- * @param ignoreNetwork - Determines whether to wipe all transactions, or just those on the
609
- * current network. If `true`, all transactions are wiped.
610
- * @param address - If specified, only transactions originating from this address will be
611
- * wiped on current network.
537
+ * @param options - The options bag.
538
+ * @param options.address - Remove transactions from this account only. Defaults to all accounts.
539
+ * @param options.chainId - Remove transactions for the specified chain only. Defaults to all chains.
612
540
  */
613
- wipeTransactions(ignoreNetwork, address) {
614
- /* istanbul ignore next */
615
- if (ignoreNetwork && !address) {
541
+ wipeTransactions({ address, chainId, } = {}) {
542
+ if (!chainId && !address) {
616
543
  this.update((state) => {
617
544
  state.transactions = [];
618
545
  });
619
546
  return;
620
547
  }
621
- const currentChainId = this.getChainId();
622
- const newTransactions = this.state.transactions.filter(({ chainId, txParams }) => {
623
- const isMatchingNetwork = ignoreNetwork || chainId === currentChainId;
548
+ const newTransactions = this.state.transactions.filter(({ chainId: txChainId, txParams }) => {
549
+ const isMatchingNetwork = !chainId || chainId === txChainId;
624
550
  if (!isMatchingNetwork) {
625
551
  return true;
626
552
  }
@@ -810,10 +736,8 @@ class TransactionController extends base_controller_1.BaseController {
810
736
  };
811
737
  editableParams.txParams = (0, lodash_1.pickBy)(editableParams.txParams);
812
738
  const updatedTransaction = (0, lodash_1.merge)({}, transactionMeta, editableParams);
813
- const provider = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
814
- chainId: transactionMeta.chainId,
815
- networkClientId: transactionMeta.networkClientId,
816
- });
739
+ const { networkClientId } = transactionMeta;
740
+ const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId });
817
741
  const ethQuery = new eth_query_1.default(provider);
818
742
  const { type } = await (0, transaction_type_1.determineTransactionType)(updatedTransaction.txParams, ethQuery);
819
743
  updatedTransaction.type = type;
@@ -841,19 +765,9 @@ class TransactionController extends base_controller_1.BaseController {
841
765
  return '';
842
766
  }
843
767
  const initialTx = listOfTxParams[0];
844
- const common = this.getCommonConfiguration(initialTx.chainId);
845
- // We need to ensure we get the nonce using the the NonceTracker on the chain matching
846
- // the txParams. In this context we only have chainId available to us, but the
847
- // NonceTrackers are keyed by networkClientId. To workaround this, we attempt to find
848
- // a networkClientId that matches the chainId. As a fallback, the globally selected
849
- // network's NonceTracker will be used instead.
850
- let networkClientId;
851
- try {
852
- networkClientId = this.messagingSystem.call(`NetworkController:findNetworkClientIdByChainId`, initialTx.chainId);
853
- }
854
- catch (err) {
855
- (0, logger_1.projectLogger)('failed to find networkClientId from chainId', err);
856
- }
768
+ const { chainId } = initialTx;
769
+ const common = this.getCommonConfiguration(chainId);
770
+ const networkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNetworkClientId).call(this, { chainId });
857
771
  const initialTxAsEthTx = tx_1.TransactionFactory.fromTxData(initialTx, {
858
772
  common,
859
773
  });
@@ -935,14 +849,12 @@ class TransactionController extends base_controller_1.BaseController {
935
849
  * Search transaction metadata for matching entries.
936
850
  *
937
851
  * @param opts - Options bag.
938
- * @param opts.searchCriteria - An object containing values or functions for transaction properties to filter transactions with.
939
852
  * @param opts.initialList - The transactions to search. Defaults to the current state.
940
- * @param opts.filterToCurrentNetwork - Whether to filter the results to the current network. Defaults to true.
941
853
  * @param opts.limit - The maximum number of transactions to return. No limit by default.
854
+ * @param opts.searchCriteria - An object containing values or functions for transaction properties to filter transactions with.
942
855
  * @returns An array of transactions matching the provided options.
943
856
  */
944
- getTransactions({ searchCriteria = {}, initialList, filterToCurrentNetwork = true, limit, } = {}) {
945
- const chainId = this.getChainId();
857
+ getTransactions({ initialList, limit, searchCriteria = {}, } = {}) {
946
858
  // searchCriteria is an object that might have values that aren't predicate
947
859
  // methods. When providing any other value type (string, number, etc), we
948
860
  // consider this shorthand for "check the value at key for strict equality
@@ -960,9 +872,6 @@ class TransactionController extends base_controller_1.BaseController {
960
872
  // Combine sortBy and pickBy to transform our state object into an array of
961
873
  // matching transactions that are sorted by time.
962
874
  const filteredTransactions = (0, lodash_1.sortBy)((0, lodash_1.pickBy)(transactionsToFilter, (transaction) => {
963
- if (filterToCurrentNetwork && transaction.chainId !== chainId) {
964
- return false;
965
- }
966
875
  // iterate over the predicateMethods keys to check if the transaction
967
876
  // matches the searchCriteria
968
877
  for (const [key, predicate] of Object.entries(predicateMethods)) {
@@ -1018,9 +927,9 @@ class TransactionController extends base_controller_1.BaseController {
1018
927
  return filteredTransactions;
1019
928
  }
1020
929
  async estimateGasFee({ transactionParams, chainId, networkClientId: requestNetworkClientId, }) {
1021
- const networkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNetworkClientId).call(this, {
1022
- networkClientId: requestNetworkClientId,
930
+ const { id: networkClientId, provider } = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({
1023
931
  chainId,
932
+ networkClientId: requestNetworkClientId,
1024
933
  });
1025
934
  const transactionMeta = {
1026
935
  txParams: transactionParams,
@@ -1029,10 +938,7 @@ class TransactionController extends base_controller_1.BaseController {
1029
938
  };
1030
939
  // Guaranteed as the default gas fee flow matches all transactions.
1031
940
  const gasFeeFlow = (0, gas_flow_1.getGasFeeFlow)(transactionMeta, this.gasFeeFlows);
1032
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1033
- networkClientId,
1034
- chainId,
1035
- });
941
+ const ethQuery = new eth_query_1.default(provider);
1036
942
  const gasFeeControllerData = await this.getGasFeeEstimates({
1037
943
  networkClientId,
1038
944
  });
@@ -1051,9 +957,9 @@ class TransactionController extends base_controller_1.BaseController {
1051
957
  * @param request.networkClientId - The ID of a specific network client to process the transaction.
1052
958
  */
1053
959
  async getLayer1GasFee({ transactionParams, chainId, networkClientId, }) {
1054
- const provider = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
1055
- networkClientId,
960
+ const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, {
1056
961
  chainId,
962
+ networkClientId,
1057
963
  });
1058
964
  return await (0, layer1_gas_fee_flow_1.getTransactionLayer1GasFee)({
1059
965
  layer1GasFeeFlows: this.layer1GasFeeFlows,
@@ -1124,15 +1030,10 @@ class TransactionController extends base_controller_1.BaseController {
1124
1030
  const isEIP1559Compatible = transactionMeta.txParams.type !== types_1.TransactionEnvelopeType.legacy &&
1125
1031
  (await this.getEIP1559Compatibility(transactionMeta.networkClientId));
1126
1032
  const { networkClientId, chainId } = transactionMeta;
1127
- const isCustomNetwork = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_isCustomNetwork).call(this, networkClientId);
1128
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1129
- networkClientId,
1130
- chainId,
1131
- });
1132
- const provider = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
1133
- networkClientId,
1134
- chainId,
1135
- });
1033
+ const isCustomNetwork = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({ networkClientId })
1034
+ .configuration.type === network_controller_1.NetworkClientType.Custom;
1035
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1036
+ const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId });
1136
1037
  await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Update Gas', parentContext: traceContext }, async () => {
1137
1038
  await (0, gas_1.updateGas)({
1138
1039
  ethQuery,
@@ -1290,10 +1191,8 @@ class TransactionController extends base_controller_1.BaseController {
1290
1191
  if (!rawTx) {
1291
1192
  return ApprovalState.NotApproved;
1292
1193
  }
1293
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1294
- networkClientId: transactionMeta.networkClientId,
1295
- chainId: transactionMeta.chainId,
1296
- });
1194
+ const { networkClientId } = transactionMeta;
1195
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1297
1196
  let preTxBalance;
1298
1197
  const shouldUpdatePreTxBalance = transactionMeta.type === types_1.TransactionType.swap;
1299
1198
  if (shouldUpdatePreTxBalance) {
@@ -1487,14 +1386,6 @@ class TransactionController extends base_controller_1.BaseController {
1487
1386
  const isCompleted = this.isLocalFinalState(transaction.status);
1488
1387
  return { meta: transaction, isCompleted };
1489
1388
  }
1490
- getChainId(networkClientId) {
1491
- const globalChainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalChainId).call(this);
1492
- const globalNetworkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
1493
- if (!networkClientId || networkClientId === globalNetworkClientId) {
1494
- return globalChainId;
1495
- }
1496
- return this.messagingSystem.call(`NetworkController:getNetworkClientById`, networkClientId).configuration.chainId;
1497
- }
1498
1389
  prepareUnsignedEthTx(chainId, txParams) {
1499
1390
  return tx_1.TransactionFactory.fromTxData(txParams, {
1500
1391
  freeze: false,
@@ -1720,7 +1611,7 @@ class TransactionController extends base_controller_1.BaseController {
1720
1611
  transactionMeta,
1721
1612
  });
1722
1613
  }
1723
- getNonceTrackerTransactions(status, address, chainId = this.getChainId()) {
1614
+ getNonceTrackerTransactions(status, address, chainId) {
1724
1615
  return (0, nonce_1.getAndFormatTransactionsForNonceTracker)(chainId, address, status, this.state.transactions);
1725
1616
  }
1726
1617
  onConfirmedTransaction(transactionMeta) {
@@ -1736,13 +1627,11 @@ class TransactionController extends base_controller_1.BaseController {
1736
1627
  }
1737
1628
  async updatePostBalance(transactionMeta) {
1738
1629
  try {
1739
- if (transactionMeta.type !== types_1.TransactionType.swap) {
1630
+ const { networkClientId, type } = transactionMeta;
1631
+ if (type !== types_1.TransactionType.swap) {
1740
1632
  return;
1741
1633
  }
1742
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1743
- networkClientId: transactionMeta.networkClientId,
1744
- chainId: transactionMeta.chainId,
1745
- });
1634
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1746
1635
  const { updatedTransactionMeta, approvalTransactionMeta } = await (0, swaps_1.updatePostTransactionBalance)(transactionMeta, {
1747
1636
  ethQuery,
1748
1637
  getTransaction: this.getTransaction.bind(this),
@@ -1764,7 +1653,6 @@ class TransactionController extends base_controller_1.BaseController {
1764
1653
  }
1765
1654
  catch (error) {
1766
1655
  if (this.isTransactionAlreadyConfirmedError(error)) {
1767
- await this.pendingTransactionTracker.forceCheckTransaction(transactionMeta);
1768
1656
  throw new Error('Previous transaction is already confirmed');
1769
1657
  }
1770
1658
  throw error;
@@ -1820,10 +1708,8 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1820
1708
  newFee,
1821
1709
  txParams: newTxParams,
1822
1710
  });
1823
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1824
- networkClientId: transactionMeta.networkClientId,
1825
- chainId: transactionMeta.chainId,
1826
- });
1711
+ const { networkClientId } = transactionMeta;
1712
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1827
1713
  const newTransactionMeta = {
1828
1714
  ...transactionMetaWithRsv,
1829
1715
  actionId,
@@ -1852,6 +1738,23 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1852
1738
  actionId,
1853
1739
  });
1854
1740
  afterSubmit?.(newTransactionMeta);
1741
+ }, _TransactionController_getChainId = function _TransactionController_getChainId(networkClientId) {
1742
+ return __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({ networkClientId })
1743
+ .configuration.chainId;
1744
+ }, _TransactionController_getNetworkClientId = function _TransactionController_getNetworkClientId({ chainId, networkClientId, }) {
1745
+ if (networkClientId) {
1746
+ return networkClientId;
1747
+ }
1748
+ return __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({
1749
+ chainId,
1750
+ }).id;
1751
+ }, _TransactionController_getEthQuery = function _TransactionController_getEthQuery({ chainId, networkClientId, }) {
1752
+ return new eth_query_1.default(__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { chainId, networkClientId }));
1753
+ }, _TransactionController_getProvider = function _TransactionController_getProvider({ chainId, networkClientId, }) {
1754
+ return __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({
1755
+ chainId,
1756
+ networkClientId,
1757
+ }).provider;
1855
1758
  }, _TransactionController_createNonceTracker = function _TransactionController_createNonceTracker({ provider, blockTracker, chainId, }) {
1856
1759
  return new nonce_tracker_1.NonceTracker({
1857
1760
  // TODO: Fix types
@@ -1860,7 +1763,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1860
1763
  // TODO: Fix types
1861
1764
  blockTracker,
1862
1765
  getPendingTransactions: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNonceTrackerPendingTransactions).bind(this, chainId),
1863
- getConfirmedTransactions: this.getNonceTrackerTransactions.bind(this, types_1.TransactionStatus.confirmed),
1766
+ getConfirmedTransactions: this.getNonceTrackerTransactions.bind(this, types_1.TransactionStatus.confirmed, chainId),
1864
1767
  });
1865
1768
  }, _TransactionController_createIncomingTransactionHelper = function _TransactionController_createIncomingTransactionHelper({ blockTracker, etherscanRemoteTransactionSource, chainId, }) {
1866
1769
  const incomingTransactionHelper = new IncomingTransactionHelper_1.IncomingTransactionHelper({
@@ -1868,7 +1771,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1868
1771
  getCurrentAccount: () => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getSelectedAccount).call(this),
1869
1772
  getLastFetchedBlockNumbers: () => this.state.lastFetchedBlockNumbers,
1870
1773
  getLocalTransactions: () => this.state.transactions,
1871
- getChainId: chainId ? () => chainId : this.getChainId.bind(this),
1774
+ getChainId: () => chainId,
1872
1775
  isEnabled: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").isEnabled,
1873
1776
  queryEntireHistory: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").queryEntireHistory,
1874
1777
  remoteTransactionSource: etherscanRemoteTransactionSource,
@@ -1879,15 +1782,14 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1879
1782
  return incomingTransactionHelper;
1880
1783
  }, _TransactionController_createPendingTransactionTracker = function _TransactionController_createPendingTransactionTracker({ provider, blockTracker, chainId, }) {
1881
1784
  const ethQuery = new eth_query_1.default(provider);
1882
- const getChainId = chainId ? () => chainId : this.getChainId.bind(this);
1883
1785
  const pendingTransactionTracker = new PendingTransactionTracker_1.PendingTransactionTracker({
1884
1786
  blockTracker,
1885
- getChainId,
1787
+ getChainId: () => chainId,
1886
1788
  getEthQuery: () => ethQuery,
1887
1789
  getTransactions: () => this.state.transactions,
1888
1790
  isResubmitEnabled: __classPrivateFieldGet(this, _TransactionController_pendingTransactionOptions, "f").isResubmitEnabled,
1889
1791
  getGlobalLock: () => __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").acquireNonceLockForChainIdKey({
1890
- chainId: getChainId(),
1792
+ chainId,
1891
1793
  }),
1892
1794
  publishTransaction: (_ethQuery, transactionMeta) => this.publishTransaction(_ethQuery, transactionMeta, {
1893
1795
  skipSubmitHistory: true,
@@ -1900,10 +1802,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1900
1802
  __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addPendingTransactionTrackerListeners).call(this, pendingTransactionTracker);
1901
1803
  return pendingTransactionTracker;
1902
1804
  }, _TransactionController_stopAllTracking = function _TransactionController_stopAllTracking() {
1903
- this.pendingTransactionTracker.stop();
1904
- __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_removePendingTransactionTrackerListeners).call(this, this.pendingTransactionTracker);
1905
- this.incomingTransactionHelper.stop();
1906
- __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_removeIncomingTransactionHelperListeners).call(this, this.incomingTransactionHelper);
1907
1805
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").stopAllTracking();
1908
1806
  }, _TransactionController_removeIncomingTransactionHelperListeners = function _TransactionController_removeIncomingTransactionHelperListeners(incomingTransactionHelper) {
1909
1807
  incomingTransactionHelper.hub.removeAllListeners('transactions');
@@ -2018,26 +1916,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
2018
1916
  txMeta.layer1GasFee = layer1GasFee;
2019
1917
  }
2020
1918
  });
2021
- }, _TransactionController_getNetworkClientId = function _TransactionController_getNetworkClientId({ networkClientId: requestNetworkClientId, chainId, }) {
2022
- const globalChainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalChainId).call(this);
2023
- const globalNetworkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
2024
- if (requestNetworkClientId) {
2025
- return requestNetworkClientId;
2026
- }
2027
- if (!chainId || chainId === globalChainId) {
2028
- return globalNetworkClientId;
2029
- }
2030
- return this.messagingSystem.call(`NetworkController:findNetworkClientIdByChainId`, chainId);
2031
- }, _TransactionController_getGlobalNetworkClientId = function _TransactionController_getGlobalNetworkClientId() {
2032
- return this.getNetworkState().selectedNetworkClientId;
2033
- }, _TransactionController_getGlobalChainId = function _TransactionController_getGlobalChainId() {
2034
- return this.messagingSystem.call(`NetworkController:getNetworkClientById`, this.getNetworkState().selectedNetworkClientId).configuration.chainId;
2035
- }, _TransactionController_isCustomNetwork = function _TransactionController_isCustomNetwork(networkClientId) {
2036
- const globalNetworkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
2037
- if (!networkClientId || networkClientId === globalNetworkClientId) {
2038
- return !(0, controller_utils_1.isInfuraNetworkType)(this.getNetworkState().selectedNetworkClientId);
2039
- }
2040
- return (this.messagingSystem.call(`NetworkController:getNetworkClientById`, networkClientId).configuration.type === network_controller_1.NetworkClientType.Custom);
2041
1919
  }, _TransactionController_getSelectedAccount = function _TransactionController_getSelectedAccount() {
2042
1920
  return this.messagingSystem.call('AccountsController:getSelectedAccount');
2043
1921
  }, _TransactionController_updateSubmitHistory = function _TransactionController_updateSubmitHistory(transactionMeta, hash) {