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

@spec.dev/event-client

v0.0.17

Published

Spec Event Client

Readme

Spec Event Client

JavaScript client for the Spec event network. Easily subscribe to any contract event or custom Spec event published on Spec.

Installation

$ npm install @spec.dev/event-client

Quickstart

Subscribe to any event on Spec by name:

import { createEventClient, SpecEvent } from '@spec.dev/event-client'

// Create event client.
const spec = createEventClient({ 
    signedAuthToken: process.env.SPEC_API_KEY,
    onConnect: () => 'Listening for Spec events...'
})

// Listen for all new ethereum blocks.
spec.on('eth.NewBlock', (event: SpecEvent) => {
    console.log(event)
})

// Listen for PostCreated contract events on Lens.
spec.on('polygon.contracts.lens.LensHubProxy.PostCreated', (event: SpecEvent) => {
    console.log(event)
})

Event Interface

All events on Spec share the following interface:

interface SpecEvent {
    id: string
    nonce: string
    name: string
    origin: SpecEventOrigin
    data: StringKeyMap | StringKeyMap[]
}

interface SpecEventOrigin {
    chainId: string
    blockNumber: number
    blockHash: string
    blockTimestamp: string
    transactionHash?: string
    contractAddress?: string
}

type StringKeyMap = { [key: string]: any }

Event Examples:

Ex: New Ethereum block event:

{
    id: '5Luq7w83pkr25jmG5pEz4D',
    nonce: '1678251758343-0',
    name: '[email protected]',
    origin: {
        chainId: '1',
        blockNumber: 16781331,
        blockHash: '0xc8923b9cffe5e57756d52df3d74c925019b73b7ac542222c506bc28e150ec67a',
        blockTimestamp: '2023-03-08T05:02:11.000Z'
    },
    data: {
        hash: '0xc8923b9cffe5e57756d52df3d74c925019b73b7ac542222c506bc28e150ec67a',
        number: 16781331,
        parentHash: '0xf83138214faa35db727816ddf52c5193dfbbe9ec882f5fea8fd732a13375dc79',
        nonce: '0x0000000000000000',
        sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347',
        logsBloom: '0x1675cc245d489ab7f4434510f5191b27892f4f6d66090eaee683b83e378b200...',
        transactionsRoot: '0xf50f4faad3b167cea6367e24429193d295d3692c372d00d5fe9bf412357faa0a',
        stateRoot: '0x7a5360ca3af2f0932c1262d9d43bdef45e11c2245eb38e7279966c685c28e5aa',
        receiptsRoot: '0xda6ef17c32766b643c680c62284a2160679966fb4731c6f5409648addbfdebbd',
        miner: '0x690b9a9e9aa1c9db991c7721a92d351db4fac990',
        difficulty: '0',
        totalDifficulty: '58750003716598352816469',
        size: '71290',
        extraData: '0x406275696c64657230783639',
        gasLimit: '30000000',
        gasUsed: '12970354',
        baseFeePerGas: '19405626329',
        transactionCount: 140,
        timestamp: '2023-03-08T05:02:11.000Z'
    }
}

Ex: Lens PostCreated contract event:

{
    id: 'aiicPFQGc1zug6KZU8Y7Tw',
    name: '[email protected]',
    nonce: '1678252171935-0',
    origin: {
        contractAddress: '0xdb46d1dc155634fbc732f92e853b10b288ad5a1d',
        transactionHash: '0x932c32aa280e9728e0391ad1e2790990681030194a873301dd8f93a70ac974a2',
        blockHash: '0xdf58fc920d4b90ff89430344842cf24812a6f0969acfd0ac7934bbd749bc7948',
        blockNumber: 40096072,
        blockTimestamp: '2023-03-08T05:09:25.000Z',
        chainId: '137'
    },
    data: {
        profileId: 9543,
        pubId: 711,
        contentURI: 'https://data.lens.phaver.com/api/lens/posts/a4d6a4e2-8380-40ec-9206-60809d09a800',
        collectModule: '0x23b9467334beb345aaa6fd1545538f3d54436e96',
        collectModuleReturnData: '0x0000000000000000000000000000000000000000000000000000000000000000',
        referenceModule: '0x0000000000000000000000000000000000000000',
        referenceModuleReturnData: null,
        timestamp: 1678252165,
        contractName: 'LensHubProxy',
        contractAddress: '0xdb46d1dc155634fbc732f92e853b10b288ad5a1d',
        transactionHash: '0x932c32aa280e9728e0391ad1e2790990681030194a873301dd8f93a70ac974a2',
        transactionIndex: 14,
        logIndex: '51',
        blockHash: '0xdf58fc920d4b90ff89430344842cf24812a6f0969acfd0ac7934bbd749bc7948',
        blockNumber: 40096072,
        blockTimestamp: '2023-03-08T05:09:25.000Z',
        chainId: '137'
    }
}

License

MIT