Fetch migration details of a pool on Raydium Launchpad
Raydium Launchpad pools begin in a fundraising phase using a bonding curve. Once the target amount of quote tokens (like SOL or USDC) is raised, the pool becomes eligible for migration. This migration moves the raised liquidity into a Raydium AMM or CPswap pool, enabling open trading.
Migration is tracked using the following fields:
status β Indicates the phase of the pool:
0 = Funding, 1 = Ready to Migrate, 2 = Migrated.
migrate_type β Shows the destination of the liquidity:
0 = Raydium AMM, 1 = CPswap.
total_quote_fund_raising β The total amount of quote tokens raised before migration.
real_base & real_quote β The actual token balances in the pool vaults; these drop to near zero after migration.
migrate_fee β Fee deducted during migration, defined in the global config.
These fields allow you to monitor the entire lifecycle of a poolβfrom launch to AMM-ready trading.
You can directly copy paste this code on replit and see it in action.
Get all pools which are ready to migrate
As mentioned above, the pools which are ready to migrate have a `status` of 1.
async function getMigrationReadyPools() {
const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
const operationsDoc = `
query MyQuery {
raydium_launchpad_PoolState(where: {status: {_eq: "1"}}) {
pubkey
status
migrate_type
migrate_fee
total_quote_fund_raising
total_base_sell
quote_protocol_fee
platform_fee
}
}
`; //status `1` indicates the pool has completed its bonding curve
const result = await fetch(
`https://programs.shyft.to/v0/graphql?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 });
}
getMigrationReadyPools();
The response includes several key fields that provide details such as the amount raised, platform fees, and more(as described above). The migrate_type field specifies whether the migration destination is a Raydium AMM or CPswap.
Fetch Status and Migration Destination of a Pool by address
async function getMigrationByPoolAddress(address) {
const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
/*
* The status field returns if the pool is funding, ready to migrate, or migrated
* the migrate_type field indicates the destination, 0 for Raydium AMM, 1 for CpSwap
*/
const operationsDoc = `
query MyQuery {
raydium_launchpad_PoolState(
where: {pubkey: {_eq: ${JSON.stringify(address)}}}
) {
status
migrate_type
total_base_sell
total_quote_fund_raising
pubkey
}
}
`;
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 });
}
getMigrationByPoolAddress("4yhL99wpeeM2ptRT6U81hG8P3bCaCNabuw28gSBTCemU");
//replace with your Pool address