Get Bonding Curve Details by Pool Address
Fetch and query a Raydium Launchpad Bonding Curve or other pool info based on pool address.
Fetch parsed Bonding curve pool info
async function getBondingCurveByPoolAddress(address) {
const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
//query to get Bonding Curve details on Launchpad by pool address
const operationsDoc = `
query MyQuery {
raydium_launchpad_PoolState(
where: {pubkey: {_eq: ${JSON.stringify(address)}}}
) {
supply
total_base_sell
total_quote_fund_raising
virtual_base
virtual_quote
real_base
real_quote
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();
if (errors) {
console.error(errors);
console.log(
"Failed to fetch data, please provide correct API key or pool address."
);
return;
}
console.dir(data, { depth: null });
}
getBondingCurveByPoolAddress("4yhL99wpeeM2ptRT6U81hG8P3bCaCNabuw28gSBTCemU");Fetch parsed Bonding curve pool info
Last updated