Place a Limit Order
Sign and submit a gasless limit order as a Maker using the KyberSwap Limit Order API.
Place a Limit Order
Makers create limit orders by signing an EIP-712 message off-chain — no gas required. The signed order is stored in KyberSwap's off-chain orderbook and settled on-chain when a Taker fills it.
Flow
POST /sign-message → sign EIP-712 → check allowance → POST /ordersStep 1 — Get the Unsigned EIP-712 Message
Call POST /write/api/v1/orders/sign-message with the order parameters:
const requestBody = {
chainId: "137", // Polygon
makerAsset: "0x2791bca1...", // USDC
takerAsset: "0x1C954E8f...", // KNC
maker: signerAddress,
allowedSenders: [signerAddress], // optional: restrict who can fill
makingAmount: "10000", // 0.01 USDC (6 decimals)
takingAmount: "20000000000000000", // 0.02 KNC (18 decimals)
expiredAt: Math.floor(Date.now() / 1000) + 3600 // expires in 1 hour
};
const { data } = await axios.post(
"https://limit-order.kyberswap.com/write/api/v1/orders/sign-message",
requestBody
);
// data contains: domain, types, message (unsigned EIP-712)Step 2 — Check and Set Allowance
The Limit Order contract must be approved to spend the Maker's makerAsset. Check the current active making amount first — allowance must cover all open orders, not just the new one:
See Contracts & Addresses for the limitOrderContract address per chain.
Step 3 — Sign the EIP-712 Message
Step 4 — Submit the Order
Append salt and signature to the original request body and POST to /write/api/v1/orders:
The response includes an orderId which can be used to track, query, or cancel the order.
Related
Last updated
Was this helpful?