Client: accounts and chains
Multi-account patterns
Patterns for multiple HD accounts, labels, and conflict-safe growth.
Overview
BIP-39 wallets can hold many HD accounts. Plan labels, path customization, and duplicate checks so users do not collide addresses across wallets.
Create with multiple accounts
js
const wallet = await client.wallets.create({
label: "Main",
accounts: 3,
password: pin,
});
wallet.accounts(); // indices 0, 1, 2Add more accounts
js
wallet.addAccount({ label: "Trading" });
wallet.addAccounts(5);
// Native Monero
await moneroWallet.addAccounts(5); // async| Field | Required | Description |
|---|---|---|
| custom paths | No | Families customized at create remain on account 0. Accounts added afterwards use the default paths for those families. |
| duplicates | No | `addAccount` can throw `conflict` when a derived address already exists under strict/address policy. |
Labels
js
wallet.renameLabel("Personal");
wallet.account(0).renameLabel("Savings");
// Monero subaddresses:
await a.monero.renameSubaddressLabel(1, "Tips");Default labels when omitted: Account {index+1} / Subaddress {index}.
UI checklist
- List wallets via
client.wallets.list(), then open one - Show
wallet.accounts()and let users switchaccount(index) - Use
setActiveChainonly for network chips—never as the sign target - For Monero receive, allocate subaddresses with createSubaddress
- Before import, call findMnemonic / findPrivateKey
Throws
| Field | Required | Description |
|---|---|---|
| conflict | No | New account address overlaps another wallet under the duplicate policy. |
| unsupported_capability | No | addAccount on private_key / watch wallets. |
| invalid_argument | No | Negative index, empty label, or conflicting id. |