Custom Approach
Last updated
Was this helpful?
Last updated
Was this helpful?
Read more about Custom Approach .
Inherit contract in your contract
Replace msg.sender
in your contract with msgSender()
Inherit contract in your contract
Replace msg.sender
in your contract with msgSender()
Deploy contract on the desired network.
Now the contracts are updated and deployed, it's time to do the changes on your client-side.
After Registering Your dApp, SmartContact & Contract method on Desired network on Biconomy Dashboard, copy the <api-key>, you will need it on the client-side code.
It is important that you need to make 2 providers on your client-side.
One normal provider from your connected wallet eg window.ethereum
for Metamask, to take the User Signature on the wallet pop-up window.
Second provider object to be used with Biconomy to send the transaction. This second provider (network provider) should be a provider initialised with network RPC URL.
That's it.
In this custom approach instead of calling you contract methods directly, you will need to call executeMetaTransaction() method and pass your contract method in functionSignature
along with other params.
So the flow will be like this, to take the user signature you need to use the wallet provider. Once you get the user signature, pass that signature in the executeMetaTransaction()
along with functionSignature
and other params and call executeMetaTransaction() method using the second provider which was passed to Biconomy object.
In basic terms, you need one provider object for sending meta transactions using Gasless SDK (EOA), another for signing meta transaction parameters.
Gasless SDK (EOA) fetches data from Biconomy's servers. Because of this, it's best to initialize your dApp or perform any action after the biconomy.READY event occurs.
If there is an error while initializing Gasless SDK (EOA), it's good to catch and log a biconomy.ERROR event for better debugging.
You can use Gasless SDK (EOA) either with or . We'll be making two provider objects, one linked to your dApp's network RPC, and the other to your user's wallet.
for complete example code
for complete example code