Move V1 to V2 got error getNativeBalance

I changed V1 to V2 is OK.

But my function get balance not work:

const fetchNativeBalance = async () => {
    const result = await Web3Api.account
      .getNativeBalance({
        chain: process.env.NEXT_PUBLIC_MAIN_NET,
        address: user?.get('ethAddress'),
      })
      .catch((e) => console.log(e));
    if (result && result.balance) {
      setEthBalance(Math.round(Moralis.Units.FromWei(result.balance) * 10000) / 10000);
    }
  };

I must change code for V2 ?

Maybe there is more info for that invalid request in the response.

I check and got error:
sometimes call OK and sometimes call failed

Check the parameters to see if there is any difference

1 Like

I checked, chain is Goerli => not working, chain is 0x5 => worked.

2 more question:

How to call cloud functions in self-host ?
How to run job same remote server?

You can run cloud functions with a similar syntax as before. Parse.Cloud.run may work.

For jobs you can run them with cron directly or you can install a module for jobs in parse server

I must run cmd:
moralis-admin-cli watch-cloud-folder --moralisApiKey cviqqXXhrv84 --moralisApiSecret WiFnf36YB1V --moralisSubdomain bzdj4a6yi.usemoralis.com --autoSave 1 --moralisCloudfolder β€œ/Users/vng/Downloads/Learn/jugaro/cloud”

for update code cloud after edit code cloud?

My cloud function :slight_smile:


image

You have to copy the cloud code in your self hosted server cloud file first. Moralis admin cli doesn’t work in this case.

I copy to this: main.js
image

That could be the file. You Amy have to change it a little to use Parse. syntax instead of Moralis. Syntax

1 Like

Hi bro, Why could not found Collection EthTransactions in my self-host MongoDB local

I transfer ETH successful but no EthTransactions tracking collection.

image