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 operationsconfig
: Protocol configurationposition
: Position management
Trade Methods
Market Operations
getAllMarkets()
: Get all marketsgetMarketById(marketId)
: Get market by IDgetMarketByAddress(address)
: Get market by PDA addresscreateMarket(args)
: Create a new marketresolveMarket({ marketId, payer, resolutionValue? })
: Resolve a marketcloseMarket(marketId, payer)
: Close a market and collect remaining liquidityupdateMarket(marketId, payer, marketEnd?, marketState?)
: Update a market's end time or state
Position Operations
openPosition(args)
: Open a new position/orderpayoutPosition(marketId, payer, positionId, positionNonce)
: Settle a position and claim payout
Config Methods
createConfig(feeAmount, payer)
: Initialize protocol configgetConfig()
: Fetch protocol configupdateFee(feeAmount)
: Update fee amountupdateFeeVault(newFeeVault)
: Update fee vault addressupdateAuthority(newAuthority)
: Update config authoritycloseConfig(payer)
: Close config (if no active markets)
Position Methods
getPositionsAccountsForMarket(marketId)
: Get all position accounts for a marketgetPositionsAccountPda(marketId, positionNonce?)
: Get PDA for a position accountgetPositionAccountIxs(marketId, payer)
: Get instructions for position account creation/lookupcreateSubPositionAccount(marketId, payer, marketAddress, options?)
: Create sub-position account
Market Types
Market States
ACTIVE
: Market is open for tradingENDED
: Market has ended, no new positionsRESOLVING
: Market is being resolvedRESOLVED
: Market has been resolved
Market Types
LIVE
: Market starts immediatelyFUTURE
: Market starts at a future time
Oracle Types
SWITCHBOARD
: Uses Switchboard oracle for resolutionMANUAL
: Manual resolution by admin
For detailed argument types, see the SDK TypeScript types or the protocol IDL.