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

@derp-trade/sdk

v0.2.0

Published

An SDK for derp.trade

Readme

@derp-trade/sdk

A TypeScript SDK for derp.trade, a Solana-based derivatives trading platform for DERPs, a new asset class based on perpetual futures.

Installation

npm install @derp-trade/sdk

Quickstart

Initialize the SDK

import { DerpSDK } from '@derp-trade/sdk';
import { Connection, Keypair } from '@solana/web3.js';
import { Wallet } from '@coral-xyz/anchor';

// Create connection to Solana
const connection = new Connection('https://api.mainnet-beta.solana.com');

// Create wallet (replace with your keypair)
const keypair = Keypair.fromSecretKey(/* your secret key */);
const wallet = new Wallet(keypair);

// Initialize SDK
const sdk = new DerpSDK(connection, wallet);

⚠️ Important: The wallet provided when constructing the SDK should have funds (SOL) on it, otherwise some SDK functions will fail.

Place Your First Order

import { BN } from '@coral-xyz/anchor';

async function placeOrder() {
  const mintAddress = 'your_token_mint_address';

  // Create order instructions
  const orderInstructions = await sdk.getOrderInstructions(mintAddress, {
    reduceOnly: false,
    side: 'long',
    // Order size in tokens with 6 decimals (e.g. this would be an order for 1 token)
    size: new BN(1000000),
    // 2x leverage (200% in basis points)
    // NOTE: This argument is only provided for presentation purposes, the position will be opened at max leverage!
    // To actually add margin to your position, use the deposit instruction.
    leverageBps: new BN(20000)
  });

  // Send transaction
  const signature = await sdk.provider.sendAndConfirm(
    new web3.Transaction().add(...orderInstructions)
  );

  console.log('Order placed:', signature);
}

Features

Market Support

  • Pump.fun markets - Integrated with pump.fun tokens
  • Bonk (Raydium Launch Lab) markets - Raydium Launch Lab integrated markets
  • External markets - Support for external pools (currently RETARDIO token)

Core Functionality

  • Place and manage DERPs orders
  • Deposit and withdraw collateral
  • Query market data and positions
  • Real-time price updates from multiple DEX sources
  • Automatic market type detection

Available Methods

Trading Operations

// Create order
await sdk.getOrderInstructions(mintAddress, orderParams);

// Deposit collateral
await sdk.rawDepositInstruction(mintAddress, amount);

// Close position and withdraw collateral
await sdk.getClosePositionInstructions(mintAddress);

// Withdraw collateral
await sdk.rawWithdrawInstruction(mintAddress);

Market Data

// Get market status (prices, funding, etc.)
const status = await sdk.marketStatus(mintAddress);

// Fetch and decode the market state account
const market = await sdk.rawMarket(mintAddress);

// Fetch and decode the position state account
const position = await sdk.positionState(mintAddress, userAddress);

// Fetch and decode the global config account
const config = await sdk.config();

Advanced Usage

The SDK exposes a fully featured and typed Anchor client instance via sdk.program. This allows you to implement any custom use cases directly:

// Access the underlying Anchor program
const program = sdk.program;

// Use any program method directly
const accounts = await program.account.marketState.all();

// Build custom instructions
const customIx = await program.methods
  .someCustomMethod()
  .accounts({
    // your accounts
  })
  .instruction();

Market Types

The SDK automatically detects market types based on the mint address:

  • pump: Pump.fun integrated markets
  • bonk: Raydium Launch Lab (Bonk) integrated markets
  • external: External pools (currently supports RETARDIO token)

Documentation

For comprehensive documentation, examples, and API reference, visit docs.derp.trade.

Development

# Install dependencies
npm install

# Build the SDK
npm run build

# Run tests
npm run test:run

# Clean build
npm run build:clean

License

MIT