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

sdk-use

v1.0.0

Published

This directory contains SDK usage examples for `@parthsoni07/pnp-sdk-v2`. Each file demonstrates how to use the SDK to perform various operations that were previously done via scripts.

Readme

SDK Usage Examples

This directory contains SDK usage examples for @parthsoni07/pnp-sdk-v2. Each file demonstrates how to use the SDK to perform various operations that were previously done via scripts.

Setup

  1. Install dependencies:
npm install
  1. Set up environment variables (create a .env file in the root directory):
PNP_RPC_URL=https://api.mainnet-beta.solana.com
HARDCODED_PRIVATE_KEY=your_private_key_here

Note: All examples load the .env file from the root directory (parent of sdk-use), not from sdk-use itself.

Usage

Each example file can be run directly with tsx or ts-node:

# Example: Create a P2P market
tsx createP2PQuickstart.ts

# Example: Trade on V3 market
tsx trade_v3.ts

# Example: Get market info
tsx market-info.ts

Available Examples

These examples demonstrate the new functionality and logic enhancements added in v2 branch (not just logging improvements).

P2P Market Creation (NEW in v2)

  • createP2PQuickstart.ts - Create a generic P2P market with simple parameters
  • createP2PTwitter.ts - Create a Twitter-linked P2P market
  • createP2PYoutube.ts - Create a YouTube-linked P2P market
  • createP2PandTrade.ts - Create a P2P market and trade on it
  • p2pRefund.ts - Claim P2P market creator refund

V3 Market Operations (NEW in v2)

  • trade_v3.ts - Trade on V3 markets
  • redeem_v3_position.ts - Redeem winning positions from resolved V3 markets
  • v3_market_info.ts - Get information about V3 P2P markets
  • list_v3_markets.ts - List all V3 market addresses
  • fetch_my_v3_markets.ts - Fetch V3 markets where you have positions
  • fetch_resolved_markets.ts - Fetch all resolved V3 markets

Market Creation (Enhanced in v2)

  • createMarket.ts - Create a standard market (with balance checking logic)
  • createMarketV3.ts - Create a V3 market (P2P market creation)
  • createMarketV3_oracle.ts - Create a V3 market with oracle
  • createMarketAndRefund.ts - Create market and claim refund if not resolvable
  • createMarketAndTrade.ts - Create market and trade on it

Market Information (NEW in v2)

  • market-info.ts - Get comprehensive market information (enhanced)
  • v2_market_info.ts - Get V2 market information
  • v3_market_info.ts - Get V3 market information
  • winningToken.ts - Get winning token for resolved markets (V2 or V3)

Key Differences from Scripts

  1. Import from npm package: All examples import from @parthsoni07/pnp-sdk-v2 instead of local paths
  2. Environment variables: Use .env file with dotenv/config for configuration
  3. ESM modules: All files use ES modules (import/export)
  4. Simplified structure: Focus on SDK usage rather than script execution

Note

Only files with actual logic enhancements or new functionality in v2 are included here. Files that only had logging improvements, type safety changes, or minor refactoring have been excluded.

Notes

  • All examples output structured JSON results between === RESULT === markers
  • Set VERBOSE=1 environment variable for detailed output
  • Private key (HARDCODED_PRIVATE_KEY) can be provided as JSON array string or base58 string in the root .env file
  • Most read-only operations don't require a private key