Send transactions web3 provider WalletConnect

Moralis.transfer({ type: "native", amount: Moralis.Units.ETH(amount), receiver: response.address }).then(function (result) {});

The use of mainnet servers and testnet servers is that specific servers will automatically populate the corresponding tables that you have in your Moralis database with the information that it is available in those specific chains.

If you use something like: web3.eth.sendTransaction({to: "address_1", from:"address_2", value: Moralis.Units.ETH("0.1")}) does it work as expected?

But that’s not the case then, it is pushing testnet and main net data to mainnet servers and also mainnet and testnet data to testnet servers as well! So i don’t see any difference whether i create a main net or test net it allows all transactions from any server.

For this i need to create web3 client as wel, so then there will be 2 clients? It will also not work because it will not be able to find web3 client in movile browsers like chrome/safari, i will test it though

You need to handle actual chain before all transactions manually
Take a look at:

It will be a difference in what you will get to see in tables like EthBalance in your dashboard. And in what events you will be able to sync on a particular Moralis server for example.

Ok Thanks, i will try this, i guess this will help! Can you test the second issue please? Because that’s kind of important as most of the users use mobile browsers.

Do you mean it doesn’t work when you login via QR code using the mobile phone and pc or mobile phone only?

Ok this also have the same issue, we are enabling the web3 client but what if web3 client is not available? Like in mobile browsers and incognito modes where we use wallet connect! How do we solve then?

It will not work when you do not have web3 client - mobile browsers like chrome/safari , incognito mode in laptop/pc where web3 client is not available then we use wallet connect but then also buy will not work! Even identifying chainId doesnt work when we dont have web3 client

You can check if web3 injected using:

if (window.ethereum) {
  //do auth with metamask
} else {
  //do auth with walletconnect
}

when user auths via walletconnect you need to specify chain:

authenticate({ provider: "walletconnect", chainId: 56 })

This is fine, i am able to achieve this. This is not the problem. I am doing a BNB transaction and at that time i want to do it via wallet connect. How do i do that? Also i only want to do it on main network so i need to know the chainId!

Also there is a problem with specifying chainId in the walletconnect authenticate . If you try authenticating on testnet , it also goes through , even though i mentioned chainid as 56

You need to create custom web3 variable in case you want use WC:

const user = await Moralis.authenticate({ provider: "walletconnect" });
const web3 = await Moralis.Web3.activeWeb3Provider.activate();

To make transaction:

web3.eth.sendTransaction({to: "address_1", from:"address_2", value: Moralis.Units.ETH

In your frontend you can use all chains you want. It doesn’t work this way. Chains on server settings - chains from which server will sync info.

I will try this one!

No that’s ok. In authenticate for wallet connect if i mention 56, and if i am on testnet of metamask, it is still authenticating me. Which i guess is wrong as chain id is different.

chainId can be specified only for walletconnect

I ve sent you a solution for metamask chain detecting above