Skip to content

Instantly share code, notes, and snippets.

@rahuldamodar94
Created October 21, 2020 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahuldamodar94/e2510c1742ae6e8018fd23d9ad307d35 to your computer and use it in GitHub Desktop.
Save rahuldamodar94/e2510c1742ae6e8018fd23d9ad307d35 to your computer and use it in GitHub Desktop.
biconomy.js
let Biconomy = require("@biconomy/mexa");
let abi = require('./testabi.json')
let Web3 = require("web3")
const biconomy = new Biconomy(window.ethereum,{apiKey: "QmA4kP-Eu.8f858b94-9d32-4d73-9102-13f0e6e60659"});
web3 = new Web3(biconomy);
biconomy.onEvent(biconomy.READY, async () => {
try{
// Initialize your dapp here like getting user accounts etc
await window.ethereum.enable();
contract = new web3.eth.Contract(abi,"0xd393b1E02dA9831Ff419e22eA105aAe4c47E1253");
let tx = await contract.methods.withdraw("1").send({from: "0xFd71Dc9721d9ddCF0480A582927c3dCd42f3064C", gas: 800000})
console.log(tx)
}catch(err){
console.log(err)
}
}).onEvent(biconomy.ERROR, (error, message) => {
// Handle error while initializing mexa
console.log(error)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment