Send transactions web3 provider WalletConnect

2 issues -

  1. if i am using BSC main net server - Send transaction for BNB works for testnet as well

  2. Send transaction for BNB does not go through in mobile browsers safari/chrome - with wallet connect , it does not show anything!

For issue 1: can you give more info of what you are doing? Like how are you sending those transactions?
for issue 2: what it happens? what did you do? does it work if opening MetaMask mobile application and from there using its own browser?

Issue 1 - i created a main net server, i connected to it via Moralis SDK and authenticated it. Then i tried to send the transaction. Now as it is BSC Main net, i think it should only support bsc main network chain but when when i connect to BSC test net in metamask and then try to aithenticate and send BNB , it still send it.

Issue 2 - It is working from inside the metamask app.

I am authenticating via Moralis and then triggering a transfer by Moralis. Authentication works by chrome/safari in mobile but send transaction does not work.

That is expected for me, you can check what network id has MetaMask from your code if you want to block that, but at the end MetaMask will send the transaction directly to the node that it has in its configuration.

How do you trigger that transfer by Moralis?

Then what is the use of Mainnet servers and testnest servers? If i send a payment via testnet , there is no way to differentiate it then! How can i make a payment only to one network in a flow?

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 })