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

@endcorp/depredict

v0.7.12

Published

SDK for interacting with the Depredict Protocol

Downloads

67

Readme

Depredict SDK

A TypeScript SDK for interacting with the Depredict Protocol Solana contract.

Installation

npm install @endcorp/depredict

Usage

import { Connection, PublicKey } from '@solana/web3.js';
import DepredictClient, { TOKEN_MINTS, DEFAULT_MINT } from '@endcorp/depredict';

// Initialize the client
const connection = new Connection('https://api.devnet.solana.com');
const adminKey = new PublicKey('your-admin-key');
const feeVault = new PublicKey('your-fee-vault');
const client = new DepredictClient(connection, adminKey, feeVault);

// Use the client to interact with the protocol
// Example: Get all markets
const markets = await client.trade.getAllMarkets();

Features

  • Create and manage markets
  • Place and manage orders
  • View market data and order books
  • Handle user trades and positions
  • Built-in token constants for easy access
  • Default USDC mint for markets

API Documentation

Trade Methods

  • getAllMarkets(): Get all markets
  • getMarketById(marketId): Get market by ID
  • createMarket(args): Create a new market (mintAddress optional; defaults to USDC devnet)
  • openPosition(args): Open a new position (mint is automatically determined from market)
  • closeMarket(marketId, payer): Close a market
  • resolveMarket(args): Resolve a market
  • payoutPosition(args): Payout a position
    • Requires rpcEndpoint for DAS/MAS proof fetching

Payout Example

await client.trade.payoutPosition({
  marketId: 1,
  payer: wallet.publicKey,
  assetId: new PublicKey('<compressed-nft-asset-id>'),
  rpcEndpoint: 'https://your-das.example',
  returnMode: 'transaction',
});

Token Constants

The SDK provides easy access to common token mints:

import { TOKEN_MINTS, DEFAULT_MINT } from '@endcorp/depredict';

// Available token mints
console.log(TOKEN_MINTS.USDC_DEVNET); // USDC on devnet
console.log(TOKEN_MINTS.USDC_MAINNET); // USDC on mainnet
console.log(TOKEN_MINTS.BONK); // BONK token
console.log(TOKEN_MINTS.SOL); // SOL token

// Default mint (USDC devnet)
console.log(DEFAULT_MINT); // Same as TOKEN_MINTS.USDC_DEVNET

Market Creation

When creating a market, you can specify the mint address or use the default (USDC devnet):

// Using default mint (USDC devnet)
const marketArgs = {
  startTime: Math.floor(Date.now() / 1000),
  endTime: Math.floor(Date.now() / 1000) + 86400, // 24 hours from now
  question: "Will BTC reach $100k by end of year?",
  metadataUri: "https://example.com/metadata.json",
  payer: wallet.publicKey,
  // mintAddress is optional - defaults to USDC_DEVNET
  oracleType: OracleType.MANUAL,
  marketType: MarketType.FUTURE,
  // Required only for FUTURE markets
  bettingStartTime: Math.floor(Date.now() / 1000),
};

// Using specific token mint
const bonkMarketArgs = {
  ...marketArgs,
  question: "Will BONK reach $1 by end of year?",
  mintAddress: TOKEN_MINTS.BONK, // Use BONK token
};

const { tx, marketId } = await client.trade.createMarket(marketArgs);

Position Trading

When opening a position, the mint and decimals are automatically determined from the market:

const positionArgs = {
  marketId: 1,
  amount: 100, // Amount in the market's token; auto-converted using market decimals
  direction: { yes: {} },
  payer: wallet.publicKey,
  metadataUri: "https://example.com/position-metadata.json"
};

const { ixs, addressLookupTableAccounts } = await client.trade.openPosition(positionArgs);

Note: The SDK automatically handles decimal conversion based on each market's configured mint. For example:

  • USDC markets (6 decimals): amount: 100 becomes 100000000 (100 * 10^6)
  • SOL markets (9 decimals): amount: 1 becomes 1000000000 (1 * 10^9)

License

MIT