@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
@@ -9,7 +9,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
10
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
11
  };
12
- 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;
12
+ 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;
13
13
  function $importDefault(module) {
14
14
  if (module?.__esModule) {
15
15
  return module.default;
@@ -22,7 +22,7 @@ import { TransactionFactory } from "@ethereumjs/tx";
22
22
  import $ethereumjsutil from "@ethereumjs/util";
23
23
  const { bufferToHex } = $ethereumjsutil;
24
24
  import { BaseController } from "@metamask/base-controller";
25
- import { query, ApprovalType, ORIGIN_METAMASK, convertHexToDecimal, isInfuraNetworkType } from "@metamask/controller-utils";
25
+ import { query, ApprovalType, ORIGIN_METAMASK, convertHexToDecimal } from "@metamask/controller-utils";
26
26
  import $EthQuery from "@metamask/eth-query";
27
27
  const EthQuery = $importDefault($EthQuery);
28
28
  import { NetworkClientType } from "@metamask/network-controller";
@@ -30,7 +30,6 @@ import { NonceTracker } from "@metamask/nonce-tracker";
30
30
  import { errorCodes, rpcErrors, providerErrors } from "@metamask/rpc-errors";
31
31
  import { add0x } from "@metamask/utils";
32
32
  import { Mutex } from "async-mutex";
33
- import { MethodRegistry } from "eth-method-registry";
34
33
  import { EventEmitter } from "events";
35
34
  import $lodash from "lodash";
36
35
  const { cloneDeep, mapValues, merge, pickBy, sortBy } = $lodash;
@@ -40,7 +39,6 @@ import { LineaGasFeeFlow } from "./gas-flows/LineaGasFeeFlow.mjs";
40
39
  import { OptimismLayer1GasFeeFlow } from "./gas-flows/OptimismLayer1GasFeeFlow.mjs";
41
40
  import { ScrollLayer1GasFeeFlow } from "./gas-flows/ScrollLayer1GasFeeFlow.mjs";
42
41
  import { TestGasFeeFlow } from "./gas-flows/TestGasFeeFlow.mjs";
43
- import { EtherscanRemoteTransactionSource } from "./helpers/EtherscanRemoteTransactionSource.mjs";
44
42
  import { GasFeePoller } from "./helpers/GasFeePoller.mjs";
45
43
  import { IncomingTransactionHelper } from "./helpers/IncomingTransactionHelper.mjs";
46
44
  import { MultichainTrackingHelper } from "./helpers/MultichainTrackingHelper.mjs";
@@ -152,22 +150,10 @@ export class TransactionController extends BaseController {
152
150
  this.messagingSystem.publish(`${controllerName}:transactionFinished`, newTransactionMeta);
153
151
  __classPrivateFieldGet(this, _TransactionController_internalEvents, "f").emit(`${transactionMeta.id}:finished`, newTransactionMeta);
154
152
  }
155
- async registryLookup(fourBytePrefix) {
156
- const registryMethod = await this.registry.lookup(fourBytePrefix);
157
- if (!registryMethod) {
158
- return {
159
- registryMethod: '',
160
- parsedRegistryMethod: { name: undefined, args: undefined },
161
- };
162
- }
163
- const parsedRegistryMethod = this.registry.parse(registryMethod);
164
- return { registryMethod, parsedRegistryMethod };
165
- }
166
153
  /**
167
154
  * Constructs a TransactionController.
168
155
  *
169
156
  * @param options - The controller options.
170
- * @param options.blockTracker - The block tracker used to poll for new blocks data.
171
157
  * @param options.disableHistory - Whether to disable storing history in transaction metadata.
172
158
  * @param options.disableSendFlowHistory - Explicitly disable transaction metadata history.
173
159
  * @param options.disableSwaps - Whether to disable additional processing on swaps transactions.
@@ -180,12 +166,9 @@ export class TransactionController extends BaseController {
180
166
  * @param options.getPermittedAccounts - Get accounts that a given origin has permissions for.
181
167
  * @param options.getSavedGasFees - Gets the saved gas fee config.
182
168
  * @param options.incomingTransactions - Configuration options for incoming transaction support.
183
- * @param options.isMultichainEnabled - Enable multichain support.
184
169
  * @param options.isSimulationEnabled - Whether new transactions will be automatically simulated.
185
170
  * @param options.messenger - The controller messenger.
186
- * @param options.onNetworkStateChange - Allows subscribing to network controller state changes.
187
171
  * @param options.pendingTransactions - Configuration options for pending transaction support.
188
- * @param options.provider - The provider used to create the underlying EthQuery instance.
189
172
  * @param options.securityProviderRequest - A function for verifying a transaction, whether it is malicious or not.
190
173
  * @param options.sign - Function used to sign transactions.
191
174
  * @param options.state - Initial state to set on this controller.
@@ -194,7 +177,7 @@ export class TransactionController extends BaseController {
194
177
  * @param options.transactionHistoryLimit - Transaction history limit.
195
178
  * @param options.hooks - The controller hooks.
196
179
  */
197
- 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, }) {
180
+ constructor({ disableHistory, disableSendFlowHistory, disableSwaps, getCurrentAccountEIP1559Compatibility, getCurrentNetworkEIP1559Compatibility, getExternalPendingTransactions, getGasFeeEstimates, getNetworkClientRegistry, getNetworkState, getPermittedAccounts, getSavedGasFees, incomingTransactions = {}, isSimulationEnabled, messenger, pendingTransactions = {}, securityProviderRequest, sign, state, testGasFeeFlows, trace, transactionHistoryLimit = 40, hooks, }) {
198
181
  super({
199
182
  name: controllerName,
200
183
  metadata,
@@ -215,10 +198,19 @@ export class TransactionController extends BaseController {
215
198
  _TransactionController_transactionHistoryLimit.set(this, void 0);
216
199
  _TransactionController_isSimulationEnabled.set(this, void 0);
217
200
  _TransactionController_testGasFeeFlows.set(this, void 0);
201
+ // private async registryLookup(fourBytePrefix: string): Promise<MethodData> {
202
+ // const registryMethod = await this.registry.lookup(fourBytePrefix);
203
+ // if (!registryMethod) {
204
+ // return {
205
+ // registryMethod: '',
206
+ // parsedRegistryMethod: { name: undefined, args: undefined },
207
+ // };
208
+ // }
209
+ // const parsedRegistryMethod = this.registry.parse(registryMethod);
210
+ // return { registryMethod, parsedRegistryMethod };
211
+ // }
218
212
  _TransactionController_multichainTrackingHelper.set(this, void 0);
219
213
  _TransactionController_checkForPendingTransactionAndStartPolling.set(this, () => {
220
- // PendingTransactionTracker reads state through its getTransactions hook
221
- this.pendingTransactionTracker.startIfPendingTransactions();
222
214
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").checkForPendingTransactionAndStartPolling();
223
215
  });
224
216
  this.messagingSystem = messenger;
@@ -227,8 +219,6 @@ export class TransactionController extends BaseController {
227
219
  this.isHistoryDisabled = disableHistory ?? false;
228
220
  this.isSwapsDisabled = disableSwaps ?? false;
229
221
  __classPrivateFieldSet(this, _TransactionController_isSimulationEnabled, isSimulationEnabled ?? (() => true), "f");
230
- // @ts-expect-error the type in eth-method-registry is inappropriate and should be changed
231
- this.registry = new MethodRegistry({ provider });
232
222
  this.getSavedGasFees = getSavedGasFees ?? ((_chainId) => undefined);
233
223
  this.getCurrentAccountEIP1559Compatibility =
234
224
  getCurrentAccountEIP1559Compatibility ?? (() => Promise.resolve(true));
@@ -256,17 +246,10 @@ export class TransactionController extends BaseController {
256
246
  hooks?.getAdditionalSignArguments ?? (() => []);
257
247
  this.publish =
258
248
  hooks?.publish ?? (() => Promise.resolve({ transactionHash: undefined }));
259
- this.nonceTracker = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_createNonceTracker).call(this, {
260
- provider,
261
- blockTracker,
262
- });
263
249
  const findNetworkClientIdByChainId = (chainId) => {
264
250
  return this.messagingSystem.call(`NetworkController:findNetworkClientIdByChainId`, chainId);
265
251
  };
266
252
  __classPrivateFieldSet(this, _TransactionController_multichainTrackingHelper, new MultichainTrackingHelper({
267
- isMultichainEnabled,
268
- provider,
269
- nonceTracker: this.nonceTracker,
270
253
  incomingTransactionOptions: incomingTransactions,
271
254
  findNetworkClientIdByChainId,
272
255
  getNetworkClientById: ((networkClientId) => {
@@ -283,28 +266,13 @@ export class TransactionController extends BaseController {
283
266
  },
284
267
  }), "f");
285
268
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").initialize();
286
- const etherscanRemoteTransactionSource = new EtherscanRemoteTransactionSource({
287
- apiKeysByChainId: incomingTransactions.etherscanApiKeysByChainId,
288
- includeTokenTransfers: incomingTransactions.includeTokenTransfers,
289
- });
290
- this.incomingTransactionHelper = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_createIncomingTransactionHelper).call(this, {
291
- blockTracker,
292
- etherscanRemoteTransactionSource,
293
- });
294
- this.pendingTransactionTracker = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_createPendingTransactionTracker).call(this, {
295
- provider,
296
- blockTracker,
297
- });
298
269
  this.gasFeeFlows = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGasFeeFlows).call(this);
299
270
  this.layer1GasFeeFlows = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getLayer1GasFeeFlows).call(this);
300
271
  const gasFeePoller = new GasFeePoller({
301
272
  findNetworkClientIdByChainId,
302
273
  gasFeeFlows: this.gasFeeFlows,
303
274
  getGasFeeControllerEstimates: this.getGasFeeEstimates,
304
- getProvider: (chainId, networkClientId) => __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
305
- networkClientId,
306
- chainId,
307
- }),
275
+ getProvider: (networkClientId) => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId }),
308
276
  getTransactions: () => this.state.transactions,
309
277
  layer1GasFeeFlows: this.layer1GasFeeFlows,
310
278
  onStateChange: (listener) => {
@@ -315,12 +283,6 @@ export class TransactionController extends BaseController {
315
283
  // when transactionsController state changes
316
284
  // check for pending transactions and start polling if there are any
317
285
  this.messagingSystem.subscribe('TransactionController:stateChange', __classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f"));
318
- // TODO once v2 is merged make sure this only runs when
319
- // selectedNetworkClientId changes
320
- onNetworkStateChange(() => {
321
- log('Detected network change', this.getChainId());
322
- this.pendingTransactionTracker.startIfPendingTransactions();
323
- });
324
286
  this.onBootCleanup();
325
287
  __classPrivateFieldGet(this, _TransactionController_checkForPendingTransactionAndStartPolling, "f").call(this);
326
288
  }
@@ -333,26 +295,11 @@ export class TransactionController extends BaseController {
333
295
  /**
334
296
  * Handle new method data request.
335
297
  *
336
- * @param fourBytePrefix - The method prefix.
298
+ * @param _fourBytePrefix - The method prefix.
337
299
  * @returns The method data object corresponding to the given signature prefix.
338
300
  */
339
- async handleMethodData(fourBytePrefix) {
340
- const releaseLock = await this.mutex.acquire();
341
- try {
342
- const { methodData } = this.state;
343
- const knownMethod = Object.keys(methodData).find((knownFourBytePrefix) => fourBytePrefix === knownFourBytePrefix);
344
- if (knownMethod) {
345
- return methodData[fourBytePrefix];
346
- }
347
- const registry = await this.registryLookup(fourBytePrefix);
348
- this.update((state) => {
349
- state.methodData[fourBytePrefix] = registry;
350
- });
351
- return registry;
352
- }
353
- finally {
354
- releaseLock();
355
- }
301
+ async handleMethodData(_fourBytePrefix) {
302
+ throw new Error('Method not implemented.');
356
303
  }
357
304
  /**
358
305
  * Add a new unapproved transaction to state. Parameters will be validated, a
@@ -360,40 +307,38 @@ export class TransactionController extends BaseController {
360
307
  * if not provided. If A `<tx.id>:unapproved` hub event will be emitted once added.
361
308
  *
362
309
  * @param txParams - Standard parameters for an Ethereum transaction.
363
- * @param opts - Additional options to control how the transaction is added.
364
- * @param opts.actionId - Unique ID to prevent duplicate requests.
365
- * @param opts.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
366
- * @param opts.method - RPC method that requested the transaction.
367
- * @param opts.origin - The origin of the transaction request, such as a dApp hostname.
368
- * @param opts.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.
369
- * @param opts.securityAlertResponse - Response from security validator.
370
- * @param opts.sendFlowHistory - The sendFlowHistory entries to add.
371
- * @param opts.type - Type of transaction to add, such as 'cancel' or 'swap'.
372
- * @param opts.swaps - Options for swaps transactions.
373
- * @param opts.swaps.hasApproveTx - Whether the transaction has an approval transaction.
374
- * @param opts.swaps.meta - Metadata for swap transaction.
375
- * @param opts.networkClientId - The id of the network client for this transaction.
376
- * @param opts.traceContext - The parent context for any new traces.
310
+ * @param options - Additional options to control how the transaction is added.
311
+ * @param options.actionId - Unique ID to prevent duplicate requests.
312
+ * @param options.deviceConfirmedOn - An enum to indicate what device confirmed the transaction.
313
+ * @param options.method - RPC method that requested the transaction.
314
+ * @param options.origin - The origin of the transaction request, such as a dApp hostname.
315
+ * @param options.requireApproval - Whether the transaction requires approval by the user, defaults to true unless explicitly disabled.
316
+ * @param options.securityAlertResponse - Response from security validator.
317
+ * @param options.sendFlowHistory - The sendFlowHistory entries to add.
318
+ * @param options.type - Type of transaction to add, such as 'cancel' or 'swap'.
319
+ * @param options.swaps - Options for swaps transactions.
320
+ * @param options.swaps.hasApproveTx - Whether the transaction has an approval transaction.
321
+ * @param options.swaps.meta - Metadata for swap transaction.
322
+ * @param options.networkClientId - The id of the network client for this transaction.
323
+ * @param options.traceContext - The parent context for any new traces.
377
324
  * @returns Object containing a promise resolving to the transaction hash if approved.
378
325
  */
379
- async addTransaction(txParams, { actionId, deviceConfirmedOn, method, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, networkClientId: requestNetworkClientId, } = {}) {
380
- log('Adding transaction', txParams);
326
+ async addTransaction(txParams, options) {
327
+ log('Adding transaction', txParams, options);
328
+ const { actionId, deviceConfirmedOn, method, networkClientId, origin, requireApproval, securityAlertResponse, sendFlowHistory, swaps = {}, traceContext, type, } = options;
381
329
  txParams = normalizeTransactionParams(txParams);
382
- if (requestNetworkClientId &&
383
- !__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(requestNetworkClientId)) {
384
- throw new Error('The networkClientId for this transaction could not be found');
330
+ if (!__classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").has(networkClientId)) {
331
+ throw new Error(`Network client not found - ${networkClientId}`);
385
332
  }
386
- const networkClientId = requestNetworkClientId ?? __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
387
333
  const isEIP1559Compatible = await this.getEIP1559Compatibility(networkClientId);
388
334
  validateTxParams(txParams, isEIP1559Compatible);
389
335
  if (origin && this.getPermittedAccounts) {
390
336
  await validateTransactionOrigin(await this.getPermittedAccounts(origin), __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getSelectedAccount).call(this).address, txParams.from, origin);
391
337
  }
392
338
  const dappSuggestedGasFees = this.generateDappSuggestedGasFees(txParams, origin);
393
- const chainId = this.getChainId(networkClientId);
394
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
339
+ const chainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getChainId).call(this, networkClientId);
340
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
395
341
  networkClientId,
396
- chainId,
397
342
  });
398
343
  const transactionType = type ?? (await determineTransactionType(txParams, ethQuery)).type;
399
344
  const existingTransactionMeta = this.getTransactionWithActionId(actionId);
@@ -464,29 +409,13 @@ export class TransactionController extends BaseController {
464
409
  transactionMeta: addedTransactionMeta,
465
410
  };
466
411
  }
467
- startIncomingTransactionPolling(networkClientIds = []) {
468
- if (networkClientIds.length === 0) {
469
- this.incomingTransactionHelper.start();
470
- return;
471
- }
412
+ startIncomingTransactionPolling(networkClientIds) {
472
413
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").startIncomingTransactionPolling(networkClientIds);
473
414
  }
474
- stopIncomingTransactionPolling(networkClientIds = []) {
475
- if (networkClientIds.length === 0) {
476
- this.incomingTransactionHelper.stop();
477
- return;
478
- }
415
+ stopIncomingTransactionPolling(networkClientIds) {
479
416
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").stopIncomingTransactionPolling(networkClientIds);
480
417
  }
481
- stopAllIncomingTransactionPolling() {
482
- this.incomingTransactionHelper.stop();
483
- __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").stopAllIncomingTransactionPolling();
484
- }
485
418
  async updateIncomingTransactions(networkClientIds = []) {
486
- if (networkClientIds.length === 0) {
487
- await this.incomingTransactionHelper.update();
488
- return;
489
- }
490
419
  await __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").updateIncomingTransactions(networkClientIds);
491
420
  }
492
421
  /**
@@ -550,7 +479,7 @@ export class TransactionController extends BaseController {
550
479
  * @returns The gas and gas price.
551
480
  */
552
481
  async estimateGas(transaction, networkClientId) {
553
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
482
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
554
483
  networkClientId,
555
484
  });
556
485
  const { estimatedGas, simulationFails } = await estimateGas(transaction, ethQuery);
@@ -564,7 +493,7 @@ export class TransactionController extends BaseController {
564
493
  * @param networkClientId - The network client id to use for the estimate.
565
494
  */
566
495
  async estimateGasBuffered(transaction, multiplier, networkClientId) {
567
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
496
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, {
568
497
  networkClientId,
569
498
  });
570
499
  const { blockGasLimit, estimatedGas, simulationFails } = await estimateGas(transaction, ethQuery);
@@ -607,24 +536,21 @@ export class TransactionController extends BaseController {
607
536
  this.updateTransaction(updatedTransactionMeta, `${controllerName}:updatesecurityAlertResponse - securityAlertResponse updated`);
608
537
  }
609
538
  /**
610
- * Removes all transactions from state, optionally based on the current network.
539
+ * Remove transactions from state.
611
540
  *
612
- * @param ignoreNetwork - Determines whether to wipe all transactions, or just those on the
613
- * current network. If `true`, all transactions are wiped.
614
- * @param address - If specified, only transactions originating from this address will be
615
- * wiped on current network.
541
+ * @param options - The options bag.
542
+ * @param options.address - Remove transactions from this account only. Defaults to all accounts.
543
+ * @param options.chainId - Remove transactions for the specified chain only. Defaults to all chains.
616
544
  */
617
- wipeTransactions(ignoreNetwork, address) {
618
- /* istanbul ignore next */
619
- if (ignoreNetwork && !address) {
545
+ wipeTransactions({ address, chainId, } = {}) {
546
+ if (!chainId && !address) {
620
547
  this.update((state) => {
621
548
  state.transactions = [];
622
549
  });
623
550
  return;
624
551
  }
625
- const currentChainId = this.getChainId();
626
- const newTransactions = this.state.transactions.filter(({ chainId, txParams }) => {
627
- const isMatchingNetwork = ignoreNetwork || chainId === currentChainId;
552
+ const newTransactions = this.state.transactions.filter(({ chainId: txChainId, txParams }) => {
553
+ const isMatchingNetwork = !chainId || chainId === txChainId;
628
554
  if (!isMatchingNetwork) {
629
555
  return true;
630
556
  }
@@ -814,10 +740,8 @@ export class TransactionController extends BaseController {
814
740
  };
815
741
  editableParams.txParams = pickBy(editableParams.txParams);
816
742
  const updatedTransaction = merge({}, transactionMeta, editableParams);
817
- const provider = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
818
- chainId: transactionMeta.chainId,
819
- networkClientId: transactionMeta.networkClientId,
820
- });
743
+ const { networkClientId } = transactionMeta;
744
+ const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId });
821
745
  const ethQuery = new EthQuery(provider);
822
746
  const { type } = await determineTransactionType(updatedTransaction.txParams, ethQuery);
823
747
  updatedTransaction.type = type;
@@ -845,19 +769,9 @@ export class TransactionController extends BaseController {
845
769
  return '';
846
770
  }
847
771
  const initialTx = listOfTxParams[0];
848
- const common = this.getCommonConfiguration(initialTx.chainId);
849
- // We need to ensure we get the nonce using the the NonceTracker on the chain matching
850
- // the txParams. In this context we only have chainId available to us, but the
851
- // NonceTrackers are keyed by networkClientId. To workaround this, we attempt to find
852
- // a networkClientId that matches the chainId. As a fallback, the globally selected
853
- // network's NonceTracker will be used instead.
854
- let networkClientId;
855
- try {
856
- networkClientId = this.messagingSystem.call(`NetworkController:findNetworkClientIdByChainId`, initialTx.chainId);
857
- }
858
- catch (err) {
859
- log('failed to find networkClientId from chainId', err);
860
- }
772
+ const { chainId } = initialTx;
773
+ const common = this.getCommonConfiguration(chainId);
774
+ const networkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNetworkClientId).call(this, { chainId });
861
775
  const initialTxAsEthTx = TransactionFactory.fromTxData(initialTx, {
862
776
  common,
863
777
  });
@@ -939,14 +853,12 @@ export class TransactionController extends BaseController {
939
853
  * Search transaction metadata for matching entries.
940
854
  *
941
855
  * @param opts - Options bag.
942
- * @param opts.searchCriteria - An object containing values or functions for transaction properties to filter transactions with.
943
856
  * @param opts.initialList - The transactions to search. Defaults to the current state.
944
- * @param opts.filterToCurrentNetwork - Whether to filter the results to the current network. Defaults to true.
945
857
  * @param opts.limit - The maximum number of transactions to return. No limit by default.
858
+ * @param opts.searchCriteria - An object containing values or functions for transaction properties to filter transactions with.
946
859
  * @returns An array of transactions matching the provided options.
947
860
  */
948
- getTransactions({ searchCriteria = {}, initialList, filterToCurrentNetwork = true, limit, } = {}) {
949
- const chainId = this.getChainId();
861
+ getTransactions({ initialList, limit, searchCriteria = {}, } = {}) {
950
862
  // searchCriteria is an object that might have values that aren't predicate
951
863
  // methods. When providing any other value type (string, number, etc), we
952
864
  // consider this shorthand for "check the value at key for strict equality
@@ -964,9 +876,6 @@ export class TransactionController extends BaseController {
964
876
  // Combine sortBy and pickBy to transform our state object into an array of
965
877
  // matching transactions that are sorted by time.
966
878
  const filteredTransactions = sortBy(pickBy(transactionsToFilter, (transaction) => {
967
- if (filterToCurrentNetwork && transaction.chainId !== chainId) {
968
- return false;
969
- }
970
879
  // iterate over the predicateMethods keys to check if the transaction
971
880
  // matches the searchCriteria
972
881
  for (const [key, predicate] of Object.entries(predicateMethods)) {
@@ -1022,9 +931,9 @@ export class TransactionController extends BaseController {
1022
931
  return filteredTransactions;
1023
932
  }
1024
933
  async estimateGasFee({ transactionParams, chainId, networkClientId: requestNetworkClientId, }) {
1025
- const networkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNetworkClientId).call(this, {
1026
- networkClientId: requestNetworkClientId,
934
+ const { id: networkClientId, provider } = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({
1027
935
  chainId,
936
+ networkClientId: requestNetworkClientId,
1028
937
  });
1029
938
  const transactionMeta = {
1030
939
  txParams: transactionParams,
@@ -1033,10 +942,7 @@ export class TransactionController extends BaseController {
1033
942
  };
1034
943
  // Guaranteed as the default gas fee flow matches all transactions.
1035
944
  const gasFeeFlow = getGasFeeFlow(transactionMeta, this.gasFeeFlows);
1036
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1037
- networkClientId,
1038
- chainId,
1039
- });
945
+ const ethQuery = new EthQuery(provider);
1040
946
  const gasFeeControllerData = await this.getGasFeeEstimates({
1041
947
  networkClientId,
1042
948
  });
@@ -1055,9 +961,9 @@ export class TransactionController extends BaseController {
1055
961
  * @param request.networkClientId - The ID of a specific network client to process the transaction.
1056
962
  */
1057
963
  async getLayer1GasFee({ transactionParams, chainId, networkClientId, }) {
1058
- const provider = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
1059
- networkClientId,
964
+ const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, {
1060
965
  chainId,
966
+ networkClientId,
1061
967
  });
1062
968
  return await getTransactionLayer1GasFee({
1063
969
  layer1GasFeeFlows: this.layer1GasFeeFlows,
@@ -1128,15 +1034,10 @@ export class TransactionController extends BaseController {
1128
1034
  const isEIP1559Compatible = transactionMeta.txParams.type !== TransactionEnvelopeType.legacy &&
1129
1035
  (await this.getEIP1559Compatibility(transactionMeta.networkClientId));
1130
1036
  const { networkClientId, chainId } = transactionMeta;
1131
- const isCustomNetwork = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_isCustomNetwork).call(this, networkClientId);
1132
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1133
- networkClientId,
1134
- chainId,
1135
- });
1136
- const provider = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getProvider({
1137
- networkClientId,
1138
- chainId,
1139
- });
1037
+ const isCustomNetwork = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({ networkClientId })
1038
+ .configuration.type === NetworkClientType.Custom;
1039
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1040
+ const provider = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { networkClientId });
1140
1041
  await __classPrivateFieldGet(this, _TransactionController_trace, "f").call(this, { name: 'Update Gas', parentContext: traceContext }, async () => {
1141
1042
  await updateGas({
1142
1043
  ethQuery,
@@ -1294,10 +1195,8 @@ export class TransactionController extends BaseController {
1294
1195
  if (!rawTx) {
1295
1196
  return ApprovalState.NotApproved;
1296
1197
  }
1297
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1298
- networkClientId: transactionMeta.networkClientId,
1299
- chainId: transactionMeta.chainId,
1300
- });
1198
+ const { networkClientId } = transactionMeta;
1199
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1301
1200
  let preTxBalance;
1302
1201
  const shouldUpdatePreTxBalance = transactionMeta.type === TransactionType.swap;
1303
1202
  if (shouldUpdatePreTxBalance) {
@@ -1491,14 +1390,6 @@ export class TransactionController extends BaseController {
1491
1390
  const isCompleted = this.isLocalFinalState(transaction.status);
1492
1391
  return { meta: transaction, isCompleted };
1493
1392
  }
1494
- getChainId(networkClientId) {
1495
- const globalChainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalChainId).call(this);
1496
- const globalNetworkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
1497
- if (!networkClientId || networkClientId === globalNetworkClientId) {
1498
- return globalChainId;
1499
- }
1500
- return this.messagingSystem.call(`NetworkController:getNetworkClientById`, networkClientId).configuration.chainId;
1501
- }
1502
1393
  prepareUnsignedEthTx(chainId, txParams) {
1503
1394
  return TransactionFactory.fromTxData(txParams, {
1504
1395
  freeze: false,
@@ -1724,7 +1615,7 @@ export class TransactionController extends BaseController {
1724
1615
  transactionMeta,
1725
1616
  });
1726
1617
  }
1727
- getNonceTrackerTransactions(status, address, chainId = this.getChainId()) {
1618
+ getNonceTrackerTransactions(status, address, chainId) {
1728
1619
  return getAndFormatTransactionsForNonceTracker(chainId, address, status, this.state.transactions);
1729
1620
  }
1730
1621
  onConfirmedTransaction(transactionMeta) {
@@ -1740,13 +1631,11 @@ export class TransactionController extends BaseController {
1740
1631
  }
1741
1632
  async updatePostBalance(transactionMeta) {
1742
1633
  try {
1743
- if (transactionMeta.type !== TransactionType.swap) {
1634
+ const { networkClientId, type } = transactionMeta;
1635
+ if (type !== TransactionType.swap) {
1744
1636
  return;
1745
1637
  }
1746
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1747
- networkClientId: transactionMeta.networkClientId,
1748
- chainId: transactionMeta.chainId,
1749
- });
1638
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1750
1639
  const { updatedTransactionMeta, approvalTransactionMeta } = await updatePostTransactionBalance(transactionMeta, {
1751
1640
  ethQuery,
1752
1641
  getTransaction: this.getTransaction.bind(this),
@@ -1768,7 +1657,6 @@ export class TransactionController extends BaseController {
1768
1657
  }
1769
1658
  catch (error) {
1770
1659
  if (this.isTransactionAlreadyConfirmedError(error)) {
1771
- await this.pendingTransactionTracker.forceCheckTransaction(transactionMeta);
1772
1660
  throw new Error('Previous transaction is already confirmed');
1773
1661
  }
1774
1662
  throw error;
@@ -1823,10 +1711,8 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1823
1711
  newFee,
1824
1712
  txParams: newTxParams,
1825
1713
  });
1826
- const ethQuery = __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getEthQuery({
1827
- networkClientId: transactionMeta.networkClientId,
1828
- chainId: transactionMeta.chainId,
1829
- });
1714
+ const { networkClientId } = transactionMeta;
1715
+ const ethQuery = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getEthQuery).call(this, { networkClientId });
1830
1716
  const newTransactionMeta = {
1831
1717
  ...transactionMetaWithRsv,
1832
1718
  actionId,
@@ -1855,6 +1741,23 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1855
1741
  actionId,
1856
1742
  });
1857
1743
  afterSubmit?.(newTransactionMeta);
1744
+ }, _TransactionController_getChainId = function _TransactionController_getChainId(networkClientId) {
1745
+ return __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({ networkClientId })
1746
+ .configuration.chainId;
1747
+ }, _TransactionController_getNetworkClientId = function _TransactionController_getNetworkClientId({ chainId, networkClientId, }) {
1748
+ if (networkClientId) {
1749
+ return networkClientId;
1750
+ }
1751
+ return __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({
1752
+ chainId,
1753
+ }).id;
1754
+ }, _TransactionController_getEthQuery = function _TransactionController_getEthQuery({ chainId, networkClientId, }) {
1755
+ return new EthQuery(__classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getProvider).call(this, { chainId, networkClientId }));
1756
+ }, _TransactionController_getProvider = function _TransactionController_getProvider({ chainId, networkClientId, }) {
1757
+ return __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").getNetworkClient({
1758
+ chainId,
1759
+ networkClientId,
1760
+ }).provider;
1858
1761
  }, _TransactionController_createNonceTracker = function _TransactionController_createNonceTracker({ provider, blockTracker, chainId, }) {
1859
1762
  return new NonceTracker({
1860
1763
  // TODO: Fix types
@@ -1863,7 +1766,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1863
1766
  // TODO: Fix types
1864
1767
  blockTracker,
1865
1768
  getPendingTransactions: __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getNonceTrackerPendingTransactions).bind(this, chainId),
1866
- getConfirmedTransactions: this.getNonceTrackerTransactions.bind(this, TransactionStatus.confirmed),
1769
+ getConfirmedTransactions: this.getNonceTrackerTransactions.bind(this, TransactionStatus.confirmed, chainId),
1867
1770
  });
1868
1771
  }, _TransactionController_createIncomingTransactionHelper = function _TransactionController_createIncomingTransactionHelper({ blockTracker, etherscanRemoteTransactionSource, chainId, }) {
1869
1772
  const incomingTransactionHelper = new IncomingTransactionHelper({
@@ -1871,7 +1774,7 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1871
1774
  getCurrentAccount: () => __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getSelectedAccount).call(this),
1872
1775
  getLastFetchedBlockNumbers: () => this.state.lastFetchedBlockNumbers,
1873
1776
  getLocalTransactions: () => this.state.transactions,
1874
- getChainId: chainId ? () => chainId : this.getChainId.bind(this),
1777
+ getChainId: () => chainId,
1875
1778
  isEnabled: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").isEnabled,
1876
1779
  queryEntireHistory: __classPrivateFieldGet(this, _TransactionController_incomingTransactionOptions, "f").queryEntireHistory,
1877
1780
  remoteTransactionSource: etherscanRemoteTransactionSource,
@@ -1882,15 +1785,14 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1882
1785
  return incomingTransactionHelper;
1883
1786
  }, _TransactionController_createPendingTransactionTracker = function _TransactionController_createPendingTransactionTracker({ provider, blockTracker, chainId, }) {
1884
1787
  const ethQuery = new EthQuery(provider);
1885
- const getChainId = chainId ? () => chainId : this.getChainId.bind(this);
1886
1788
  const pendingTransactionTracker = new PendingTransactionTracker({
1887
1789
  blockTracker,
1888
- getChainId,
1790
+ getChainId: () => chainId,
1889
1791
  getEthQuery: () => ethQuery,
1890
1792
  getTransactions: () => this.state.transactions,
1891
1793
  isResubmitEnabled: __classPrivateFieldGet(this, _TransactionController_pendingTransactionOptions, "f").isResubmitEnabled,
1892
1794
  getGlobalLock: () => __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").acquireNonceLockForChainIdKey({
1893
- chainId: getChainId(),
1795
+ chainId,
1894
1796
  }),
1895
1797
  publishTransaction: (_ethQuery, transactionMeta) => this.publishTransaction(_ethQuery, transactionMeta, {
1896
1798
  skipSubmitHistory: true,
@@ -1903,10 +1805,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
1903
1805
  __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_addPendingTransactionTrackerListeners).call(this, pendingTransactionTracker);
1904
1806
  return pendingTransactionTracker;
1905
1807
  }, _TransactionController_stopAllTracking = function _TransactionController_stopAllTracking() {
1906
- this.pendingTransactionTracker.stop();
1907
- __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_removePendingTransactionTrackerListeners).call(this, this.pendingTransactionTracker);
1908
- this.incomingTransactionHelper.stop();
1909
- __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_removeIncomingTransactionHelperListeners).call(this, this.incomingTransactionHelper);
1910
1808
  __classPrivateFieldGet(this, _TransactionController_multichainTrackingHelper, "f").stopAllTracking();
1911
1809
  }, _TransactionController_removeIncomingTransactionHelperListeners = function _TransactionController_removeIncomingTransactionHelperListeners(incomingTransactionHelper) {
1912
1810
  incomingTransactionHelper.hub.removeAllListeners('transactions');
@@ -2021,26 +1919,6 @@ _TransactionController_internalEvents = new WeakMap(), _TransactionController_in
2021
1919
  txMeta.layer1GasFee = layer1GasFee;
2022
1920
  }
2023
1921
  });
2024
- }, _TransactionController_getNetworkClientId = function _TransactionController_getNetworkClientId({ networkClientId: requestNetworkClientId, chainId, }) {
2025
- const globalChainId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalChainId).call(this);
2026
- const globalNetworkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
2027
- if (requestNetworkClientId) {
2028
- return requestNetworkClientId;
2029
- }
2030
- if (!chainId || chainId === globalChainId) {
2031
- return globalNetworkClientId;
2032
- }
2033
- return this.messagingSystem.call(`NetworkController:findNetworkClientIdByChainId`, chainId);
2034
- }, _TransactionController_getGlobalNetworkClientId = function _TransactionController_getGlobalNetworkClientId() {
2035
- return this.getNetworkState().selectedNetworkClientId;
2036
- }, _TransactionController_getGlobalChainId = function _TransactionController_getGlobalChainId() {
2037
- return this.messagingSystem.call(`NetworkController:getNetworkClientById`, this.getNetworkState().selectedNetworkClientId).configuration.chainId;
2038
- }, _TransactionController_isCustomNetwork = function _TransactionController_isCustomNetwork(networkClientId) {
2039
- const globalNetworkClientId = __classPrivateFieldGet(this, _TransactionController_instances, "m", _TransactionController_getGlobalNetworkClientId).call(this);
2040
- if (!networkClientId || networkClientId === globalNetworkClientId) {
2041
- return !isInfuraNetworkType(this.getNetworkState().selectedNetworkClientId);
2042
- }
2043
- return (this.messagingSystem.call(`NetworkController:getNetworkClientById`, networkClientId).configuration.type === NetworkClientType.Custom);
2044
1922
  }, _TransactionController_getSelectedAccount = function _TransactionController_getSelectedAccount() {
2045
1923
  return this.messagingSystem.call('AccountsController:getSelectedAccount');
2046
1924
  }, _TransactionController_updateSubmitHistory = function _TransactionController_updateSubmitHistory(transactionMeta, hash) {