Documentation Index Fetch the complete documentation index at: https://pond.dflow.net/llms.txt
Use this file to discover all available pages before exploring further.
To increase, trade an input token (USDC, CASH, or any SPL) into the outcome token. To decrease, flip the mints. Both directions use the same /order endpoint.
Increase
Set up
Imports, env config, and the wallet/connection used across every step.
import "dotenv/config" ;
import { Connection , Keypair , VersionedTransaction } from "@solana/web3.js" ;
import bs58 from "bs58" ;
const DFLOW_TRADE_API_URL = process . env . DFLOW_TRADE_API_URL ?? "https://dev-quote-api.dflow.net" ;
const DFLOW_API_KEY = process . env . DFLOW_API_KEY ; // optional; not needed for dev endpoints
const DFLOW_SETTLEMENT_MINT = process . env . DFLOW_SETTLEMENT_MINT ?? "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" ; // USDC
const SOLANA_RPC_URL = process . env . SOLANA_RPC_URL ?? "https://api.mainnet-beta.solana.com" ;
const connection = new Connection ( SOLANA_RPC_URL , "confirmed" );
const keypair = Keypair . fromSecretKey (
bs58 . decode ( process . env . SOLANA_PRIVATE_KEY ?? "" )
);
const headers : HeadersInit = {};
if ( DFLOW_API_KEY ) headers [ "x-api-key" ] = DFLOW_API_KEY ;
Request an order
const outcomeMint = "OUTCOME_TOKEN_MINT_ADDRESS" ;
const amount = 25_000_000 ; // 25 USDC (6 decimals)
const params = new URLSearchParams ();
params . append ( "inputMint" , DFLOW_SETTLEMENT_MINT );
params . append ( "outputMint" , outcomeMint );
params . append ( "amount" , amount . toString ());
params . append ( "userPublicKey" , keypair . publicKey . toBase58 ());
const orderResponse = await fetch (
` ${ DFLOW_TRADE_API_URL } /order? ${ params } ` ,
{ headers }
). then (( r ) => r . json ());
Sign and submit
const txBuffer = Buffer . from ( orderResponse . transaction , "base64" );
const transaction = VersionedTransaction . deserialize ( txBuffer );
transaction . sign ([ keypair ]);
const signature = await connection . sendRawTransaction ( transaction . serialize (), {
skipPreflight: true ,
maxRetries: 2 ,
});
console . log ( ` Tx: https://orbmarkets.io/tx/ ${ signature } ` );
await connection . confirmTransaction ({
signature ,
blockhash: transaction . message . recentBlockhash ,
lastValidBlockHeight: orderResponse . lastValidBlockHeight ,
});
Check order status
const status = await fetch (
` ${ DFLOW_TRADE_API_URL } /order-status?signature= ${ signature } ` ,
{ headers }
). then (( r ) => r . json ());
console . log ( status . status , status . fills );
Decrease
Request an order
// Reuses DFLOW_TRADE_API_URL, DFLOW_SETTLEMENT_MINT, headers, and keypair from the setup above.
const decOutcomeMint = "OUTCOME_TOKEN_MINT_ADDRESS" ;
const decAmount = 5_000_000 ; // 5 outcome tokens (6 decimals)
const decParams = new URLSearchParams ();
decParams . append ( "inputMint" , decOutcomeMint );
decParams . append ( "outputMint" , DFLOW_SETTLEMENT_MINT );
decParams . append ( "amount" , decAmount . toString ());
decParams . append ( "userPublicKey" , keypair . publicKey . toBase58 ());
const decOrderResponse = await fetch (
` ${ DFLOW_TRADE_API_URL } /order? ${ decParams } ` ,
{ headers }
). then (( r ) => r . json ());
Sign and submit
const decTxBuffer = Buffer . from ( decOrderResponse . transaction , "base64" );
const decTransaction = VersionedTransaction . deserialize ( decTxBuffer );
decTransaction . sign ([ keypair ]);
const decSignature = await connection . sendRawTransaction ( decTransaction . serialize (), {
skipPreflight: true ,
maxRetries: 2 ,
});
console . log ( ` Tx: https://orbmarkets.io/tx/ ${ decSignature } ` );
await connection . confirmTransaction ({
signature: decSignature ,
blockhash: decTransaction . message . recentBlockhash ,
lastValidBlockHeight: decOrderResponse . lastValidBlockHeight ,
});
Check order status
const decStatus = await fetch (
` ${ DFLOW_TRADE_API_URL } /order-status?signature= ${ decSignature } ` ,
{ headers }
). then (( r ) => r . json ());
console . log ( decStatus . status , decStatus . fills );
Settlement
Reduce orders settle via one of two paths depending on reserve balance.
When reserves are balanced, the order settles immediately. Unused outcome tokens are refunded, platform fees are transferred, and stablecoins move from the Settlement Vault to your wallet.
When reserves are not balanced, the order fills without immediate settlement. Unused outcome tokens are refunded. Later, when reserves rebalance, the settlement authority completes settlement and transfers stablecoins to your wallet.
Buy Outcome Tokens Open or grow a prediction market position from any input token.
Redeem Outcome Tokens Complete redemption flow including scalar outcome payouts.
Track User Positions Map wallet balances back to markets and outcomes.
Market Lifecycle States a market moves through and what each one allows.
API Routes