[SOLVED] Why Does "Get All Polygon" ERC20 Tokens Not Include Matic Token?

When I call to https://deep-index.moralis.io/api/v2/{address}/erc20?chain=matic&format=decimal

I get a list of all the erc20 tokens on the polygon network for that user EXCEPT not maticā€¦

Why is this not included?? Thatā€™s like the main one when you are on polygon networkā€¦ :thinking:

Matic is the native currency that you get it separately, it is not an erc token.

1 Like

Ahhhh, I see now that I can get the matic token balance by calling the endpoint with ā€œ/balanceā€ rather than ā€œ/erc20ā€.

Thanks @cryptokid :+1:

2 Likes

Okay so how I get a userā€™s Matic balance from their metamask using Moralis? sorry I canā€™t find it in documentation.

https://docs.moralis.io/moralis-server/web3-sdk/account#getnativebalance

1 Like

Thank you. So now I have another question. I have 0.9527 MATIC in my metamask but this function is returning balance: "952715967636363640".

Why is that? it doesnā€™t return values less than 1 with 0. in front of it? how can i fix this?

https://docs.moralis.io/moralis-server/tools/moralis-units

1 Like