🔥Get Pool by Creator Address

Fetch and query a Pumpswap AMM pool info based on creator address.

Pump AMM's architecture allows for the retrieval of liquidity pool details not only by pool address, but also by the creator of the pool. Here, we filter by the creator field to fetch pool details.

You can directly copy paste this code on replit and see it in action.

Fetch parsed Pump swap pool info

async function getPoolDetailsByCreator(creatorAddress) {
  const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
  //query to get pool details on PumpSwap by creator address
  const operationsDoc = `
    query MyQuery {
    pump_fun_amm_Pool(
      where: {creator: {_eq: ${JSON.stringify(creatorAddress)}}}
    ) {
          base_mint
          creator
          index
          lp_mint
          lp_supply
          pool_base_token_account
          pool_bump
          pool_quote_token_account
          quote_mint
          pubkey
      }
  }
`; //you can cherrypick the fields as per your requirement

 const result = await fetch(
    `https://programs.shyft.to/v0/graphql/accounts?api_key=${SHYFT_API_KEY}&network=mainnet-beta`, //SHYFT's GQL endpoint
    {
      method: "POST",
      body: JSON.stringify({
        query: operationsDoc,
        variables: {},
        operationName: "MyQuery",
      }),
    }
  );

  const { errors, data } = await result.json();

  console.dir(data, { depth: null });
}

getPoolDetailsByCreator("6jpk47MKaa9vaswNq8yEGnBn8K5K8sx2RKgtbLP2zP4P");
//creator wallet address

The response contains base_mint and quote_mint which is the liquidity pool pair. Please note that more fields such as pool_base_token_account, pool_quote_token_account, lp_supplycan also be cherrypicked, or omitted as per your requirement.

Last updated

Was this helpful?