Cannot get balances without switching to ethereum network

const options = {
  chain: "polygon"
const balance = await Moralis.Web3API.account.getNativeBalance(options);

Hi, the above code works perfect except the fact that it switches to ethereum network even while fetching balances for the polygon network. Please help me to resolve this…

This code does not change the network.

Switching network happens with await Moralis.switchNetwork function. Maybe this is getting executed while running your code.

1 Like

Thanks man it worked :slight_smile:

1 Like