I have this function to obtain the price of matic, but it didnāt work for me, and it worked for me on the server served by moralis, and now it doesnāt work on my own server. and I notice that the cloud returns this error:
Invalid function: "getTokenPrice" {"code":141,"stack":"Error: Invalid function: \"getTokenPrice\"\n at handler (C:\\Users\\david\\Documents\\Programacion\\react\\Koolinart\\backend\\node_modules\\parse-server\\src\\Routers\\FunctionsRouter.js:120:13)\n at C:\\Users\\david\\Documents\\Programacion\\react\\Koolinart\\backend\\node_modules\\parse-server\\src\\PromiseRouter.js:72:20"}
Does the function have anything to do with the cloud? or is this error a part?
const getMaticPrice = async () => {
const options: any = {
address: '0xCC42724C6683B7E57334c4E856f4c9965ED682bD',
chain: "eth",
exchange: "PancakeSwapv2",
currencies: ["USD"]
};
const price = await Web3Api.token.getTokenPrice(options);
console.log('priceMatic', price);
setPriceMatic(price.usdPrice);
};
what would be the correct way to do it?