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

@subsquid/archive-registry

v3.3.2

Published

A community-owned registry of Squid archives and networks

Downloads

7,688

Readme

Squid Archive Registry

A community-owned registry of Squid archives in a json format.

Usage of @subsquid/archive-registry

The registry is available as an npm package @subsquid/archive-registry. It can be used to conveniently access registry files and e.g. lookup a Squid Archive or EVM Squid Archive by network name.

Listing the available networks

Use the included squid-archive-registry executable to list supported networks:

$ squid-archive-registry --help
Usage: run [options]

Display list of available archives

Options:
  -t --type <type>  Network type (choices: "evm", "substrate")
  -h, --help        display help for command

Substrate archives

The first argument is the name of the network. The second argument is set of lookup filters of type LookupOptionsSubstrate.

import { lookupArchive } from '@subsquid/archive-registry'

const processor = new SubstrateProcessor()
  .setDataSource({
    archive: lookupArchive("kusama"), 
  });

More accurate way to choose from Substrate networks is to specify type parameter inside options for the function. By default type is set to Substrate.

const processor = new SubstrateProcessor()
  .setDataSource({
    archive: lookupArchive("kusama", { type: "Substrate" }), 
  });

LookupOptionsSubstrate supports additional filtering by genesis hash, archive version (semver range) and docker image names (of archive and archive gateway).

There is also a convenience method to get network information by its name:

  // ...
  .setDataSource({
    archive: lookupArchive("kusama", { genesis: "0xb0a8d493285c2df73290dfb7e61f870f17b41801197a149ca93654499ea3dafe" }), 
  });

EVM archives

Similar to Substrate archive: first argument is the name of the network, second one is a set of lookup filters of type LookupOptionsEVM.

import { lookupArchive } from '@subsquid/archive-registry'

const processor = new EvmBatchProcessor()
  .setDataSource({
    archive: lookupArchive("avalanche"), 
  });

LookupOptionsEVM supports additional filtering by release type:

There is also a convenience method to get network information by its name:

  // ...
  .setDataSource({
    archive: lookupArchive("avalanche", { type: "EVM", release: "FireSquid" }), 
  });

What is a Squid Archive?

Squid Archive provides easy access to the historical on-chain data with little modifications. It is essential for Substrate Squid pipelines or EVM Squid pipelines. It can also be used on its own as a GraphQL-based block explorer with powerful filtering and search capabilities over historical events and transactions.

How to use an Archive?

The primary use case of a Squid Archive is to serve data to a Substrate Squid Processor or EVM Squid Processor.

The urls are not supposed to be accessed with a browser. To explore the endpoint with an interactive and human-friendly console, use explorerUrl field in archives.json (only for substrate archives).

For example, for exploring Kusama historical data, one can inspect archives.json and local Kusama explorer at https://kusama.explorer.subsquid.io/graphql. One can open the GraphQL playground by navigating to this url and use the pane on right hand side to filter (where:) and pick the fields of interest.

For example, the following query will return details on the last 10 transfers:

query RecentBalancesTransfers {
  events(orderBy: block_height_DESC, where: {name_eq: "Balances.Transfer"}, limit: 10) {
    args
    name
    call {
      name
      args
    }
    block {
      timestamp
      height
    }
  }
}

How to contribute

To contribute a new archive, make a PR updating archives.json or archives-evm.json specifying the network name and the url. Further, one has to regenerate types in src/chains.ts by running npm run gen-types. This will update the list of supported chain names and makes it easier to developers to discover which lookups will succeed at compile time.