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 splPriceInSol
function 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 splPriceInSol
function with your own param(desired token address).
splPriceInSol("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
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