https://api.liquidy.financeHow it works
The Liquidy Swap API is an off-chain router. It finds the best route between any two tokens through any of the RUJI Trade books and returns a swap message you can submit directly — it does not move funds for you.
- Get supported tokens — GET
/swap/tokensreturns the denoms, decimals, and display metadata for tokens the router can quote and route. - Request a route — POST
/swap/route(single route) or/swap/sroute(split route) with input denom, amount in atomics, output denom, and slippage. - Use the best route — the response ranks paths; typically take
routes[0]. Each route includes expected output, price impact, andtx.swap(stages +min_return). - Execute on chain — send a CosmWasm execute to the router contract with
routes[0].txas the message and attach the input token asfunds(fullinput.amountfor a single route).
Router contract
thor1efrmwk6fzhaugu056mz3nkq4vl0fgpfacm3gp6fhgrdkm4q8rrmsd5a6r5API base: https://api.liquidy.finance
Swap history (indexed transactions): https://api.liquidy.finance/history
Message shape
A single-route swap is one MsgExecuteContract: the msg field is the API's tx object; funds carries the coin you are swapping in.
{
"contract": "thor1efrmwk6fzhaugu056mz3nkq4vl0fgpfacm3gp6fhgrdkm4q8rrmsd5a6r5",
"msg": routes[0].tx,
"funds": [{ "denom": "<input-denom>", "amount": "<input-amount-atomics>" }]
}Split routes return multiple legs — broadcast one execute per leg, each funded with that leg's split.amount, not the full input.
Signing with CosmJS
Use CosmJS to sign and broadcast on Rujira / Thorchain-style chains:
@cosmjs/cosmwasm-stargate—SigningCosmWasmClientand.execute()for contract calls@cosmjs/stargate— wallet, fees, andGasPrice
import { SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";
await client.execute(
senderAddress,
routerContract,
route.tx, // routes[0].tx from the API
"auto",
undefined,
[{ denom: inputDenom, amount: inputAmount }],
);Optional: simulate first with the router's simulate query (see Swap tab) to verify the returned amount before broadcasting.