SDK
One ES module served from this site. No install.
import { oxl } from 'https://www.0xleverage.tech/sdk/0xleverage.js';
const markets = await oxl.markets(); // every coin with depth and caps
const q = await oxl.quoteLong({ coin: 'UNSEEN', margin: 100, leverage: 2 });
console.log(q.entryPrice, q.liqPrice, q.ok);
const s = await oxl.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 oxl.openLong(window.ethereum, { coin: 'UNSEEN', margin: 100, leverage: 2 });
await oxl.close(window.ethereum, positionId);
await oxl.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.0xleverage.tech/sdk/0xleverage.js -o 0xleverage.js.