Client: accounts and chains
Set the active chain
UI selection helpers—signing and export always take an explicit chain.
Overview
setActiveChain / activeChain are UI-only. They do not change signing, export, or derivation—always pass chainOrFamily to those APIs explicitly.
setActiveChain
Signature
js
account.setActiveChain(selection)Parameters
| Field | Required | Description |
|---|---|---|
| selection | Yes | `"all" | GrayChainId` — show all networks, or one network. |
Response
this (Account, chainable). Persists when storage is set.
activeChain
Signature
js
account.activeChain()Parameters
None.
Response
| Field | Required | Description |
|---|---|---|
| last set "all" | No | `GrayChainId[]` — same as `chainIds()` |
| last set one chain | No | That `GrayChainId` string |
Usage
js
account.setActiveChain("all");
account.activeChain(); // → ["ethereum", "base", "bitcoin", …]
account.setActiveChain("bitcoin");
account.activeChain(); // → "bitcoin"
// Signing still requires an explicit chain:
const { signature, standard } = await account.signMessage("hello", "ethereum");Throws
| Field | Required | Description |
|---|---|---|
| invalid_argument | No | Unknown chain id not on this account’s `chainIds()`. |