Client: accounts and chains
Accounts inside a wallet
HD accounts expose addresses, paths, and signing per enabled chain.
Overview
A Wallet holds HD Account slots. Each account exposes addresses, paths, and signing for every chain in enabledChains. Native Monero wallets use the same account index model via MoneroWallet.account.
Wallet properties
| Field | Required | Description |
|---|---|---|
| id | Yes | `"wal_…"` |
| label | Yes | `string` — mutable UI name |
| kind | Yes | `"mnemonic" | "private_key" | "watch"` |
| paths | No | `FamilyPaths` — custom paths from create/import |
| enabledChains | Yes | `GrayChainId[]` — frozen allowlist for this wallet |
accounts()
Signature
js
wallet.accounts()Parameters
None.
Response
AccountSummary[]
ts
[{ id: string; index: number; label?: string }, …]account(indexOrId)
Signature
js
wallet.account(indexOrId)Parameters
| Field | Required | Description |
|---|---|---|
| indexOrId | Yes | `number | string | { index?: number; id?: string }` — HD index, account id, or object. |
Response
Account
ts
{
id: string; // "acc_…"
index: number;
label?: string;
chainIds(): GrayChainId[];
address(chainOrFamily, all?): string | Array<{ address; type }>;
path(chainOrFamily): string;
addresses(): ChainAddress[];
monero: AccountMonero; // when monero enabled
// sign*, export*, setActiveChain, …
}Usage
js
wallet.account(0)
wallet.account("acc_…")
wallet.account({ index: 0 })
wallet.account({ id: "acc_…" })
wallet.account(0).renameLabel("Trading");Throws
| Field | Required | Description |
|---|---|---|
| not_found | No | Index or id does not exist on this wallet. |
addAccount / addAccounts
js
wallet.addAccount(options?)
wallet.addAccounts(count, options?)| Field | Required | Description |
|---|---|---|
| options.index | No | `number` — HD index (auto next if omitted). |
| options.label | No | `string` — UI name / shared prefix. |
| count | Yes | `number` — for `addAccounts` only. |
Response: Account / Account[]. Mnemonic wallets only. Custom-path families from create stay on account 0. Native Monero addAccounts is async.
js
wallet.addAccount({ label: "Account 2" })
wallet.addAccounts(3) // BIP-39 sync
await w.addAccounts(5); // native Monero async