Shyft
Start BuildingSupportWebsite
  • Welcome
    • 👋Introducing Shyft
    • 🏗️Start Building
  • Solana Infrastructure
    • 🚁Shyft RPCs
  • Yellowstone gRPC Network
    • Decoding gRPC Latency
    • ⚡gRPC Docs
      • Introduction
      • Authentication
      • Subscribe Requests
      • FAQ
      • Getting Started
        • Initializing the Yellowstone Client
        • Making a gRPC connection
        • Adding a Reconnection Mechanism
        • 🔥Replaying Slots with Solana yellowstone gRPCs
        • Modifying your Subscribe Request
        • Closing a gRPC Connection
      • Subscribing to Transactions
        • All Transactions of an address
        • Subscribing to all transactions of a Liquidity Pool
        • Subscribing to all transactions of multiple addresses
        • Subscribing to all transactions of a Token
      • Subscribing to Accounts
        • Account Updates for a Program
        • Account Updates for an Address
        • Account updates using memcmp
      • Streaming Blocks & BlocksMeta
        • Streaming Block Updates
        • Subscribing to BlocksMeta
      • Modifying & Unsubscribing
  • Solana defi data
    • DeFI APIs
      • Get Pool By Address
      • Get Pools By Token Pair
      • Get All Pools for a Token
      • Get Liquidity Details of a Pool
  • Callbacks
    • ☎️What are Callbacks?
      • Transaction Callbacks
      • Account Callbacks
    • 📔Callback APIs
      • Response Structure
      • List Callbacks
      • Register callback
      • Remove callback
      • 🔥Pause a callback
      • 🔥Resume a callback
      • Update Callbacks
      • Add Addresses
      • Remove addresses
  • Solana Super Indexers
    • 🌩️GraphQL APIs
      • Getting Started
      • Building Queries
      • Paginating Response
      • Applying Filters
      • Ordering and Sorting Data
    • 📀Case Studies
      • Tensor
        • Get Active Listings of a Wallet
        • Get Active Bids of a Wallet
        • Get Active Listings of a Collection
        • Get all Bids of a Collection
        • Get all Pools of a Margin Account
        • Get all Pools by Owner
      • Raydium
        • Get Pool By Address
        • Get Pools By Token Address
        • Get Pools Created Between Time
        • Get Pool Burn Percentage
        • Get Liquidity Details of a Pool
        • Get Pool and OpenBook Market Info
        • Get Token Supply Percentage In Pool
      • Orca Whirlpool
        • Get Pool by Address
        • Get Pool by Token Address
        • Get Positions for a Pool
        • Get Positions for a Wallet
        • Get Liquidity Details of a Pool
      • Kamino
        • Get Borrow Details of a Wallet
        • Get Deposit Details of a Wallet
        • Get Reserve Details
      • Cross Marketplace Queries
        • Get active listings across marketplaces for a wallet
        • Get listings for a collection across marketplaces
        • Get floor price of a collection
      • Cross Defi Queries
        • Fetch Liquidity Pools for Token
      • Native Staking
        • Get Stakes for a Wallet
        • Get Stakes For Validator
      • Governance/Realms
        • Get DAO Token Owners
        • Get Proposals For Governing Mint
        • Get All Proposals For DAO
        • Get DAO Treasury Info
        • Get All Active Proposals For Wallet
      • Meteora
        • Get All LB Position Pairs
        • Get Position of a User Wallet
        • Get Pool by Token Addresses
        • Get All Deposits for a User
        • Get All Withdraws for a User
        • Get All Fees Claimed by a User
        • Get All User Positions and Deposits for a Pool
        • Get All User Positions and Withdrawals for a Pool
      • Fluxbeam
        • Get Pool by Address
        • Get Pool by Token Addresses
      • Drift
        • Get User account for Delegate
        • Get User accounts based on authority
        • Get User details based on Referrer
        • Get Borrow/Deposit Amount for an User
        • Get PrepPositions for an User Account
        • Getting OrderId and userOrderId
        • Get OpenOrders for a User Account
      • 🔥Pumpswap
        • 🔥Get Pool by Address
        • 🔥Get Pool by Creator Address
        • 🔥Get Pools by Token Addresses
      • Raydium Launchpad
        • Get Bonding Curve Details by Pool Address
        • Get All Pools for a Creator
        • Get Pools by Token Addresses
        • Get Migration details of a Pool
  • Solana APIs
    • API Reference
    • Transactions
      • Parsed Transaction Structure
      • Transaction APIs
        • History
        • Parse Signature
        • Parse Multiple Signatures
        • Send
        • Send Multiple
    • NFT
      • 🔥Create Gasless
      • Create
      • Read All
      • Burn
      • 🔥Burn Multiple NFTs V2
      • Update
      • 🔥Create NFT from Metadata
      • 🔥Read Wallet Nfts
      • 🔥Read Selected NFTs
      • 🔥Get NFT Owners
      • 🔥Update NFT Metadata Uri
      • 🔥Update V2
      • Search
      • Transfer
      • Transfer Multiple NFTs
      • Mint
      • Read
    • Wallet
      • Get Balance
      • Get Token Balance
      • Get All Tokens Balance
      • Get Portfolio
      • Resolve Address
      • Get All Domains
      • Get Stake Accounts
    • Fungible Tokens
      • Create
      • Mint
      • Burn
      • 🔥Update
      • Get Token Info
      • Transfer
      • Airdrop
  • 📘Dev Guides
    • 📀gRPC Case Studies
      • Pumpfun
        • Streaming and Parsing Pump.fun Transactions
        • Streaming and Parsing Pump.fun Accounts
        • Detecting new Token launches on Pump.fun
        • Detecting Buy/Sell Transactions on Pump.fun
        • Detecting tokens migrating from Pump.fun to Pump Swap AMM
      • PumpSwap AMM
        • Streaming and Parsing Pump Swap Transactions
        • Streaming and Parsing Pump Swap AMM Accounts
        • Detecting Buy/Sell Transactions on Pump Swap AMM
        • Detecting tokens migrating from Pump.fun to Pump Swap AMM
      • Raydium AMM
        • Streaming and Parsing Raydium AMM Transactions
        • Streaming and Parsing Raydium AMM Accounts
        • Detecting Buy/Sell Transactions on Raydium AMM
        • Detecting new Pools on Raydium AMM
      • Raydium CLMM
        • Streaming and Parsing Raydium CLMM Transactions
        • Streaming and Parsing Raydium CLMM Accounts
      • Raydium CPMM
        • Streaming and Parsing Raydium CPMM Transactions
        • Streaming and Parsing Raydium CPMM Accounts
      • Raydium Launchpad
        • Streaming and Parsing Raydium Launchpad Transactions
        • Streaming and Parsing Raydium Launchpad Accounts
      • Meteora DAMM v2
        • Streaming and Parsing Meteora DAMM v2 Transactions
        • Streaming and Parsing Meteora DAMM v2 Accounts
