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

seer-ai

v1.0.2

Published

An AI-powered oracle to verify outcomes for prediction markets using Gemini.

Readme

seer-ai

An AI-powered oracle to verify outcomes for prediction markets using Google's Gemini API with grounding capabilities. Automatically resolves queries and can prepare blockchain transactions for prediction market contracts.

Installation

npm install seer-ai

Usage

Basic Usage - Resolve a Query

Get a definitive answer (YES/NO/AMBIGUOUS) for past or current events:

import { Seer } from 'seer-ai';

const seer = new Seer({ apiKey: 'your-gemini-api-key' });

const result = await seer.resolve('Was BTC above $60,000 on Oct 26, 2024?');

console.log(result.answer); // "YES: According to..."
console.log(result.sources); // Array of source URLs

Predict Future Events

Get a probability-based prediction for future events:

const prediction = await seer.predict('Will BTC be above $100,000 by Jan 1, 2026?');

console.log(prediction.answer); // "PREDICTION: YES — 75% probability. Market trends indicate..."
console.log(prediction.sources); // Array of source URLs

Advanced Usage - Resolve and Prepare Blockchain Transaction

import { Seer } from 'seer-ai';
import { ethers } from 'ethers';

const seer = new Seer({ apiKey: 'your-gemini-api-key' });

const result = await seer.resolveAndPrepareTx({
  query: 'Was BTC above $60,000 on Oct 26, 2025?',
  abi: ['function resolveMarket(uint256 outcome)'],
  contractAddress: '0x...',
  functionName: 'resolveMarket',
  paramsBuilder: (outcome) => [outcome === 'YES' ? 1 : 0],
  // Optional: broadcast transaction
  chainRpc: 'https://sepolia.infura.io/v3/YOUR_KEY',
  privateKey: '0x...', // Omit for transaction data only
});

if (result.status === 'resolved') {
  console.log('Answer:', result.answer);
  console.log('Transaction data:', result.data);
  console.log('To address:', result.to);
  if (result.txHash) {
    console.log('Transaction hash:', result.txHash);
  }
} else {
  console.log('Market not yet resolved:', result.answer);
}

API

Seer Class

Constructor

new Seer({ apiKey: string })
  • apiKey: Your Google Gemini API key

Methods

resolve(query: string): Promise<QueryResult>

Resolves a query with a definitive answer based on verifiable facts.

  • Returns an answer that starts with "YES:", "NO:", or "AMBIGUOUS:"
  • Used for past or current events
  • Includes citation sources from Google Search grounding

predict(query: string): Promise<QueryResult>

Predicts the probability of a future event.

  • Returns an answer starting with "PREDICTION: YES — X%" or "PREDICTION: NO — X%"
  • Used for future events that haven't occurred yet
  • Provides probabilistic forecasts based on current evidence
  • Includes citation sources

resolveAndPrepareTx({ ... }): Promise<ResolvedResult | NotResolvedResult>

Resolves a query and either generates or broadcasts blockchain transaction data.

  • Calls resolve() internally to get definitive answer
  • Returns transaction data if resolved (YES/NO)
  • Returns not_resolved status if outcome is ambiguous
  • Can optionally broadcast the transaction to the blockchain

Parameters:

  • query: The prediction query to resolve
  • abi: Contract ABI as an array
  • contractAddress: Smart contract address
  • functionName: Function name to call
  • paramsBuilder: Function that maps YES/NO to function parameters
  • chainRpc (optional): RPC URL for broadcasting
  • privateKey (optional): Private key for broadcasting

Types

interface QueryResult {
  answer: string;
  sources: Source[];
}

interface Source {
  uri: string;
  title: string;
}

// Resolved result (YES/NO)
interface ResolvedResult {
  status: 'resolved';
  answer: string;
  sources: Source[];
  to: string;
  data: string;
  txHash?: string; // Only present if transaction was broadcast
}

// Not resolved result (AMBIGUOUS)
interface NotResolvedResult {
  status: 'not_resolved';
  answer: string;
  sources: Source[];
}

Features

  • 🤖 AI-powered oracle using Gemini 2.5 Flash
  • 🔍 Google Search grounding for factual information
  • 📚 Automatic source citations
  • ✅ Definite answers (YES/NO/AMBIGUOUS) via resolve()
  • 📊 Probabilistic predictions via predict()
  • ⛓️ Blockchain transaction preparation and broadcasting
  • 🎯 Purpose-built for prediction market resolution
  • 🔐 Supports transaction RD signature or broadcasting

License

ISC