Skip to content
Docs

Client: Monero

Monero wallet types

Cake Wallet-compatible BIP-39 paths, plus native Polyseed and legacy MoneroWallet support.

Overview

Gray3 supports Monero two ways: BIP-39 HD accounts on a normal Wallet (Cake Wallet-compatible path m/44'/128'/{account}'/0/0), and native MoneroWallet from Polyseed (16) or Legacy (25) via client.wallets.monero. Both require "monero" on the client allowlist (or omit chains, which enables every mainnet).

Platform support

Keys, addresses, and subaddresses work on every platform. Wallet sync and transfers depend on the platform:

  • Node.js: supported with no setup.
  • Browsers and extensions: bundle monero-ts yourself and call configureMonero({ moneroTs, workerUrl }). The wallet cannot send custom headers, so give it a short-lived URI from gray.monero.browserConnection() on your backend (see Browser wallets).
  • React Native: not available, because monero-ts needs WebAssembly and Web Workers.

gray.monero.syncConnection() contains your project secret key. Use it only in Node.js processes you control. See Platforms.

BIP-39 on a Gray3 wallet

js
const wallet = await client.wallets.create({ password: pin });
const a = wallet.account(0);

a.address("monero");              // primary 4…
a.monero.subaddress(0);           // same as primary
await a.monero.createSubaddress(); // allocate receive 8…
a.exportPrivateKey("monero");     // spend key
a.monero.exportViewKey();         // view key

paths.monero applies only to BIP-39 HD (not Polyseed / Legacy). Watch-only by address throws unsupported_capability — see Watch-only wallet.

Native create / restore

Signature

js
await client.wallets.monero.create(options?)
await client.wallets.monero.restore(options)

Parameters

FieldRequiredDescription
labelNo`string` — UI name
seedTypeNo`"polyseed"` (default on create) | `"legacy"` — restore auto-detects by word count unless set
mnemonicYes`string` — required for `restore` (16 or 25 words)
passwordNo`string` — keystore PIN when storage is encrypted

Response

Promise<MoneroWallet> — also returned from client.wallets.open for native wallets (OpenedWallet).

ts
MoneroWallet {
  id, label, kind,
  account(index): MoneroAccount,
  monero: MoneroWalletMonero, // birthdayUnix, …
  addAccount / addAccounts / close / …
}
js
const poly = await client.wallets.monero.create({ label: "XMR", password: pin });
const again = await client.wallets.monero.restore({ mnemonic, password: pin });
const opened = await client.wallets.open(poly.id, { password: pin }); // MoneroWallet

API map

FieldRequiredDescription
a.monero.syncNoRequires restoreHeight or restoreDate; resumes past checkpoint
a.monero.balance / activityNoLive while synced; cached after reopen
a.monero.prepareTransfer / signTransferNoSend — live sync required in session
a.monero.createSubaddress*NoAllocate / list receive 8… (persisted)
a.monero.close / w.closeNoDrop WASM after sync/send (not needed for create/open/address)

Throws

FieldRequiredDescription
unsupported_capabilityNo`monero` not on client allowlist; watch-only Monero.
conflictNoDuplicate native seed / address under duplicate policy.
invalid_argumentNoBad mnemonic / seedType mismatch.
unauthorizedNoEncrypted storage — bad PIN.