Skip to content

Instantly share code, notes, and snippets.

@stiv-yakovenko
Created July 29, 2017 22:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stiv-yakovenko/26994bbe32457bb69ef7694e98a5e7cf to your computer and use it in GitHub Desktop.
Save stiv-yakovenko/26994bbe32457bb69ef7694e98a5e7cf to your computer and use it in GitHub Desktop.
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'));
var abi = [{
"constant": false,
"inputs": [{"name": "jsn", "type": "string"}],
"name": "deposit",
"outputs": [{"name": "", "type": "int256"}],
"payable": false,
"type": "function"
}, {
"anonymous": false,
"inputs": [{"indexed": true, "name": "_sender", "type": "address"}, {
"indexed": false,
"name": "jsn",
"type": "string"
}],
"name": "Evt",
"type": "event"
}];
var medApi = {MAIN_CONTRACT_ID: "0x5cb023C894D7838Ee7C0eE43AFD8D10D75Cd89bd"};
medApi.contract = new web3.eth.Contract(abi, medApi.MAIN_CONTRACT_ID);
medApi.contract.events.Evt({fromBlock: 0, toBlock: 'latest'},function () {
}).on('data',function (evt) {
console.log("evt",evt);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment