Getting Started with Depredict SDK
The Depredict SDK is a TypeScript library for interacting with the Depredict Protocol on Solana.
Installation
npm install @endcorp/depredictUsage Example
import { Connection, PublicKey } from '@solana/web3.js';
import DepredictClient, { MarketType, OracleType } from '@endcorp/depredict';
// Initialize the client
const connection = new Connection('https://api.devnet.solana.com');
const adminKey = new PublicKey('...'); // Your admin public key
const feeVault = new PublicKey('...'); // Your fee vault public key
const client = new DepredictClient(connection, adminKey, feeVault);
// Example: Get your markets (by authority)
const myMarkets = await client.trade.getMarketsByAuthority(adminKey);
// Example: Create a LIVE market
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,
// bettingStartTime required for FUTURE markets
});Features
- Create and manage prediction markets
- Place and manage positions
- View market data and liquidity
- Handle user trades and NFT positions
- Protocol configuration management
