fetch-raydium-pool
fetch-raydium-pool copied to clipboard
Fetch Solana token price in SOL using Raydium SDK
Fetch token price in SOL on Raydium
Simple one file typescript module to obtain pool id and calculate the token price in SOL utilizing Raydium SDK, with given token address only.
Simple usage
-
Install this module.
yarn add spl-price-in-sol -
Import
splPriceInSolfunction from the package. -
Set RPC using your own QUICK NODE OR HELIUS. In env file...
RPC=https://mainnet.helius-rpc.com/?api-key=<your_key> -
Call
splPriceInSolfunction with your own param(desired token address).splPriceInSol("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); // USDC for testing purpose
I hope you guys implement this package into your large project and enjoy it!
Feel free to contribute to enhancing the package. Thanks for improving @Allen-Taylor