0.6.1 • Published 3 years ago

@aloxide/demux v0.6.1

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
3 years ago

Table of content

Package @aloxide/demux

Implement demux pattern for sync data from blockchain to a centralized database.

Usage

real samples

ExpressActionWatcher: Exposes the API methods from the BaseActionWatcher through an Express server.

const expressWatcher = new ExpressActionWatcher(
  actionReader,
  actionHandler,
  pollInterval,
  portNumber,
);

expressWatcher.listen();

Now you can start watching for block data by making POST /start request, and to stop receiving block data by making POST /pause request. Between these requests, actionReader will read block data from the blockchain and passing it to actionHandler.

AloxideActionWatcher: A ready-to-use action watcher with ability to get only one block per request e.g. using in a lambda function.

Call watchOnce to read data of only one block (specified by startAtBlock option), for example when you want to read the blockchain once per lambda invocation.

const actionWatcher = new AloxideActionWatcher(actionReader, actionHandler, 1000);
await actionWatcher.watchOnce(); // `actionHandler` will be run once
0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago