Fetch and query a Raydium Launchpad pool info based on creator address.
Raydium Launchpad pools can also be queried by the wallet that created them. Here, we filter by the creator field to fetch all pools launched by a specific address.
You can directly copy paste this code on replit and see it in action.
Fetch all Pools created by an User
async function getPoolDetailsByCreator(creatorAddress) {
const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
//query to get pool details by creator address
const operationsDoc = `
query MyQuery {
raydium_launchpad_PoolState(
where: {creator: {_eq: ${JSON.stringify(creatorAddress)}}}
) {
supply
total_base_sell
total_quote_fund_raising
virtual_base
virtual_quote
real_base
real_quote
pubkey
migrate_type
migrate_fee
base_mint
base_vault
base_decimals
quote_vault
quote_mint
quote_decimals
creator
}
}
`; //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("87wMyjR6RfpJLVy4TWEHK9WEe9UfMEMeU63BJnW3xfee");
//creator wallet address
The response contains base_mint and quote_mint which is the liquidity pool pair. The response also contains more fields such as the the token vaults, token decimals, virtual base and quote, migration details, amount of tokens raised etc. which can be cherrypicked, or omitted as per your requirement.