Skip to content

Getting Started with Depredict SDK

The Depredict SDK is a TypeScript library for interacting with the Depredict Protocol on Solana.

Installation

npm install @endcorp/depredict

Usage Example

import { Connection, PublicKey } from '@solana/web3.js';
import DepredictClient, { MarketType, OracleType, TOKEN_MINTS } from '@endcorp/depredict';
 
// Initialize the client (connection only)
const connection = new Connection('https://api.devnet.solana.com');
const client = new DepredictClient(connection);
 
// Authorities
const adminKey = new PublicKey('...'); // payer/authority for setup + txs
const feeVault = new PublicKey('...'); // protocol fee vault (ATA for market mint)
 
// One-time setup (send with your signer/wallet):
// await sendTx(await client.config.createConfig(50, adminKey, feeVault), [adminSigner]);
// await sendTx((await client.marketCreator.createMarketCreator({ name: 'My Platform', feeVault, creatorFeeBps: 50, signer: adminKey })).ixs, [adminSigner]);
 
// Example: Get your markets (by authority)
const myMarkets = await client.trade.getMarketsByAuthority(adminKey);
 
// Example: Create a LIVE market (assumes config + market creator exist)
const { tx, marketId } = await client.trade.createMarket({
  startTime: Math.floor(Date.now()/1000),
  endTime: Math.floor(Date.now()/1000) + 86400,
  question: 'Will SOL close above $200 today?',
  oracleType: OracleType.MANUAL,
  marketType: MarketType.LIVE,
  metadataUri: 'https://example.com/metadata.json',
  payer: adminKey,
  mintAddress: TOKEN_MINTS.USDC_DEVNET, // optional; defaults to USDC devnet
  // bettingStartTime required for FUTURE markets
});
// submit `tx` with your wallet adapter

Token Programs & ATAs

  • Market mints can be SPL Token or Token-2022. The SDK auto-detects the mint’s owner and derives ATAs with the matching token program.
  • Ensure fee vaults and creator vaults have ATAs for the market mint (with the correct token program). The SDK builders will derive them when possible; otherwise, create them client-side.

Features

  • Create and manage prediction markets
  • Place and manage positions
  • View market data and liquidity
  • Handle user trades and NFT positions
  • Protocol configuration management
Depredict is an END Corp. project. | Copyright © 2025 END Corp.