Hi.
I have a page where I call the native price of different tokens for BSC, and that is working great. But in the same page I also want to show the price of AVAX and MATIC, but with no success. Iāll Appreciate any help I can get
The code Iām using for Polygon is:
const optionsMATIC = {
address: ā0x0000000000000000000000000000000000001010ā,
chain: āmaticā
};
var priceMATIC = await Moralis.Web3API.token.getTokenPrice(optionsMATIC);
console.log(priceMATIC);
And for this the result is:
-
exchangeAddress: ā0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32ā
-
exchangeName: āQuickswapā
-
nativePrice:
-
decimals: 18
-
name: āMatic Tokenā
-
symbol: āMATICā
-
value: ā0ā
And for Avalanche I have this code:
const optionsAVAX = {
address: āFvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Zā,
chain: āavalancheā
};
var priceAVAX = await Moralis.Web3API.token.getTokenPrice(optionsAVAX);
console.log(priceAVAX);
where the result is:
Uncaught (in promise) {code: 141, error: āInvalid hex numberā}