Created
August 18, 2020 14:54
-
-
Save rahuldamodar94/fa277fbacaf03c8a8fb8a36437004ad4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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