@metamask-previews/accounts-controller 27.0.0-preview-bf2d2c4c → 27.0.0-preview-8ea9b81f

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.
@@ -3,7 +3,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
3
3
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
- var _AccountsController_instances, _AccountsController_generateInternalAccountForNonSnapAccount, _AccountsController_listSnapAccounts, _AccountsController_listNormalAccounts, _AccountsController_handleOnSnapKeyringAccountEvent, _AccountsController_handleOnKeyringStateChange, _AccountsController_handleOnSnapStateChange, _AccountsController_getAccountsByKeyringType, _AccountsController_getLastSelectedAccount, _AccountsController_getLastSelectedIndex, _AccountsController_handleNewAccountAdded, _AccountsController_publishAccountChangeEvent, _AccountsController_handleAccountRemoved, _AccountsController_handleOnMultichainNetworkDidChange, _AccountsController_populateExistingMetadata, _AccountsController_subscribeToMessageEvents, _AccountsController_registerMessageHandlers;
6
+ var _AccountsController_instances, _AccountsController_generateInternalAccountForNonSnapAccount, _AccountsController_getSnapKeyring, _AccountsController_listSnapAccounts, _AccountsController_listNormalAccounts, _AccountsController_handleOnSnapKeyringAccountEvent, _AccountsController_handleOnKeyringStateChange, _AccountsController_update, _AccountsController_handleOnSnapStateChange, _AccountsController_getAccountsByKeyringType, _AccountsController_getLastSelectedAccount, _AccountsController_getLastSelectedIndex, _AccountsController_getInternalAccountFromAddressAndType, _AccountsController_handleOnMultichainNetworkDidChange, _AccountsController_populateExistingMetadata, _AccountsController_subscribeToMessageEvents, _AccountsController_registerMessageHandlers;
7
7
  import { BaseController } from "@metamask/base-controller";
8
8
  import { SnapKeyring } from "@metamask/eth-snap-keyring";
9
9
  import { EthAccountType, EthMethod, EthScope, isEvmAccountType } from "@metamask/keyring-api";
