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

edgebets-sdk

v1.1.0

Published

TypeScript SDK for EdgeBets sports simulation API with x402 payment support

Readme

edgebets-sdk

TypeScript SDK for the EdgeBets sports simulation API. Run professional-grade Monte Carlo simulations for NBA, NFL, MLB, and MLS with x402 USDC payments on Solana.

Features

  • 10,000 Monte Carlo simulations per request
  • Full TypeScript support with comprehensive types
  • Automatic payment handling via x402 protocol
  • Auto-polling for simulation results
  • 4 major sports leagues (NBA, NFL, MLB, MLS)
  • Edge detection vs market odds
  • OpenClaw compatible for AI agent integration

Installation

npm install edgebets-sdk

Quick Start

import { EdgeBetsClient } from 'edgebets-sdk';
import { Keypair } from '@solana/web3.js';
import fs from 'fs';

// Load your Solana wallet
const secretKey = JSON.parse(fs.readFileSync('~/.config/solana/id.json', 'utf-8'));
const keypair = Keypair.fromSecretKey(Uint8Array.from(secretKey));

// Create client
const client = new EdgeBetsClient({
  wallet: keypair,
  debug: true,
});

// Get today's NBA games (FREE)
const games = await client.getGames('nba');
console.log(`Found ${games.length} NBA games today`);

// Run simulation on first game ($1.00 USDC)
const result = await client.simulate('nba', games[0].id, {
  onStatus: (status) => console.log(`Status: ${status}`),
});

// Display results
console.log(`${result.homeTeamName} vs ${result.awayTeamName}`);
console.log(`Home win: ${(result.homeWinProbability * 100).toFixed(1)}%`);
console.log(`Away win: ${(result.awayWinProbability * 100).toFixed(1)}%`);
console.log(`Projected total: ${result.averageTotalPoints.toFixed(1)}`);

if (result.edgeAnalysis?.homeIsValue) {
  console.log('VALUE: Home team has positive edge vs market!');
}

API Reference

EdgeBetsClient

Constructor

const client = new EdgeBetsClient({
  wallet: keypair,              // Solana Keypair or WalletAdapter
  rpcEndpoint: '...',           // Custom RPC (default: mainnet-beta)
  apiBaseUrl: '...',            // Custom API URL
  pollingInterval: 3000,        // Poll interval in ms
  pollingTimeout: 120000,       // Max poll time in ms
  debug: false,                 // Enable debug logging
});

Games (FREE)

// Get today's games
const games = await client.getGames('nba');     // 'nba' | 'nfl' | 'mlb' | 'mls'

// Get tomorrow's games
const tomorrow = await client.getTomorrowGames('nfl');

// Get specific game
const game = await client.getGameDetails('mlb', 'mlb-2026-03-28-nyy-bos');

Simulations ($1.00 USDC)

// Full simulation with auto-polling
const result = await client.simulate('nba', gameId, {
  count: 10000,                               // Simulation count
  onStatus: (status, job) => { ... },         // Status callback
  pollingInterval: 3000,                      // Override poll interval
  pollingTimeout: 120000,                     // Override timeout
});

// Manual flow (advanced)
const job = await client.startSimulation('nba', gameId);
const status = await client.pollResult(job.jobId);

Wallet & Balance

// Check balance
const balance = await client.checkBalance();
// { usdc: 5.25, sol: 0.05, sufficient: true }

// Get price quote (live from server — always trust this over cached/documented values)
const quote = await client.getQuote();
// { price: 1.0, currency: 'USDC', network: 'solana-mainnet', recipient: '...' }

// Check if wallet configured
client.hasWallet();  // boolean

// Get treasury address
client.getTreasuryWallet();  // 'DuDL...'

// Get simulation price
client.getPrice();  // 1.0

Types

SimulationResult

interface SimulationResult {
  gameId: string;
  simulationCount: number;

  // Teams
  homeTeamName: string;
  awayTeamName: string;
  homeTeamAbbr: string;
  awayTeamAbbr: string;

  // Win Probabilities (0-1)
  homeWinProbability: number;
  awayWinProbability: number;

  // Score Projections
  averageHomeScore: number;
  averageAwayScore: number;
  averageTotalPoints: number;
  predictedSpread: number;

  // Advanced Analytics
  elo?: EloRatings;
  fourFactors?: FourFactors;          // NBA only
  edgeAnalysis?: EdgeAnalysis;         // Value vs market
  bettingInsights?: BettingInsights;   // Fair odds
  scoreDistribution?: ScoreDistribution;
  factorBreakdown?: FactorBreakdown[];
}

EdgeAnalysis

interface EdgeAnalysis {
  hasOdds: boolean;
  homeEdge: number;         // Positive = value
  awayEdge: number;
  homeIsValue: boolean;
  awayIsValue: boolean;
  spreadEdge: number;
  homeKelly?: number;       // Kelly bet fraction
  awayKelly?: number;
}

Error Handling

import {
  EdgeBetsError,
  PaymentRequiredError,
  InsufficientBalanceError,
  WalletNotConfiguredError,
  PollingTimeoutError,
  SimulationFailedError,
} from 'edgebets-sdk';

try {
  const result = await client.simulate('nba', gameId);
} catch (error) {
  if (error instanceof InsufficientBalanceError) {
    console.log(`Need ${error.required} USDC, have ${error.available}`);
  } else if (error instanceof PollingTimeoutError) {
    console.log('Simulation took too long, try again');
  } else if (error instanceof WalletNotConfiguredError) {
    console.log('Please configure a wallet');
  }
}

Helper Function

import { createClient } from 'edgebets-sdk';
import fs from 'fs';

// Quick setup from secret key file
const secretKey = JSON.parse(fs.readFileSync('wallet.json', 'utf-8'));
const client = createClient(secretKey, { debug: true });

OpenClaw Integration

This package includes a SKILL.md for OpenClaw agents. Install via ClawHub:

clawhub install edgebets

Or give your agent this URL:

https://api.edgebets.fun/api/v1/x402/openapi.json

Pricing

| Action | Cost | |--------|------| | Get games | FREE | | Run simulation | $1.00 USDC |

Payments are processed via x402 protocol on Solana mainnet.

Pick of the Day (FREE)

// Get today's pick
const pick = await client.getTodaysPick();

if (pick.hasPick && pick.pick) {
  console.log(`Pick: ${pick.pick.pick} (${pick.pick.confidence})`);
  console.log(`Win probability: ${(pick.pick.winProbability * 100).toFixed(1)}%`);

  if (pick.pick.result && pick.pick.result !== 'pending') {
    console.log(`Result: ${pick.pick.result.toUpperCase()}`);
  }
}

if (pick.message) {
  console.log(pick.message);  // "New pick available at 2 AM Central"
}

// Get track record
const record = await client.getTrackRecord();
console.log(`Record: ${record.wins}-${record.losses} (${record.winRate}%)`);
console.log(`Streak: ${record.streak}${record.streakType}`);

Requirements

  • Node.js 18+
  • Solana wallet with USDC (for paid simulations)
  • Small amount of SOL for transaction fees

Security Note

You may see npm audit warnings about bigint-buffer - this is a known issue in the Solana ecosystem affecting all SPL Token packages. The vulnerability requires specific malicious input that doesn't occur in normal SDK usage. See Solana SPL Token issues for updates

Links

License

MIT