Skip to content
Docs

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

FieldRequiredDescription
idYes`"wal_…"`
labelYes`string` — mutable UI name
kindYes`"mnemonic" | "private_key" | "watch"`
pathsNo`FamilyPaths` — custom paths from create/import
enabledChainsYes`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

FieldRequiredDescription
indexOrIdYes`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

FieldRequiredDescription
not_foundNoIndex or id does not exist on this wallet.

addAccount / addAccounts

js
wallet.addAccount(options?)
wallet.addAccounts(count, options?)
FieldRequiredDescription
options.indexNo`number` — HD index (auto next if omitted).
options.labelNo`string` — UI name / shared prefix.
countYes`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