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?