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):
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
The response to eth_getTransactionReceipt would be null unless the transaction is mined. So, ideally, you can subscribe to the txMined event to receive a notification when the transaction goes through.
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):
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 theeth_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):
Device Info (please complete the following information):