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’}