Docs

Use the app

Swap

Socket quotes your trade on every pool of the pair at once, picks the best fill, and prints the quote in the order the program will run it.

Quote every pool of a pair#

A pair can have many pools on Socket: one with no hook, one with a dynamic fee, one recording a TWAP, and so on. They hold separate liquidity and can quote different amounts. The swap page doesn't make you choose blind. Enter an amount and it quotes the same trade on every pool of the pair in parallel, then lists them side by side.

The pool marked Best is chosen for you:

  • For an exact-input trade, the pool that pays out the most.
  • For an exact-output trade, the pool that asks for the least input.
  • When two pools quote the same amount, the one with fewer hook permissions wins: fewer hook calls can change the result at execution.

Pools whose quote can't fill the whole trade are listed but never chosen for you; you can still pick one yourself and swap the part it fills. Pools whose hook would reject the trade, or that can't quote it at all, are listed with the reason and can't be picked.

Exact input or exact output#

Type in the top field to fix what you pay; type in the bottom field to fix what you receive. The other side becomes the estimate.

ModeYou fixThe slippage limit protects
Exact inputThe amount you payThe least you'll accept to receive
Exact outputThe amount you receiveThe most you'll pay, including any hook surcharge

An exact-output swap fills completely or fails. An exact-input swap can stop early when the price reaches the end of the pool's liquidity; the app shows that as a partial fill before you sign.

The receipt#

Under the form, the chosen pool's quote is printed as a receipt in the order the program runs it:

  1. AccountsRouter10 fixed accounts plus the hook's extras, read from the pool's discovery account.
  2. Before swapHook, bit 1Reads the pool. With fee override (16) it may set this swap's fee, up to the pool's max fee.
  3. CLMMSocketMoves the price through the active ranges and takes the LP fee. No hook runs here.
  4. After swapHook, bit 2Sees the result. With input surcharge (32) it may add a charge, up to the pool's surcharge cap.
  5. SettleSocketTokens move once. A surcharge is held apart for the pool creator, never mixed with LP funds.
If any stop fails, the whole transaction reverts: no fee taken, no price moved, no tokens sent.

Each row tells you who acted: whether the fee is the pool's base fee or one the hook set, how far the price moves and how many ticks it crosses, whether the after-swap hook may add a surcharge and how large it can be, and what settles. After the swap finalizes, the receipt is stamped with the transaction it came from.

Slippage#

Slippage is the room you allow between the quote and the execution. The default is 0.5%; 0.1% and 1% are one tap away, or enter your own. The setting is remembered in this browser.

A dynamic-fee pool's fee decays every second, so its quote can be a second of decay away from what the hook charges at execution. That difference is far smaller than any sensible slippage limit.

Hook surcharges#

A pool whose mask includes input surcharge (32) lets its hook add a charge to the input after the swap math, up to the pool's cap. The receipt shows the largest surcharge the pool allows. For exact output, your slippage limit covers the surcharge; for exact input, the transaction also carries an explicit cap on the total you can be debited. The surcharge never goes to LPs and is held apart in the vault for the pool's creator. The built-in hooks never add one.

Partial fills#

If an exact-input trade is larger than a pool can fill before its price runs out of liquidity, the quote shows how much would be spent and how much would stay in your wallet. Pick that pool and the button changes to Swap what this pool can fill. The rest is never debited.

This is how you trade into a range order: the order's range is the only liquidity in its pool, so a swap through it usually fills only up to the end of the order.

When a pool refuses#

Some quotes come back with a reason instead of an amount:

The pool showsWhy
No liquidity at the current priceNo position covers the pool's current price.
Only fills in its order's directionA range-order pool's only liquidity is the order, which trades one way.
The filled range order rejects swaps…The order has filled and its owner hasn't withdrawn yet. Swaps that would move the price back into the order's range are rejected until they do.

See Errors for what each program error means when a transaction fails after signing.