Integrate Gasless SDK (EOA)
Integrate Gasless SDK (EOA) on our client side to enable gasless transactions
Gasless SDK (EOA) can be installed either via npm repository or using standalone javascript file using html <script/> tag
Install Gasless SDK (EOA) via npm
npm install @biconomy/mexa
Import and Initialize Gasless SDK (EOA)
import { Biconomy } from "@biconomy/mexa";
const biconomy = new Biconomy(window.ethereum,{apiKey: "q9oEztJM8.e8ed08a7-5b38-48e3-b4c0-f66e6b66f407"});
web3 = new Web3(biconomy);
Initialize DApp after Gasless SDK (EOA) initialization
biconomy.onEvent(biconomy.READY, () => {
// Initialize your dapp here like getting user accounts etc
await window.ethereum.enable();
contract = new web3.eth.Contract(config.contract.abi, config.contract.address);
startApp();
}).onEvent(biconomy.ERROR, (error, message) => {
// Handle error while initializing mexa
console.log(error)
});
Congratulations 👏
You have now enabled meta transactions in your DApp. Interact with web3 the way you have been doing it.
Check out the full code here https://github.com/bcnmy/dapp-demo
Last updated
Was this helpful?