MCPcopy Create free account
hub / github.com/ICBNetwork/web3-Wallet / setSelectedAccount

Method setSelectedAccount

app/core/Engine.ts:1645–1654  ·  view source on GitHub ↗
(address: string)

Source from the content-addressed store, hash-verified

1643
1644 // This should be used instead of directly calling PreferencesController.setSelectedAddress or AccountsController.setSelectedAccount
1645 setSelectedAccount(address: string) {
1646 const { AccountsController, PreferencesController } = this.context;
1647 const account = AccountsController.getAccountByAddress(address);
1648 if (account) {
1649 AccountsController.setSelectedAccount(account.id);
1650 PreferencesController.setSelectedAddress(address);
1651 } else {
1652 throw new Error(`No account found for address: ${address}`);
1653 }
1654 }
1655
1656 /**
1657 * This should be used instead of directly calling PreferencesController.setAccountLabel or AccountsController.setAccountName in order to keep the names in sync

Callers 2

Engine.test.jsFile · 0.80
Engine.tsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected