Skip to content

Instantly share code, notes, and snippets.

@rahuldamodar94
Created August 18, 2020 14:54
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/fa277fbacaf03c8a8fb8a36437004ad4 to your computer and use it in GitHub Desktop.
Save rahuldamodar94/fa277fbacaf03c8a8fb8a36437004ad4 to your computer and use it in GitHub Desktop.
let Web3 = require("web3");
let artifacts = require("./abi.json");
const provider = new Web3.providers.WebsocketProvider(
"wss://ws-mumbai.matic.today"
);
const web3 = new Web3(provider);
const rootContractInstance = new web3.eth.Contract(
artifacts,
"0x2E81cA2533C82caE6fca5D9b521FD9c46f8aa1Ba"
);
rootContractInstance.events
.Data(
{
address: "0x2E81cA2533C82caE6fca5D9b521FD9c46f8aa1Ba",
},
function (error, event) {
console.log(event);
}
)
.on("connected", function (subscriptionId) {
console.log(subscriptionId);
})
.on("data", function (event) {
console.log(event); // same results as the optional callback above
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment