Skip to content
Docs

Client: wallets

List, open, rename, and remove

List metas, open Wallet or MoneroWallet, rename, remove, or wipe all wallets.

Overview

Lifecycle APIs on client.wallets and instance methods on Wallet / MoneroWallet. open returns OpenedWallet = Wallet | MoneroWallet.

list

Signature

js
await client.wallets.list()

Parameters

None.

Response

Promise<GrayWalletMeta[]>

ts
[
  {
    id: string;                 // "wal_…"
    label: string;
    kind: "mnemonic" | "private_key" | "watch";
    paths?: FamilyPaths;
    createdAt?: string;         // ISO
    updatedAt?: string;
  },
]
js
const list = await client.wallets.list();
// → [{ id: "wal_…", label: "Main", kind: "mnemonic" }, …]

open

Signature

js
await client.wallets.open(walletId, options?)

Parameters

FieldRequiredDescription
walletIdYes`string` — from `list()[].id`.
options.passwordNo`string` — keystore PIN when storage is encrypted.

Response

Promise<OpenedWallet> where OpenedWallet = Wallet | MoneroWallet

ts
// BIP-39 / PK / watch → Wallet
// Native Polyseed / Legacy Monero → MoneroWallet
const opened = await client.wallets.open(id, { password: pin });
if ("monero" in opened && opened.kind /* … */) {
  // branch on kind / instanceof as needed for native Monero
}
js
const wallet = await client.wallets.open(list[0].id, { password: pin });
const a = wallet.account(0);

Throws

FieldRequiredDescription
not_foundNoUnknown wallet id.
unauthorizedNoEncrypted storage — bad or missing PIN.

renameLabel

js
wallet.renameLabel(label)
FieldRequiredDescription
labelYes`string` — non-empty UI name.

Response: this (chainable). Persists when storage is set.

remove

js
await client.wallets.remove(walletId, options?)
FieldRequiredDescription
walletIdYes`string` — wallet to delete.
options.passwordNo`string` — keystore PIN when encrypted.

Response: Promise<void>

js
await client.wallets.remove(wallet.id, { password: pin });

reset

js
await client.wallets.reset({ password })
FieldRequiredDescription
passwordNo`string` — required for encrypted keystore (works even if locked). Omit when no storage or `encryption: false`.

Response: Promise<void>. Wipes all wallets in memory + local DB.

js
await client.wallets.reset({ password: pin }); // wrong PIN → unauthorized
await client.wallets.reset(); // ok when no storage or encryption: false

exportMnemonic / persist

js
const phrase = wallet.exportMnemonic(); // mnemonic wallets only
await wallet.persist();                 // no-op without storage
FieldRequiredDescription
exportMnemonicNoThrows if kind is not mnemonic (e.g. private_key / watch).