Skip to main content

Quick start

Unstable API v0 and SDK 0.x

SDK 0.8.2 targets /v0. Breaking changes remain possible before API /v1 and SDK 1.0.0. Pinning the SDK does not freeze server behavior. Review the version policy and changelog before upgrading.

Install​

Install @t3tris-labs/sdk from the npm registry. Pin the version and commit your lockfile for reproducible installations; no GitHub dependency or Git client is required.

# Bun
bun add @t3tris-labs/sdk@0.8.2

# npm
npm install @t3tris-labs/sdk@0.8.2

# pnpm
pnpm add @t3tris-labs/sdk@0.8.2

# Yarn
yarn add @t3tris-labs/sdk@0.8.2

Wallet examples use viem. Add it to your application if you do not already have it.

Read the API on your server​

Create an organization and customer API key in Curate. Put the key in a server-only environment variable named T3TRIS_API_KEY. Do not prefix it with NEXT_PUBLIC_, VITE_ or another browser-exposed prefix.

import { createT3trisClient } from "@t3tris-labs/sdk";

const client = createT3trisClient({
apiKey: process.env.T3TRIS_API_KEY,
});

const chains = await client.catalog.listChains();
const assets = await client.catalog.listAssets({ chainId: 42161, limit: 20 });
const vaults = await client.vaults.list({ limit: 20 });

The default API origin is https://api.t3tris.finance. You can override it with baseUrl, then T3TRIS_API_URL. Supply the origin without /v0, which the SDK appends to request paths.

createT3trisClient() also reads T3TRIS_API_KEY automatically. Passing the key explicitly is useful when one backend serves several customers.

Empty vault list?

Customer vault queries are scoped to the vaults attached to that key. Add a vault in Curate, or use keys.attachVault with a key carrying the manage scope. Reading the chain catalog does not require a vault attachment.

For a browser application, call your own backend route. Backend integration shows the boundary and pagination.

Read a contract with your existing wallet​

Your application must obtain the provider and account through its own connection UI. This function accepts an existing EIP-1193 connection. It neither opens a wallet modal nor submits a transaction.

import { createT3trisClient } from "@t3tris-labs/sdk";
import type { Address, EIP1193Provider } from "viem";

export async function readVaultAsset(
provider: EIP1193Provider,
account: Address,
vault: Address,
chainId: number,
) {
const client = createT3trisClient({ provider, account });
return client.vaults.read.asset({ chainId, address: vault });
}

The provider must already be on chainId. No API key is needed. If you already use viem or wagmi, pass { walletClient, publicClient } instead, as shown in wallet integration.

Continue​

Use authentication for protected API writes. For transactions, read the wallet result lifecycle before building a deposit or redemption flow.