The Flashnet SDK allows you to discover active liquidity pools and retrieve detailed market data for them. You can list all available pools with powerful filtering and sorting options, or query for the specific details of a single pool.

Listing Pools

The listPools method is the primary way to discover pools. You can use it without any parameters to get a list of all pools, or provide a query object to filter and sort the results.
async function discoverPools() {
  try {
    const response = await client.listPools({
      minTvl: 10000, // Minimum TVL of $10,000 (if Asset B is a stablecoin)
      sort: "VOLUME24H_DESC", // Show most active pools first
      limit: 20,
    });

    console.log(`Found ${response.totalCount} pools meeting the criteria.`);
    response.pools.forEach(pool => {
      console.log(`- Pool ${pool.lpPublicKey}: TVL = ${pool.tvlAssetB}, Volume (24h) = ${pool.volume24hAssetB}`);
    });

  } catch (error) {
    console.error('Failed to list pools:', error);
  }
}

Filtering and Sorting

The listPools method accepts a ListPoolsQuery object with the following options:
ParameterTypeDescription
assetAAddressstringFilter by the address of Asset A.
assetBAddressstringFilter by the address of Asset B.
hostNamesstring[]Filter by one or more host namespaces.
minVolume24hnumberOnly include pools with 24-hour volume above this value.
minTvlnumberOnly include pools with TVL above this value.
curveTypesstring[]Filter by curve type (e.g., ["CONSTANT_PRODUCT"]).
sortPoolSortOrderSort results by TVL, VOLUME24H, or CREATED_AT.
limitnumberThe maximum number of pools to return.
offsetnumberThe number of pools to skip for pagination.
afterUpdatedAtstringRFC3339 timestamp to get pools updated after a date.

Example: Finding Specific Pairs

async function findBtcUsdbPools() {
  const pools = await client.listPools({
    assetAAddress: "bitcoin-pubkey",
    assetBAddress: "usdb-pubkey",
    sort: "TVL_DESC",
  });
  console.log('Found BTC/USDB pools by TVL:', pools);
}

Getting Pool Details

To get all available information for a single pool, use the getPool method with the pool’s ID (its lpPublicKey).
async function getPoolDetails(poolId: string) {
  try {
    const pool = await client.getPool(poolId);

    console.log('Pool Details:', pool);
    console.log(`- TVL: ${pool.tvlAssetB}`);
    console.log(`- 24h Volume: ${pool.volume24hAssetB}`);
    console.log(`- 24h Price Change: ${pool.priceChangePercent24h}%`);
    console.log(`- Current Price: ${pool.currentPriceAInB}`);

  } catch (error) {
    console.error('Failed to get pool details:', error);
  }
}

Understanding Market Data

The pool objects returned by the SDK contain valuable market data. Some fields are common to all pool types, while others are specific to either constant product or single-sided bonding curve pools.
FieldApplies ToDescription
lpPublicKeyBothThe unique identifier (public key) for the liquidity pool. This is used as the poolId.
hostNameBothThe namespace of the host that created the pool, if any.
hostFeeBpsBothThe host fee rate in basis points (e.g., 100 BPS = 1%).
lpFeeBpsBothThe liquidity provider fee rate in basis points (e.g., 30 BPS = 0.3%).
assetAAddressBothThe public key (address) of the first asset in the pair.
assetBAddressBothThe public key (address) of the second asset in the pair.
assetAReserveBothThe current amount of Asset A held in the pool’s reserves.
assetBReserveBothThe current amount of Asset B held in the pool’s reserves.
tvlAssetBBothTotal Value Locked, denominated in Asset B. This is a key measure of a pool’s liquidity.
volume24hAssetBBothThe total value of assets swapped in the pool over the last 24 hours, denominated in Asset B.
priceChangePercent24hBothThe percentage change in the price of Asset A relative to Asset B over the last 24 hours.
currentPriceAInBBothThe current spot price of Asset A in terms of Asset B, calculated from the pool’s reserves.
curveTypeBothThe type of pool: CONSTANT_PRODUCT or SINGLE_SIDED.
createdAtBothThe timestamp when the pool was created.
updatedAtBothThe timestamp of the last event (e.g., swap, liquidity change) that updated the pool’s state.
virtualReserveASingle-SidedThe virtual reserve of Asset A used for price calculations along the bonding curve.
virtualReserveBSingle-SidedThe virtual reserve of Asset B used for price calculations along the bonding curve.
initialReserveASingle-SidedThe initial amount of Asset A deposited by the creator to start the bonding curve.
graduationThresholdAmountSingle-SidedThe absolute amount of Asset A that must be sold for the pool to “graduate” to a constant product pool.
bondingProgressPercentSingle-SidedThe percentage of the graduationThresholdAmount that has been met so far.
thresholdPctSingle-SidedThe graduation threshold expressed as a percentage of the initialReserveA.