@metamask-previews/accounts-controller 27.0.0-preview-aa7690c1 → 27.0.0-preview-b881bfc9

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_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;
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;
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,15 +123,14 @@ export class AccountsController extends BaseController {
123
123
  * @returns The selected internal account.
124
124
  */
125
125
  getSelectedAccount() {
126
- const { internalAccounts: { selectedAccount }, } = this.state;
127
126
  // Edge case where the extension is setup but the srp is not yet created
128
127
  // certain ui elements will query the selected address before any accounts are created.
129
- if (selectedAccount === '') {
128
+ if (this.state.internalAccounts.selectedAccount === '') {
130
129
  return EMPTY_ACCOUNT;
131
130
  }
132
- const account = this.getAccountExpect(selectedAccount);
133
- if (isEvmAccountType(account.type)) {
134
- return account;
131
+ const selectedAccount = this.getAccountExpect(this.state.internalAccounts.selectedAccount);
132
+ if (isEvmAccountType(selectedAccount.type)) {
133
+ return selectedAccount;
135
134
  }
136
135
  const accounts = this.listAccounts();
137
136
  if (!accounts.length) {
@@ -151,14 +150,13 @@ export class AccountsController extends BaseController {
151
150
  * @returns The last selected account compatible with the specified chain ID or undefined.
152
151
  */
153
152
  getSelectedMultichainAccount(chainId) {
154
- const { internalAccounts: { selectedAccount }, } = this.state;
155
153
  // Edge case where the extension is setup but the srp is not yet created
156
154
  // certain ui elements will query the selected address before any accounts are created.
157
- if (selectedAccount === '') {
155
+ if (this.state.internalAccounts.selectedAccount === '') {
158
156
  return EMPTY_ACCOUNT;
159
157
  }
160
158
  if (!chainId) {
161
- return this.getAccountExpect(selectedAccount);
159
+ return this.getAccountExpect(this.state.internalAccounts.selectedAccount);
162
160
  }
163
161
  const accounts = this.listMultichainAccounts(chainId);
164
162
  return __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getLastSelectedAccount).call(this, accounts);
@@ -180,11 +178,12 @@ export class AccountsController extends BaseController {
180
178
  */
181
179
  setSelectedAccount(accountId) {
182
180
  const account = this.getAccountExpect(accountId);
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;
181
+ this.update((currentState) => {
182
+ currentState.internalAccounts.accounts[account.id].metadata.lastSelected =
183
+ Date.now();
184
+ currentState.internalAccounts.selectedAccount = account.id;
187
185
  });
186
+ __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_publishAccountChangeEvent).call(this, account);
188
187
  }
189
188
  /**
190
189
  * Sets the name of the account with the given ID.
@@ -214,19 +213,19 @@ export class AccountsController extends BaseController {
214
213
  internalAccount.id !== accountId)) {
215
214
  throw new Error('Account name already exists');
216
215
  }
217
- const internalAccount = {
218
- ...account,
219
- metadata: { ...account.metadata, ...metadata },
220
- };
221
- this.update((state) => {
222
- // FIXME: Do not remove this comment - This error is flaky: Comment out or restore the `ts-expect-error` directive below as needed.
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.
223
222
  // See: https://github.com/MetaMask/utils/issues/168
224
223
  // // @ts-expect-error Known issue - `Json` causes recursive error in immer `Draft`/`WritableDraft` types
225
- state.internalAccounts.accounts[accountId] = internalAccount;
224
+ currentState.internalAccounts.accounts[accountId] = internalAccount;
225
+ if (metadata.name) {
226
+ this.messagingSystem.publish('AccountsController:accountRenamed', internalAccount);
227
+ }
226
228
  });
227
- if (metadata.name) {
228
- this.messagingSystem.publish('AccountsController:accountRenamed', internalAccount);
229
- }
230
229
  }
231
230
  /**
232
231
  * Updates the internal accounts list by retrieving normal and snap accounts,
@@ -265,8 +264,21 @@ export class AccountsController extends BaseController {
265
264
  };
266
265
  return internalAccountMap;
267
266
  }, {});
268
- __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_update).call(this, (state) => {
269
- state.internalAccounts.accounts = accounts;
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
+ }
270
282
  });
271
283
  }
272
284
  /**
@@ -332,11 +344,6 @@ _AccountsController_instances = new WeakSet(), _AccountsController_generateInter
332
344
  },
333
345
  },
334
346
  };
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;
340
347
  }, _AccountsController_listSnapAccounts =
341
348
  /**
342
349
  * Returns a list of internal accounts created using the SnapKeyring.
@@ -344,11 +351,13 @@ _AccountsController_instances = new WeakSet(), _AccountsController_generateInter
344
351
  * @returns A promise that resolves to an array of InternalAccount objects.
345
352
  */
346
353
  async function _AccountsController_listSnapAccounts() {
347
- const keyring = __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_getSnapKeyring).call(this);
348
- if (!keyring) {
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) {
349
357
  return [];
350
358
  }
351
- return keyring.listAccounts();
359
+ const snapAccounts = snapKeyring.listAccounts();
360
+ return snapAccounts;
352
361
  }, _AccountsController_listNormalAccounts =
353
362
  /**
354
363
  * Returns a list of normal accounts.
@@ -398,153 +407,104 @@ async function _AccountsController_listNormalAccounts() {
398
407
  return internalAccounts;
399
408
  }, _AccountsController_handleOnSnapKeyringAccountEvent = function _AccountsController_handleOnSnapKeyringAccountEvent(event, ...payload) {
400
409
  this.messagingSystem.publish(event, ...payload);
401
- }, _AccountsController_handleOnKeyringStateChange = function _AccountsController_handleOnKeyringStateChange({ isUnlocked, keyrings, }) {
402
- // TODO: Change when accountAdded event is added to the keyring controller.
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
403
413
  // We check for keyrings length to be greater than 0 because the extension client may try execute
404
414
  // submit password twice and clear the keyring state.
405
415
  // https://github.com/MetaMask/KeyringController/blob/2d73a4deed8d013913f6ef0c9f5c0bb7c614f7d3/src/KeyringController.ts#L910
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;
427
- }
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);
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
+ }));
447
427
  }
448
428
  else {
449
- // Otherwise, that's a new account.
450
- patch.added.push({
451
- address,
452
- type: keyring.type,
453
- });
429
+ updatedNormalKeyringAddresses.push(...keyring.accounts.map((address) => {
430
+ return {
431
+ address,
432
+ type: keyring.type,
433
+ };
434
+ }));
454
435
  }
455
- // Keep track of those address to check for removed accounts later.
456
- addresses.add(address);
457
436
  }
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);
437
+ const { previousNormalInternalAccounts, previousSnapInternalAccounts } = this.listMultichainAccounts().reduce((accumulator, account) => {
438
+ if (account.metadata.keyring.type === KeyringTypes.snap) {
439
+ accumulator.previousSnapInternalAccounts.push(account);
466
440
  }
467
- }
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);
441
+ else {
442
+ accumulator.previousNormalInternalAccounts.push(account);
480
443
  }
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
- }
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);
502
458
  }
503
459
  }
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);
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);
529
465
  }
530
- else {
531
- // It will be undefined if there are no accounts.
532
- internalAccounts.selectedAccount = '';
466
+ }
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);
533
471
  }
534
472
  }
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);
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);
545
477
  }
546
- this.messagingSystem.publish('AccountsController:selectedAccountChange', account);
547
478
  }
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
+ }
484
+ }
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
+ }
490
+ }
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
+ }
506
+ }
507
+ });
548
508
  }
549
509
  }, _AccountsController_handleOnSnapStateChange = function _AccountsController_handleOnSnapStateChange(snapState) {
550
510
  // only check if snaps changed in status
@@ -585,18 +545,43 @@ async function _AccountsController_listNormalAccounts() {
585
545
  // NOTE: For now we use the current date, since we know this value
586
546
  // will always be higher than any already selected account index.
587
547
  return Date.now();
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;
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;
594
559
  }
595
- // This might be undefined if the Snap deleted the account before
596
- // reaching that point.
597
- return keyring.getAccountByAddress(address);
598
560
  }
599
- return __classPrivateFieldGet(this, _AccountsController_instances, "m", _AccountsController_generateInternalAccountForNonSnapAccount).call(this, address, type);
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;
600
585
  }, _AccountsController_handleOnMultichainNetworkDidChange = function _AccountsController_handleOnMultichainNetworkDidChange(id) {
601
586
  let accountId;
602
587
  // We only support non-EVM Caip chain IDs at the moment. Ex Solana and Bitcoin