Track a swap

Poll a swap on any chain and venue until it settles, and retry failed requests safely.

Poll a swap's status after you send it. Start every 2 to 3 seconds, slow to every 10 to 15 seconds, and stop at a final status.

curl "$AQUA0_API/api/swap/status/$CHAIN_ID/<txHash>" -H "X-API-Key: $AQUA0_API_KEY"

txHash is the transaction hash on an EVM chain and the transaction signature on Solana. The answer is the same on every chain, and venue with venueInfo says which venue settled the swap.

statusMeaning
PENDINGSent and not settled yet.
SETTLEDOn chain. settlement has the block time and the pool's token changes.
FAILEDThe transaction failed. Quote again to trade.
UNKNOWNThe chain has no such transaction, or it settled no swap on Aqua0 liquidity.

settlement gives each token's change from the pool's side, so the token the trader paid is positive and the token they received is negative.

A transaction you just sent can read UNKNOWN until the network sees it, so keep polling for a few seconds. A wallet's settled swaps on every venue are listed by GET /api/swap/history/{wallet}.

Retrying requests

  • 429: wait for the Retry-After header, then retry.
  • 503: wait details.retryAfterSeconds, then retry.
  • 500 or a network error: retry with backoff.
  • Any other 4xx: fix the request. It fails the same way if sent again.

A read that comes back with X-Data-Stale: true could not be read fully fresh. Retry it shortly for a full answer. Quotes change nothing, so they are always safe to retry. See Errors for every code.

On this page