@liberfi.io/ui-predict 0.1.75 → 0.1.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1420 +0,0 @@
1
- import './client-Doli88ls.mjs';
2
-
3
- /** Supported prediction market providers */
4
- type ProviderType = "dflow" | "kalshi" | "polymarket";
5
- /** Market lifecycle status */
6
- type MarketStatus = "initialized" | "active" | "inactive" | "closed" | "determined" | "finalized";
7
- /** Sort fields for queries */
8
- type SortField = "volume" | "volume24h" | "liquidity" | "openInterest" | "startDate";
9
- /** Sort order */
10
- type SortOrder = "asc" | "desc";
11
- /** Order status for swap orders */
12
- type OrderStatus = "pending" | "expired" | "failed" | "open" | "pendingClose" | "closed";
13
- /** Platform fee mode */
14
- type PlatformFeeMode = "inputMint" | "outputMint";
15
- /** Slippage tolerance - can be number (basis points) or 'auto' */
16
- type SlippageTolerance = number | "auto";
17
- /** Priority level for transactions */
18
- type PriorityLevel = "medium" | "high" | "veryHigh";
19
- /** Execution mode for orders */
20
- type ExecutionMode = "sync" | "async";
21
- /** Settlement source information */
22
- interface SettlementSource {
23
- /** Name of the settlement source */
24
- name: string;
25
- /** URL to the settlement source */
26
- url: string;
27
- }
28
- /** Standard Event - dflow standard format */
29
- interface StandardEvent {
30
- /** Event ticker (unique identifier) */
31
- ticker: string;
32
- /** Series ticker this event belongs to */
33
- seriesTicker: string;
34
- /** Event title */
35
- title: string;
36
- /** Event subtitle */
37
- subtitle: string;
38
- /** Competition name */
39
- competition?: string | null;
40
- /** Competition scope */
41
- competitionScope?: string | null;
42
- /** Event image URL */
43
- imageUrl?: string | null;
44
- /** Total liquidity */
45
- liquidity?: number | null;
46
- /** Nested markets */
47
- markets?: StandardMarket[] | null;
48
- /** Open interest */
49
- openInterest?: number | null;
50
- /** Settlement sources */
51
- settlementSources?: SettlementSource[] | null;
52
- /** Strike date (unix timestamp) */
53
- strikeDate?: number | null;
54
- /** Strike period */
55
- strikePeriod?: string | null;
56
- /** Total volume */
57
- volume?: number | null;
58
- /** 24 hour volume */
59
- volume24h?: number | null;
60
- }
61
- /** Events list response */
62
- interface StandardEventsResponse {
63
- /** Pagination cursor */
64
- cursor?: number | null;
65
- /** List of events */
66
- events: StandardEvent[];
67
- }
68
- /** Market account info for Solana */
69
- interface MarketAccountInfo {
70
- /** Market ledger address */
71
- marketLedger: string;
72
- /** Yes outcome mint address */
73
- yesMint: string;
74
- /** No outcome mint address */
75
- noMint: string;
76
- /** Whether the market is initialized */
77
- isInitialized: boolean;
78
- /** Redemption status */
79
- redemptionStatus?: string | null;
80
- /** Scalar outcome percentage */
81
- scalarOutcomePct?: number | null;
82
- }
83
- /** Standard Market - dflow standard format */
84
- interface StandardMarket {
85
- /** Market ticker (unique identifier) */
86
- ticker: string;
87
- /** Event ticker this market belongs to */
88
- eventTicker: string;
89
- /** Market type */
90
- marketType: string;
91
- /** Market title */
92
- title: string;
93
- /** Market subtitle */
94
- subtitle: string;
95
- /** Yes outcome subtitle */
96
- yesSubTitle: string;
97
- /** No outcome subtitle */
98
- noSubTitle: string;
99
- /** Market open time (unix timestamp) */
100
- openTime: number;
101
- /** Market close time (unix timestamp) */
102
- closeTime: number;
103
- /** Market expiration time (unix timestamp) */
104
- expirationTime: number;
105
- /** Market status */
106
- status: MarketStatus;
107
- /** Total trading volume */
108
- volume: number;
109
- /** Market result */
110
- result: string;
111
- /** Open interest */
112
- openInterest: number;
113
- /** Whether market can close early */
114
- canCloseEarly: boolean;
115
- /** Primary rules for the market */
116
- rulesPrimary: string;
117
- /** Market accounts information */
118
- accounts: Record<string, MarketAccountInfo>;
119
- /** Early close condition */
120
- earlyCloseCondition?: string | null;
121
- /** Yes ask price */
122
- yesAsk?: string | null;
123
- /** Yes bid price */
124
- yesBid?: string | null;
125
- /** No ask price */
126
- noAsk?: string | null;
127
- /** No bid price */
128
- noBid?: string | null;
129
- /** Secondary rules */
130
- rulesSecondary?: string | null;
131
- }
132
- /** Markets list response */
133
- interface StandardMarketsResponse {
134
- /** Pagination cursor */
135
- cursor?: number | null;
136
- /** List of markets */
137
- markets: StandardMarket[];
138
- }
139
- /** A single level in the order book */
140
- interface OrderbookLevel {
141
- /** Price level */
142
- price: number;
143
- /** Quantity at this price level */
144
- quantity: number;
145
- }
146
- /** Orderbook response (normalised by the client) */
147
- interface OrderbookResponse {
148
- /** Yes side bids (sorted descending by price) */
149
- yesBids: OrderbookLevel[];
150
- /** Yes side asks (sorted ascending by price) */
151
- yesAsks: OrderbookLevel[];
152
- /** No side bids (sorted descending by price) */
153
- noBids: OrderbookLevel[];
154
- /** No side asks (sorted ascending by price) */
155
- noAsks: OrderbookLevel[];
156
- /** Orderbook sequence number */
157
- sequence?: number;
158
- }
159
- /** Single trade response */
160
- interface SingleTradeResponse {
161
- /** Unique trade identifier */
162
- tradeId: string;
163
- /** Market ticker */
164
- ticker: string;
165
- /** Trade price (integer cents) */
166
- price: number;
167
- /** Number of contracts traded */
168
- count: number;
169
- /** Yes outcome price (integer cents) */
170
- yesPrice: number;
171
- /** No outcome price (integer cents) */
172
- noPrice: number;
173
- /** Yes outcome price in dollars */
174
- yesPriceDollars: string;
175
- /** No outcome price in dollars */
176
- noPriceDollars: string;
177
- /** Taker side of the trade (yes/no) */
178
- takerSide: string;
179
- /** Unix timestamp when trade was created */
180
- createdTime: number;
181
- }
182
- /** Multi trade response */
183
- interface MultiTradeResponse {
184
- /** Pagination cursor for next page */
185
- cursor?: string | null;
186
- /** List of trades */
187
- trades: SingleTradeResponse[];
188
- }
189
- /** Single on-chain trade */
190
- interface OnchainTrade {
191
- /** Unique trade ID */
192
- id: number;
193
- /** Unix timestamp when trade was created */
194
- createdAt: number;
195
- /** Event type (e.g. "fill") */
196
- eventType: string;
197
- /** Order Solana account address */
198
- orderAccount: string;
199
- /** Input token mint address */
200
- inputMint: string;
201
- /** Output token mint address */
202
- outputMint: string;
203
- /** Input amount in raw token units */
204
- inputAmount: number;
205
- /** Output amount in raw token units */
206
- outputAmount: number;
207
- /** Fee token mint address */
208
- feeMint: string;
209
- /** Fee amount in raw token units */
210
- feeAmount: number;
211
- /** Solana transaction signature */
212
- transactionSignature: string;
213
- /** User wallet address */
214
- wallet: string;
215
- /** Fill recipient address */
216
- fillRecipient: string;
217
- /** Refund recipient address */
218
- refundRecipient: string;
219
- /** Number of contracts (raw amount / 10^6) */
220
- contracts?: number | null;
221
- /** Market ticker */
222
- marketTicker?: string | null;
223
- /** Trade side ("yes" | "no") */
224
- side?: string | null;
225
- /** USD price per outcome contract */
226
- usdPricePerContract?: number | null;
227
- }
228
- /** On-chain trades paginated response */
229
- interface MultiOnchainTradeResponse {
230
- /** Pagination cursor for next page */
231
- cursor?: string | null;
232
- /** List of on-chain trades */
233
- trades: OnchainTrade[];
234
- }
235
- /** Sort field for on-chain trades */
236
- type OnchainTradeSortBy = "createdAt" | "inputAmount" | "outputAmount";
237
- /** Base query parameters shared by all on-chain trade endpoints */
238
- interface OnchainTradesBaseQueryParams {
239
- /** Maximum number of trades to return (1-250, default 100) */
240
- limit?: number;
241
- /** Pagination cursor (trade ID) */
242
- cursor?: string;
243
- /** Sort field */
244
- sortBy?: OnchainTradeSortBy;
245
- /** Sort order */
246
- sortOrder?: SortOrder;
247
- /** Minimum amount filter (raw 6-decimal precision) */
248
- minAmount?: number;
249
- /** Maximum amount filter (raw 6-decimal precision) */
250
- maxAmount?: number;
251
- }
252
- /** Query parameters for on-chain trades by wallet */
253
- interface OnchainTradesByWalletQueryParams extends OnchainTradesBaseQueryParams {
254
- /** Wallet address */
255
- walletAddress: string;
256
- }
257
- /** Query parameters for on-chain trades by event */
258
- interface OnchainTradesByEventQueryParams extends OnchainTradesBaseQueryParams {
259
- /** Event ticker */
260
- eventTicker: string;
261
- /** Optional wallet address filter */
262
- wallet?: string;
263
- }
264
- /** Query parameters for on-chain trades by market */
265
- interface OnchainTradesByMarketQueryParams extends OnchainTradesBaseQueryParams {
266
- /** Market ticker */
267
- marketTicker: string;
268
- /** Optional wallet address filter */
269
- wallet?: string;
270
- }
271
- /** Candlestick OHLC prices */
272
- interface CandlestickOHLC {
273
- /** Open price */
274
- open: number;
275
- /** High price */
276
- high: number;
277
- /** Low price */
278
- low: number;
279
- /** Close price */
280
- close: number;
281
- }
282
- /** Candlestick data point */
283
- interface CandlestickDataPoint {
284
- /** End of period timestamp */
285
- end_period_ts: number;
286
- /** Yes ask OHLC prices */
287
- yes_ask: CandlestickOHLC;
288
- /** Volume */
289
- volume?: number;
290
- }
291
- /** Candlesticks response */
292
- interface CandlesticksResponse {
293
- /** Array of candlestick data points */
294
- candlesticks?: CandlestickDataPoint[];
295
- }
296
- /** Forecast percentile data point */
297
- interface ForecastPercentileDataPoint {
298
- /** Timestamp */
299
- ts: number;
300
- /** Raw forecast value */
301
- raw: number;
302
- /** Formatted forecast value */
303
- formatted: string;
304
- }
305
- /** Forecast percentile history response */
306
- interface ForecastPercentileHistoryResponse {
307
- /** Percentile history data */
308
- history?: Record<string, ForecastPercentileDataPoint[]>;
309
- }
310
- /** Series settlement source */
311
- interface SeriesSettlementSource {
312
- /** Settlement source name */
313
- name: string;
314
- /** Settlement source URL */
315
- url: string;
316
- }
317
- /** Series response */
318
- interface SeriesResponse {
319
- /** Series ticker */
320
- ticker: string;
321
- /** Event frequency (e.g., daily, weekly, monthly) */
322
- frequency: string;
323
- /** Series title */
324
- title: string;
325
- /** Category (e.g., Politics, Economics, Entertainment) */
326
- category: string;
327
- /** List of tags */
328
- tags: string[];
329
- /** Settlement sources */
330
- settlementSources: SeriesSettlementSource[];
331
- /** Contract URL */
332
- contractUrl: string;
333
- /** Contract terms URL */
334
- contractTermsUrl: string;
335
- /** Product metadata */
336
- productMetadata?: unknown;
337
- /** Fee type */
338
- feeType: string;
339
- /** Fee multiplier */
340
- feeMultiplier: number;
341
- /** Additional prohibitions */
342
- additionalProhibitions: string[];
343
- }
344
- /** Series list response */
345
- interface SeriesListResponse {
346
- /** List of series */
347
- series: SeriesResponse[];
348
- }
349
- /** Tags by categories response */
350
- interface TagsByCategoriesResponse {
351
- /** Mapping of series categories to their associated tags */
352
- tagsByCategories: Record<string, string[]>;
353
- }
354
- /** Filters by sports response */
355
- interface FiltersBySportsResponse {
356
- /** Filtering options available for each sport */
357
- filtersBySports: Record<string, unknown>;
358
- /** Ordered list of sport identifiers */
359
- sportOrdering: string[];
360
- }
361
- /** Search response */
362
- interface SearchResponse {
363
- /** List of events matching the search query */
364
- events: StandardEvent[];
365
- /** Cursor for pagination */
366
- cursor: number;
367
- }
368
- /** Route plan leg */
369
- interface RoutePlanLeg {
370
- /** Venue for the leg */
371
- venue: string;
372
- /** Key identifying the market on the venue */
373
- marketKey: string;
374
- /** Data for the leg */
375
- data?: string;
376
- /** Base58-encoded input mint address */
377
- inputMint: string;
378
- /** Base58-encoded output mint address */
379
- outputMint: string;
380
- /** Maximum input amount for the leg as a scaled integer */
381
- inAmount: string;
382
- /** Expected output amount for the leg as a scaled integer */
383
- outAmount: string;
384
- /** Decimals for the input mint */
385
- inputMintDecimals: number;
386
- /** Decimals for the output mint */
387
- outputMintDecimals: number;
388
- }
389
- /** Platform fee response */
390
- interface PlatformFee {
391
- /** Platform fee as a scaled integer */
392
- amount: string;
393
- /** Token account that will receive the platform fee */
394
- feeAccount: string;
395
- /** Platform fee in basis points */
396
- feeBps: number;
397
- /** Segmenter fee as a scaled integer */
398
- segmenterFeeAmount: string;
399
- /** Segmenter fee in percent */
400
- segmenterFeePct: number;
401
- }
402
- /** Quote response for imperative swap */
403
- interface QuoteResponse {
404
- /** Base58-encoded input mint address */
405
- inputMint: string;
406
- /** Maximum input amount as a scaled integer */
407
- inAmount: string;
408
- /** Base58-encoded output mint address */
409
- outputMint: string;
410
- /** Expected output amount after all fees as a scaled integer */
411
- outAmount: string;
412
- /** Minimum output amount after all fees as a scaled integer */
413
- otherAmountThreshold: string;
414
- /** Same as otherAmountThreshold */
415
- minOutAmount: string;
416
- /** Max allowed slippage in basis points */
417
- slippageBps: number;
418
- /** Price impact of the swap as a percentage string */
419
- priceImpactPct: string;
420
- /** Route that the swap will take */
421
- routePlan: RoutePlanLeg[];
422
- /** Slot at which the request was evaluated */
423
- contextSlot: number;
424
- /** True if the request was for a Jito bundle */
425
- forJitoBundle?: boolean;
426
- /** Transfer fee amount applied to the quote */
427
- outTransferFee?: string;
428
- /** Platform fee applied to the quote */
429
- platformFee?: PlatformFee;
430
- /** Identifier for the request */
431
- requestId?: string;
432
- /** Compute units consumed by quote simulation */
433
- simulatedComputeUnits?: number;
434
- }
435
- /** Compute budget info */
436
- interface ComputeBudgetInfo {
437
- /** Compute unit price assigned to the transaction */
438
- microLamports: number;
439
- /** Compute unit price estimated by the server */
440
- estimatedMicroLamports?: number;
441
- }
442
- /** Prioritization type */
443
- interface PrioritizationType {
444
- /** Compute budget prioritization fee */
445
- computeBudget?: ComputeBudgetInfo;
446
- }
447
- /** Swap response for imperative swap */
448
- interface SwapResponse {
449
- /** Base64-encoded swap transaction */
450
- swapTransaction: string;
451
- /** Last block height at which the transaction is valid */
452
- lastValidBlockHeight: number;
453
- /** Prioritization fee in lamports */
454
- prioritizationFeeLamports: number;
455
- /** Compute unit limit assigned to the transaction */
456
- computeUnitLimit: number;
457
- /** Prioritization fee type */
458
- prioritizationType?: PrioritizationType;
459
- }
460
- /** Account meta response */
461
- interface AccountMetaResponse {
462
- /** Pubkey of the account */
463
- pubkey: string;
464
- /** Is the account a signer? */
465
- isSigner: boolean;
466
- /** Is the account writable? */
467
- isWritable: boolean;
468
- }
469
- /** Instruction response */
470
- interface InstructionResponse {
471
- /** Pubkey of the program that executes this instruction */
472
- programId: string;
473
- /** Metadata describing accounts that should be passed to the program */
474
- accounts: AccountMetaResponse[];
475
- /** Opaque data passed to the program for its own interpretation */
476
- data: string;
477
- }
478
- /** Blockhash with metadata */
479
- interface BlockhashWithMetadata {
480
- /** Base58-encoded blockhash */
481
- blockhash: string;
482
- /** The last block height at which a transaction that uses the blockhash is valid */
483
- lastValidBlockHeight: number;
484
- }
485
- /** Swap instructions response */
486
- interface SwapInstructionsResponse {
487
- /** Instructions that determine the compute budget and prioritization fee */
488
- computeBudgetInstructions: InstructionResponse[];
489
- /** Instructions that should be included before the swap instruction */
490
- setupInstructions: InstructionResponse[];
491
- /** The swap instruction */
492
- swapInstruction: InstructionResponse;
493
- /** Instructions that should be included after the swap instruction */
494
- cleanupInstructions: InstructionResponse[];
495
- /** Other instructions that should be included in the transaction */
496
- otherInstructions: InstructionResponse[];
497
- /** The lookup table addresses */
498
- addressLookupTableAddresses: string[];
499
- /** Prioritization fee in lamports */
500
- prioritizationFeeLamports: number;
501
- /** Compute unit limit assigned to the transaction */
502
- computeUnitLimit: number;
503
- /** A blockhash that can be used to construct the transaction */
504
- blockhashWithMetadata: BlockhashWithMetadata;
505
- /** Prioritization fee type */
506
- prioritizationType?: PrioritizationType;
507
- }
508
- /** Order response */
509
- interface OrderResponse {
510
- /** Execution mode: "sync" or "async" */
511
- executionMode: ExecutionMode;
512
- /** Input amount as a scaled integer */
513
- inAmount: string;
514
- /** Base58-encoded input mint address */
515
- inputMint: string;
516
- /** Output amount as a scaled integer */
517
- outAmount: string;
518
- /** Base58-encoded output mint address */
519
- outputMint: string;
520
- /** Other output amount for async prediction market orders */
521
- otherAmountThreshold?: string;
522
- /** Platform fee information */
523
- platformFee?: PlatformFee;
524
- /** Price impact in percent */
525
- priceImpactPct?: string;
526
- /** Priority fee in lamports */
527
- prioritizationFeeLamports?: number;
528
- /** Prioritization fee type */
529
- prioritizationType?: unknown;
530
- /** Revert mint address for async orders */
531
- revertMint?: string;
532
- /** Route plan */
533
- routePlan?: RoutePlanLeg[];
534
- /** Max allowed slippage in basis points */
535
- slippageBps: number;
536
- /** Base64-encoded transaction to sign and send */
537
- transaction?: string;
538
- }
539
- /** Order fill information */
540
- interface OrderFill {
541
- /** Base58-encoded signature of the fill transaction */
542
- signature: string;
543
- /** Input mint for the fill */
544
- inputMint: string;
545
- /** Input amount including fees, as a scaled integer */
546
- inAmount: string;
547
- /** Output mint for the fill */
548
- outputMint: string;
549
- /** Output amount including fees, as a scaled integer */
550
- outAmount: string;
551
- }
552
- /** Order revert information */
553
- interface OrderRevert {
554
- /** Base58-encoded signature of the revert transaction */
555
- signature: string;
556
- /** Mint returned to the user */
557
- mint: string;
558
- /** Amount returned to the user, as a scaled integer */
559
- amount: string;
560
- }
561
- /** Order status response */
562
- interface OrderStatusResponse {
563
- /** Status of the order */
564
- status: OrderStatus;
565
- /** Total input amount filled, as a scaled integer */
566
- inAmount: string;
567
- /** Total output amount filled, as a scaled integer */
568
- outAmount: string;
569
- /** Fills for the order */
570
- fills?: OrderFill[];
571
- /** Reverts for the order */
572
- reverts?: OrderRevert[];
573
- }
574
- /** Intent expiry */
575
- interface IntentExpiry {
576
- /** Number of slots after open transaction when intent expires */
577
- slotsAfterOpen?: number;
578
- }
579
- /** Intent quote response */
580
- interface IntentQuoteResponse {
581
- /** Base58-encoded input mint address */
582
- inputMint: string;
583
- /** Maximum input amount as a scaled integer */
584
- inAmount: string;
585
- /** Base58-encoded output mint address */
586
- outputMint: string;
587
- /** Expected output amount after all fees as a scaled integer */
588
- outAmount: string;
589
- /** Minimum output amount after all fees as a scaled integer */
590
- otherAmountThreshold: string;
591
- /** Same as otherAmountThreshold */
592
- minOutAmount: string;
593
- /** Max allowed slippage in basis points */
594
- slippageBps: number;
595
- /** Maximum fee budget for intent processing in lamports */
596
- feeBudget: number;
597
- /** Price impact of the swap as a percentage string */
598
- priceImpactPct: string;
599
- /** Intent expiry information */
600
- expiry?: IntentExpiry;
601
- /** Last valid block height for the open transaction */
602
- lastValidBlockHeight?: number;
603
- /** Base64-encoded intent opening transaction */
604
- openTransaction?: string;
605
- /** Platform fee applied to the quote */
606
- platformFee?: PlatformFee;
607
- }
608
- /** Intent swap response */
609
- interface IntentSwapResponse {
610
- /** Base58-encoded program ID of the program that facilitates the swap */
611
- programId: string;
612
- /** Base58-encoded order address */
613
- orderAddress: string;
614
- /** Base58-encoded open transaction signature */
615
- openTransactionSignature: string;
616
- }
617
- /** Prediction market init response */
618
- interface PredictionMarketInitResponse {
619
- /** Base64-encoded transaction to initialize the market */
620
- transaction: string;
621
- /** The last block height at which the blockhash assigned to the transaction is valid */
622
- lastValidBlockHeight: number;
623
- /** Compute unit limit assigned to the transaction */
624
- computeUnitLimit: number;
625
- }
626
- /** Token with decimals */
627
- type TokenWithDecimals = [string, number];
628
- /** Token list response */
629
- type TokenListResponse = string[];
630
- /** Token list with decimals response */
631
- type TokenListWithDecimalsResponse = TokenWithDecimals[];
632
- /** Venue list response */
633
- type VenueListResponse = string[];
634
- /** Single wallet position item */
635
- interface WalletPositionItem {
636
- /** Token mint address */
637
- mint: string;
638
- /** Token balance (UI amount) */
639
- balance: number;
640
- /** Token decimals */
641
- decimals: number;
642
- /** Position side: YES, NO, or UNKNOWN */
643
- position: "YES" | "NO" | "UNKNOWN";
644
- /** Associated market details */
645
- market?: StandardMarket | null;
646
- }
647
- /** Wallet positions response */
648
- interface WalletPositionsResponse {
649
- /** Wallet address */
650
- wallet: string;
651
- /** USDC balance (UI amount) */
652
- usdcBalance: number;
653
- /** List of positions */
654
- positions: WalletPositionItem[];
655
- }
656
- /** Outcome mints response */
657
- interface OutcomeMintsResponse {
658
- /** List of all yes_mint and no_mint pubkeys from supported markets */
659
- mints: string[];
660
- }
661
- /** Filter outcome mints response */
662
- interface FilterOutcomeMintsResponse {
663
- /** List of addresses that are outcome mints */
664
- outcomeMints: string[];
665
- }
666
- /** Live data response - structure depends on upstream API */
667
- type LiveDataResponse = Record<string, unknown>;
668
- /** Event query parameters */
669
- interface EventQueryParams {
670
- /** Maximum number of events to return */
671
- limit?: number;
672
- /** Pagination cursor (number of events to skip) */
673
- cursor?: number;
674
- /** Filter by series tickers (comma-separated, max 25) */
675
- seriesTickers?: string;
676
- /** Filter events that are initialized */
677
- isInitialized?: boolean;
678
- /** Filter events by market status */
679
- status?: MarketStatus;
680
- /** Sort field */
681
- sort?: SortField;
682
- /** Sort order */
683
- order?: SortOrder;
684
- /** Include nested markets in response */
685
- withNestedMarkets?: boolean;
686
- }
687
- /** Market query parameters */
688
- interface MarketQueryParams {
689
- /** Maximum number of markets to return */
690
- limit?: number;
691
- /** Pagination cursor (number of markets to skip) */
692
- cursor?: number;
693
- /** Filter markets that are initialized */
694
- isInitialized?: boolean;
695
- /** Filter markets by status */
696
- status?: MarketStatus;
697
- /** Sort field */
698
- sort?: SortField;
699
- /** Sort order */
700
- order?: SortOrder;
701
- }
702
- /** Markets batch request */
703
- interface MarketsBatchRequest {
704
- /** List of market tickers to lookup */
705
- tickers?: string[] | null;
706
- /** List of mint addresses to lookup */
707
- mints?: string[] | null;
708
- }
709
- /** Orderbook query parameters */
710
- interface OrderbookQueryParams {
711
- /** Market ticker or mint address */
712
- marketTicker?: string;
713
- /** Mint address (alternative to marketTicker) */
714
- mintAddress?: string;
715
- }
716
- /** Trades query parameters */
717
- interface TradesQueryParams {
718
- /** Maximum number of trades to return (1-1000, default 100) */
719
- limit?: number;
720
- /** Pagination cursor (trade ID) to start from */
721
- cursor?: string;
722
- /** Filter by market ticker */
723
- ticker?: string;
724
- /** Filter trades after this Unix timestamp */
725
- minTs?: number;
726
- /** Filter trades before this Unix timestamp */
727
- maxTs?: number;
728
- }
729
- /** Trades by mint query parameters */
730
- interface TradesByMintQueryParams {
731
- /** Mint address (ledger or outcome mint) */
732
- mintAddress: string;
733
- /** Maximum number of trades to return (1-1000, default 100) */
734
- limit?: number;
735
- /** Pagination cursor (trade ID) to start from */
736
- cursor?: string;
737
- /** Filter trades after this Unix timestamp */
738
- minTs?: number;
739
- /** Filter trades before this Unix timestamp */
740
- maxTs?: number;
741
- }
742
- /** Candlesticks query parameters */
743
- interface CandlesticksQueryParams {
744
- /** Start timestamp (Unix timestamp) */
745
- startTs: number;
746
- /** End timestamp (Unix timestamp) */
747
- endTs: number;
748
- /** Time period length of each candlestick in minutes (1, 60, or 1440) */
749
- periodInterval: number;
750
- }
751
- /** Forecast percentile history query parameters */
752
- interface ForecastPercentileHistoryQueryParams {
753
- /** The series ticker */
754
- seriesTicker: string;
755
- /** The event ticker */
756
- eventId: string;
757
- /** Comma-separated list of percentile values (0-10000, max 10 values) */
758
- percentiles: string;
759
- /** Start timestamp for the range */
760
- startTs: number;
761
- /** End timestamp for the range */
762
- endTs: number;
763
- /** Period interval in minutes (0, 1, 60, or 1440) */
764
- periodInterval: number;
765
- }
766
- /** Forecast percentile history by mint query parameters */
767
- interface ForecastPercentileHistoryByMintQueryParams {
768
- /** Any mint address associated with the market */
769
- mintAddress: string;
770
- /** Comma-separated list of percentile values (0-10000, max 10 values) */
771
- percentiles: string;
772
- /** Start timestamp for the range */
773
- startTs: number;
774
- /** End timestamp for the range */
775
- endTs: number;
776
- /** Period interval in minutes (0, 1, 60, or 1440) */
777
- periodInterval: number;
778
- }
779
- /** Series query parameters */
780
- interface SeriesQueryParams {
781
- /** Filter series by category */
782
- category?: string;
783
- /** Filter series by tags (comma-separated list) */
784
- tags?: string;
785
- /** Filter series that are initialized */
786
- isInitialized?: boolean;
787
- /** Filter series by market status */
788
- status?: MarketStatus;
789
- }
790
- /** Search query parameters */
791
- interface SearchQueryParams {
792
- /** The query string to search for */
793
- q: string;
794
- /** Field to sort by */
795
- sort?: SortField;
796
- /** How to order the results */
797
- order?: SortOrder;
798
- /** How many records to limit the results to */
799
- limit?: number;
800
- /** Cursor for pagination */
801
- cursor?: number;
802
- /** Include nested markets in response */
803
- withNestedMarkets?: boolean;
804
- /** Include market account information */
805
- withMarketAccounts?: boolean;
806
- }
807
- /** Live data query parameters */
808
- interface LiveDataQueryParams {
809
- /** Array of milestone IDs (max 100) */
810
- milestoneIds: string[];
811
- }
812
- /** Live data by event query parameters */
813
- interface LiveDataByEventQueryParams {
814
- /** Event ticker */
815
- eventTicker: string;
816
- /** Minimum start date to filter milestones (RFC3339 format) */
817
- minimumStartDate?: string;
818
- /** Filter by milestone category */
819
- category?: string;
820
- /** Filter by competition */
821
- competition?: string;
822
- /** Filter by source ID */
823
- sourceId?: string;
824
- /** Filter by milestone type */
825
- type?: string;
826
- }
827
- /** Live data by mint query parameters */
828
- interface LiveDataByMintQueryParams {
829
- /** Market mint address */
830
- mintAddress: string;
831
- /** Minimum start date to filter milestones (RFC3339 format) */
832
- minimumStartDate?: string;
833
- /** Filter by milestone category */
834
- category?: string;
835
- /** Filter by competition */
836
- competition?: string;
837
- /** Filter by source ID */
838
- sourceId?: string;
839
- /** Filter by milestone type */
840
- type?: string;
841
- }
842
- /** Outcome mints query parameters */
843
- interface OutcomeMintsQueryParams {
844
- /** Minimum close timestamp */
845
- minCloseTs?: number;
846
- }
847
- /** Filter outcome mints request */
848
- interface FilterOutcomeMintsRequest {
849
- /** List of token addresses to filter (max 200) */
850
- addresses: string[];
851
- }
852
- /** Quote query parameters */
853
- interface QuoteQueryParams {
854
- /** Base58-encoded input mint address */
855
- inputMint: string;
856
- /** Base58-encoded output mint address */
857
- outputMint: string;
858
- /** Input amount as a scaled integer */
859
- amount: number;
860
- /** Max allowed slippage in basis points or "auto" */
861
- slippageBps?: SlippageTolerance;
862
- /** Comma-separated list of DEXes to include */
863
- dexes?: string;
864
- /** Comma-separated list of DEXes to exclude */
865
- excludeDexes?: string;
866
- /** Platform fee in basis points */
867
- platformFeeBps?: number;
868
- /** Platform fee mode */
869
- platformFeeMode?: PlatformFeeMode;
870
- /** If true, the quote will be used for a sponsored swap */
871
- sponsoredSwap?: boolean;
872
- /** If true, the quote will be used for a destination token account swap */
873
- destinationSwap?: boolean;
874
- /** If true, only use single-leg routes */
875
- onlyDirectRoutes?: boolean;
876
- /** Maximum number of legs in the route */
877
- maxRouteLength?: number;
878
- /** If true, only use JIT routes */
879
- onlyJitRoutes?: boolean;
880
- /** If true, only use routes compatible with Jito bundles */
881
- forJitoBundle?: boolean;
882
- }
883
- /** Prioritization fee lamports type */
884
- type PrioritizationFeeLamports = number | "auto" | "disabled" | {
885
- priorityLevelWithMaxLamports: {
886
- priorityLevel: PriorityLevel;
887
- maxLamports: number;
888
- };
889
- } | {
890
- autoMultiplier: number;
891
- } | {
892
- lamports: number;
893
- };
894
- /** Destination token account param */
895
- type DestinationTokenAccountParam = string | {
896
- associatedTokenAccount: {
897
- owner: string;
898
- };
899
- };
900
- /** Create fee account params */
901
- interface CreateFeeAccountParams {
902
- referralAccount: string;
903
- mint: string;
904
- }
905
- /** Positive slippage params */
906
- interface PositiveSlippageParams {
907
- feeAccount: string;
908
- feeBps?: number;
909
- }
910
- /** Swap request body */
911
- interface SwapRequestBody {
912
- /** Base58-encoded address of the swapper's wallet */
913
- userPublicKey: string;
914
- /** The response from the quote endpoint */
915
- quoteResponse: QuoteResponse;
916
- /** Compute unit price in micro-lamports */
917
- computeUnitPriceMicroLamports?: number;
918
- /** Create fee account params */
919
- createFeeAccount?: CreateFeeAccountParams;
920
- /** Destination token account */
921
- destinationTokenAccount?: DestinationTokenAccountParam;
922
- /** If true, simulate to determine compute unit limit */
923
- dynamicComputeUnitLimit?: boolean;
924
- /** Fee account address */
925
- feeAccount?: string;
926
- /** Jito sandwich mitigation account */
927
- includeJitoSandwichMitigationAccount?: boolean | string;
928
- /** Positive slippage params */
929
- positiveSlippage?: PositiveSlippageParams;
930
- /** Prioritization fee in lamports */
931
- prioritizationFeeLamports?: PrioritizationFeeLamports;
932
- /** Sponsor wallet address for gasless swaps */
933
- sponsor?: string;
934
- /** If false, use wrapped SOL */
935
- wrapAndUnwrapSol?: boolean;
936
- }
937
- /** Order query parameters */
938
- interface OrderQueryParams {
939
- /** Base58-encoded address of the swapper's wallet */
940
- userPublicKey?: string;
941
- /** Base58-encoded input mint address */
942
- inputMint: string;
943
- /** Base58-encoded output mint address */
944
- outputMint: string;
945
- /** Input amount as a scaled integer */
946
- amount: number;
947
- /** Max allowed slippage in basis points or "auto" */
948
- slippageBps?: SlippageTolerance;
949
- /** Max allowed slippage for prediction market orders */
950
- predictionMarketSlippageBps?: SlippageTolerance;
951
- /** Comma-separated list of DEXes to include */
952
- dexes?: string;
953
- /** Comma-separated list of DEXes to exclude */
954
- excludeDexes?: string;
955
- /** If true, only use single-leg routes */
956
- onlyDirectRoutes?: boolean;
957
- /** Maximum number of legs in the route */
958
- maxRouteLength?: number;
959
- /** If true, only use JIT routes */
960
- onlyJitRoutes?: boolean;
961
- /** If true, only use routes compatible with Jito bundles */
962
- forJitoBundle?: boolean;
963
- /** If true, allow synchronous execution */
964
- allowSyncExec?: boolean;
965
- /** If true, allow asynchronous execution */
966
- allowAsyncExec?: boolean;
967
- /** If true, enforces input mint as revert mint for async orders */
968
- restrictRevertMint?: boolean;
969
- /** Platform fee mode */
970
- platformFeeMode?: PlatformFeeMode;
971
- /** Platform fee in basis points */
972
- platformFeeBps?: number;
973
- /** Platform fee scale for async prediction market swaps */
974
- platformFeeScale?: number;
975
- /** Token account that will receive the platform fee */
976
- feeAccount?: string;
977
- /** Referral account associated with the fee account */
978
- referralAccount?: string;
979
- /** Token account that will receive the positive slippage fee */
980
- positiveSlippageFeeAccount?: string;
981
- /** If false, use wrapped SOL */
982
- wrapAndUnwrapSol?: boolean;
983
- /** Prioritization fee in lamports or "auto" or object */
984
- prioritizationFeeLamports?: number | "auto" | {
985
- jitoTipLamports: number;
986
- };
987
- /** If true, dynamically compute unit limit */
988
- dynamicComputeUnitLimit?: boolean;
989
- /** Dynamic slippage settings */
990
- dynamicSlippage?: {
991
- minBps?: number;
992
- maxBps?: number;
993
- };
994
- /** Sponsor wallet address */
995
- sponsor?: string;
996
- /** Payer for prediction market initialization */
997
- predictionMarketInitPayer?: string;
998
- /** Wallet to receive reverted tokens */
999
- revertWallet?: string;
1000
- /** Destination wallet */
1001
- destinationWallet?: string;
1002
- /** Destination token account */
1003
- destinationTokenAccount?: string;
1004
- /** Jito sandwich mitigation account */
1005
- jitoSandwichMitigationAccount?: string;
1006
- /** Recipient for outcome account rent */
1007
- outcomeAccountRentRecipient?: string;
1008
- /** Include Jito sandwich mitigation account */
1009
- includeJitoSandwichMitigationAccount?: boolean;
1010
- }
1011
- /** Order status query parameters */
1012
- interface OrderStatusQueryParams {
1013
- /** Base58-encoded transaction signature */
1014
- signature: string;
1015
- /** Last block height at which the transaction is valid */
1016
- lastValidBlockHeight?: number;
1017
- }
1018
- /** Intent quote query parameters */
1019
- interface IntentQuoteQueryParams {
1020
- /** Base58-encoded address of the swapper's wallet */
1021
- userPublicKey?: string;
1022
- /** Base58-encoded input mint address */
1023
- inputMint: string;
1024
- /** Base58-encoded output mint address */
1025
- outputMint: string;
1026
- /** Input amount as a scaled integer */
1027
- amount: number;
1028
- /** Max allowed slippage in basis points or "auto" */
1029
- slippageBps?: SlippageTolerance;
1030
- /** Platform fee in basis points */
1031
- platformFeeBps?: number;
1032
- /** Fee account address */
1033
- feeAccount?: string;
1034
- /** Referral account address */
1035
- referralAccount?: string;
1036
- /** If false, use wrapped SOL */
1037
- wrapAndUnwrapSol?: boolean;
1038
- /** Maximum amount willing to pay for intent processing in lamports */
1039
- feeBudget?: number;
1040
- /** Limit on the automatically-determined maximum fee budget */
1041
- maxAutoFeeBudget?: number;
1042
- }
1043
- /** Intent swap request body */
1044
- interface IntentSwapRequestBody {
1045
- /** The response from the quote endpoint */
1046
- quoteResponse: IntentQuoteResponse;
1047
- /** Base64-encoded intent opening transaction, signed by the user */
1048
- signedOpenTransaction: string;
1049
- }
1050
- /** Positions by wallet query parameters */
1051
- interface PositionsByWalletQueryParams {
1052
- /** Solana wallet address */
1053
- walletAddress: string;
1054
- }
1055
- /** Prediction market init query parameters */
1056
- interface PredictionMarketInitQueryParams {
1057
- /** Base58-encoded address of the payer */
1058
- payer: string;
1059
- /** Base58-encoded mint address of either outcome mint */
1060
- outcomeMint: string;
1061
- }
1062
- /**
1063
- * Contract for the predict data client.
1064
- * Provider-agnostic interface that can be implemented by different providers.
1065
- */
1066
- interface IPredictClient {
1067
- /** Get events list */
1068
- getEvents(params?: EventQueryParams): Promise<StandardEventsResponse>;
1069
- /** Get event by ID */
1070
- getEventById(eventId: string, withNestedMarkets?: boolean): Promise<StandardEvent>;
1071
- /** Get event candlesticks */
1072
- getEventCandlesticks(ticker: string, params: CandlesticksQueryParams): Promise<CandlesticksResponse>;
1073
- /** Get event forecast percentile history */
1074
- getEventForecastPercentileHistory(params: ForecastPercentileHistoryQueryParams): Promise<ForecastPercentileHistoryResponse>;
1075
- /** Get event forecast percentile history by mint */
1076
- getEventForecastPercentileHistoryByMint(params: ForecastPercentileHistoryByMintQueryParams): Promise<ForecastPercentileHistoryResponse>;
1077
- /** Get markets list */
1078
- getMarkets(params?: MarketQueryParams): Promise<StandardMarketsResponse>;
1079
- /** Get market by ticker */
1080
- getMarketById(marketId: string): Promise<StandardMarket>;
1081
- /** Get market by mint address */
1082
- getMarketByMint(mintAddress: string): Promise<StandardMarket>;
1083
- /** Get markets batch */
1084
- getMarketsBatch(request: MarketsBatchRequest): Promise<StandardMarketsResponse>;
1085
- /** Get market candlesticks */
1086
- getMarketCandlesticks(ticker: string, params: CandlesticksQueryParams): Promise<CandlesticksResponse>;
1087
- /** Get market candlesticks by mint */
1088
- getMarketCandlesticksByMint(mintAddress: string, params: CandlesticksQueryParams): Promise<CandlesticksResponse>;
1089
- /** Get orderbook by market ticker */
1090
- getOrderbook(marketTicker: string): Promise<OrderbookResponse>;
1091
- /** Get orderbook by mint address */
1092
- getOrderbookByMint(mintAddress: string): Promise<OrderbookResponse>;
1093
- /** Get trades list */
1094
- getTrades(params?: TradesQueryParams): Promise<MultiTradeResponse>;
1095
- /** Get trades by mint address */
1096
- getTradesByMint(params: TradesByMintQueryParams): Promise<MultiTradeResponse>;
1097
- /** Get on-chain trades by wallet address */
1098
- getOnchainTradesByWallet(params: OnchainTradesByWalletQueryParams): Promise<MultiOnchainTradeResponse>;
1099
- /** Get on-chain trades by event ticker */
1100
- getOnchainTradesByEvent(params: OnchainTradesByEventQueryParams): Promise<MultiOnchainTradeResponse>;
1101
- /** Get on-chain trades by market ticker */
1102
- getOnchainTradesByMarket(params: OnchainTradesByMarketQueryParams): Promise<MultiOnchainTradeResponse>;
1103
- /** Get live data */
1104
- getLiveData(params: LiveDataQueryParams): Promise<LiveDataResponse>;
1105
- /** Get live data by event ticker */
1106
- getLiveDataByEvent(params: LiveDataByEventQueryParams): Promise<LiveDataResponse>;
1107
- /** Get live data by mint address */
1108
- getLiveDataByMint(params: LiveDataByMintQueryParams): Promise<LiveDataResponse>;
1109
- /** Get series list */
1110
- getSeries(params?: SeriesQueryParams): Promise<SeriesListResponse>;
1111
- /** Get series by ticker */
1112
- getSeriesByTicker(seriesTicker: string): Promise<SeriesResponse>;
1113
- /** Get tags by categories */
1114
- getTagsByCategories(): Promise<TagsByCategoriesResponse>;
1115
- /** Get filters by sports */
1116
- getFiltersBySports(): Promise<FiltersBySportsResponse>;
1117
- /** Search events */
1118
- search(params: SearchQueryParams): Promise<SearchResponse>;
1119
- /** Get prediction market positions by wallet address */
1120
- getPositionsByWallet(params: PositionsByWalletQueryParams): Promise<WalletPositionsResponse>;
1121
- /** Get outcome mints */
1122
- getOutcomeMints(params?: OutcomeMintsQueryParams): Promise<OutcomeMintsResponse>;
1123
- /** Filter outcome mints */
1124
- filterOutcomeMints(request: FilterOutcomeMintsRequest): Promise<FilterOutcomeMintsResponse>;
1125
- /** Get quote for imperative swap */
1126
- getQuote(params: QuoteQueryParams): Promise<QuoteResponse>;
1127
- /** Create imperative swap transaction */
1128
- createSwap(request: SwapRequestBody): Promise<SwapResponse>;
1129
- /** Create imperative swap instructions */
1130
- createSwapInstructions(request: SwapRequestBody): Promise<SwapInstructionsResponse>;
1131
- /** Get order quote and optionally a transaction */
1132
- getOrder(params: OrderQueryParams): Promise<OrderResponse>;
1133
- /** Get order status */
1134
- getOrderStatus(params: OrderStatusQueryParams): Promise<OrderStatusResponse>;
1135
- /** Get intent quote for declarative swap */
1136
- getIntentQuote(params: IntentQuoteQueryParams): Promise<IntentQuoteResponse>;
1137
- /** Submit intent swap */
1138
- submitIntentSwap(request: IntentSwapRequestBody): Promise<IntentSwapResponse>;
1139
- /** Initialize prediction market */
1140
- initPredictionMarket(params: PredictionMarketInitQueryParams): Promise<PredictionMarketInitResponse>;
1141
- /** Get token list */
1142
- getTokens(): Promise<TokenListResponse>;
1143
- /** Get token list with decimals */
1144
- getTokensWithDecimals(): Promise<TokenListWithDecimalsResponse>;
1145
- /** Get venue list */
1146
- getVenues(): Promise<VenueListResponse>;
1147
- }
1148
- /** WebSocket connection status */
1149
- type WsConnectionStatus = "connecting" | "connected" | "disconnected" | "reconnecting";
1150
- /** WebSocket subscription options */
1151
- interface WsSubscribeOptions {
1152
- /** Subscribe to all markets */
1153
- all?: boolean;
1154
- /** Subscribe to specific market tickers */
1155
- tickers?: string[];
1156
- }
1157
- /** Price update message from server */
1158
- interface WsPriceUpdate {
1159
- channel: "prices";
1160
- type: "ticker";
1161
- market_ticker: string;
1162
- yes_bid: string | null;
1163
- yes_ask: string | null;
1164
- no_bid: string | null;
1165
- no_ask: string | null;
1166
- }
1167
- /** Trade update message from server */
1168
- interface WsTradeUpdate {
1169
- channel: "trades";
1170
- type: "trade";
1171
- market_ticker: string;
1172
- trade_id: string;
1173
- price: number;
1174
- count: number;
1175
- yes_price: number;
1176
- no_price: number;
1177
- yes_price_dollars: string;
1178
- no_price_dollars: string;
1179
- taker_side: "yes" | "no";
1180
- created_time: number;
1181
- }
1182
- /** Orderbook update message from server */
1183
- interface WsOrderbookUpdate {
1184
- channel: "orderbook";
1185
- type: "orderbook";
1186
- market_ticker: string;
1187
- yes_bids: OrderbookLevel[];
1188
- yes_asks: OrderbookLevel[];
1189
- no_bids: OrderbookLevel[];
1190
- no_asks: OrderbookLevel[];
1191
- }
1192
- /**
1193
- * Contract for the predict WebSocket client.
1194
- * Provider-agnostic interface for real-time data streaming.
1195
- * Only exposes business-related methods; connection management is implementation detail.
1196
- */
1197
- interface IPredictWsClient {
1198
- /** Get current connection status */
1199
- getStatus(): WsConnectionStatus;
1200
- /** Subscribe to status changes, returns unsubscribe function */
1201
- onStatusChange(callback: (status: WsConnectionStatus) => void): () => void;
1202
- /**
1203
- * Subscribe to price updates.
1204
- * Returns an unsubscribe function that removes the listener and sends unsubscribe to server.
1205
- */
1206
- subscribePrices(options: WsSubscribeOptions, onUpdate: (update: WsPriceUpdate) => void): () => void;
1207
- /**
1208
- * Subscribe to trade updates.
1209
- * Returns an unsubscribe function that removes the listener and sends unsubscribe to server.
1210
- */
1211
- subscribeTrades(options: WsSubscribeOptions, onUpdate: (update: WsTradeUpdate) => void): () => void;
1212
- /**
1213
- * Subscribe to orderbook updates.
1214
- * Returns an unsubscribe function that removes the listener and sends unsubscribe to server.
1215
- */
1216
- subscribeOrderbook(options: WsSubscribeOptions, onUpdate: (update: WsOrderbookUpdate) => void): () => void;
1217
- }
1218
-
1219
- /**
1220
- * Build a query string from a params object.
1221
- * Skips `undefined` and `null` values.
1222
- */
1223
- declare function buildQuery(params: Record<string, unknown>, provider?: ProviderType): string;
1224
- /** Cast typed params to Record for buildQuery */
1225
- declare function toRecord<T extends object>(params: T): Record<string, unknown>;
1226
- /**
1227
- * Base class for prediction market clients.
1228
- * Provides common HTTP request utilities.
1229
- */
1230
- declare abstract class BasePredictClient {
1231
- protected readonly endpoint: string;
1232
- protected readonly provider: ProviderType;
1233
- constructor(endpoint: string, provider: ProviderType);
1234
- /**
1235
- * Build URL with query parameters
1236
- */
1237
- protected buildUrl(path: string, params?: Record<string, unknown>): string;
1238
- /**
1239
- * Perform a GET request
1240
- */
1241
- protected fetch<T>(path: string, params?: Record<string, unknown>): Promise<T>;
1242
- /**
1243
- * Perform a POST request
1244
- */
1245
- protected postRequest<T, P = unknown>(path: string, data: P, params?: Record<string, unknown>): Promise<T>;
1246
- }
1247
-
1248
- /**
1249
- * DFlow Prediction Market Client.
1250
- * Implements IPredictClient interface using the DFlow API.
1251
- */
1252
- declare class DflowPredictClient extends BasePredictClient implements IPredictClient {
1253
- constructor(endpoint: string);
1254
- getEvents(params?: EventQueryParams): Promise<StandardEventsResponse>;
1255
- getEventById(eventId: string, withNestedMarkets?: boolean): Promise<StandardEvent>;
1256
- getEventCandlesticks(ticker: string, params: CandlesticksQueryParams): Promise<CandlesticksResponse>;
1257
- getEventForecastPercentileHistory(params: ForecastPercentileHistoryQueryParams): Promise<ForecastPercentileHistoryResponse>;
1258
- getEventForecastPercentileHistoryByMint(params: ForecastPercentileHistoryByMintQueryParams): Promise<ForecastPercentileHistoryResponse>;
1259
- getMarkets(params?: MarketQueryParams): Promise<StandardMarketsResponse>;
1260
- getMarketById(marketId: string): Promise<StandardMarket>;
1261
- getMarketByMint(mintAddress: string): Promise<StandardMarket>;
1262
- getMarketsBatch(request: MarketsBatchRequest): Promise<StandardMarketsResponse>;
1263
- getMarketCandlesticks(ticker: string, params: CandlesticksQueryParams): Promise<CandlesticksResponse>;
1264
- getMarketCandlesticksByMint(mintAddress: string, params: CandlesticksQueryParams): Promise<CandlesticksResponse>;
1265
- getOrderbook(marketTicker: string): Promise<OrderbookResponse>;
1266
- getOrderbookByMint(mintAddress: string): Promise<OrderbookResponse>;
1267
- getTrades(params?: TradesQueryParams): Promise<MultiTradeResponse>;
1268
- getTradesByMint(params: TradesByMintQueryParams): Promise<MultiTradeResponse>;
1269
- getOnchainTradesByWallet(params: OnchainTradesByWalletQueryParams): Promise<MultiOnchainTradeResponse>;
1270
- getOnchainTradesByEvent(params: OnchainTradesByEventQueryParams): Promise<MultiOnchainTradeResponse>;
1271
- getOnchainTradesByMarket(params: OnchainTradesByMarketQueryParams): Promise<MultiOnchainTradeResponse>;
1272
- getLiveData(params: LiveDataQueryParams): Promise<LiveDataResponse>;
1273
- getLiveDataByEvent(params: LiveDataByEventQueryParams): Promise<LiveDataResponse>;
1274
- getLiveDataByMint(params: LiveDataByMintQueryParams): Promise<LiveDataResponse>;
1275
- getSeries(params?: SeriesQueryParams): Promise<SeriesListResponse>;
1276
- getSeriesByTicker(seriesTicker: string): Promise<SeriesResponse>;
1277
- getTagsByCategories(): Promise<TagsByCategoriesResponse>;
1278
- getFiltersBySports(): Promise<FiltersBySportsResponse>;
1279
- search(params: SearchQueryParams): Promise<SearchResponse>;
1280
- getPositionsByWallet(params: PositionsByWalletQueryParams): Promise<WalletPositionsResponse>;
1281
- getOutcomeMints(params?: OutcomeMintsQueryParams): Promise<OutcomeMintsResponse>;
1282
- filterOutcomeMints(request: FilterOutcomeMintsRequest): Promise<FilterOutcomeMintsResponse>;
1283
- getQuote(params: QuoteQueryParams): Promise<QuoteResponse>;
1284
- createSwap(request: SwapRequestBody): Promise<SwapResponse>;
1285
- createSwapInstructions(request: SwapRequestBody): Promise<SwapInstructionsResponse>;
1286
- getOrder(params: OrderQueryParams): Promise<OrderResponse>;
1287
- getOrderStatus(params: OrderStatusQueryParams): Promise<OrderStatusResponse>;
1288
- getIntentQuote(params: IntentQuoteQueryParams): Promise<IntentQuoteResponse>;
1289
- submitIntentSwap(request: IntentSwapRequestBody): Promise<IntentSwapResponse>;
1290
- initPredictionMarket(params: PredictionMarketInitQueryParams): Promise<PredictionMarketInitResponse>;
1291
- getTokens(): Promise<TokenListResponse>;
1292
- getTokensWithDecimals(): Promise<TokenListWithDecimalsResponse>;
1293
- getVenues(): Promise<VenueListResponse>;
1294
- }
1295
-
1296
- /**
1297
- * DflowPredictWsClient - WebSocket client for real-time prediction market data
1298
- *
1299
- * Features:
1300
- * - Auto-reconnect with exponential backoff
1301
- * - Heartbeat (ping/pong) for connection health
1302
- * - Subscription management for prices, trades, orderbook channels
1303
- * - Event emitter pattern for message handling
1304
- */
1305
-
1306
- /** WebSocket channel types */
1307
- type WsChannel = "prices" | "trades" | "orderbook";
1308
- /** WebSocket event types for event emitter */
1309
- type WsEventType = "connect" | "disconnect" | "reconnecting" | "error" | "price" | "trade" | "orderbook" | "status" | "subscribed" | "unsubscribed";
1310
- /** WebSocket client configuration */
1311
- interface WsClientConfig {
1312
- /** WebSocket endpoint URL */
1313
- wsUrl: string;
1314
- /** Auto-connect on instantiation */
1315
- autoConnect?: boolean;
1316
- /** Auto-reconnect on disconnect */
1317
- autoReconnect?: boolean;
1318
- /** Reconnect interval base in ms (default: 1000) */
1319
- reconnectIntervalBase?: number;
1320
- /** Max reconnect interval in ms (default: 30000) */
1321
- reconnectMaxInterval?: number;
1322
- /** Ping interval in ms (default: 30000) */
1323
- pingInterval?: number;
1324
- }
1325
- type EventCallback<T = unknown> = (data: T) => void;
1326
- interface EventListeners {
1327
- connect: EventCallback<void>[];
1328
- disconnect: EventCallback<{
1329
- code?: number;
1330
- reason?: string;
1331
- }>[];
1332
- reconnecting: EventCallback<{
1333
- attempt: number;
1334
- delay: number;
1335
- }>[];
1336
- error: EventCallback<Error>[];
1337
- price: EventCallback<WsPriceUpdate>[];
1338
- trade: EventCallback<WsTradeUpdate>[];
1339
- orderbook: EventCallback<WsOrderbookUpdate>[];
1340
- status: EventCallback<WsConnectionStatus>[];
1341
- subscribed: EventCallback<{
1342
- channel: WsChannel;
1343
- all?: boolean;
1344
- tickers?: string[];
1345
- }>[];
1346
- unsubscribed: EventCallback<{
1347
- channel: WsChannel;
1348
- all?: boolean;
1349
- tickers?: string[];
1350
- }>[];
1351
- }
1352
- declare class DflowPredictWsClient implements IPredictWsClient {
1353
- private ws;
1354
- private readonly wsUrl;
1355
- private readonly autoReconnect;
1356
- private readonly reconnectIntervalBase;
1357
- private readonly reconnectMaxInterval;
1358
- private readonly pingInterval;
1359
- private status;
1360
- private reconnectAttempts;
1361
- private reconnectTimeout;
1362
- private pingIntervalId;
1363
- private shouldReconnect;
1364
- private listeners;
1365
- private subscriptions;
1366
- constructor(config: WsClientConfig);
1367
- /**
1368
- * Connect to the WebSocket server
1369
- */
1370
- connect(): void;
1371
- /**
1372
- * Disconnect from the WebSocket server
1373
- */
1374
- disconnect(): void;
1375
- /**
1376
- * Check if connected to the server
1377
- */
1378
- isConnected(): boolean;
1379
- /**
1380
- * Get current connection status
1381
- */
1382
- getStatus(): WsConnectionStatus;
1383
- /** Subscribe to price updates, returns unsubscribe function */
1384
- subscribePrices(options: WsSubscribeOptions, onUpdate: (update: WsPriceUpdate) => void): () => void;
1385
- /** Subscribe to trade updates, returns unsubscribe function */
1386
- subscribeTrades(options: WsSubscribeOptions, onUpdate: (update: WsTradeUpdate) => void): () => void;
1387
- /** Subscribe to orderbook updates, returns unsubscribe function */
1388
- subscribeOrderbook(options: WsSubscribeOptions, onUpdate: (update: WsOrderbookUpdate) => void): () => void;
1389
- /** Subscribe to status changes, returns unsubscribe function */
1390
- onStatusChange(callback: (status: WsConnectionStatus) => void): () => void;
1391
- /**
1392
- * Add event listener
1393
- */
1394
- on<T extends WsEventType>(event: T, callback: EventListeners[T][number]): () => void;
1395
- /**
1396
- * Remove event listener
1397
- */
1398
- off<T extends WsEventType>(event: T, callback: EventListeners[T][number]): void;
1399
- /**
1400
- * Remove all listeners for an event (or all events)
1401
- */
1402
- removeAllListeners(event?: WsEventType): void;
1403
- private subscribeChannel;
1404
- private unsubscribeChannel;
1405
- private setStatus;
1406
- private emit;
1407
- private send;
1408
- private sendSubscription;
1409
- private handleMessage;
1410
- private scheduleReconnect;
1411
- private restoreSubscriptions;
1412
- private startPingInterval;
1413
- private stopPingInterval;
1414
- }
1415
- /**
1416
- * Create a new DflowPredictWsClient instance
1417
- */
1418
- declare function createDflowPredictWsClient(config: WsClientConfig): DflowPredictWsClient;
1419
-
1420
- export { type IntentSwapRequestBody as $, type SearchQueryParams as A, type SearchResponse as B, type CandlesticksResponse as C, type WalletPositionsResponse as D, type EventQueryParams as E, type ForecastPercentileHistoryQueryParams as F, type OutcomeMintsQueryParams as G, type OutcomeMintsResponse as H, type IPredictClient as I, type FilterOutcomeMintsRequest as J, type FilterOutcomeMintsResponse as K, type LiveDataQueryParams as L, type MarketQueryParams as M, type QuoteResponse as N, type OrderResponse as O, type PositionsByWalletQueryParams as P, type QuoteQueryParams as Q, type SwapRequestBody as R, type StandardEvent as S, type TradesQueryParams as T, type SwapResponse as U, type SwapInstructionsResponse as V, type WalletPositionItem as W, type OrderQueryParams as X, type OrderStatusQueryParams as Y, type IntentQuoteQueryParams as Z, type IntentQuoteResponse as _, type StandardMarket as a, type IntentSwapResponse as a0, type PredictionMarketInitQueryParams as a1, type PredictionMarketInitResponse as a2, type TokenListResponse as a3, type TokenListWithDecimalsResponse as a4, type VenueListResponse as a5, type WsConnectionStatus as a6, type WsPriceUpdate as a7, type WsTradeUpdate as a8, type WsOrderbookUpdate as a9, type OrderRevert as aA, type IntentExpiry as aB, type TokenWithDecimals as aC, type OrderbookQueryParams as aD, type PrioritizationFeeLamports as aE, type DestinationTokenAccountParam as aF, type CreateFeeAccountParams as aG, type PositiveSlippageParams as aH, type WsSubscribeOptions as aI, BasePredictClient as aJ, buildQuery as aK, toRecord as aL, DflowPredictClient as aM, DflowPredictWsClient as aN, createDflowPredictWsClient as aO, type WsClientConfig as aP, type ProviderType as aa, type MarketStatus as ab, type SortField as ac, type SortOrder as ad, type OrderStatus as ae, type PlatformFeeMode as af, type SlippageTolerance as ag, type PriorityLevel as ah, type ExecutionMode as ai, type SettlementSource as aj, type MarketAccountInfo as ak, type OnchainTrade as al, type OnchainTradeSortBy as am, type OnchainTradesBaseQueryParams as an, type CandlestickOHLC as ao, type CandlestickDataPoint as ap, type ForecastPercentileDataPoint as aq, type SeriesSettlementSource as ar, type RoutePlanLeg as as, type PlatformFee as at, type ComputeBudgetInfo as au, type PrioritizationType as av, type AccountMetaResponse as aw, type InstructionResponse as ax, type BlockhashWithMetadata as ay, type OrderFill as az, type OrderStatusResponse as b, type SeriesResponse as c, type OrderbookLevel as d, type SingleTradeResponse as e, type IPredictWsClient as f, type StandardEventsResponse as g, type StandardMarketsResponse as h, type MarketsBatchRequest as i, type OrderbookResponse as j, type MultiTradeResponse as k, type TradesByMintQueryParams as l, type OnchainTradesByWalletQueryParams as m, type MultiOnchainTradeResponse as n, type OnchainTradesByEventQueryParams as o, type OnchainTradesByMarketQueryParams as p, type CandlesticksQueryParams as q, type ForecastPercentileHistoryResponse as r, type ForecastPercentileHistoryByMintQueryParams as s, type LiveDataResponse as t, type LiveDataByEventQueryParams as u, type LiveDataByMintQueryParams as v, type SeriesQueryParams as w, type SeriesListResponse as x, type TagsByCategoriesResponse as y, type FiltersBySportsResponse as z };