> ## Documentation Index
> Fetch the complete documentation index at: https://docs.caminotreasury.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> Install @camino-treasury/sdk and read your first C0 balance from chain

## Install

`@camino-treasury/sdk` is published on npm and works with any package manager.

```bash theme={null}
bun add @camino-treasury/sdk @wagmi/core viem
```

```bash theme={null}
pnpm add @camino-treasury/sdk @wagmi/core viem
```

```bash theme={null}
npm install @camino-treasury/sdk @wagmi/core viem
```

[@wagmi/core](https://wagmi.sh) and [viem](https://viem.sh) are peer dependencies. The SDK supports `@wagmi/core >= 3` and `viem >= 2`.

## Read a C0 balance

<Steps>
  <Step title="Create a wagmi config">
    ```ts theme={null}
    import { createConfig, http } from "@wagmi/core";
    import { mainnet } from "@wagmi/core/chains";

    const config = createConfig({
      chains: [mainnet],
      transports: { [mainnet.id]: http() },
    });
    ```
  </Step>

  <Step title="Call readC0BalanceOf">
    ```ts theme={null}
    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
    ```
  </Step>

  <Step title="Format the value">
    ```ts theme={null}
    import { formatUnits } from "viem";

    console.log(formatUnits(balance, 6)); // "123.456789"
    ```
  </Step>
</Steps>

<Note>
  C0 has 6 decimals. The raw `bigint` returned by `readC0BalanceOf` is the on-chain value scaled by `10^6`.
</Note>

## 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](/smart-contracts/c0-token), [swap-facility](/smart-contracts/swap-facility), and [swap-adapter](/smart-contracts/swap-adapter) for the per-contract surface.
