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 🙏

© 2026 – Pkg Stats / Ryan Hefner

eosws

v1.3.1

Published

`eosws` JavaScript/TypeScript bindings (from the [dfuse API](https://dfuse.io/))

Readme

eosws Js/Ts bindings (from the dfuse API)

WebSocket consumer for the https://dfuse.io API on EOS networks.

Acknowledgement

A big thanks (and hug) to our dear friend Denis Carriere from EOS Nation for creating the initial version of this project.

Quickstart

Available endpoints:

  • Mainnet wss://mainnet.eos.dfuse.io/v1/stream?token=[API TOKEN]
  • Kylin wss://kylin.eos.dfuse.io/v1/stream?token=[API TOKEN]

Get Actions

import WebSocket from "ws"
import { get_actions, parse_actions } from "eosws"

// Get started with a free dfuse streaming API account.
// https://dfuse.io/#subscribe
const API_TOKEN = "eyJ...IBg"
const origin = "https://example.com"
const ws = new WebSocket(`wss://<SERVER>/v1/stream?token=${API_TOKEN}`, { origin })

ws.onopen = () => {
  ws.send(get_actions({ account: "eosio.token", action_name: "transfer" }))
}

ws.onmessage = (message) => {
  const actions = parse_actions(message.data)

  if (actions) {
    const { from, to, quantity, memo } = actions.data.trace.act.data
    console.log(from, to, quantity, memo)
  }
}

Get Table Rows

import { get_table_rows, parse_table_rows } from "eosws"

ws.onopen = () => {
  ws.send(get_table_rows({ code: "eosio", scope: "eosio", table_name: "voters" }))
}

ws.onmessage = (message) => {
  const table = parse_table_rows<Voters>(message.data, voters_req_id)

  if (table) {
    const { owner, producers, last_vote_weight } = table.data.row
    console.log(owner, producers, last_vote_weight)
  }
}

Related Javascript

Related Video

API

Table of Contents

OptionalParams

Type: Object

Properties

  • req_id string An ID that you want sent back to you for any responses related to this request.
  • start_block number Block at which you want to start processing. It can be an absolute block number, or a negative value, meaning how many blocks from the current head block on the chain. Ex: -2500 means 2500 blocks in the past, relative to the head block.
  • fetch boolean Whether to fetch an initial snapshot of the requested entity.
  • with_progress number Frequency of the progress of blocks processing (within the scope of a req_id). You will, at a maximum, receive one notification each 250 milliseconds (when processing large amounts of blocks), and when blockNum % frequency == 0. When you receive a progress notification associated with a stream (again, identified by its req_id), you are guaranteed to have seen all messages produced by that stream, between the previous progress notification and the one received (inclusively).

get_actions

Get Actions

Parameters

  • data object Data Parameters
    • data.account string Contract account targeted by the action.
    • data.receiver string? Specify the receiving account executing its smart contract. If left blank, defaults to the same value as account.
    • data.action_name string? Name of the action called within the account contract.
    • data.with_ramops boolean? Stream RAM billing changes and reasons for costs of storage produced by each action.
    • data.with_inline_traces boolean? Stream the inline actions produced by each action.
    • data.with_deferred boolean? Stream the modifications to deferred transactions produced by each action.
  • options OptionalParams Optional Parameters (optional, default {})

Examples

ws.send(get_actions({ account: "eosio.token", action_name: "transfer" }))

Returns string Message for ws.send

get_transaction

Get Transaction

Retrieve a transaction and follow its life-cycle. BETA: some life-cycle events are still being rolled out.

Parameters

  • id string The transaction ID you're looking to track.
  • options OptionalParams Optional Parameters (optional, default {})

Examples

ws.send(get_transaction("517...86d"))

Returns string Message for ws.send

get_table_rows

Get Table Rows

Retrieve a stream of changes to the tables, as a side effect of transactions/actions being executed.

Parameters

  • data object Data Parameters
    • data.code string Contract account which wrote to tables.
    • data.scope string Table scope where table is stored.
    • data.table_name string Table name, shown in the contract ABI.
    • data.json boolean With json=true (or 1), table rows will be decoded to JSON, using the ABIs active on the queried block. This endpoint will thus automatically adapt to upgrades to the ABIs on chain. (optional, default true)
    • data.verbose boolean? Return the code, table_name, scope and key alongside each row.
  • options OptionalParams Optional parameters (optional, default {})

Examples

ws.send(get_table_rows({ code: "eosio", scope: "eosio", table_name: "global" }))

Returns string Message for ws.send

unlisten

Unlisten

To interrupt a stream, you can unlisten with the original req_id

Parameters

Examples

ws.send(unlisten("original-request-id"))

generateReqId

Generate Req ID

Examples

generateReqId() // => req123

Returns string Request ID

parse_actions

Parse Actions from get_actions from WebSocket onmessage listener

Parameters

  • data WebSocketData WebSocket Data from message event
  • req_id string? Request ID

Examples

const actions = parse_actions < any > message

Returns ActionTrace Action Trace

parse_table_rows

Parse Table Deltas from get_table_rows from WebSocket onmessage listener

Parameters

  • data WebSocketData WebSocket Data from message event
  • req_id string? Request ID

Examples

const table_deltas = parse_table_rows < any > message

Returns ActionTrace Action Trace

parse_ping

Parse Ping from WebSocket onmessage listener

Parameters

  • data WebSocketData WebSocket Data from message event

Examples

const ping = parse_ping(message)

Returns Ping Ping