Install
@camino-treasury/sdk is published on npm and works with any package manager.
bun add @camino-treasury/sdk @wagmi/core viem
pnpm add @camino-treasury/sdk @wagmi/core viem
npm install @camino-treasury/sdk @wagmi/core viem
@wagmi/core and viem are peer dependencies. The SDK supports @wagmi/core >= 3 and viem >= 2.
Read a C0 balance
Create a wagmi config
import { createConfig, http } from "@wagmi/core";
import { mainnet } from "@wagmi/core/chains";
const config = createConfig({
chains: [mainnet],
transports: { [mainnet.id]: http() },
});
Call readC0BalanceOf
import { readC0BalanceOf, addresses } from "@camino-treasury/sdk";
const balance = await readC0BalanceOf(config, {
address: addresses[mainnet.id].c0,
args: ["0xYourAddressHere"],
});
console.log(balance); // bigint, scaled to 6 decimals
Format the value
import { formatUnits } from "viem";
console.log(formatUnits(balance, 6)); // "123.456789"
C0 has 6 decimals. The raw bigint returned by readC0BalanceOf is the on-chain value scaled by 10^6.
What’s exported
@camino-treasury/sdk exposes the same surface from four entry points:
| Import path | What you get |
|---|
@camino-treasury/sdk | Everything — flat re-export of data, actions, and claim (default for most users). |
@camino-treasury/sdk/data | Per-chain addresses, the C0Addresses type, and raw ABIs. |
@camino-treasury/sdk/actions | Typed read* / write* / simulate* / watch*Event helpers. |
@camino-treasury/sdk/claim | getPeriods, claim, and the Period type for the yield-claim flow. |
Use the subpaths when you want narrower imports or to make data-vs-action usage explicit. The flat root works for everything.
See c0-token, swap-facility, and swap-adapter for the per-contract surface.