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

wisdom-sdk

v0.1.19

Published

Core business logic and data access layer for prediction markets

Downloads

8

Readme

Wisdom SDK

Core business logic and data access layer for prediction markets.

Installation

npm install wisdom-sdk
# or
yarn add wisdom-sdk
# or
pnpm add wisdom-sdk

Usage

Basic Operations

// Import the entire library
import { marketStore, predictionStore } from 'wisdom-sdk';

// Or import specific modules for better tree-shaking
import { marketStore } from 'wisdom-sdk/market-store';
import { predictionStore } from 'wisdom-sdk/prediction-store';

// Create a new market
const market = await marketStore.createMarket({
  name: 'Will Bitcoin hit $100k in 2025?',
  description: 'Market resolves YES if...',
  type: 'binary',
  outcomes: [
    { id: 0, name: 'No' },
    { id: 1, name: 'Yes' }
  ],
  createdBy: 'user_123'
});

// Create a prediction
const prediction = await predictionStore.createPrediction({
  marketId: market.id,
  userId: 'user_456',
  prediction: 'Yes',
  confidence: 0.8
});

Market Search and Query

import { marketStore, MarketQueryOptions } from 'wisdom-sdk';

// Find active markets in the crypto category with pagination
const queryOptions: MarketQueryOptions = {
  status: 'active',
  category: 'crypto',
  limit: 20,
  sortBy: 'createdAt',
  sortDirection: 'desc'
};

const result = await marketStore.getMarkets(queryOptions);
console.log(`Found ${result.total} markets, showing ${result.items.length}`);

// Search for markets containing specific terms
const searchResult = await marketStore.searchMarkets('bitcoin price', {
  status: 'active',
  limit: 10
});

// Get markets by category with automatic sorting
const cryptoMarkets = await marketStore.getMarketsByCategory('crypto', {
  sortBy: 'poolAmount',
  sortDirection: 'desc'
});

// Find trending markets (highest pool amount)
const trendingMarkets = await marketStore.getTrendingMarkets(5);

// Get related markets
const relatedMarkets = await marketStore.getRelatedMarkets('market-id', 3);

// Load more results with cursor-based pagination
if (result.hasMore && result.nextCursor) {
  const nextPage = await marketStore.getMarkets({
    ...queryOptions,
    cursor: result.nextCursor
  });
}

Features

  • TypeScript-first design with full type safety
  • Data access layer with Vercel KV store integration
  • Support for prediction markets, user balances, and stats
  • Advanced market search and filtering capabilities
  • On-chain market creation and resolution via Stacks blockchain
  • Pagination, sorting, and efficient data retrieval
  • Built for both ESM and CommonJS environments
  • Structured logging and error handling
  • Tree-shakable modules for optimal bundle size

Module Structure

The library is organized into independent modules that can be imported separately:

  • wisdom-sdk/market-store - Market creation and management
  • wisdom-sdk/prediction-store - Prediction operations and NFT receipts
  • wisdom-sdk/user-balance-store - User balance tracking
  • wisdom-sdk/user-stats-store - User statistics for leaderboards
  • wisdom-sdk/bug-report-store - Bug report management
  • wisdom-sdk/kv-store - Low-level KV store operations
  • wisdom-sdk/logger - Structured logging utilities
  • wisdom-sdk/utils - Shared utilities

Documentation

For detailed API documentation, see the GitHub repository at github.com/r0zar/wisdom.

Reference Implementations

We provide reference implementations to help you build robust UIs with the Wisdom SDK:

  • Markets Datatable Reference - A comprehensive implementation of a paginated datatable with sorting, filtering, and analytics for markets

Development

# Install dependencies
pnpm install

# Start development mode with watch
pnpm dev

# Build the package
pnpm build

# Run tests
pnpm test

# Run type checks
pnpm typecheck

# Run linter
pnpm lint

Technical Notes

This library uses modern JavaScript features and build tooling:

  • Built with tsup (based on esbuild) for ultra-fast builds
  • Dual ESM/CJS output formats for maximum compatibility
  • Source maps for improved debugging
  • Full tree-shaking support
  • Proper subpath exports for individual modules
  • Structured logging with Pino

License

MIT