Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility between Web3Auth and Biconomy w/ React TS (error while getting transaction receipt) #661

Open
mdr-altdev opened this issue Oct 2, 2022 · 2 comments

Comments

@mdr-altdev
Copy link

Describe the bug

I want to use Biconomy + Web3Auth in a Next.js typescript project, and I found an issue with the provider interfaces.
I am using web3 1.7.3, @web3auth/web3auth 2.0.2, @biconomy/mexa 3.0.4

This is the way I initialize Web3Auth + Biconomy (classic way):

const web3auth = new Web3Auth({
  clientId,
  chainConfig: {
    chainNamespace: "eip155",
    chainId: "0x13881",
    rpcTarget: "https://polygon-mumbai.infura.io/v3/{INFURA_PROJ_ID}",
  },
})
await web3auth.initModal()

if (web3auth.provider) {
  const biconomy = new Biconomy(web3auth.provider, {
    apiKey: apiKey,
    debug: true,
    contractAddresses: [HelloWriter],
  })
  await biconomy.init()
}

After init, I wish to call a contract function using biconomy.provider (which comes from the web3auth.provider).
The call actually works, and the transaction is mined (in the Biconomy debug logs, I can see Tx Hash mined message received at client with id...), however the eth_getTransactionReceipt call fails:

invalid argument 0: json: cannot unmarshal non-string into Go value of type common.Hash

I am suspecting an incompatibility between the web3auth provider (which is expected to be EIP1193) and the ExternalProvider interface used within Biconomy.

I know that @shahbaz17 made a working example of Web3Auth + Biconomy (https://github.com/shahbaz17/biconomy-web3auth-example), and I can also reproduce it on my side, but I can't figure out how to make it work in a Typescript React environment (tested both with Next and vanilla React), built with the NPM packages and not using the ones from the CDN.

It is worth noting than when I switch to ethers.js (while doing exactly the same thing), the transaction doesn't succeed: it is broadcast to the RPC node, but it fails.

To Reproduce

I am using Web3Auth's nextjs-evm-web3auth-example template as a basis, on top of which I have only added the Biconomy conf, as well as a very simple call to a ERC2771-enabled ERC721 contract. This is the repo:
https://github.com/mdr-altdev/web3auth-biconomy-poc

This is deployed on Vercel:
https://web3auth-biconomy-poc-eu5k.vercel.app/
-> After logging in (whether with Metamask or social login), click "Mint NFT" to reproduce

Expected behavior

I would expect the eth_getTransactionReceipt request made by the provider not to fail, and receive a proper notification when the tx goes through.

Screenshots

Here are the logs that I get (most of them are on the Biconomy side, with debug enabled):
Screen Shot 2022-10-02 at 13 02 28

Device Info (please complete the following information):

  • Device: Mac M1
  • OS: MacOS Monterey
  • Browser: chrome
  • Version 105
  • web3 1.7.3, @web3auth/web3auth 2.0.2, @biconomy/mexa 3.0.4
@arav06
Copy link

arav06 commented Nov 27, 2022

facing the exact same issue. would appreciate it if web3auth could take a look at it

@malay44
Copy link

malay44 commented Jun 5, 2023

hey i am facing the same issue but i don't think it's due to web3auth, cause i am not using it then also i am having the same error

@arav06 and @mdr-altdev can you guys pls tell me how did you overcome this error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants