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
| Flow | Route | Pricing |
|---|---|---|
| Buy | USDC → SBC, same chain | 1:1 par |
| Par swap | Brale ↔ Brale, same peg, same chain | 1:1 par, 0 bps |
| Cross-chain | Base ↔ Solana | 1:1 par |
| Redeem | Brale stable → USDC | DEX-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 usAll 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:
- 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.
- 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.
- 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
- Quotes and token info: read endpoints, balances, redemption pricing
- Same-chain swaps: the sign-and-relay flow on Base and Solana
- Cross-chain swaps: Base ↔ Solana intents, settlement, and refunds