Hi, I’ve used the ETH network instead of Polygon because I have no balances in Polygon Metamask. The output I am getting is a duplicate token balance for one coin that I have and no data fetched for the actual ETH I have in the wallet. Why could this be happening? I have coded exactly how I see the instructor code the project. My output and getStats() function are below.
Output:
(2) [{…}, {…}]
0:
balance: "1085471724297161"
decimals: "9"
logo: null
name: "FLOKI"
symbol: "FLOKI"
thumbnail: null
token_address: "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e"
[[Prototype]]: Object
1:
balance: "1085471724297161"
decimals: "9"
logo: null
name: "FLOKI"
symbol: "FLOKI"
thumbnail: null
token_address: "0x43f11c02439e2736800433b4594994bd43cd066d"
[[Prototype]]: Object
length: 2
[[Prototype]]: Array(0)
async function getStats () {
const balances = await Moralis.Web3API.account.getTokenBalances();
console.log(balances);
$tokenBalanceTBody.innerHTML = balances.map( (token, index) => `
<tr>
<td>${index+1}</td>
<td>${token.symbol}</td>
<td>${tokenValue(token.balance, token.decimals)}</td>
<td>button</td>
</tr>
`).join('');
}