If you’re building on Stable, whether that’s a neobank, a payroll provider, a wallet, or an incentivized yield product, this SDK is your backend. It lets you move USDT0 between user balances, bridge it in from other chains, and swap between tokens.
@stablechain/sdk adds Earn alongside the existing transfer, bridge, and swap. Approvals, permits, share math, liquidity routing, and decimals are all handled internally, so a position takes the same shape as any other call you're already making.
This is the first Stable Build, our series for developers shipping products on Stable. If we ship something for you, you'll read it here first.
Each method maps to a real operation a stablecoin product needs: putting balances to work, taking them back out, claiming what's earned, and reading the position to show your users where they stand.
The SDK is changing quickly while we ship v1. The snippets below are accurate at the time of writing, but the SDK reference is always the source of truth.
Move USDT0 from a user’s balance into a Morpho vault that supplies StableEarn.
const { txHash } = await stable.earn.deposit({ amount: 100 });ERC-20 approval and permit signatures happen behind the scenes. Pass depositBuffer to cap the deposit at a fraction of the vault's idle liquidity, or idempotencyKey to deduplicate retries. See the SDK reference for the full parameter list.
Exit by asset amount with withdraw, or by share count with redeem.
// By asset amount
await stable.earn.withdraw({ amount: 100 });
// By share count, for closing a full position
await stable.earn.redeem({ shares: 50 });When idle vault liquidity is short, forceWithdraw and forceRedeem deallocate from the underlying market adapters in the same call. See the SDK reference for the full Earn surface.
Fetch pending Merkl rewards and claim every reward token in one transaction, with proofs handled for you
const { rewards } = await stable.earn.incentiveRewards.fetch();
const { txHash, tokenCount } = await stable.earn.incentiveRewards.claim();See the SDK reference for the response shape.
createStableReader returns a read-only client for positions, APY, projections, and instant-withdrawability checks. Useful anywhere a dashboard or quote screen wants the data layer without a connected wallet.
import { createStableReader, Network, STABLE_VAULT_ADDRESS } from "@stablechain/sdk";
const reader = createStableReader({
network: Network.Mainnet,
earn: { vault: STABLE_VAULT_ADDRESS },
address: "0xYourAddress",
});
const { assets } = await reader.earn.position();
const { apy, native, rewards } = await reader.earn.getYield();
const { projectedYield } = await reader.earn.preview({ amount: 1000, horizonDays: 365 });
const { isInstant, availableLiquidity } = await reader.earn.withdrawability({ amount: 500 });See the SDK reference for the response shape.
Alongside StableEarn, SDK v0 includes the core asset movement primitives developers need. Whether you're moving assets, earning yield, or managing positions, it all happens through the same typed client.
transfer, bridge, and swap are unchanged and ship in the same stable object, with quoteBridge and quoteSwap for read-only previews. A neobank backend can move balances, move funds in from another chain, swap into USDT0, and put the rest to work, all without leaving the SDK.
npm install @stablechain/sdk viem and you're set. The SDK quickstart walks through creating a client, sending your first deposit, and reading a position on testnet. Grab testnet USDT0 from the faucet before running through it.
We're shipping richer financial primitives on top of USDT, more data through the reader, and broader liquidity into the same client
The SDK overview is the canonical reference for all methods, errors, and signing modes.
If you're building on Stable or have questions about the SDK, find us in Discord.
We're shaping the next version now, and we want to hear what you need from the SDK. Tell us what you're building, what's missing, and what you'd like to see next.

