Skip to content

Instantly share code, notes, and snippets.

@p14n
Created May 15, 2018 20:09
Show Gist options
  • Save p14n/ed08739cd79a6e771dfa6e323beef722 to your computer and use it in GitHub Desktop.
Save p14n/ed08739cd79a6e771dfa6e323beef722 to your computer and use it in GitHub Desktop.
Contract events
const eventToAction = name => (err, result) => {
store.dispatch({ type: "event", name: name, ...result.args });
};
contract.PaidEvent().watch(eventToAction("paid"));
contract.ReclaimedEvent().watch(eventToAction("reclaimed"));
contract.Instantiated().watch(eventToAction("created"));
contract.KilledStateChange().watch(eventToAction("killed"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment