Client: Monero
Daemon access through the Cloud API
On Node.js, use gray.monero.syncConnection(); never send it to a browser or mobile app.
Overview
On a Node.js server, get a daemon connection from @gray3/cloud and pass it to account.monero.sync. The connection carries your project secret key, so it must never be sent to a browser or mobile app.
Signature
js
gray.monero.syncConnection()Parameters
None on the helper (credentials come from the configuration of your Gray Cloud SDK client, which holds the project ID and secret key on the server).
Response
MoneroDaemonConnection — pass as sync({ connection }).
ts
type MoneroSyncConnection = {
uri: string; // Gray3 Cloud daemon proxy URL
headers: Record<string, string>; // project credentials — server only
};Usage
js
import { Gray } from "@gray3/cloud";
import { GrayClient } from "@gray3/client";
const gray = new Gray({ projectId, secretKey }); // backend only
const client = await GrayClient.create({ /* monero in chains or omit */ });
const conn = gray.monero.syncConnection();
await account.monero.sync({
connection: conn,
restoreHeight: 3_200_000,
});Self-hosted escape hatch
Advanced: pass the uri of a self-hosted monerod with no headers. Do not put daemon API keys in a mobile or web app.
js
await account.monero.sync({
connection: { uri: "http://127.0.0.1:18081" },
restoreHeight: 3_200_000,
});Related Cloud docs
HTTP routes for Monero daemon proxy: Cloud API — Sync with Wallet SDKs.
Throws
| Field | Required | Description |
|---|---|---|
| unauthorized | No | Cloud credentials missing/invalid when creating syncConnection. |
| provider_unavailable | No | Daemon proxy unreachable during sync. |