ethjs-contract icon indicating copy to clipboard operation
ethjs-contract copied to clipboard

RFC: Integrate eth-block-tracker for subscribable queries

Open danfinlay opened this issue 8 years ago • 3 comments

Feature Proposal

Description

What if ethjs queries returned promEvents, somewhat like [email protected] plans to have.

In addition to calling .then() on a result, you could subscribe to updates. Imagine:

token.balanceOf(my_address).on('latest', updateBalanceView)

Should be easier than ever with eth-block-tracker.

danfinlay avatar Apr 20 '17 01:04 danfinlay

oooooo. We can do this. But I would make in it's own module, and have hooks for it in different modules.

SilentCicero avatar Apr 20 '17 13:04 SilentCicero

Yeah maybe it could be like ethjs-event-contract, and its initialization takes an ethjs-contract and an eth-block-tracker, and allows subscribing to updates on any property constant function of that contract, as well as maybe access to a synchronous property cache, of last-retrieved values?

danfinlay avatar Apr 22 '17 20:04 danfinlay

Yes, that could work and would reduce bulk/module complexity on the main contract object.

SilentCicero avatar Apr 23 '17 19:04 SilentCicero