Skip to content

Instantly share code, notes, and snippets.

@rahuldamodar94
Created November 7, 2020 08:21
Show Gist options
  • Save rahuldamodar94/38585f1f90b09329f4b1771aa4bbd658 to your computer and use it in GitHub Desktop.
Save rahuldamodar94/38585f1f90b09329f4b1771aa4bbd658 to your computer and use it in GitHub Desktop.
biconomySample.js
let Biconomy = require("@biconomy/mexa");
let abi = require('./testabi.json')
let Web3 = require("web3")
const biconomy = new Biconomy(window.ethereum,{apiKey: "A8U9q3qVt.66db9879-a33c-4551-98b0-7016616eb1ab"});
web3 = new Web3(biconomy);
biconomy.onEvent(biconomy.READY, async () => {
console.log("successs")
try{
// Initialize your dapp here like getting user accounts etc
await window.ethereum.enable();
contract = new web3.eth.Contract(abi,"0xd393b1E02dA9831Ff419e22eA105aAe4c47E1253");
tx = await contract.methods.executeMetaTransaction(
"0xfd71dc9721d9ddcf0480a582927c3dcd42f3064c",
"0x2e1a7d4d000000000000000000000000000000000000000000000000000000000000000a",
"0xe715f553b64bb58834bd2d03f0412322da982afe16cb0858c342dc8baff53438",
"0x7804dded77f0a124ee4fd8d6e928c619b0596ddf5ab47820e162d8b80aa27291",
27).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