For agents
Set up the HyperCore account once with toStandardPerp, then one call finds the best LP and runs the swap. Every step is written to a journal first, and resumeSwaps finishes or refunds anything a crash left open.
npm install @biloa/sdk viemimport { MAINNET, swapBest } from "@biloa/sdk";
import { parseUnits } from "viem";
// taker: HyperCore key, Elysium wallet and public clients, clock and journal; see the SDK README
const out = await swapBest(
taker,
{
dir: "toElysium",
token: MAINNET.usdc,
usdc: "10",
minNet: parseUnits("9.95", 6),
},
{ registry: MAINNET.registry },
);- What a swap costs
- A 3 bps protocol fee, the LP's spread and HyperCore's 1 USDC fee for the new escrow account (1.01 USDC in swaps to HyperCore)
- Swap size
- Up to 1,000 USDC per swap; each LP sets its range, and
biloa-lpstarts at 10 to 200 USDC