Skip to content
Docs

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

FieldRequiredDescription
selectionYes`"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

FieldRequiredDescription
last set "all"No`GrayChainId[]` — same as `chainIds()`
last set one chainNoThat `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

FieldRequiredDescription
invalid_argumentNoUnknown chain id not on this account’s `chainIds()`.