PnP SDK Documentation
Table of Contents
Guides:- Create a Market
- Custom Oracles
- Trading & Redemption
- Refunds
- API Reference
- CLI Usage
- Examples & Best Practices
Overview
The PnP SDK is a TypeScript library for interacting with Solana-based prediction markets. It provides a clean, type-safe interface for creating markets, trading positions, and managing market operations on the Solana blockchain.Features
- Create and manage prediction markets on Solana
- Trade YES/NO tokens
- Redeem positions for resolved markets
- Claim creator refunds for unresolved markets
- Interact with on-chain market data
- Fetch real-time market prices & multipliers (no wallet required)
- Fetch settlement criteria from proxy server
- TypeScript-first development experience
- Comprehensive error handling
- Built on top of
@solana/web3.jsand supports both SPL Token and Token-2022 programs
Prerequisites
- Node.js 16+
- npm or yarn
- Solana CLI (for local development)
- Basic understanding of Solana and blockchain concepts
Installation
Quick Start
-
Install the package:
-
Import the SDK - Two methods are supported:
Method 1: ESM Direct Import (Recommended)
Method 2: CommonJS Require (For compatibility)
-
Initialize the client:
-
Example operation - fetching market info:
