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 fromgray.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
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 keypaths.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
await client.wallets.monero.create(options?)
await client.wallets.monero.restore(options)Parameters
| Field | Required | Description |
|---|---|---|
| label | No | `string` — UI name |
| seedType | No | `"polyseed"` (default on create) | `"legacy"` — restore auto-detects by word count unless set |
| mnemonic | Yes | `string` — required for `restore` (16 or 25 words) |
| password | No | `string` — keystore PIN when storage is encrypted |
Response
Promise<MoneroWallet> — also returned from client.wallets.open for native wallets (OpenedWallet).
MoneroWallet {
id, label, kind,
account(index): MoneroAccount,
monero: MoneroWalletMonero, // birthdayUnix, …
addAccount / addAccounts / close / …
}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 }); // MoneroWalletAPI map
| Field | Required | Description |
|---|---|---|
| a.monero.sync | No | Requires restoreHeight or restoreDate; resumes past checkpoint |
| a.monero.balance / activity | No | Live while synced; cached after reopen |
| a.monero.prepareTransfer / signTransfer | No | Send — live sync required in session |
| a.monero.createSubaddress* | No | Allocate / list receive 8… (persisted) |
| a.monero.close / w.close | No | Drop WASM after sync/send (not needed for create/open/address) |
Throws
| Field | Required | Description |
|---|---|---|
| unsupported_capability | No | `monero` not on client allowlist; watch-only Monero. |
| conflict | No | Duplicate native seed / address under duplicate policy. |
| invalid_argument | No | Bad mnemonic / seedType mismatch. |
| unauthorized | No | Encrypted storage — bad PIN. |