1

i'm trying to send a transaction via bsc using WalletConnect and web3

This is the connection code

    const provider = new WalletConnectProvider({
  rpc: {
    1: "https://bsc-dataseed.binance.org/",
    2: "https://bsc-dataseed1.defibit.io/",
    3: "https://bsc-dataseed1.ninicoin.io/",
    // ...
  },
});

async function () {

  await provider.enable();

  //  Get Accounts
  web3.eth.getAccounts((error, accounts) => {
    if (error) alert(error)
    this.account = accounts[0]
  })

And this is the cransaction call

web3.eth.sendTransaction({
          to: '0x...',
          from: this.account,
          value: 1000000000000, //test value
        }, ((error, hash) => {
          if (error) alert(error)
          else console.log(hash)
        }));

The problem is that on my trust wallet the transaction is on the ETH blockchain, even if i can read my bsc token balance correctly. Any ideas?

1 Answer 1

0

You need to set the network ID, not just the providers, not sure where but thats what you need to look for

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.