Avalanche And Polygan native Prices

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 :slight_smile:


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:

  1. exchangeAddress: “0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32”

  2. exchangeName: “Quickswap”

  3. nativePrice:

  4. decimals: 18

  5. name: “Matic Token”

  6. symbol: “MATIC”

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

What kind of address is this?

Is the address I get from coin market cap and also from coingecko

Captura de ecrã 2021-12-15, às 15.07.17|675x241

We may not support that type of address

So what about Matic on Polygan… why usd price is zero?

And in avalanche without that type of address how to fetch usd price of AVAX?

you want the price of AVAX, or Matic? and not necessarily to get the price from those networks? In that case maybe you can query that price on ETH or BSC network for AVAX and Matic

I need both. Ok, that’s a solution. But I’m not sure that AVAX exists in BSC or ETH…