walletconnect-monorepo: Ethers.js MetaMask Mobile error: eth_sendTransaction

Not sure where this issue originates - MetaMask, Ethers.js, or here. Apologies if this is the wrong place.

Issue

Attempting to fire a transaction fails with error The method eth_sendTransaction does not exist/is not available.

This flow works for WalletConnect with the test wallet (test.walletconnect.org). It also works well with MetaMask browser extension (ie. not using WalletConnect)

@walletconnect/web3-provider v1.0.13 @ethersproject/providers ^5.0.4

const provider = new WalletConnectProvider({
      infuraId: infuraKey // Required
});

await provider.enable();
const walletProvider = new Web3Provider(provider);

contracts[name] = new Contract(
   CONTRACTS[name][networkName],
    CONTRACTS[name].abi,
    walletProvider
);

const approvalAmount = amountBn || parseUnits("500000", 18);
const tx = await contracts[token].approve(
  spender,
  approvalAmount
);

Discussion

Going to continue researching…

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 18 (4 by maintainers)

Most upvoted comments

IT WORKS!!!

    "@ethersproject/contracts": "^5.0.1",
    "@ethersproject/providers": "^5.0.4",
    "@walletconnect/web3-provider": "1.2.0-alpha.0",

Could you try the following which we are currently testing?

  1. Install pre-release version available on NPM at next tag (v1.2.0-alpha.0)
  2. Make sure that you get the Signer from the provider

Example:

const web3Provider = new WalletConnectProvider(..)

const provider = new ethers.providers.Web3Provider(web3Provider)

const tokenContract = new Contract(tokenAddress, tokenAbi, provider.getSigner())

@moodysalem Does this still happen with the latest version? I thought this was fixed? What version are you using? Can you provide a code snippet with an ABI?

No. The ethers issue I linked is fixed in the latest version.

However, this WalletConnect issue on which we are commenting is broken with the latest ethers version. So we cannot upgrade to the latest ethers version in the Uniswap Interface without breaking WalletConnect. And we need to upgrade ethers to fix the ethers issue.

I’m asking if you have any insight into how to fix this WalletConnect/ethers compatibility issue in the latest version of ethers.

Hey, just wanted to see what the latest is on this issue and if there’s any known workarounds? Thought I must have been making a simple mistake but apparently this is quite the tricky issue. In this instance I’m seeing the error when trying to send a transaction with ethers + Argent via WalletConnect

  • WalletConnect v1.1.0
  • Web3Modal v1.9.0
  • ethers v5.0.7