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

@d10r/snapshot-strategies

v0.1.3

Published

The Score API is a simple RESTful API that calculates scores for various strategies based on the Snapshot protocol. This README outlines the functionality provided by the API and how to use it without any specific code examples.

Readme

Snapshot Score API

The Score API is a simple RESTful API that calculates scores for various strategies based on the Snapshot protocol. This README outlines the functionality provided by the API and how to use it without any specific code examples.

🚀 For strategy & validation development

If you're looking to add new voting strategies or validation strategies, please see the STRATEGIES.md guide which contains detailed instructions for developers.


We recommend using the snapshot.js library for obtaining voting power and doing validation, as it provides a simple and convenient way to interact with the Snapshot Score API. The snapshot.js library offers the following methods:

  • getScores() - https://docs.snapshot.org/tools/snapshot.js#getscores
  • getVp() - https://github.com/snapshot-labs/snapshot.js/blob/ad55119b0b684f7d6eeaa06f3642f7424d1fa949/src/utils.ts#L190
  • validate() - https://github.com/snapshot-labs/snapshot.js/blob/ad55119b0b684f7d6eeaa06f3642f7424d1fa949/src/utils.ts#L227

The URL for score api is https://score.snapshot.org

API Endpoints

1. POST /

The base endpoint serves as the entry point for various methods:

  • get_vp: Calculate voting power for a given address using strategies.
  • validate: Validate a given address using validation strategies.

2. GET /api

This endpoint returns the current version of the Snapshot Score API and block numbers for different networks.

Send a GET request to this endpoint to receive a JSON object containing the version and block_num properties.

3. GET /api/strategies

This endpoint returns a list of available strategies for calculating voting power.

Send a GET request to this endpoint to receive a JSON object containing key-value pairs representing the strategies and their respective information.

4. GET /api/validations

This endpoint returns a list of available validation strategies for address validation.

Send a GET request to this endpoint to receive a JSON object containing key-value pairs representing the validation strategies and their respective information.

5. POST /api/scores

This endpoint calculates scores for a given set of strategies and addresses.

To use this endpoint, send a POST request with a JSON body containing the params object. The params object should include:

  • space: The id of the space to calculate scores for.
  • network: The network ID to use for calculations.
  • snapshot: A specific block number or 'latest' for the latest block.
  • addresses: An array of addresses for which the scores will be calculated.
  • strategies: An array of strategy objects, each containing a name and params property.
  • force: A boolean indicating whether to force the calculation of scores despite potential restrictions.

Running the API locally with Docker

You can run the API locally using Docker. To do so, follow these steps:

  1. Clone the repository and cd into it.
  2. Copy the .env.example file to .env and set necessary values.
  3. Run docker-compose up to start the API.

Running load tests with Artillery

You can run load tests on the API using Artillery. To do so, follow these steps:

  1. Clone the repository and cd into it.
  2. Copy the .env.example file to .env and set necessary values.
  3. Run npm install to install dependencies.
  4. Install Artillery globally by running npm install -g artillery.
  5. Run artillery run -t <your server url> ./test/load/<test-file>.yml to run the load test.` to run the load test.