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

@backchain/fortune

v0.2.0

Published

Backchain Fortune — Commit-reveal prediction game

Readme

@backchain/fortune

Fortune module for the Backchain DeFi ecosystem on opBNB. Provably fair commit-reveal lottery with three risk tiers.

Install

npm install @backchain/fortune

Quick Start

import { FortuneModule } from '@backchain/fortune';

const fortune = new FortuneModule(context); // context from @backchain/core
const { gameId, secret } = await fortune.play(ethers.parseEther('0.01'), [3], 0b001);
// wait for the reveal delay (~60s on opBNB), then reveal
await fortune.reveal(gameId, [3], secret);
const result = await fortune.getGameResult(gameId);

API

Tiers

| Tier | Odds | Multiplier | |------|----------|------------| | 0 | 1 in 5 | 2x | | 1 | 1 in 10 | 5x | | 2 | 1 in 150 | 100x |

Write Methods

play(wagerAmount: bigint, guesses: number[], tierMask: number): Promise<PlayResult> Commit to a game. wagerAmount is the BNB bet. guesses is an array of numbers the player predicts. tierMask is a bitmask selecting which tiers to participate in (bit 0 = Tier 0, bit 1 = Tier 1, bit 2 = Tier 2). Returns { gameId, secret }. Store secret — it is required to reveal.

reveal(gameId: bigint, guesses: number[], secret: string): Promise<TransactionResult> Reveal a committed game. Must be called after the reveal delay has passed (approximately 60 seconds). Provide the same guesses and the secret returned by play. If the player wins, BNB is transferred automatically.

Read Methods

getGame(gameId: bigint): Promise<Game> Returns full state of a game: player address, wager, tiers, commit hash, reveal block, status, and payout.

getGameResult(gameId: bigint): Promise<GameResult> Returns the outcome of a revealed game: whether the player won, the winning number drawn, the player's guesses, and the payout amount.

getGameStatus(gameId: bigint): Promise<GameStatus> Returns a simple status string for a game: 'pending', 'ready_to_reveal', 'revealed', or 'expired'.

getTierInfo(tier: number): Promise<TierInfo> Returns configuration for a tier: range of valid numbers, multiplier, and current pool balance available for payouts.

License

MIT