Powered by GitBook
On this page

Was this helpful?

  1. Solana Super Indexers
  2. Case Studies
  3. Raydium Launchpad

Get Pools by Token Addresses

Fetch Launchpad Pools based on a single Token Address or a Liquidity Pair

Raydium Launchpad uses bonding curve pools to launch tokens, with each pool defined by a token pair (also known as liquidity pair). This pair is represented by the baseMint (the launched token) and quoteMint (the token used to buy it). We can apply filters to these fields to retrieve specific pool details involving a particular token pair. For instance we are trying to get liquidity pools involving CHUCK token and SOL, so we filter baseMintand quoteMintfields using the _in filter.

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

Fetch Pool by Liquidity Pair (CHUCK-SOL)

async function getPoolDetailsByLiquidtyPair(mintAddressA, mintAddressB) {
    const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
    //query to get pool details on Launchpad by liquidity pair
    const operationsDoc = `
      query MyQuery {
        raydium_launchpad_PoolState(where: {base_mint: {_in: ${JSON.stringify([
        mintAddressA,
        mintAddressB,
      ])}}, quote_mint: {_in: ${JSON.stringify([
        mintAddressA,
        mintAddressB,
      ])}}}) {    
                    total_base_sell
                    total_quote_fund_raising
                    virtual_base
                    virtual_quote
                    real_base
                    real_quote
                    pubkey
                    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?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 });
}

getPoolDetailsByLiquidtyPair("AzDFgqyGq1drDHyxTpVUf5dXLQd74P3m5sspJXgnbray","So11111111111111111111111111111111111111112");
{
  "raydium_launchpad_PoolState": [
    {
      "supply": 1000000000000000,
      "total_base_sell": 793100000000000,
      "total_quote_fund_raising": 85000000000,
      "virtual_base": 1073025605596382,
      "virtual_quote": 30000852951,
      "real_base": 3362661090671,
      "real_quote": 94312608,
      "pubkey": "DH9yxXuEVVZDckygk3rjyCuCiCruZh5UjNEqPRpinhvs",
      "migrate_type": 0,
      "migrate_fee": 0,
      "base_mint": "AzDFgqyGq1drDHyxTpVUf5dXLQd74P3m5sspJXgnbray",
      "base_vault": "ACxk6fqKasawUyHfUyEXjco72zDHVbSuXtZNniKo8Bf1",
      "base_decimals": 6,
      "quote_vault": "3Z9991PEpofHaA3SyN7K7cBhU2zrvi6TgdJEhz4fEYsT",
      "quote_mint": "So11111111111111111111111111111111111111112",
      "quote_decimals": 9,
      "creator": "8yxpxgHkuK323jhxQ4qawKsq2SpePaPV5qYZL8sZ3edX"
    }
  ]
}

We can also query liquidity pool involving a particular token address, for that we would have to filter the baseMint or quoteMint field using the _in filter.

Fetch Pools involving a Token

async function getPoolsForAToken(mintAddress) {
  const SHYFT_API_KEY = "YOUR_SHYFT_API_KEY";
  const operationsDoc = `
		query MyQuery {
            raydium_launchpad_PoolState(where: {_or: [{_or: {base_mint: {_eq: ${JSON.stringify(
              mintAddress
            )}}}},{_or: {quote_mint: {_eq: ${JSON.stringify(
    mintAddress
  )}}}}]}) {
              total_base_sell
              total_quote_fund_raising
              virtual_base
              virtual_quote
              real_base
              real_quote
              pubkey
              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?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 });
}

