Network error when loading some components (ethereum-bilerplate)

I’m testing the new ethereum boilerplate (https://github.com/ethereum-boilerplate/ethereum-boilerplate).
I’ve followed all the steps

  1. installed dependencies
  2. started a server – now trying a non-local server because I assumed it could a CORS issue (but this happens whether I used a local network or a test network)
  3. Changed the .env file

I am getting a network error every time I load some components.

Would be able to help me understand what the problem may be?
Many thanks

you could try http://127.0.0.1:3000/ instead of localhost if you get CORS errors

thank you. I’ve tried but no luck (same network error)

did you connect to MetaMask?

Yes. I did connect. :confused:

I connected but my wallet balance is not updating. Don’t know if this is related but I get all these errors on the browser console when I reload the app.

getNativeBalance will not work with local devchain, if that is what you are trying to do

1 Like

I see. Thank you. I’m assuming this means I have to build and deploy to a testnet or a mainnet? If so could you please point me to any documentation on how to do that?

It’s my first dApp – I am very familiar with Firebase and Vue but this is a Moralis and React boilerplate so, in a way, I’m starting from scratch.

I think that in particular to get native balance, you don’t have to deploy anything, only to specify a testnet or mainnet chain as parameter

You mean on the .env file? Like this:

No, I mean getNativeBalance has some parameters: https://docs.moralis.io/moralis-server/web3-sdk/account#getnativebalance

1 Like

Thank you. I’m trying to understand where the sequence of events is failing.
The getNativeBalance function is only called on the useNativeBalance hook.
The chain name is hardcoded in the useNativeBalance.js

To debug I could just just change that to a test network like “Mumbai”, but I can’t be sure if that is the exact string. Do you know what is the right string of the Mumbai chain in the useMoralisWeb3ApiCall?

Ideally I would have this done dynamically every time a user decides to change chain on the useChain.js hook but the hook is failing to recognise the Mumbai’s chain ID

Any guidance on this?
Many thanks

you can look in https://admin.moralis.io/web3Api to get the exact names for the chains.
in particular the string is mumbai

but, it should be better to add your questions to this thread: Ethereum Boilerplate Questions

1 Like