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

spring-ship-tools

v1.0.1

Published

TypeScript utilities for connecting to and consuming EOSIO/Antelope/Spring State History (Ship) WebSocket endpoints

Readme

spring-ship-tools

TypeScript library for connecting to and consuming EOSIO/Antelope/Spring State History (Ship) WebSocket endpoints. Subscribe to blockchain blocks, action traces, and table deltas with support for both single-threaded and multi-threaded deserialization.

Features

  • WebSocket connection management with automatic reconnection
  • Block, action trace, and table delta subscriptions
  • ABI caching and deserialization via eosjs
  • Multi-threaded deserialization using worker threads
  • Promise queue for controlled message processing
  • TypeScript-first with full type definitions

Requirements

  • Node.js >= 22
  • An EOSIO/Antelope node with the State History Plugin enabled

Installation

npm install spring-ship-tools

Quick Start

import {
    StateHistoryConnection,
    ShipConsumer,
    BlockProcessor,
    EOSJsDeserializer,
    LocalAbiProvider,
    LocalBlockRepository,
} from 'spring-ship-tools';

async function main() {
    const deserializer = new EOSJsDeserializer({ threads: 1 });

    const ship = new StateHistoryConnection({
        endpoint: 'ws://your-ship-endpoint:8080',
        deserializer,
        connectionOptions: {
            allow_empty_deltas: true,
            allow_empty_blocks: false,
            allow_empty_traces: true,
            min_block_confirmation: 1,
        },
    });

    ship.on('error', console.error);
    ship.on('info', console.info);

    const abi = new LocalAbiProvider({
        rpcEndpoint: 'https://your-rpc-endpoint',
    });
    await abi.init();

    const processor = new BlockProcessor({
        deserializer,
        abiProvider: abi,
        failOnDeserializationError: false,
        deltaListeners: [
            {
                table: '*',
                contract: 'eosio.token',
                processor: async ({ delta }) => {
                    console.log('Delta:', delta);
                },
            },
        ],
    });

    processor.addTraceListener({
        account: 'eosio.token',
        name: 'transfer',
        processor: async ({ trace }) => {
            console.log('Transfer:', trace);
        },
    });

    const consumer = new ShipConsumer({
        repository: new LocalBlockRepository(START_BLOCK_NUM),
        consumerOptions: {
            end_block: END_BLOCK_NUM,
            fetch_deltas: true,
            max_messages_in_flight: 1,
            irreversible_only: false,
        },
        processor,
        blockDelay: 0,
    });

    await ship.startProcessing(consumer);
}

void main();

API

StateHistoryConnection

Manages the WebSocket connection to a Ship endpoint.

const ship = new StateHistoryConnection({
    endpoint: string,              // Ship WebSocket URL
    deserializer: IDeserializer,
    connectionOptions: {
        allow_empty_deltas: boolean,
        allow_empty_blocks: boolean,
        allow_empty_traces: boolean,
        min_block_confirmation: number,
    },
});

Events: info, debug, error, warning

BlockProcessor

Registers listeners for action traces and table deltas.

// Listen to table deltas
processor.addDeltaListener({
    contract: string,   // contract account name, or '*' for all
    table: string,      // table name, or '*' for all
    processor: (params) => Promise<void>,
});

// Listen to action traces
processor.addTraceListener({
    account: string,    // contract account name, or '*' for all
    name: string,       // action name, or '*' for all
    processor: (params) => Promise<void>,
});

Block lifecycle hooks can be passed via preBlockHook and postBlockHook arrays in the constructor options.

Events: warn

EOSJsDeserializer / ParallelDeserializer

// Single-threaded
const deserializer = new EOSJsDeserializer({ threads: 1 });

// Multi-threaded
const deserializer = new EOSJsDeserializer({ threads: 4 });

LocalAbiProvider

Fetches and caches contract ABIs from an EOSIO/Antelope RPC endpoint. Uses Node's built-in fetch by default.

const abi = new LocalAbiProvider({
    rpcEndpoint: 'https://your-rpc-endpoint',
    fetchApi: customFetch,  // optional, defaults to global fetch
});
await abi.init();

LocalBlockRepository

In-memory block repository that tracks the last processed block number.

const repository = new LocalBlockRepository(startBlockNum);

ShipConsumer

Configures block consumption behavior.

const consumer = new ShipConsumer({
    repository: IProcessedBlockRepository,
    processor: IBlockProcessor,
    blockDelay: number,          // milliseconds to wait between blocks
    consumerOptions: {
        end_block: number,
        fetch_deltas: boolean,
        max_messages_in_flight: number,
        irreversible_only: boolean,
    },
});

Interfaces

You can implement your own providers and processors against these interfaces:

  • IAbiProvider — ABI lookup and caching
  • IBlockProcessor — block processing logic
  • IProcessedBlockRepository — block tracking/persistence
  • IShipConsumer — consumer configuration