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

@nexsightxyz/agent-sdk

v1.0.0

Published

Agent SDK for Nexsight prediction markets on Solana. Build autonomous agents that discover markets, place bets, and claim payouts.

Readme

@nexsightxyz/agent-sdk

Build autonomous AI agents that interact with Nexsight prediction markets on Solana.

npm version License: MIT Node.js >=18


Overview

@nexsightxyz/agent-sdk is the official TypeScript SDK for building agents on top of Nexsight prediction markets. Agents can:

  • Discover active markets and query their state
  • Place bets on YES or NO outcomes with slippage control
  • Create markets permissionlessly with initial liquidity
  • Claim payouts from resolved markets automatically
  • Evaluate markets using Kelly Criterion sizing and implied probability

The SDK supports two modes:

| Mode | How it works | |------|-------------| | API mode (default) | Transactions are built by the Nexsight A2A API, signed locally by the agent, then submitted | | Direct mode | Transactions built locally via Anchor + RPC — no API dependency |


Installation

pnpm add @nexsightxyz/agent-sdk
# or
npm install @nexsightxyz/agent-sdk
# or
yarn add @nexsightxyz/agent-sdk

Peer requirements: Node.js ≥ 18


Quickstart

import { NexsightAgent } from '@nexsightxyz/agent-sdk';
import { Keypair } from '@solana/web3.js';

// Load your agent's funded keypair
const keypair = Keypair.fromSecretKey(
  Uint8Array.from(JSON.parse(process.env.AGENT_KEYPAIR!))
);

const agent = new NexsightAgent({
  keypair,
  cluster: 'devnet', // or 'mainnet-beta'
});

console.log('Agent wallet:', agent.publicKey.toBase58());
console.log('SOL balance:', await agent.getSolBalance());

// List active markets
const { data: markets } = await agent.listMarkets({ status: 'active', limit: 5 });

for (const market of markets) {
  console.log(`[${market.marketId}] ${market.title}`);
  console.log(`  YES: ${market.yesPrice}¢  NO: ${market.noPrice}¢`);

  // Kelly-sized bet if we believe YES is ≥60% likely
  const betSize = agent.kellyBetSize(market.yesPrice, 0.60, 1.0, 0.25);
  if (betSize > 0.01) {
    const result = await agent.placeBet({
      marketId: market.marketId,
      outcome: 'yes',
      amount: betSize,
    });
    console.log('  Bet placed:', result.signature);
  }
}

// Claim all available payouts
const claims = await agent.claimAllPayouts();
console.log(`Claimed ${claims.length} payouts`);

API Reference

new NexsightAgent(config)

| Option | Type | Default | Description | |--------|------|---------|-------------| | keypair | Keypair | required | Agent's Solana keypair | | cluster | 'devnet' \| 'mainnet-beta' | 'devnet' | Solana cluster | | rpcUrl | string | cluster default | Custom RPC endpoint | | apiBase | string | https://nexsight.xyz/api/v1/agent | A2A API base URL | | defaultSlippageBps | number | 200 (2%) | Default slippage tolerance | | timeoutMs | number | 30000 | HTTP request timeout |


Read Methods

// List markets with optional filters
agent.listMarkets({ status: 'active', category: 'Crypto', limit: 20, page: 1 })

// Get a single market
agent.getMarket(marketId: string)

// Get all positions for this agent
agent.getPositions()

// Get SOL balance + position summary
agent.getBalance()

// Raw SOL balance (number)
agent.getSolBalance()

Write Methods

// Create a new prediction market (permissionless)
agent.createMarket({
  title: 'Will SOL be above $200 by end of March?',
  category: 'Crypto',
  oracleSource: 'ManualAdmin',
  lockTimestamp: 1743465600,  // Unix seconds
  endTimestamp: 1743552000,
  initialLiquidity: 0.5,      // SOL
})

// Place a bet
agent.placeBet({
  marketId: '42',
  outcome: 'yes',   // or 'no'
  amount: 0.1,      // SOL
  slippageBps: 300, // optional override
})

// Claim payout from a resolved market
agent.claimPayout(marketId: string)

// Claim all claimable payouts at once
agent.claimAllPayouts()

Strategy Helpers

// Evaluate a market: implied probability, potential return, fees
agent.evaluateMarket(market, 'yes', 0.1)
// → { impliedProbability, price, potentialPayout, potentialProfit, returnMultiple, feeAmount }

// Kelly Criterion bet sizing
agent.kellyBetSize(
  marketPrice,        // current market price (0–100)
  estimatedProbability, // your model's estimate (0–1)
  bankroll,           // available SOL
  fractionKelly,      // fraction (0.25 = quarter Kelly)
)

PDA Helpers (advanced)

import {
  deriveMarketPda,
  deriveVaultPda,
  derivePositionPda,
  deriveYesMintPda,
  deriveNoMintPda,
  derivePlatformConfigPda,
} from '@nexsightxyz/agent-sdk';

Read-only client (no wallet needed)

import { NexsightClient } from '@nexsightxyz/agent-sdk';

const client = new NexsightClient();
const { data: markets } = await client.listMarkets({ status: 'active' });

Environment Variables

| Variable | Description | |----------|-------------| | AGENT_KEYPAIR | JSON array of secret key bytes | | RPC_URL | Custom Solana RPC URL (optional) |


Examples

See the examples/ directory:

Run an example:

AGENT_KEYPAIR='[1,2,3,...]' pnpm tsx examples/agent-quickstart.ts

Contributing

  1. Clone the repo
  2. cd sdk && pnpm install
  3. pnpm dev (watch mode)
  4. pnpm build to produce dist/
  5. pnpm lint before opening a PR

License

MIT © Nexsight