Fill a Limit Order
Discover open limit orders and execute a fill on-chain as a Taker using the KyberSwap Limit Order API.
Fill a Limit Order
Flow
GET /orders → GET /operator-signature → check allowance
→ POST /encode/fill-order-to → send transactionStep 1 — Get Open Orders
const { data } = await axios.get(
"https://limit-order.kyberswap.com/read-partner/api/v1/orders",
{
params: {
chainId: 137,
makerAsset: "0x2791bca1...", // token the Maker is selling
takerAsset: "0x1C954E8f...", // token the Taker must provide
}
}
);
const orders = data.data; // sorted best-rate first
const targetOrderId = orders[0].id;Step 2 — Get the Operator Signature
Step 3 — Check and Set Allowance
Step 4 — Encode the Fill Calldata
Step 5 — Execute On-chain
Related
Last updated
Was this helpful?