DocsHow quoting works

How quoting works

A Cleave quote is the whole trade worked out before you sign: which pools and paths it uses, what you pay, what you receive, what others charge and, between chains, how long it takes. This page explains what goes into a quote, at a high level.

What a quote is

A quote is priced live from the current state of the chain. It answers one question: for this amount of this token, how much of the other token can you get right now, and how?

Every quote states:

  • the amount you pay and the amount you are expected to receive
  • the route: each pool and path the trade uses and its share of the input
  • the least you can receive at your slippage, for you to check in Review
  • costs charged by others, such as a bridge fee or network gas
  • an estimate in USD where the tokens have a price

Prices move with every block, so a quote is short-lived. The app refreshes it while you look at it. An agent's plan carries a validUntil time, after which it should plan again.

Splitting a trade

A single pool has a price that moves as you trade into it. The larger the trade, the further the price moves against you. Cleave splits your trade into parts so that each part meets a better price:

  • Over several pools: the same pair often trades in more than one pool. Each pool takes the share it can fill well.
  • Over several paths: a trade can also go through another token on the way, when that path pays more.

The parts rejoin into the token you asked for, in one transaction. The route view in the app shows each path and its share of your input.

Cleave prices trades on the exchanges it lists on each chain. That is many pools, but not every pool on every chain.

What the quote already includes

  • Fees: Cleave's fees are inside the quoted price. Pool fees are inside the rate.
  • Tokens with their own transfer fee: some tokens take a fee each time they move. Cleave checks for this and quotes what actually arrives. When a token takes such a fee, the quote says so.
  • Unrouted input: if part of your input cannot be routed well, that part comes back to your wallet in the same transaction.
  • Price impact: when what you receive is worth noticeably less than what you pay at market prices, the quote carries a price impact warning. It never blocks the trade; you decide.

Costs that others charge are listed, not hidden: a bridge or relay fee where a route has one, a messaging fee paid in the native coin on routes that need one, an optional delivery fee, and network gas.

Between chains

A cross-chain quote covers the whole trip in one step:

  1. a swap on the source chain, when the token you pay is not the one the bridge carries
  2. the bridge to the destination chain
  3. a swap on arrival, when the token you want is not the one the bridge carries

You sign once on the source chain. If the swap on arrival cannot run, the recipient gets the bridged token instead, and the quote tells you which token that is before you send.

Choosing a route

When several routes can carry a transfer, Cleave ranks them by how certain the outcome is first, then by how fast they arrive, then by how much they deliver. A route that ends with a swap on arrival ranks below one that delivers directly, unless it is the only way to get the token you asked for. The app shows each route with its time, its costs and what arrives, so you can pick.

Some routes can go unfilled. If a transfer is not filled before it expires, it is refunded to the sender on the source chain.

Before you sign

  • The app test-runs every step against the chain before your wallet asks. A step that would fail is not sent.
  • Each transaction is checked against the quote you reviewed. If they differ, you get a new quote.
  • Approvals are sized to the trade.

See Safety for every check the app runs.

Same quotes for apps and agents

The app, the partner API and the agent tools use the same quote engine. An agent gets the quote as a plan with unsigned calls; see Agents. Developers can read the full answer in the API; see API.