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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pockit/challenge-protocol

v0.0.14

Published

A protocol for matchmaking and game governance on EVM based blockchains.

Readme

Pockit Challenge Protocol

A library for managing blockchain-based game governance using ethers.js, with a bundled matchmaking contract ABI.

Installation

npm install @pockit/challenge-protocol

Usage

// index.js

const Governor = require('@pockit/challenge-protocol');

const gov = new Governor({
  privateKey: 'governor-private-key',
  matchMakingContractAddress: '0xb8f26231ab263ed6c85f2a602a383d597936164b', // sanko mainnet
  fee: 2,
gameHandler: async (gameId, wallet, contract, onGameHandled, onGameResolved) => {
    // Fetch game details from the contract
    const game = await contract.getGame(gameId);
    const players = game.players;

    // Condition: Wait until at least 2 players are in the game
    if (players.length < 2) {
      return;
    }

    // Mark the game as ready to start
    await onGameHandled();

    // Add your game logic here
    await new Promise((resolve) => setTimeout(resolve, 10000));
    const loserIndex = Math.floor(Math.random() * 2); // 0 or 1
    const loser = players[loserIndex];
    const winner = players[1 - loserIndex]; // Opposite of loser
    console.log(`Game ${gameId}: Winner is ${winner}, Loser is ${loser}`);

    // End the game by marking the losers
    await onGameResolved([loser]);
  },
  contractABI: customABI, // Optional
  providerUrl: 'https://mainnet.sanko.xyz' // Optional
});

// Start polling for games
gov.pollForNewGames();

Existing Contract Deployments

These deployed contracts can be used by anyone (for a 2% fee). Ownership of games is determined by the governor parameter used while calling createGame on a client.

0xb8f26231ab263ed6c85f2a602a383d597936164b // sanko mainnet
0xDefE687Cb741fFd583f70E9d5C5000da0c9710dF // sanko testnet
0xd0cE8C6c7Ec2DB144d53ca8A4eb3Ce612F0BEA87 // eth mainnet

Games using the global matchmaking contract are featured on the global leaderboard.

API

Governor(options)

Creates a new instance of the Governor class with the specified options.

Options

  • privateKey (string, required): Ethereum private key used to sign transactions.
  • matchMakingContractAddress (string): Address of the matchmaking contract on the blockchain.
  • fee (number): Fee charged for ending games.
  • gameHandler (function): Callback function to handle game logic. Receives (gameId, wallet, contract, onGameHandled, onGameResolved) as arguments.
  • providerUrl (string, optional): Custom RPC provider URL. Defaults to https://mainnet.sanko.xyz.
  • contractABI (array, optional): Custom contract ABI. Defaults to the bundled ABI included in the package.