getPoolsForAToken("C4cAaJyaeKGpCLRRwuPSh6J76vytgPUzE265PtBrWray");
{
  "raydium_launchpad_PoolState": [
    {
      "total_base_sell": 793100000000000,
      "total_quote_fund_raising": 85000000000,
      "virtual_base": 1073025605596382,
      "virtual_quote": 30000852951,
      "real_base": 3540872139,
      "real_quote": 99005,
      "pubkey": 'DSUdt9zUrxSe5QXQbjtVvm4qXHboG7jKMp12QoMkuN1e',
      "base_mint": 'C4cAaJyaeKGpCLRRwuPSh6J76vytgPUzE265PtBrWray',
      "base_vault": 'EJgxfswUpZmkfBZCPDyDYPzgMXduCJztRH4pWAHqgkXv',
      "base_decimals": 6,
      "quote_vault": 'T1M3iHY9aZfkGywjqVh9vcgLm1e3cFFypCL4UHtg1ND',
      "quote_mint": 'So11111111111111111111111111111111111111112',
      "quote_decimals": 9,
      "creator": 'HrbmBQdxp5QWTE3wB5eBQ9ZmkawMLWwYv1nVJznTr4h4'
    }
  ]
}

PreviousGet All Pools for a CreatorNextGet Migration details of a Pool

Last updated 1 month ago

Was this helpful?

📀