π₯Get Pool by Address
Fetch and query a Pumpswap AMM pool info based on pool address.
Fetch parsed pump swap pool info
async function getPoolDetailsByPoolAddress(address) {
const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
//query to get pool details on PumpSwap by pool address
const operationsDoc = `
query MyQuery {
pump_fun_amm_Pool(
where: {pubkey: {_eq: ${JSON.stringify(address)}}}
) {
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 });
}
getPoolDetailsByPoolAddress("DCQWy2Jx8vodKaznKdYWv5BXnXDgFgjHqFgKHypzr3x");
//pool address for which we are fetching dataLast updated