npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

steem-interface

v1.2.2

Published

An interface to the Steem blockchain which supports multi-node redundancy for high availability systems.

Downloads

3

Readme

Steem Interface

An interface to the Steem blockchain which supports multi-node redundancy for high availability systems.

Installation

npm install steem-interface

Usage

const steem_interface = require('steem-interface');

steem_interface.init();
steem_interface.stream({ on_op: onOperation });

Methods

Init

Initialize the library and connect to the RPC nodes. Calling init() with no parameters will initialize with the default options, or you can specify an options object as shown below.

steem_interface.init({
  logging_level: 3,   // Level of console logging. 1 = minimal, 4 = full
	rpc_error_limit: 5,   // The number of errors responses from an RPC node in a 1 minute period before it's disabled for an hour
	rpc_nodes: ["https://api.steemit.com", "https://anyx.io", "https://rpc.usesteem.com"],  // Array of RPC node URLs
	save_state: saveState,  // Function to call to save the last block read to persistent storage. The last block number will be passed as a function parameter.
	load_state: loadState   // Function to call to load the last block from persistent storage so the app can pick up from where it left off after a downtime
});

Stream

Streams blocks from the blockchain as they come in.

steem_interface.stream({ 
  on_op: onOperation,   // Function to call every time a new operation is received
  on_block: onBlock     // Function to call every time a new block is received
});

function onBlock(block) { ... }
function onOperation(op, block_num, block_id, previous_block_id, transaction_id, block_time) { ... }

Api

Make a database API to the Steem RPC node(s).

steem_interface.api(method_name, params)
  .then(result => console.log(result))
  .catch(err => console.log(err));

Broadcast

Broadcast a transaction to the Steem blockchain.

steem_interface.broadcast(method_name, params, key)
  .then(result => console.log(result))
  .catch(err => console.log(err));

Transfer

Helper function to broadcast a transfer operation. Note that amount must be in the format #.### [STEEM|SBD].

steem_interface.transfer(from, to, amount, memo, key);

Custom JSON

Helper function to broadcast a custom_json operation. This function will retry the transaction up to 3 times if it fails after a delay to deal with the one custom_json transaction per account per block restriction on the Steem blockchain. After HF21 (scheduled for August, 2019) this limit will be increased to 5 custom_json transactions per account per block so this may no longer be necessary.

steem_interface.custom_json(id, json, account, key, use_active);