Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.stable.xyz/llms.txt

Use this file to discover all available pages before exploring further.

@stablechain/sdk is the official TypeScript client for Stable. It wraps viem with a small, typed API for the operations you reach for most: transfer USDT0, bridge between chains, and swap tokens on Stable. Routing, approvals, decimals, and chain switching are handled for you.
import { createStable, Network } from "@stablechain/sdk";
import { privateKeyToAccount } from "viem/accounts";

const stable = createStable({
  network: Network.Mainnet,
  account: privateKeyToAccount("0x..."),
});

const { txHash } = await stable.transfer({
  from: "0xYourAddress",
  to: "0xRecipient",
  amount: 10,
});
txHash: 0x8f3a...2d41

What the SDK does

  • transfer — send native USDT0 or any ERC-20 on Stable. Gas is paid in USDT0 automatically.
  • quoteBridge / bridge — cross-chain transfers. LayerZero for USDT0 → USDT0, LI.FI for everything else. Route is picked for you.
  • quoteSwap / swap — same-chain token swaps via LI.FI, with ERC-20 approval handled internally.
The SDK is published on npm as @stablechain/sdk and requires viem >= 2.0.0 as a peer dependency.

When to use it (and when not to)

Use the SDK when you want a typed, opinionated client that hides routing and approval boilerplate. Drop down to raw viem or ethers when you need direct control over transaction construction, custom gas strategies, or contract calls outside transfer / bridge / swap.
The SDK signs with any viem-compatible signer: a private-key Account, a browser Transport like custom(window.ethereum), or a pre-built WalletClient (for example, the one returned by wagmi’s useWalletClient).

Start here

Quickstart

Install the SDK and run your first transfer, bridge, and swap on testnet.

SDK reference

Every method, config option, enum, and error class.

Use with viem

Server-side accounts, browser wallets, and bring-your-own WalletClient.

Use with wagmi

Wire the SDK into a React app with useWalletClient and hooks.

Install from npm

View the package on npmjs.com and check the latest version.

Connect to Stable

Chain IDs, RPC endpoints, and explorers for mainnet and testnet.

Fund a testnet wallet

Get testnet USDT0 from the faucet before running the quickstart.
Last modified on May 11, 2026