0

I have a contract with the following event (using 0.4.24):

event UpdateProgress(bool _gameInProgress);

I am registering the contract like this:

import Web3 from 'web3';
import address from './address';

const web3 = new Web3(window.web3.currentProvider);
const abi = [{...}}


// Access to our contract that exists on the blockchain.
export default new web3.eth.Contract(abi, address);

When I call the events object in my JS:

// Contract
import leaderboard from './leaderboard';


console.log(leaderboard.events.allEvents());

All events is empty. What am I doing incorrect here?

bumped to the homepage by Community yesterday

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

0

Please find documentation on it.

There is pretty good example how to use it. E.g:

var events = leaderboard.allEvents({fromBlock: 0, toBlock: 'latest'});
events.get(function(error, logs){ /* handle events here... */ });
  • Appreciate the comment. Not fully the issue though. ABI issues. – Tulun Nov 20 '18 at 23:25
0

Just need to update my ABI. Figured this out ages ago. Derp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.