steemradar

An event-driven JavaScript library for streaming Steem blockchain.

Usage no npm install needed!

<script type="module">
  import steemradar from 'https://cdn.skypack.dev/steemradar';
</script>

README

SteemRadar.js

Build Status NPM version GitHub license Downloads Powered by utopian.io

An event-driven lightweight library for streaming Steem blockchain.

Installation

Using npm:

npm install steemradar

RPC Servers

wss://anyx.io By Default

wss://appbasetest.timcliff.com

  • Note: this library currently supports web sockets only

API

Usage

Create a new instance

const { Client } = require("steemradar"),
  client = new Client({ nodeURL: "wss://anyx.io" });

Settings

The following command will set transaction by operation property:

client.blockchain.setStreamOperations(true); // default false

The following command will set custom comment options:

client.blockchain.setCommentOptions({
  authors: ["steem"]
});

The following command will set custom transfer options:

client.blockchain.setTransferOptions({
  senders: ["steem"],
  receivers: ["steem"]
});

The following command will set custom funds track options:

client.blockchain.setFundsTrackOptions({
  parentSender: "steem"
});
  • Note: All these commands you can call them more than once like using them in multiple cases for more flexibility, And all events will be reset by your latest options.

Reset all settings example:

client.blockchain.settings.clear();

Flexible events

Event: transaction

Event: transaction:<transactionType>

Event: transaction:<transactionType>:<customParent>

Event: transaction:<transactionType>:<customParent>:<customChild>

Error handling

Event: error

Custom events parent/child types

Type Custom Parent Custom Child
account count
transaction transfer funds track
transaction transfer memo profane
transaction comment parent
transaction comment child
transaction comment body mention
transaction comment body profane
transaction comment author blacklisted
transaction vote positive
transaction vote negative
  • Note: the table above is just the built-in custom parents/child moreover you can use any operation type property

Examples

client.blockchain.on("transaction", trx => {
  console.log(trx);
});
client.blockchain.removeAllListeners("transaction");
client.blockchain.once("transaction:vote:positive", trx => {
  console.log(trx);
});
client.blockchain.once("transaction:feed_publish", trx => {
  console.log(trx);
});
client.blockchain.on("error", err => {
  console.error(err);
});

Contribute

All contributions are welcome by opening a new pull request, And for suggests or feature request please open a new issue.

Bugs

Please open a new issue for any bug.

License

MIT