How can I get USD price of a Pumpfun token without using an API?

I am able to get info of a pumpfun token using getAccountInfo on the bonding curve address, but it does not contain the USD price of the token.

This is the code I have so far to get pumpfun token info

export const getPumpfunBondingCurveAccountData = async(wallet: Wallet, mint: PublicKey) => {

    const provider = new AnchorProvider(connection, wallet, { commitment: "confirmed" })
    const pumpfunProgram = new Program<PumpFun>(IDL as PumpFun, provider)

    // get bonding curve PDA
    const bondingCurvePDA = PublicKey.findProgramAddressSync(
        [Buffer.from(PUMPFUN_BONDING_CURVE_SEED), mint.toBuffer()],
        pumpfunProgram.programId
    )[0]
    const tokenAccount = await connection.getAccountInfo(bondingCurvePDA, "processed")
    if (!tokenAccount) {
        console.log(`Token account not found for pumpfun token ${mint.toBase58()}`)
        return
    }
    console.log(`Token account owner:${tokenAccount.owner.toBase58()}`)
    let bondingCurveAccount = BondingCurveAccount.fromBuffer(tokenAccount.data)
    console.log("-- Bonding Curve Account ---")
    console.log(bondingCurveAccount)
    return bondingCurveAccount
}

This outputs an info like the following in the console

Token account owner:6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P
-- Bonding Curve Account ---
BondingCurveAccount {
  discriminator: 6966180631402821399n,
  virtualTokenReserves: 936194487413872n,
  virtualSolReserves: 34383881167n,
  realTokenReserves: 656294487413872n,
  realSolReserves: 4383881167n,
  tokenTotalSupply: 1000000000000000n,
  complete: false
}

Is there any way I can get the USD price or USD marketcap of the token from this data?

Related Articles

how to Filter Raydium Pool with geyser

is there anyone know how to filter the raydium pool newly created pairs with geyser python, transaction { signatures: “G337364220355377210257334275137736315314$34692025425535132427620505330]f324265370Z360f27125330122321w254315351Q227 31DJ357e6243203255CL202312r27200” message { header {…

Responses

Your email address will not be published. Required fields are marked *