Skip to content

Depredict SDK API Reference

This page provides an overview of the main classes and methods available in the Depredict SDK.

DepredictClient

The main entry point for interacting with the Depredict protocol.

import DepredictClient from '@endcorp/depredict';
 
const client = new DepredictClient(connection, adminKey, feeVault);

Properties

  • trade: Market and trading operations
  • config: Protocol configuration
  • position: Position management

Trade Methods

Market Operations

  • getAllMarkets(): Get all markets
  • getMarketById(marketId): Get market by ID
  • getMarketByAddress(address): Get market by PDA address
  • createMarket(args): Create a new market
  • resolveMarket({ marketId, payer, resolutionValue? }): Resolve a market
  • closeMarket(marketId, payer): Close a market and collect remaining liquidity
  • updateMarket(marketId, payer, marketEnd?, marketState?): Update a market's end time or state

Position Operations

  • openPosition(args): Open a new position/order
  • payoutPosition(marketId, payer, positionId, positionNonce): Settle a position and claim payout

Config Methods

  • createConfig(feeAmount, payer): Initialize protocol config
  • getConfig(): Fetch protocol config
  • updateFee(feeAmount): Update fee amount
  • updateFeeVault(newFeeVault): Update fee vault address
  • updateAuthority(newAuthority): Update config authority
  • closeConfig(payer): Close config (if no active markets)

Position Methods

  • getPositionsAccountsForMarket(marketId): Get all position accounts for a market
  • getPositionsAccountPda(marketId, positionNonce?): Get PDA for a position account
  • getPositionAccountIxs(marketId, payer): Get instructions for position account creation/lookup
  • createSubPositionAccount(marketId, payer, marketAddress, options?): Create sub-position account

Market Types

Market States

  • ACTIVE: Market is open for trading
  • ENDED: Market has ended, no new positions
  • RESOLVING: Market is being resolved
  • RESOLVED: Market has been resolved

Market Types

  • LIVE: Market starts immediately
  • FUTURE: Market starts at a future time

Oracle Types

  • SWITCHBOARD: Uses Switchboard oracle for resolution
  • MANUAL: Manual resolution by admin

For detailed argument types, see the SDK TypeScript types or the protocol IDL.

Depredict is an END Corp. project. | Copyright © 2025 END Corp.