SaucerSwap V2 Liquidity Operations Fetch all Pools Retrieve all V2 liquidity pools via SaucerSwap REST API
SaucerSwap offers a public REST API endpoint to retrieve all liquidity pools, accompanied by useful metadata for each pool, including liquidity pool reserves, and their associated tokens. Use the following URL options to access the data.
Data JSON Schema
Typescript
Copy type ApiLiquidityPoolV2 = {
id : number ;
contractId : string ;
tokenA : ApiToken ;
amountA : string ; //total amount for tokenA, in smallest unit
tokenB : ApiToken ;
amountB : string ; //total amount for tokenB, in smallest unit
fee : number ;
sqrtRatioX96 : string ;
tickCurrent : number ;
liquidity : string ;
}
type ApiToken = {
decimals : number
icon ?: string
id : string
name : string
price : string
priceUsd : number
symbol : string
dueDiligenceComplete : boolean
isFeeOnTransferToken : boolean
timestampSecondsLastListingChange : number
description : string | null
website : string | null
twitterHandle : string | null
sentinelReport : string | null
}
Code Overview
⛽ No gas cost
Typescript
Copy const url = 'https://api.saucerswap.finance/v2/pools/' ;
const response = await axios .get (url);
const pools = response .data;
for ( const pool of pools as ApiLiquidityPoolV2 [] ) {
const symbolA = pool . tokenA .symbol;
const symbolB = pool . tokenB .symbol;
const feeTier = pool .fee / 10_000.0 ;
const currTick = pool .tickCurrent;
const liquidity = pool .liquidity;
let output = '' ;
output += `Pool id: ${ pool .id } ` ;
output += ` - ${ symbolA } / ${ symbolB } @ ${ feeTier } %` ;
output += ` - Current tick: ${ currTick } ` ;
output += `, Liquidity: ${ liquidity } ` ;
console .log (output);
}