Skip to main content
Full surface of @stablechain/sdk. For a walkthrough, see SDK quickstart.

Install

viem >= 2.0.0 is a peer dependency.

createStable(config)

Construct a StableClient. Returns an object with the methods listed under StableClient.

StableConfig

Provide one of account, transport, or walletClient.

StableClient

transfer(params)

Send native USDT0 or any ERC-20 on Stable. Switches the wallet to the Stable chain, fetches token decimals on-chain when missing, and waits for the receipt.
Returns OperationResult ({ txHash, toAmount? }).

quoteBridge(params)

Preview a bridge. Read-only — no signature, no gas.
Returns BridgeQuote.

bridge(params)

Bridge tokens cross-chain. The SDK picks the route: LayerZero for USDT0 → USDT0, LI.FI for everything else. Pass a pre-fetched quote to skip the internal quote call.

quoteSwap(params)

Fetch a LI.FI swap quote on Stable. Returns a pre-built transaction request and the approval address.

swap(params)

Swap tokens on Stable via LI.FI. Handles ERC-20 approval automatically and switches the wallet’s chain when needed.

Enums

Network

Chain

Used by quoteBridge and bridge. Each entry has a corresponding CHAIN_CONFIGS entry.

CHAIN_CONFIGS

Partial<Record<Chain, ChainConfig>> keyed by Chain enum. Each entry exposes id, rpc, usdt, and decimals. Use it when you need the canonical USDT address on a supported chain without hard-coding it.

Errors

All SDK errors extend StableError, which extends viem’s BaseError. Errors carry structured metadata so you can branch on error.name or instanceof.

SDK quickstart

Install the SDK and run your first transfer on testnet.

Use with viem

Switch between private-key, browser-wallet, and pre-built signers.

Use with wagmi

Wire the SDK into a React app with hooks.
Last modified on May 11, 2026