Hello everyone, After successfully fetching the BSC token prices for both tokenOne and tokenTwo, but my problem is how will I fetch all the tokenprices listed in the bsctokenlist.json. I tried to enable switching tokens in the swap box to ensure that the token prices update accordingly. Unfortunately, only the prices for tokenOne and tokenTwo are displayed, and I am seeking a solution to resolve this issue and display tokenprices for all bsc tokens in my created json file. How can I address this problem?
app.get("/tokenPrice", async (req, res) => {
const {query} = req;
({
apiKey: ""
});
const responseOne = await Moralis.EvmApi.token.getTokenPrice({
"chain": "0x38",
"exchange": "pancakeswapv2",
"address": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
});
const responseTwo = await Moralis.EvmApi.token.getTokenPrice({
"chain": "0x38",
"exchange": "pancakeswapv2",
"address": "0x2170Ed0880ac9A755fd29B2688956BD959F933F8"
});
const usdPrices = {
tokenOne: responseOne.raw.usdPrice,
tokenTwo: responseTwo.raw.usdPrice,
ratio: responseOne.raw.usdPrice/responseTwo.raw.usdPrice
};
return res.status(200).json({usdPrices});
});