Getting started
Get a Curvy client running in a few lines of TypeScript.
Installation
pnpm add @0xcurvy/curvy-sdknpm install @0xcurvy/curvy-sdkyarn add @0xcurvy/curvy-sdkNode.js 22.16 or newer is required for server applications.
1. Create a config
Browser applications should start with createBrowserCurvyConfig. It enables IndexedDB persistence and session restoration by default.
import { createBrowserCurvyConfig } from "@0xcurvy/curvy-sdk/config";
const config = await createBrowserCurvyConfig({
environment: "mainnet",
});Use createServerCurvyConfig in a server process. It avoids ambient global state, so pass the config to every action.
2. Consume actions
Actions are imported from the single actions entrypoint.
import { getBalances, getNetworks } from "@0xcurvy/curvy-sdk/actions";
const networks = getNetworks({ config });
const balances = await getBalances({ config });Every action accepts typed parameters. Most actions accept config; browser applications with one ambient config may omit it.
3. Clean up
Destroy the config when its owner unmounts or the process stops.
await config.destroy();This stops timers, detaches listeners, clears memoized clients, and releases the proving runtime.
Vite applications
Add the SDK plugin so Vite handles the packaged WASM modules, proving worker, and development isolation headers correctly.
import { curvy } from "@0xcurvy/curvy-sdk/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [curvy()],
});