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

@primodiumxyz/pg-indexer-reader

v0.6.9

Published

Minimal Typescript indexer for Store

Downloads

34

Readme

pg-indexer-reader

Getting Started

Requirements

  • Node 14+
  • Docker
  • pnpm

To start a local indexer on foundry chain run:

pnpm start:local

To properly remove docker networks and volumes run:

pnpm docker:clean

Endpoints

1. GET /api/logs

This endpoint retrieves blockchain logs based on specified filters. It returns data in a chunked stream format for efficient processing.

Request Parameters

  • input: JSON string specifying filters for the logs. It should conform to the filterSchema.

Response

  • Returns a stream of chunked JSON data, each containing a subset of the logs.
  • Each JSON object includes blockNumber, chunk, totalChunks, and logs.

2. GET /api/queryLogs

An endpoint for querying logs based on a specific database query structure. This endpoint also chunks the response for efficient processing.

Request Parameters

  • input: JSON string specifying the address and queries for the database. It should conform to the dbQuerySchema.

Response

  • Similar to /api/logs, this returns a stream of chunked JSON data with blockchain logs.

Installation and Running

[Provide instructions on how to install, configure, and run your API.]

Schemas

Filter Schema

The filterSchema is used to define the structure of filters for querying logs. Below is the documentation of its properties:

| Property | Type | Optional | Description | | --------- | ---------------- | -------- | -------------------------------------------------------------------------- | | address | String | Yes | A hexadecimal string representing the address. Must be a valid hex string. | | filters | Array of Objects | No | An array of filter objects. Each object can have the following properties: |

Filter Object Properties

Each object in the filters array has the following properties:

| Property | Type | Optional | Description | | --------- | ------ | -------- | ----------------------------------------------------------------------------- | | tableId | String | No | A hexadecimal string representing the table ID. Must be a valid hex string. | | key0 | String | Yes | A hexadecimal string representing the first key. Must be a valid hex string. | | key1 | String | Yes | A hexadecimal string representing the second key. Must be a valid hex string. |

Default for filters is an empty array ([]).


DB Query Schema

The dbQuerySchema is used for constructing database queries. It consists of two main properties:

| Property | Type | Description | | --------- | ---------------- | -------------------------------------------------------------------------- | | address | String | A hexadecimal string representing the address. Must be a valid hex string. | | queries | Array of Objects | An array of querySchema objects. |

Query Schema

Each object in the queries array adheres to the following structure:

| Property | Type | Optional | Description | | ----------- | ---------------------------- | -------- | ------------------------------------------------------------------------------------ | | tableName | String | No | The name of the table to query. | | namespace | String | Yes | The namespace of the table, with a default value of an empty string. | | tableType | Enum | Yes | The type of the table, either offchainTable or table, with a default of table. | | where | whereClauseSchema | Yes | A single where clause object. | | and | Array of whereClauseSchema | Yes | An array of where clause objects combined with AND logic. | | or | Array of whereClauseSchema | Yes | An array of where clause objects combined with OR logic. |

Where Clause Schema

The whereClauseSchema is used to define conditions in the query. It has the following properties:

| Property | Type | Description | | ----------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | column | String | The name of the column to apply the condition to. | | operation | Enum | The operation to perform. Valid options: eq (equal), neq (not equal), lt (less than), lte (less than or equal to), gt (greater than), gte (greater than or equal to). | | value | String | The value to compare the column against. |

Note: Only one of where, and, or or can be defined at a time in a querySchema object.