Getting NaN with "I cloned ZERION in 20minutes"


@mayjer (author of this great video?)

I have installed your code from the since i could not clone it from the repo itself and as described in the md file (=> empty react app).

After installing (see my previous post Zerion cloned: cloud functions error [Solved] ) the app runs…

but I get a NaN …

The Metamask is set to the ropsten network and the account has 2.996 ETH available…

What can be the reason?

Yes I made the Zerion Clone video. Glad you enjoyed it!

This may be a bug in the useCoinData() hook where it calculates the price in the case where there is only an eth balance and no token transactions. Take a look at the calculation of totalBalance in the hook. If you find the bug you’re welcome to make a pull request. Unfortunately, I won’t be getting back to this project for a while as there are some high priority back end features for Moralis we’re working on right now.

1 Like

If someone has solutions to this please post it here. :snail:

The problem is with “output.amount” value. I have tried to fix it whole day now.

How can I get metamask’s eth amount value to it?

          let totalBalance = 0;
          const newList = => {
            const output = { ...tokens };
            const tokenData = data[token.symbol.toUpperCase()];
            output.price = tokenData?.current_price || 0;
            output.image = tokenData?.image;
            output.amount = tokenValue(+output.balance, +output.decimals); //amount value NaN
            output.value = output.price * output.amount;
            totalBalance += output.value;
            output.valueTxt = tokenValueTxt(