@@ -123,14 +123,15 @@ export class AccountsController extends BaseController {
123
123
  * @returns The selected internal account.
124
124
  */
125
125
  getSelectedAccount() {
126
+ const { internalAccounts: { selectedAccount }, } = this.state;
126
127
  // Edge case where the extension is setup but the srp is not yet created
127
128
  // certain ui elements will query the selected address before any accounts are created.
128
- if (this.state.internalAccounts.selectedAccount === '') {
129
+ if (selectedAccount === '') {
129
130
  return EMPTY_ACCOUNT;
130
131
  }
131
- const selectedAccount = this.getAccountExpect(this.state.internalAccounts.selectedAccount);
132
- if (isEvmAccountType(selectedAccount.type)) {
133
- return selectedAccount;
132
+ const account = this.getAccountExpect(selectedAccount);
133
+ if (isEvmAccountType(account.type)) {
134
+ return account;
134
135
  }
135
136
  const accounts = this.listAccounts();
136
137
  if (!accounts.length) {
@@ -150,13 +151,14 @@ export class AccountsController extends BaseController {
150
151
  * @returns The last selected account compatible with the specified chain ID or undefined.
151
152
  */
152
153
  getSelectedMultichainAccount(chainId) {
154
+ const { internalAccounts: { selectedAccount }, } = this.state;
153
155
  // Edge case where the extension is setup but the srp is not yet created
154
156
  // certain ui elements will query the selected address before any accounts are created.
155
- if (this.state.internalAccounts.selectedAccount === '') {
157
+ if (selectedAccount === '') {
156
158
  return EMPTY_ACCOUNT;
157
159
  }
158
160
  if (!chainId) {
159
- return this.getAccountExpect(this.state.internalAccounts.selectedAccount);
161
+ return this.getAccountExpect(selectedAccount);
160
162
  }
161
163
  const accounts = this.listMultichainAccounts(chainId);
162
164
  return __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedAccount).call(this, accounts);
@@ -178,12 +180,11 @@ export class AccountsController extends BaseController {
178
180
  */
179
181
  setSelectedAccount(accountId) {
180
182
  const account = this.getAccountExpect(accountId);
181
- this.update((currentState) => {
182
- currentState.internalAccounts.accounts[account.id].metadata.lastSelected =
183
- Date.now();
184
- currentState.internalAccounts.selectedAccount = account.id;
183
+ __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_update).call(this, (state) => {
184
+ const { internalAccounts } = state;
185
+ internalAccounts.accounts[account.id].metadata.lastSelected = Date.now();
186
+ internalAccounts.selectedAccount = account.id;
185
187
  });
186
- __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_publishAccountChangeEvent).call(this, account);
187
188
  }
188
189
  /**
189
190
  * Sets the name of the account with the given ID.
@@ -213,19 +214,19 @@ export class AccountsController extends BaseController {
213
214
  internalAccount.id !== accountId)) {
214
215
  throw new Error('Account name already exists');
215
216
  }
216
- this.update((currentState) => {
217
- const internalAccount = {
218
- ...account,
219
- metadata: { ...account.metadata, ...metadata },
220
- };
221
- // Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed.
217
+ const internalAccount = {
218
+ ...account,
219
+ metadata: { ...account.metadata, ...metadata },
220
+ };
221
+ __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_update).call(this, (state) => {
222
+ // FIXME: Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed.
222
223
  // See: https://github.com/MetaMask/utils/issues/168
223
224
  // // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types
224
- currentState.internalAccounts.accounts[accountId] = internalAccount;
225
- if (metadata.name) {
226
- this.messagingSystem.publish('AccountsController:accountRenamed', internalAccount);
227
- }
225
+ state.internalAccounts.accounts[accountId] = internalAccount;
228
226
  });
227
+ if (metadata.name) {
228
+ this.messagingSystem.publish('AccountsController:accountRenamed', internalAccount);
229
+ }
229
230
  }
230
231
  /**
231
232
  * Updates the internal accounts list by retrieving normal and snap accounts,
@@ -264,21 +265,8 @@ export class AccountsController extends BaseController {
264
265
  };
265
266
  return internalAccountMap;
266
267
  }, {});
267
- this.update((currentState) => {
268
- currentState.internalAccounts.accounts = accounts;
269
- if (!currentState.internalAccounts.accounts[currentState.internalAccounts.selectedAccount]) {
270
- const lastSelectedAccount = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedAccount).call(this, Object.values(accounts));
271
- if (lastSelectedAccount) {
272
- currentState.internalAccounts.selectedAccount =
273
- lastSelectedAccount.id;
274
- currentState.internalAccounts.accounts[lastSelectedAccount.id].metadata.lastSelected = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedIndex).call(this);
275
- __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_publishAccountChangeEvent).call(this, lastSelectedAccount);
276
- }
277
- else {
278
- // It will be undefined if there are no accounts
279
- currentState.internalAccounts.selectedAccount = '';
280
- }
281
- }
268
+ __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_update).call(this, (state) => {
269
+ state.internalAccounts.accounts = accounts;
282
270
  });
283
271
  }
284
272
  /**
@@ -344,6 +332,11 @@ _AccountsController_instances = new WeakSet(), _AccountsController_generateInter
344
332
  },
345
333
  },
346
334
  };
335
+ }, _AccountsController_getSnapKeyring = function _AccountsController_getSnapKeyring() {
336
+ const [snapKeyring] = this.messagingSystem.call('KeyringController:getKeyringsByType', SnapKeyring.type);
337
+ // Snap keyring is not available until the first account is created in the keyring
338
+ // controller, so this might be undefined.
339
+ return snapKeyring;
347
340
  }, _AccountsController_listSnapAccounts =
348
341
  /**
349
342
  * Returns a list of internal accounts created using the SnapKeyring.
@@ -351,13 +344,11 @@ _AccountsController_instances = new WeakSet(), _AccountsController_generateInter
351
344
  * @returns A promise that resolves to an array of InternalAccount objects.
352
345
  */
353
346
  async function _AccountsController_listSnapAccounts() {
354
- const [snapKeyring] = this.messagingSystem.call('KeyringController:getKeyringsByType', SnapKeyring.type);
355
- // snap keyring is not available until the first account is created in the keyring controller
356
- if (!snapKeyring) {
347
+ const keyring = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getSnapKeyring).call(this);
348
+ if (!keyring) {
357
349
  return [];
358
350
  }
359
- const snapAccounts = snapKeyring.listAccounts();
360
- return snapAccounts;
351
+ return keyring.listAccounts();
361
352
  }, _AccountsController_listNormalAccounts =
362
353
  /**
363
354
  * Returns a list of normal accounts.
@@ -407,104 +398,153 @@ async function _AccountsController_listNormalAccounts() {
407
398
  return internalAccounts;
408
399
  }, _AccountsController_handleOnSnapKeyringAccountEvent = function _AccountsController_handleOnSnapKeyringAccountEvent(event, ...payload) {
409
400
  this.messagingSystem.publish(event, ...payload);
410
- }, _AccountsController_handleOnKeyringStateChange = function _AccountsController_handleOnKeyringStateChange(keyringState) {
411
- // check if there are any new accounts added
412
- // TODO: change when accountAdded event is added to the keyring controller
401
+ }, _AccountsController_handleOnKeyringStateChange = function _AccountsController_handleOnKeyringStateChange({ isUnlocked, keyrings, }) {
402
+ // TODO: Change when accountAdded event is added to the keyring controller.
413
403
  // We check for keyrings length to be greater than 0 because the extension client may try execute
414
404
  // submit password twice and clear the keyring state.
415
405
  // https://github.com/MetaMask/KeyringController/blob/2d73a4deed8d013913f6ef0c9f5c0bb7c614f7d3/src/KeyringController.ts#L910
416
- if (keyringState.isUnlocked && keyringState.keyrings.length > 0) {
417
- const updatedNormalKeyringAddresses = [];
418
- const updatedSnapKeyringAddresses = [];
419
- for (const keyring of keyringState.keyrings) {
420
- if (keyring.type === KeyringTypes.snap) {
421
- updatedSnapKeyringAddresses.push(...keyring.accounts.map((address) => {
422
- return {
423
- address,
424
- type: keyring.type,
425
- };
426
- }));
427
- }
428
- else {
429
- updatedNormalKeyringAddresses.push(...keyring.accounts.map((address) => {
430
- return {
431
- address,
432
- type: keyring.type,
433
- };
434
- }));
435
- }
406
+ if (!isUnlocked || keyrings.length === 0) {
407
+ return;
408
+ }
409
+ // State patches.
410
+ const generatePatch = () => {
411
+ return {
412
+ previous: {},
413
+ added: [],
414
+ updated: [],
415
+ removed: [],
416
+ };
417
+ };
418
+ const patches = {
419
+ snap: generatePatch(),
420
+ normal: generatePatch(),
421
+ };
422
+ // Gets the patch object based on the keyring type (since Snap accounts and other accounts
423
+ // are handled differently).
424
+ const patchOf = (type) => {
425
+ if (type === KeyringTypes.snap) {
426
+ return patches.snap;
436
427
  }
437
- const { previousNormalInternalAccounts, previousSnapInternalAccounts } = this.listMultichainAccounts().reduce((accumulator, account) => {
438
- if (account.metadata.keyring.type === KeyringTypes.snap) {
439
- accumulator.previousSnapInternalAccounts.push(account);
428
+ return patches.normal;
429
+ };
430
+ // Create a map (with lower-cased addresses) of all existing accounts.
431
+ for (const account of this.listMultichainAccounts()) {
432
+ const address = account.address.toLowerCase();
433
+ const patch = patchOf(account.metadata.keyring.type);
434
+ patch.previous[address] = account;
435
+ }
436
+ // Go over all keyring changes and create patches out of it.
437
+ const addresses = new Set();
438
+ for (const keyring of keyrings) {
439
+ const patch = patchOf(keyring.type);
440
+ for (const accountAddress of keyring.accounts) {
441
+ // Lower-case address to use it in the `previous` map.
442
+ const address = accountAddress.toLowerCase();
443
+ const account = patch.previous[address];
444
+ if (account) {
445
+ // If the account exists before, this might be an update.
446
+ patch.updated.push(account);
440
447
  }
441
448
  else {
442
- accumulator.previousNormalInternalAccounts.push(account);
443
- }
444
- return accumulator;
445
- }, {
446
- previousNormalInternalAccounts: [],
447
- previousSnapInternalAccounts: [],
448
- });
449
- const addedAccounts = [];
450
- const deletedAccounts = [];
451
- // snap account ids are random uuid while normal accounts
452
- // are determininistic based on the address
453
- // ^NOTE: This will be removed when normal accounts also implement internal accounts
454
- // finding all the normal accounts that were added
455
- for (const account of updatedNormalKeyringAddresses) {
456
- if (!this.state.internalAccounts.accounts[getUUIDFromAddressOfNormalAccount(account.address)]) {
457
- addedAccounts.push(account);
449
+ // Otherwise, that's a new account.
450
+ patch.added.push({
451
+ address,
452
+ type: keyring.type,
453
+ });
458
454
  }
455
+ // Keep track of those address to check for removed accounts later.
456
+ addresses.add(address);
459
457
  }
460
- // finding all the snap accounts that were added
461
- for (const account of updatedSnapKeyringAddresses) {
462
- if (!previousSnapInternalAccounts.find((internalAccount) => internalAccount.address.toLowerCase() ===
463
- account.address.toLowerCase())) {
464
- addedAccounts.push(account);
458
+ }
459
+ // We might have accounts associated with removed keyrings, so we iterate
460
+ // over all previous known accounts and check against the keyring addresses.
461
+ for (const patch of [patches.snap, patches.normal]) {
462
+ for (const [address, account] of Object.entries(patch.previous)) {
463
+ // If a previous address is not part of the new addesses, then it got removed.
464
+ if (!addresses.has(address)) {
465
+ patch.removed.push(account);
465
466
  }
466
467
  }
467
- // finding all the normal accounts that were deleted
468
- for (const account of previousNormalInternalAccounts) {
469
- if (!updatedNormalKeyringAddresses.find(({ address }) => address.toLowerCase() === account.address.toLowerCase())) {
470
- deletedAccounts.push(account);
468
+ }
469
+ // Diff that we will use to publish events afterward.
470
+ const diff = {
471
+ removed: [],
472
+ added: [],
473
+ };
474
+ __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_update).call(this, (state) => {
475
+ const { internalAccounts } = state;
476
+ for (const patch of [patches.snap, patches.normal]) {
477
+ for (const account of patch.removed) {
478
+ delete internalAccounts.accounts[account.id];
479
+ diff.removed.push(account.id);
471
480
  }
472
- }
473
- // finding all the snap accounts that were deleted
474
- for (const account of previousSnapInternalAccounts) {
475
- if (!updatedSnapKeyringAddresses.find(({ address }) => address.toLowerCase() === account.address.toLowerCase())) {
476
- deletedAccounts.push(account);
481
+ for (const added of patch.added) {
482
+ const account = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getInternalAccountFromAddressAndType).call(this, added.address, added.type);
483
+ if (account) {
484
+ // Re-compute the list of accounts everytime, so we can make sure new names
485
+ // are also considered.
486
+ const accounts = Object.values(internalAccounts.accounts);
487
+ // Get next account name available for this given keyring.
488
+ const name = this.getNextAvailableAccountName(account.metadata.keyring.type, accounts);
489
+ // If it's the first account, we need to select it.
490
+ const lastSelected = accounts.length === 0 ? __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedIndex).call(this) : 0;
491
+ internalAccounts.accounts[account.id] = {
492
+ ...account,
493
+ metadata: {
494
+ ...account.metadata,
495
+ name,
496
+ importTime: Date.now(),
497
+ lastSelected,
498
+ },
499
+ };
500
+ diff.added.push(internalAccounts.accounts[account.id]);
501
+ }
477
502
  }
478
503
  }
479
- this.update((currentState) => {
480
- if (deletedAccounts.length > 0) {
481
- for (const account of deletedAccounts) {
482
- currentState.internalAccounts.accounts = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_handleAccountRemoved).call(this, currentState.internalAccounts.accounts, account.id);
483
- }
504
+ });
505
+ // Now publish events
506
+ for (const id of diff.removed) {
507
+ this.messagingSystem.publish('AccountsController:accountRemoved', id);
508
+ }
509
+ for (const account of diff.added) {
510
+ this.messagingSystem.publish('AccountsController:accountAdded', account);
511
+ }
512
+ // NOTE: Since we also track "updated" accounts with our patches, we could fire a new event
513
+ // like `accountUpdated` (we would still need to check if anything really changed on the account).
514
+ }, _AccountsController_update = function _AccountsController_update(callback) {
515
+ // The currently selected account might get deleted during the update, so keep track
516
+ // of it before doing any change.
517
+ const previouslySelectedAccount = this.state.internalAccounts.selectedAccount;
518
+ this.update((state) => {
519
+ callback(state);
520
+ // If the account no longer exists (or none is selected), we need to re-select another one.
521
+ const { internalAccounts } = state;
522
+ if (!internalAccounts.accounts[previouslySelectedAccount]) {
523
+ const accounts = Object.values(internalAccounts.accounts);
524
+ // Get the lastly selected account (according to the current accounts).
525
+ const lastSelectedAccount = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedAccount).call(this, accounts);
526
+ if (lastSelectedAccount) {
527
+ internalAccounts.selectedAccount = lastSelectedAccount.id;
528
+ internalAccounts.accounts[lastSelectedAccount.id].metadata.lastSelected = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedIndex).call(this);
484
529
  }
485
- if (addedAccounts.length > 0) {
486
- for (const account of addedAccounts) {
487
- currentState.internalAccounts.accounts =
488
- __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_handleNewAccountAdded).call(this, currentState.internalAccounts.accounts, account);
489
- }
530
+ else {
531
+ // It will be undefined if there are no accounts.
532
+ internalAccounts.selectedAccount = '';
490
533
  }
491
- // We don't use list accounts because it is not the updated state yet.
492
- const existingAccounts = Object.values(currentState.internalAccounts.accounts);
493
- // handle if the selected account was deleted
494
- if (!currentState.internalAccounts.accounts[this.state.internalAccounts.selectedAccount]) {
495
- const lastSelectedAccount = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedAccount).call(this, existingAccounts);
496
- if (lastSelectedAccount) {
497
- currentState.internalAccounts.selectedAccount =
498
- lastSelectedAccount.id;
499
- currentState.internalAccounts.accounts[lastSelectedAccount.id].metadata.lastSelected = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedIndex).call(this);
500
- __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_publishAccountChangeEvent).call(this, lastSelectedAccount);
501
- }
502
- else {
503
- // It will be undefined if there are no accounts
504
- currentState.internalAccounts.selectedAccount = '';
505
- }
534
+ }
535
+ });
536
+ // Now, we compare the newly selected account, and we send event if different.
537
+ const { selectedAccount } = this.state.internalAccounts;
538
+ if (selectedAccount && selectedAccount !== previouslySelectedAccount) {
539
+ const account = this.getSelectedMultichainAccount();
540
+ // The account should always be defined at this point, since we have already checked for
541
+ // `selectedAccount` to be non-empty.
542
+ if (account) {
543
+ if (isEvmAccountType(account.type)) {
544
+ this.messagingSystem.publish('AccountsController:selectedEvmAccountChange', account);
506
545
  }
507
- });
546
+ this.messagingSystem.publish('AccountsController:selectedAccountChange', account);
547
+ }
508
548
  }
509
549
  }, _AccountsController_handleOnSnapStateChange = function _AccountsController_handleOnSnapStateChange(snapState) {
510
550
  // only check if snaps changed in status
@@ -545,43 +585,18 @@ async function _AccountsController_listNormalAccounts() {
545
585
  // NOTE: For now we use the current date, since we know this value
546
586
  // will always be higher than any already selected account index.
547
587
  return Date.now();
548
- }, _AccountsController_handleNewAccountAdded = function _AccountsController_handleNewAccountAdded(accountsState, account) {
549
- let newAccount;
550
- if (account.type !== KeyringTypes.snap) {
551
- newAccount = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_generateInternalAccountForNonSnapAccount).call(this, account.address, account.type);
552
- }
553
- else {
554
- const [snapKeyring] = this.messagingSystem.call('KeyringController:getKeyringsByType', SnapKeyring.type);
555
- newAccount = snapKeyring.getAccountByAddress(account.address);
556
- // The snap deleted the account before the keyring controller could add it
557
- if (!newAccount) {
558
- return accountsState;
588
+ }, _AccountsController_getInternalAccountFromAddressAndType = function _AccountsController_getInternalAccountFromAddressAndType(address, type) {
589
+ if (type === KeyringTypes.snap) {
590
+ const keyring = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getSnapKeyring).call(this);
591
+ // We need the Snap keyring to retrieve the account from its address.
592
+ if (!keyring) {
593
+ return undefined;
559
594
  }
595
+ // This might be undefined if the Snap deleted the account before
596
+ // reaching that point.
597
+ return keyring.getAccountByAddress(address);
560
598
  }
561
- const isFirstAccount = Object.keys(accountsState).length === 0;
562
- // Get next account name available for this given keyring
563
- const accountName = this.getNextAvailableAccountName(newAccount.metadata.keyring.type, Object.values(accountsState));
564
- const newAccountWithUpdatedMetadata = {
565
- ...newAccount,
566
- metadata: {
567
- ...newAccount.metadata,
568
- name: accountName,
569
- importTime: Date.now(),
570
- lastSelected: isFirstAccount ? __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedIndex).call(this) : 0,
571
- },
572
- };
573
- accountsState[newAccount.id] = newAccountWithUpdatedMetadata;
574
- this.messagingSystem.publish('AccountsController:accountAdded', newAccountWithUpdatedMetadata);
575
- return accountsState;
576
- }, _AccountsController_publishAccountChangeEvent = function _AccountsController_publishAccountChangeEvent(account) {
577
- if (isEvmAccountType(account.type)) {
578
- this.messagingSystem.publish('AccountsController:selectedEvmAccountChange', account);
579
- }
580
- this.messagingSystem.publish('AccountsController:selectedAccountChange', account);
581
- }, _AccountsController_handleAccountRemoved = function _AccountsController_handleAccountRemoved(accountsState, accountId) {
582
- delete accountsState[accountId];
583
- this.messagingSystem.publish('AccountsController:accountRemoved', accountId);
584
- return accountsState;
599
+ return __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_generateInternalAccountForNonSnapAccount).call(this, address, type);
585
600
  }, _AccountsController_handleOnMultichainNetworkDidChange = function _AccountsController_handleOnMultichainNetworkDidChange(id) {
586
601
  let accountId;
587
602
  // We only support non-EVM Caip chain IDs at the moment. Ex Solana and Bitcoin