SDK
One ES module served from this site. No install.
import { korax } from 'https://www.koraxleverage.xyz/sdk/korax.js';
const markets = await korax.markets(); // every coin with depth and caps
const q = await korax.quoteLong({ coin: 'UNSEEN', margin: 100, leverage: 2 });
console.log(q.entryPrice, q.liqPrice, q.ok);
const s = await korax.quoteShort({ coin: '0x…', margin: 50, leverage: 1.5 });
The SDK fetches /api/markets and runs the same quote and caps math as the app. To trade, pass an EIP-1193 provider:
await korax.openLong(window.ethereum, { coin: 'UNSEEN', margin: 100, leverage: 2 });
await korax.close(window.ethereum, positionId);
await korax.supply(window.ethereum, { coin: 'UNSEEN', side: 'usdc', amount: 500 });
Writes need the contracts' addresses, which the SDK reads from /api/config.
Fetch it with curl: curl -s https://www.koraxleverage.xyz/sdk/korax.js -o korax.js.