Developer guide

Swaps and bridges

4 min read

Route execution

LI.FI routes are read live for quoting and status. Execution follows the same signing and reconciliation boundary as every other operation type, with each leg persisted independently.

Same-chain swaps

A swap between two representations on the same network is not settled by the aggregator. It recognises three canonical tokens per network and none of this deployment's own representations, so nobody quotes that pair. Outside mainnet it is settled by a pool the deployment owns, seeds and prices itself.

That pool is not a market. Its rates are fixed per ordered pair and set when it is deployed: there is no curve, no liquidity provider and no price discovery, so a quote is exactly reproducible and equals what the execution pays. A quote settled by it carries settlementProvider: "deployment_pool" and swapProvider.productive: false, and no surface may present its rate as a market price. On mainnet the aggregator settles the swap with the real tokens.

The quote states what it will deliver — toAmount, in the asset being received — before it is accepted, and that figure is the floor the execution accepts: a rate that changed in between reverts on chain instead of delivering less. What is credited afterwards is read from the settlement itself, not from the quote.

When a route is eligible

LI.FI is used for an enabled swap, bridge or cross-chain combination; it is not a fallback for a direct transfer. The route, assets, networks and environment must be explicitly approved by capability manifests.

Quote and settlement

A route quote keeps ChatterPay's service fee separate from provider and network costs. The customer accepts the quote before execution begins. If the route's provider cost cannot be safely normalized to the source asset, the platform does not invent a total debit.

Multi-leg truth

Cross-chain work can contain irreversible legs. The operation records explicit partial or recovery states rather than claiming a fictional rollback. LI.FI reconciliation compares each leg's on-chain and provider evidence against the accepted quote to confirm the financial result.

Capabilities in this area

This area covers the capabilities below. The Roadmap states the current availability of each one.

  • Live read-only quote and status — The platform asks the live LI.FI service which routes exist for a pair of assets, what they cost and what state an execution is in. It only reads, so a Partner can see real prices and real route availability.

  • Simulated execution in Mock and Anvil — Routes with several steps execute against local profiles. The result comes back marked as simulated in the API answer and on screen, and its transaction hashes do not link to a block explorer.

  • Persisted multi-leg operations — A route that crosses networks is stored as several legs, each with its own route identifier, amount, hash and state. That is what lets an operation report that one leg settled and another did not, and lets the part that failed be refunded.

  • Same-network swap against the deployment's own pool — Two assets on the same network are exchanged against a pool this deployment owns and prices, at a fixed rate rather than a market one. It exists because the aggregator does not recognise the test representations, so outside a real network nobody else quotes that pair. The quote states what will be delivered before it is accepted, and says that the route is not a market.

  • Swap available from every interface — The same swap runs from the Sandbox through the SDK and from the conversational bot, because it is one more operation on the same API and not a feature of one screen.

  • Safe live execution — Executing a real route on a public network, with a limit per tenant, a switch that stops execution when the service misbehaves, and a check that the route about to run is still the one that was quoted and confirmed.

  • Swap-eligible assets aligned with LI.FI coverage — The list of assets that can be swapped is built from the routes the aggregator actually covers. Asking for a quote on an asset with no route is answered with that reason, instead of an empty route.