Skip to content

Swap API

Swap stablecoins without holding gas. The user signs; a solver pays the gas and delivers the output from its own inventory.

The distinguishing property is par pricing. When both sides of a swap are Brale-issued tokens tracking the same peg (SBC, cfUSD), they fill at true par: 1:1, 0 bps, zero slippage. Not "low fee". The solver earns nothing on the swap itself; the only cost is gas, which the solver absorbs. 1 cfUSD on Solana becomes exactly 1 SBC on Base.

What you can do

FlowRoutePricing
BuyUSDC → SBC, same chain1:1 par
Par swapBrale ↔ Brale, same peg, same chain1:1 par, 0 bps
Cross-chainBase ↔ Solana1:1 par
RedeemBrale stable → USDCDEX-priced, slippage applies

Redemption is the one non-par flow. Exiting a Brale stable to USDC routes through a DEX anchor pool, so the output reflects real pool depth for the size. Everything else is par.

Base URLs

Testnet   https://better-intents-ui-testnet.stablecoinxyz.workers.dev
Mainnet   Access-gated, contact us

All endpoints return JSON. Errors are { "error": "<message>" } with a 4xx or 5xx status. Amounts described as ...Base or ...Raw are integer strings in the token's smallest units; uiAmount fields are human decimal strings.

How a swap executes

Every swap follows the same three beats, whether it's same-chain or cross-chain:

  1. Quote. Ask the API what you'd receive. For par routes this is deterministic; for redemption it's a live DEX quote with a signed proceeds floor.
  2. Sign. The user signs an EIP-712 order that binds the terms (tokens, amounts, solver, deadline, nonce) plus a token permit. Nothing is submitted from the user's wallet, so no gas is needed.
  3. Submit. You POST the signed order. The solver verifies it against its own view, then relays it on-chain and pays the gas.

Because the user signs the terms rather than a transaction, a relaying solver cannot alter what was agreed. The order struct is checked on-chain at execution.

Same-chain swaps settle atomically in a single transaction. Cross-chain swaps lock the input in escrow, and the solver delivers on the destination before claiming, with an M-of-N attestor quorum gating the claim and a permissionless refund if the order expires unfilled.

Access control

On mainnet, the endpoints that move funds are allowlist-gated server-side. Requests from an address that isn't approved are rejected before any signature work happens. Testnet is open.

Per-swap notional caps apply on both networks. Read the current cap from /api/base/info (max) rather than assuming a value.

Next steps