Skip to content

Instantly share code, notes, and snippets.

@janx
Created January 9, 2016 11:48
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 janx/8a82c4294421daef347c to your computer and use it in GitHub Desktop.
Save janx/8a82c4294421daef347c to your computer and use it in GitHub Desktop.
Web3.js event watch problem
// if 2nd arg is 'latest', everything is fine
var event = book.NewRecord(null, 'latest');
//event.get(function(err, results) {
// console.log(results);
//});
event.watch(function(err, result) {
if(err) {
console.log("error:", err);
} else {
console.log(result);
}
});
// if 2nd arg is {fromBlock: 0, ...}, I get infinite errors on line#23:
// error: Error: Can only serialize integers(...)
var event = book.NewRecord(null, {fromBlock: 0, toBlock: 'latest'});
//event.get(function(err, results) {
// console.log(results);
//});
event.watch(function(err, result) {
if(err) {
console.log("error:", err);
} else {
console.log(result);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment