Skip to content
Swap

LCX Liberty. American DeFi. Your keys. Your assets. Your control.

API reference

Swap

POST /v1/swap returns a priced route and signable calldata in one round trip.

Request

POST/v1/swap

Everything /v1/quote takes, plus a taker. Returns everything /v1/quote returns, plus data.transaction with to, data and value hoisted to the top level, because that is the shape every wallet library already accepts. transaction.routerDeployed is false on a chain with no router, and there is no transaction to send.

json
{
  "chainId": 1,
  "tokenIn":  "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
  "tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "amount": "5",
  "decimals": 18,
  "taker": "0xYourUser…",
  "slippageBps": 50
}

Response

ts
const { quote, transaction } = await lcx.swap({ … });
await wallet.sendTransaction(transaction); // { to, data, value }
Check /v1/allowance before sending. A swap from an ERC-20 with no allowance reverts, and the revert costs the user gas.