DOCS / 02

Swapping with the app

Connecting a wallet, choosing tokens, reading the quote, setting slippage, approving and sending a swap, and what every badge and warning means.

The swap app lives at /swap. Everything below happens in your browser and your wallet; Tirio never holds your tokens.

1. Connect a wallet

Click Connect wallet. The dialog lists the browser wallets it finds through EIP-6963 discovery (MetaMask, Rabby, the Coinbase Wallet extension, OKX, Trust and others), or a single "Browser wallet" entry when the wallet does not announce itself. On a phone, open the app inside your wallet's in-app browser. If no wallet is installed, the dialog links to the download pages of MetaMask, Rabby, OKX Wallet and Trust Wallet.

WalletConnect is not supported yet.

2. Choose the network

Pick BNB Chain at the top of the card. Robinhood Chain is listed with a "SOON" marker and cannot be selected until the contracts are deployed there. Choosing a network asks your wallet to switch to it; if your wallet changes network on its own, the app follows. The status line under the card shows whether the chain is live, how many pools are tracked and the current Tirio fee.

3. Choose the tokens

Native BNB is preselected as the token you pay; USDT is preselected as the token you receive. Click either token to open the list: it comes from the Tirio API with the native coin first, and you can search by name or symbol. The arrow between the two boxes flips the pair.

To trade a token that is not listed, paste its address. The app reads its symbol, name and decimals on chain and shows it with a warning: its transfer tax and liquidity are unknown, and anyone can deploy a token with any name, so check the address before you trade. Unlisted tokens stay marked as "Unlisted token" in the card.

4. Enter an amount

Type the amount you pay. MAX fills in your whole balance; for the native coin it keeps a reserve for gas. Approximate USD values are shown for both sides when the API can price the tokens, together with the difference between them.

5. Read the quote

A quote is requested 400 ms after your last edit and refreshed every 15 seconds while the card is open. Each quote carries a deadline (two minutes after it was made); the Valid Ns badge counts it down, and when fewer than 20 seconds remain the app fetches a fresh quote before letting you swap. The Router refuses a transaction sent after its deadline.

The badges next to the countdown say how the quote was made:

BadgeMeaning
Exact quoteEvery leg of the route was quoted exactly.
EstimatedSome legs were interpolated between exact samples. The minimum received still protects you: the transaction reverts if you would get less.
SimulatedThe complete transaction was simulated on chain before the quote was returned; the output and gas shown are the simulated ones.

Below the badges:

  • Rate: click it to invert the direction.
  • Price impact: how far your order moves the pool prices compared with the spot rate.
  • Minimum received: the least you will get; anything less reverts the swap.
  • Tirio fee: the fee in bps and in units of the token you pay.
  • Network fee: the estimated gas cost, from the quote's gas estimate and the current gas price.
  • Max slippage: your current setting.

6. Slippage and minimum received

Open the settings with the gear button. The presets are 0.1 %, 0.5 % and 1 %; the default is 0.5 %. A custom value may have at most two decimals and cannot exceed 50 %. Settings of 5 % or more show a high-slippage warning; settings below 0.05 % warn that the swap may revert if the price moves at all.

The minimum received is computed by the API from your setting: minOut = amountOut × (10000 − slippageBps) / 10000, and it is written into the transaction. The Router compares it with the recipient's balance change and reverts the whole swap if the balance grew by less.

Tokens with a transfer tax move more than quoted. When a quote involves a taxed token and your slippage is below 1 %, the card suggests 1 % and offers a Use 1% button.

7. Price impact warnings

The price impact figure turns amber at 1 % and red at 5 %. From 5 % the card adds a High price impact notice and suggests a smaller amount. From 15 % the button reads Price impact too high and stays disabled until you press I understand; it then changes to Swap anyway. The confirmation is forgotten whenever the quote changes.

8. Approve

An ERC-20 input needs an allowance for the Router. When the current allowance is below the amount you pay, the button reads Approve TOKEN; confirm the approval in your wallet and wait for it to be mined. By default each approval covers the exact amount of the swap. Unlimited approval is an off-by-default toggle in the settings: with it on, the button reads Approve TOKEN (unlimited) and the Router can move any amount of that token on your behalf until you revoke the allowance.

Native BNB needs no approval.

9. Swap

Press Swap. The app first simulates the exact transaction with eth_call ("Simulating the swap…"). If the simulation reverts, the Router's error is decoded into a plain message (for example InsufficientOutput or Expired), nothing is sent and a fresh quote is requested. Otherwise your wallet asks you to confirm ("Confirm the swap in your wallet"), and the status panel tracks the transaction to its receipt with a link to the explorer.

On success the panel shows what you sold and what you received; for ERC-20 outputs the received amount is read from the receipt's Transfer logs, for native outputs the quoted amount is shown. If the transaction reverts on chain, nothing was swapped and only gas was spent. A transaction you cancel or replace in your wallet is reported as cancelled.

Reading the route card

The route card sits at the bottom of the details:

  • The title says Single path or Split over N paths, followed by the number of pools and DEXes used.
  • The bar shows each path's share of the input; the same colour marks the path's row below.
  • Each row starts with the path's share in percent, then alternates tokens (with the amount flowing through) and DEX pills.
  • A DEX pill is coloured by the DEX and shows the pool's fee (for example 0.25%). Click it to open the pool on the explorer (BscScan on BNB Chain). Hover it to see whether the hop was quoted on chain or from the pool's current state and whether it was interpolated.
  • The ↻ marker is a wrap or unwrap of the native coin.
  • Amounts are the simulated outputs at the current block.

Warnings and paused quotes

  • Transfer tax: "TOKEN charges an X transfer tax on sells/buys. The quote already includes it." If the tax could not be checked, the card says you may receive less than quoted.
  • Quotes paused: the API answered 503 (its pool state is behind the chain, the Router is not deployed on that chain, or pools are still loading). The app retries every 5 seconds.
  • Busy, retrying: the API's rate limit was hit; the app waits for the time it was told and retries.
  • No route found: no route for this pair and amount, or the best route failed in simulation.
  • Token not supported: the API refuses the token, with the reason shown.
  • Insufficient balance and Insufficient BNB for gas are checked against your wallet before the button is enabled.