@dimes-dot-fi/sdk 1.0.0

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.
@@ -0,0 +1,1241 @@
1
+ type CamelCase<S extends string> = S extends `${infer P}_${infer Q}` ? `${P}${Capitalize<CamelCase<Q>>}` : S;
2
+ type CamelizeKeys<T> = T extends readonly (infer U)[] ? CamelizeKeys<U>[] : T extends object ? {
3
+ [K in keyof T as K extends string ? CamelCase<K> : K]: CamelizeKeys<T[K]>;
4
+ } : T;
5
+
6
+ interface components {
7
+ schemas: {
8
+ CreateTokenBody: {
9
+ /**
10
+ * @description Customer wallet address (Solana public key or EVM address)
11
+ * @example 0x1234567890123456789012345678901234567890
12
+ */
13
+ wallet_address: string;
14
+ };
15
+ CreateTokenResult: {
16
+ /** @description JWT authentication token */
17
+ token: string;
18
+ /**
19
+ * @description ISO 8601 timestamp when token expires
20
+ * @example 2025-01-15T10:35:00.000Z
21
+ */
22
+ expires_at: string;
23
+ };
24
+ CustomerContractInfo: {
25
+ /**
26
+ * @description EVM chain ID
27
+ * @example 137
28
+ */
29
+ evm_chain_id: string;
30
+ /**
31
+ * @description Checksummed address of the authorized offer signer on Polygon
32
+ * @example 0x70997970C51812dc3A010C7d01b50e0d17dc79C8
33
+ */
34
+ polygon_signer_address: string;
35
+ /**
36
+ * @description Checksummed address of the vault contract on Polygon
37
+ * @example 0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc
38
+ */
39
+ polygon_vault_contract_address: string;
40
+ };
41
+ CustomerLimit: {
42
+ /**
43
+ * @description Total limit formatted as USD
44
+ * @example 1000.00
45
+ */
46
+ limit_usd: string;
47
+ /**
48
+ * @description Total limit in USD pips (10000 pips = $1)
49
+ * @example 10000000
50
+ */
51
+ limit_usd_pips: string;
52
+ /**
53
+ * @description Remaining available limit formatted as USD
54
+ * @example 750.00
55
+ */
56
+ remaining_usd: string;
57
+ /**
58
+ * @description Remaining available limit in USD pips
59
+ * @example 7500000
60
+ */
61
+ remaining_usd_pips: string;
62
+ /**
63
+ * @description Current usage formatted as USD
64
+ * @example 250.00
65
+ */
66
+ usage_usd: string;
67
+ /**
68
+ * @description Current usage in USD pips
69
+ * @example 2500000
70
+ */
71
+ usage_usd_pips: string;
72
+ };
73
+ CustomerOriginationTier: {
74
+ /**
75
+ * @description Origination fee in basis points for this tier
76
+ * @example 100
77
+ */
78
+ fee_bps: number;
79
+ /**
80
+ * @description Maximum leverage in basis points for this tier
81
+ * @example 20000
82
+ */
83
+ max_leverage_bps: number;
84
+ };
85
+ CustomerFees: {
86
+ /**
87
+ * @description Lifetime fee APR in basis points
88
+ * @example 500
89
+ */
90
+ lifetime_apr_bps: number;
91
+ /**
92
+ * @description Liquidation fee in basis points
93
+ * @example 200
94
+ */
95
+ liquidation_bps: number;
96
+ /** @description Origination fee tiers by leverage */
97
+ origination_tiers: components["schemas"]["CustomerOriginationTier"][];
98
+ };
99
+ CustomerLeverage: {
100
+ /**
101
+ * @deprecated
102
+ * @description Deprecated: use maxYesBps and maxNoBps. Populated as min(maxYesBps, maxNoBps) for backwards compatibility.
103
+ * @example 50000
104
+ */
105
+ max_bps: number;
106
+ /**
107
+ * @description Maximum leverage in basis points for the YES side
108
+ * @example 50000
109
+ */
110
+ max_yes_bps: number;
111
+ /**
112
+ * @description Maximum leverage in basis points for the NO side
113
+ * @example 50000
114
+ */
115
+ max_no_bps: number;
116
+ /**
117
+ * @description Minimum leverage in basis points
118
+ * @example 10000
119
+ */
120
+ min_bps: number;
121
+ /**
122
+ * @description Leverage step increment in basis points
123
+ * @example 1000
124
+ */
125
+ step_bps: number;
126
+ };
127
+ CustomerMarketPrices: {
128
+ /**
129
+ * @description NO side ask price formatted as USD
130
+ * @example 0.51
131
+ */
132
+ no_ask_price_usd: string;
133
+ /**
134
+ * @description NO side ask price in USD pips (10000 pips = $1)
135
+ * @example 5100
136
+ */
137
+ no_ask_price_usd_pips: string;
138
+ /**
139
+ * @description NO side bid price formatted as USD
140
+ * @example 0.49
141
+ */
142
+ no_bid_price_usd: string;
143
+ /**
144
+ * @description NO side bid price in USD pips (10000 pips = $1)
145
+ * @example 4900
146
+ */
147
+ no_bid_price_usd_pips: string;
148
+ /**
149
+ * @description YES side ask price formatted as USD
150
+ * @example 0.51
151
+ */
152
+ yes_ask_price_usd: string;
153
+ /**
154
+ * @description YES side ask price in USD pips (10000 pips = $1)
155
+ * @example 5100
156
+ */
157
+ yes_ask_price_usd_pips: string;
158
+ /**
159
+ * @description YES side bid price formatted as USD
160
+ * @example 0.49
161
+ */
162
+ yes_bid_price_usd: string;
163
+ /**
164
+ * @description YES side bid price in USD pips (10000 pips = $1)
165
+ * @example 4900
166
+ */
167
+ yes_bid_price_usd_pips: string;
168
+ };
169
+ CustomerMarket: {
170
+ /**
171
+ * @description Market category
172
+ * @example politics
173
+ */
174
+ category: string;
175
+ /** @description Fee configuration */
176
+ fees: components["schemas"]["CustomerFees"];
177
+ /**
178
+ * @description Market ID
179
+ * @example dm_mkt_abc123
180
+ */
181
+ id: string;
182
+ /** @description Leverage configuration */
183
+ leverage: components["schemas"]["CustomerLeverage"];
184
+ /**
185
+ * @description Prediction market provider
186
+ * @enum {string}
187
+ */
188
+ provider: "kalshi" | "polymarket";
189
+ /**
190
+ * @description Current market status
191
+ * @enum {string}
192
+ */
193
+ status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
194
+ /**
195
+ * @description Market tags for filtering
196
+ * @example [
197
+ * "politics",
198
+ * "election"
199
+ * ]
200
+ */
201
+ tags: string[];
202
+ /**
203
+ * @description Market ticker identifier
204
+ * @example TRUMP-2024-WIN
205
+ */
206
+ ticker: string;
207
+ /** @description Market title */
208
+ title?: string;
209
+ /** @description Latest bid/ask prices for YES and NO sides. Only present when the request includes `expand=prices`. */
210
+ prices?: components["schemas"]["CustomerMarketPrices"] | null;
211
+ /**
212
+ * @description Whether this market is accepting new positions
213
+ * @example true
214
+ */
215
+ accepting_new_positions: boolean;
216
+ /**
217
+ * @description ISO 8601 timestamp when market closes
218
+ * @example 2025-01-20T12:00:00.000Z
219
+ */
220
+ close_time?: string;
221
+ /**
222
+ * @description ISO 8601 timestamp of the latest time a new position can be opened in this market
223
+ * @example 2025-01-20T11:30:00.000Z
224
+ */
225
+ latest_enter_at?: string;
226
+ /**
227
+ * @description Minimum notional amount formatted as USD
228
+ * @example 5.00
229
+ */
230
+ min_notional_usd: string;
231
+ /**
232
+ * @description Minimum notional amount in USD pips (10000 pips = $1)
233
+ * @example 50000
234
+ */
235
+ min_notional_usd_pips: string;
236
+ /**
237
+ * @description Capacity-limited maximum notional for NO side formatted as USD
238
+ * @example 50.00
239
+ */
240
+ capacity_max_notional_no_usd?: string | null;
241
+ /**
242
+ * @description Capacity-limited maximum notional for NO side in USD pips (10000 pips = $1)
243
+ * @example 500000000
244
+ */
245
+ capacity_max_notional_no_usd_pips?: string | null;
246
+ /**
247
+ * @description Capacity-limited maximum notional for YES side formatted as USD
248
+ * @example 50.00
249
+ */
250
+ capacity_max_notional_yes_usd?: string | null;
251
+ /**
252
+ * @description Capacity-limited maximum notional for YES side in USD pips (10000 pips = $1)
253
+ * @example 500000000
254
+ */
255
+ capacity_max_notional_yes_usd_pips?: string | null;
256
+ /**
257
+ * @description Maximum notional available for NO side formatted as USD
258
+ * @example 50.00
259
+ */
260
+ max_notional_no_usd?: string;
261
+ /**
262
+ * @description Maximum notional available for NO side in USD pips (10000 pips = $1)
263
+ * @example 500000000
264
+ */
265
+ max_notional_no_usd_pips?: string;
266
+ /**
267
+ * @description Maximum notional available for YES side formatted as USD
268
+ * @example 50.00
269
+ */
270
+ max_notional_yes_usd?: string;
271
+ /**
272
+ * @description Maximum notional available for YES side in USD pips (10000 pips = $1)
273
+ * @example 500000000
274
+ */
275
+ max_notional_yes_usd_pips?: string;
276
+ /**
277
+ * @description Slippage-limited maximum notional for NO side formatted as USD
278
+ * @example 50.00
279
+ */
280
+ slippage_max_notional_no_usd?: string | null;
281
+ /**
282
+ * @description Slippage-limited maximum notional for NO side in USD pips (10000 pips = $1)
283
+ * @example 500000000
284
+ */
285
+ slippage_max_notional_no_usd_pips?: string | null;
286
+ /**
287
+ * @description Slippage-limited maximum notional for YES side formatted as USD
288
+ * @example 50.00
289
+ */
290
+ slippage_max_notional_yes_usd?: string | null;
291
+ /**
292
+ * @description Slippage-limited maximum notional for YES side in USD pips (10000 pips = $1)
293
+ * @example 500000000
294
+ */
295
+ slippage_max_notional_yes_usd_pips?: string | null;
296
+ /**
297
+ * @description Reason code if market is not accepting new positions
298
+ * @example QUOTE_MARKET_NOT_ELIGIBLE
299
+ */
300
+ rejection_reason_code?: string;
301
+ /** @description Subtitle for the YES outcome */
302
+ yes_sub_title?: string;
303
+ };
304
+ CustomerPositionEntry: {
305
+ /**
306
+ * @description Entry collateral formatted as USD
307
+ * @example 2.50
308
+ */
309
+ collateral_usd: string;
310
+ /**
311
+ * @description Entry collateral in USD pips (10000 pips = $1)
312
+ * @example 25000
313
+ */
314
+ collateral_usd_pips: string;
315
+ /**
316
+ * @description Entry leverage in basis points (20000 = 2x)
317
+ * @example 20000
318
+ */
319
+ leverage_bps: number;
320
+ /**
321
+ * @description Entry notional formatted as USD
322
+ * @example 5.00
323
+ */
324
+ notional_usd: string;
325
+ /**
326
+ * @description Entry notional in USD pips
327
+ * @example 50000
328
+ */
329
+ notional_usd_pips: string;
330
+ /**
331
+ * @description ISO 8601 timestamp when position was opened
332
+ * @example 2025-01-15T10:30:00.000Z
333
+ */
334
+ opened_at?: string;
335
+ /**
336
+ * @description Origination fee in basis points
337
+ * @example 100
338
+ */
339
+ origination_fee_bps: number;
340
+ /**
341
+ * @description Origination fee formatted as USD
342
+ * @example 0.05
343
+ */
344
+ origination_fee_usd: string;
345
+ /**
346
+ * @description Origination fee in USD pips
347
+ * @example 500
348
+ */
349
+ origination_fee_usd_pips: string;
350
+ /**
351
+ * @description Entry price formatted as USD
352
+ * @example 0.50
353
+ */
354
+ price_usd: string;
355
+ /**
356
+ * @description Entry price in USD pips
357
+ * @example 5000
358
+ */
359
+ price_usd_pips: string;
360
+ /**
361
+ * @description Effective entry price (actual fill price on the prediction market) formatted as USD. Null until the fill is recorded on chain.
362
+ * @example 0.5025
363
+ */
364
+ effective_entry_price_usd?: string | null;
365
+ /**
366
+ * @description Effective entry price in USD pips. Null until the fill is recorded on chain.
367
+ * @example 5025
368
+ */
369
+ effective_entry_price_usd_pips?: string | null;
370
+ /**
371
+ * @description Execution slippage between the offer's indicative entry price and the actual fill price, in basis points. Signed: positive means the fill was worse than the quote, negative means the fill was better. Null until the fill is recorded on chain.
372
+ * @example 50
373
+ */
374
+ effective_slippage_bps?: number | null;
375
+ };
376
+ CustomerPositionFailure: {
377
+ /**
378
+ * @description Failure reason code
379
+ * @example price_exceeded_tolerance
380
+ */
381
+ reason: string;
382
+ };
383
+ CustomerPositionUnwind: {
384
+ /**
385
+ * @description Leverage after unwind in basis points (20000 = 2x)
386
+ * @example 30000
387
+ */
388
+ after_leverage_bps: number;
389
+ /**
390
+ * @description Leverage before unwind in basis points (20000 = 2x)
391
+ * @example 60000
392
+ */
393
+ before_leverage_bps: number;
394
+ /**
395
+ * @description ISO 8601 timestamp when the unwind was executed on-chain
396
+ * @example 2025-06-02T14:30:00.000Z
397
+ */
398
+ executed_at: string;
399
+ };
400
+ CustomerPositionUnwindList: {
401
+ data: components["schemas"]["CustomerPositionUnwind"][];
402
+ has_more: boolean;
403
+ total_count?: number;
404
+ /**
405
+ * @description Current leverage of the position in basis points (20000 = 2x)
406
+ * @example 30000
407
+ */
408
+ current_leverage_bps: number;
409
+ /**
410
+ * @description ISO 8601 timestamp when the position was opened on-chain (null if not yet opened)
411
+ * @example 2025-06-01T12:00:00.000Z
412
+ */
413
+ originated_at: string | null;
414
+ /**
415
+ * @description Leverage at position origination in basis points (20000 = 2x)
416
+ * @example 60000
417
+ */
418
+ origination_leverage_bps: number;
419
+ };
420
+ CustomerPositionCurrent: {
421
+ /**
422
+ * @description Current collateral formatted as USD
423
+ * @example 2.50
424
+ */
425
+ collateral_usd: string;
426
+ /**
427
+ * @description Current collateral in USD pips
428
+ * @example 25000
429
+ */
430
+ collateral_usd_pips: string;
431
+ /**
432
+ * @description Effective collateral formatted as USD
433
+ * @example 2.45
434
+ */
435
+ effective_collateral_usd: string;
436
+ /**
437
+ * @description Effective collateral after fees in USD pips
438
+ * @example 24500
439
+ */
440
+ effective_collateral_usd_pips: string;
441
+ /**
442
+ * @description Current leverage in basis points
443
+ * @example 18000
444
+ */
445
+ leverage_bps: number;
446
+ /**
447
+ * @description Current mark price formatted as USD
448
+ * @example 0.55
449
+ */
450
+ mark_price_usd: string;
451
+ /**
452
+ * @description Current mark price in USD pips
453
+ * @example 5500
454
+ */
455
+ mark_price_usd_pips: string;
456
+ /**
457
+ * @description Unrealized PnL net of all fees (origination + pending lifetime) as return on equity in basis points
458
+ * @example 1800
459
+ */
460
+ net_unrealized_pnl_bps: number;
461
+ /**
462
+ * @description Unrealized PnL net of all fees formatted as USD
463
+ * @example 0.45
464
+ */
465
+ net_unrealized_pnl_usd: string;
466
+ /**
467
+ * @description Unrealized PnL net of all fees in USD pips (can be negative)
468
+ * @example 4500
469
+ */
470
+ net_unrealized_pnl_usd_pips: string;
471
+ /**
472
+ * @description Current notional formatted as USD
473
+ * @example 5.50
474
+ */
475
+ notional_usd: string;
476
+ /**
477
+ * @description Current notional in USD pips
478
+ * @example 55000
479
+ */
480
+ notional_usd_pips: string;
481
+ /**
482
+ * @description Position token units held (1000000 units = 1 token)
483
+ * @example 10000000
484
+ */
485
+ position_token_units: string;
486
+ /**
487
+ * @description Total position value formatted as USD
488
+ * @example 3.00
489
+ */
490
+ position_value_usd: string;
491
+ /**
492
+ * @description Total position value in USD pips
493
+ * @example 30000
494
+ */
495
+ position_value_usd_pips: string;
496
+ /**
497
+ * @description Unrealized PnL as return on equity in basis points (1000 = 10%)
498
+ * @example 2000
499
+ */
500
+ unrealized_pnl_bps: number;
501
+ /**
502
+ * @description Unrealized PnL formatted as USD
503
+ * @example 0.50
504
+ */
505
+ unrealized_pnl_usd: string;
506
+ /**
507
+ * @description Unrealized PnL in USD pips (can be negative)
508
+ * @example 5000
509
+ */
510
+ unrealized_pnl_usd_pips: string;
511
+ };
512
+ CustomerPositionOpenFees: {
513
+ /**
514
+ * @description Accrued lifetime fee formatted as USD
515
+ * @example 0.01
516
+ */
517
+ accrued_lifetime_fee_usd: string;
518
+ /**
519
+ * @description Accrued lifetime fee in USD pips
520
+ * @example 100
521
+ */
522
+ accrued_lifetime_fee_usd_pips: string;
523
+ /**
524
+ * @description Lifetime fee APR in basis points
525
+ * @example 500
526
+ */
527
+ lifetime_apr_bps: number;
528
+ /**
529
+ * @description Pending lifetime fee formatted as USD
530
+ * @example 0.005
531
+ */
532
+ pending_lifetime_fee_usd: string;
533
+ /**
534
+ * @description Pending lifetime fee in USD pips
535
+ * @example 50
536
+ */
537
+ pending_lifetime_fee_usd_pips: string;
538
+ };
539
+ CustomerPositionRisk: {
540
+ /**
541
+ * @description Current liquidation price formatted as USD
542
+ * @example 0.35
543
+ */
544
+ current_liquidation_price_usd: string;
545
+ /**
546
+ * @description Current liquidation price in USD pips
547
+ * @example 3500
548
+ */
549
+ current_liquidation_price_usd_pips: string;
550
+ /**
551
+ * @description Margin health 0-10000 (10000 at entry, 0 at liquidation)
552
+ * @example 7500
553
+ */
554
+ health_bps: number;
555
+ /**
556
+ * @description Buffer to liquidation in basis points
557
+ * @example 500
558
+ */
559
+ liquidation_buffer_bps: number;
560
+ /**
561
+ * @description Liquidation fee in basis points
562
+ * @example 200
563
+ */
564
+ liquidation_fee_bps: number;
565
+ /**
566
+ * @description Dollar distance to liquidation formatted as USD
567
+ * @example 0.50
568
+ */
569
+ margin_buffer_usd: string;
570
+ /**
571
+ * @description Dollar distance to liquidation in USD pips
572
+ * @example 5000
573
+ */
574
+ margin_buffer_usd_pips: string;
575
+ };
576
+ CustomerPositionTiming: {
577
+ /** @description Whether settlement is pending (market resolved or voided, settlement not yet executed) */
578
+ is_settlement_pending: boolean;
579
+ /** @description Whether the market was voided (closed with no winner, 50/50 payout at $0.50 per token) */
580
+ is_voided: boolean;
581
+ /**
582
+ * @description ISO 8601 timestamp when market closes
583
+ * @example 2025-01-20T12:00:00.000Z
584
+ */
585
+ market_close_time?: string;
586
+ /**
587
+ * @description Market status from the prediction market provider. When 'determined' or 'finalized', mark price reflects the settlement outcome ($1 or $0)
588
+ * @example active
589
+ * @enum {string}
590
+ */
591
+ market_status: "active" | "amended" | "closed" | "determined" | "disputed" | "finalized" | "inactive" | "initialized";
592
+ /**
593
+ * @description Minutes until market closes
594
+ * @example 1440
595
+ */
596
+ time_to_close_minutes?: number;
597
+ };
598
+ CustomerOpenPosition: {
599
+ /** @description Entry details */
600
+ entry: components["schemas"]["CustomerPositionEntry"];
601
+ /** @description Failure details if the position failed */
602
+ failure?: components["schemas"]["CustomerPositionFailure"];
603
+ /**
604
+ * @description Position ID
605
+ * @example dm_pos_abc123
606
+ */
607
+ id: string;
608
+ /**
609
+ * @description Prediction market provider
610
+ * @enum {string}
611
+ */
612
+ provider: "kalshi" | "polymarket";
613
+ /**
614
+ * @description Market side
615
+ * @enum {string}
616
+ */
617
+ side: "yes" | "no";
618
+ /**
619
+ * @description Simplified position status
620
+ * @enum {string}
621
+ */
622
+ status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
623
+ /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
624
+ unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
625
+ /** @description Current position state */
626
+ current: components["schemas"]["CustomerPositionCurrent"];
627
+ /** @description Fee details for open position */
628
+ fees: components["schemas"]["CustomerPositionOpenFees"];
629
+ /** @description Risk metrics */
630
+ risk: components["schemas"]["CustomerPositionRisk"];
631
+ /** @description Timing information */
632
+ timing: components["schemas"]["CustomerPositionTiming"];
633
+ /**
634
+ * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
635
+ * @example 84000
636
+ */
637
+ effective_leverage_bps: number;
638
+ /**
639
+ * @description Market ticker identifier
640
+ * @example TRUMP-2024-WIN
641
+ */
642
+ market_ticker: string;
643
+ /** @description Market title */
644
+ market_title?: string;
645
+ /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
646
+ on_chain_position_key: string;
647
+ /**
648
+ * @description Wallet address (Solana public key or EVM address)
649
+ * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
650
+ */
651
+ wallet_address: string;
652
+ };
653
+ CustomerPositionClosedFees: {
654
+ /**
655
+ * @description Lifetime fee APR in basis points
656
+ * @example 500
657
+ */
658
+ lifetime_apr_bps: number;
659
+ /**
660
+ * @description Origination fee in basis points
661
+ * @example 100
662
+ */
663
+ origination_fee_bps: number;
664
+ /**
665
+ * @description Origination fee formatted as USD
666
+ * @example 0.05
667
+ */
668
+ origination_fee_usd: string;
669
+ /**
670
+ * @description Origination fee in USD pips
671
+ * @example 500
672
+ */
673
+ origination_fee_usd_pips: string;
674
+ /**
675
+ * @description Total blended fees formatted as USD
676
+ * @example 0.065
677
+ */
678
+ total_fees_usd: string;
679
+ /**
680
+ * @description Total blended fees (origination + lifetime + liquidation) in USD pips
681
+ * @example 650
682
+ */
683
+ total_fees_usd_pips: string;
684
+ /**
685
+ * @description Total lifetime fee formatted as USD
686
+ * @example 0.015
687
+ */
688
+ total_lifetime_fee_usd: string;
689
+ /**
690
+ * @description Total lifetime fee collected in USD pips
691
+ * @example 150
692
+ */
693
+ total_lifetime_fee_usd_pips: string;
694
+ };
695
+ CustomerPositionResult: {
696
+ /**
697
+ * @description ISO 8601 timestamp when position was closed
698
+ * @example 2025-01-16T14:30:00.000Z
699
+ */
700
+ closed_at: string;
701
+ /**
702
+ * @description Collected lifetime fee formatted as USD
703
+ * @example 0.015
704
+ */
705
+ collected_lifetime_fee_usd: string;
706
+ /**
707
+ * @description Collected lifetime fee in USD pips
708
+ * @example 150
709
+ */
710
+ collected_lifetime_fee_usd_pips: string;
711
+ /**
712
+ * @description Collected liquidation fee formatted as USD
713
+ * @example 0.00
714
+ */
715
+ collected_liquidation_fee_usd: string;
716
+ /**
717
+ * @description Collected liquidation fee in USD pips
718
+ * @example 0
719
+ */
720
+ collected_liquidation_fee_usd_pips: string;
721
+ /**
722
+ * @description Realized PnL net of all fees (origination + lifetime + liquidation) as return on equity in basis points
723
+ * @example 1700
724
+ */
725
+ net_realized_pnl_bps: number;
726
+ /**
727
+ * @description Realized PnL net of all fees formatted as USD
728
+ * @example 0.435
729
+ */
730
+ net_realized_pnl_usd: string;
731
+ /**
732
+ * @description Realized PnL net of all fees in USD pips (can be negative)
733
+ * @example 4350
734
+ */
735
+ net_realized_pnl_usd_pips: string;
736
+ /**
737
+ * @description Proceeds formatted as USD
738
+ * @example 3.00
739
+ */
740
+ proceeds_usd: string;
741
+ /**
742
+ * @description Proceeds returned to user in USD pips
743
+ * @example 30000
744
+ */
745
+ proceeds_usd_pips: string;
746
+ /**
747
+ * @description Realized PnL formatted as USD
748
+ * @example 0.50
749
+ */
750
+ realized_pnl_usd: string;
751
+ /**
752
+ * @description Realized PnL in USD pips (can be negative)
753
+ * @example 5000
754
+ */
755
+ realized_pnl_usd_pips: string;
756
+ };
757
+ CustomerClosedPosition: {
758
+ /** @description Entry details */
759
+ entry: components["schemas"]["CustomerPositionEntry"];
760
+ /** @description Failure details if the position failed */
761
+ failure?: components["schemas"]["CustomerPositionFailure"];
762
+ /**
763
+ * @description Position ID
764
+ * @example dm_pos_abc123
765
+ */
766
+ id: string;
767
+ /**
768
+ * @description Prediction market provider
769
+ * @enum {string}
770
+ */
771
+ provider: "kalshi" | "polymarket";
772
+ /**
773
+ * @description Market side
774
+ * @enum {string}
775
+ */
776
+ side: "yes" | "no";
777
+ /**
778
+ * @description Simplified position status
779
+ * @enum {string}
780
+ */
781
+ status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
782
+ /** @description Inline unwind history. Only present when the request includes `expand=unwinds`; omitted otherwise. */
783
+ unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
784
+ /** @description Fee details for closed position */
785
+ fees: components["schemas"]["CustomerPositionClosedFees"];
786
+ /** @description Position result/outcome */
787
+ result: components["schemas"]["CustomerPositionResult"];
788
+ /**
789
+ * @description Time-weighted average structural leverage in basis points over position lifetime (20000 = 2x)
790
+ * @example 84000
791
+ */
792
+ effective_leverage_bps: number;
793
+ /**
794
+ * @description Market ticker identifier
795
+ * @example TRUMP-2024-WIN
796
+ */
797
+ market_ticker: string;
798
+ /** @description Market title */
799
+ market_title?: string;
800
+ /** @description On-chain position key (bytes32) for requestClose", example: "0xabc123... */
801
+ on_chain_position_key: string;
802
+ /**
803
+ * @description Wallet address (Solana public key or EVM address)
804
+ * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
805
+ */
806
+ wallet_address: string;
807
+ /**
808
+ * @description Reason the position was closed
809
+ * @enum {string}
810
+ */
811
+ close_reason: "closed" | "liquidated" | "reverted" | "settled";
812
+ };
813
+ CreateOfferBody: {
814
+ /**
815
+ * @description Leverage in basis points (20000 = 2x, 100000 = 10x). Must be divisible by 2500. Maximum 10x.
816
+ * @example 50000
817
+ */
818
+ leverage_bps: number;
819
+ /**
820
+ * @description Market ticker
821
+ * @example TRUMP-2024-WIN
822
+ */
823
+ market_ticker: string;
824
+ /**
825
+ * @description Notional amount in USD pips (10,000 pips = $1.00)
826
+ * @example 50000
827
+ */
828
+ notional_amount_usd_pips: string;
829
+ /**
830
+ * @description Market side (yes or no)
831
+ * @enum {string}
832
+ */
833
+ effective_side: "yes" | "no";
834
+ /**
835
+ * @description Maximum acceptable slippage in basis points (100 bps = 1%). Must be between 1% and 10%.
836
+ * @example 200
837
+ */
838
+ slippage_bps: number;
839
+ /**
840
+ * @description Prediction market provider
841
+ * @default kalshi
842
+ * @example kalshi
843
+ * @enum {string}
844
+ */
845
+ pm_provider: "kalshi" | "polymarket";
846
+ };
847
+ ApiCustomerOffer: {
848
+ /**
849
+ * @description Offer ID
850
+ * @example dm_off_abc123
851
+ */
852
+ id: string;
853
+ /**
854
+ * @description Prediction market provider
855
+ * @enum {string}
856
+ */
857
+ provider: "kalshi" | "polymarket";
858
+ /**
859
+ * @description Wallet address (Solana public key or EVM address)
860
+ * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
861
+ */
862
+ authority_public_key: string;
863
+ /**
864
+ * @description Current liquidation price formatted as USD
865
+ * @example 0.35
866
+ */
867
+ current_liquidation_price_usd: string;
868
+ /**
869
+ * @description Current liquidation price in USD pips (10000 pips = $1). Position will be liquidated if market price reaches this level.
870
+ * @example 3500
871
+ */
872
+ current_liquidation_price_usd_pips: string;
873
+ /**
874
+ * @description Entry price on the offer's effective side, formatted as USD
875
+ * @example 0.50
876
+ */
877
+ entry_price_usd: string;
878
+ /**
879
+ * @description Entry price on the offer's effective side, in USD pips (10000 pips = $1)
880
+ * @example 5000
881
+ */
882
+ entry_price_usd_pips: string;
883
+ /**
884
+ * @description Collateral in USDC units (1,000,000 units = 1 USDC). Contract-ready value for createPosition.
885
+ * @example 2500000
886
+ */
887
+ collateral_usdc_units: string;
888
+ /**
889
+ * @description Chain ID for EVM signature
890
+ * @example 137
891
+ */
892
+ evm_chain_id: string;
893
+ /**
894
+ * @description On-chain bytes32 Polymarket market identifier
895
+ * @example 0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890
896
+ */
897
+ polymarket_market_id: string;
898
+ /** @description EIP-191 signature for contract create position */
899
+ contract_signature: string;
900
+ /**
901
+ * @description Polymarket ERC1155 conditional token ID for the selected side
902
+ * @example 52114319501245915516055106046884209969926127482827954674443846427813813222426
903
+ */
904
+ polymarket_token_id: string;
905
+ /**
906
+ * @description Vault contract address on Polygon
907
+ * @example 0x1234567890123456789012345678901234567890
908
+ */
909
+ polygon_vault_contract_address: string;
910
+ /**
911
+ * @description Expected trading fee formatted as USD
912
+ * @example 0.02
913
+ */
914
+ expected_open_trading_fee_usd: string;
915
+ /**
916
+ * @description Expected trading fee in USD pips
917
+ * @example 225
918
+ */
919
+ expected_open_trading_fee_usd_pips: string;
920
+ /**
921
+ * @description Expected open trading fee in USDC units (1,000,000 units = 1 USDC). Contract-ready value.
922
+ * @example 20000
923
+ */
924
+ expected_open_trading_fee_usdc_units: string;
925
+ /**
926
+ * @description ISO 8601 timestamp when offer expires
927
+ * @example 2025-01-15T10:35:00.000Z
928
+ */
929
+ expires_at: string;
930
+ /**
931
+ * @description Leverage in basis points (20000 = 2x)
932
+ * @example 20000
933
+ */
934
+ leverage_bps: number;
935
+ /**
936
+ * @description Lifetime fee APR in basis points
937
+ * @example 2000
938
+ */
939
+ lifetime_fee_apr_bps: number;
940
+ /**
941
+ * @description Liquidation fee in basis points
942
+ * @example 250
943
+ */
944
+ liquidation_fee_bps: number;
945
+ /**
946
+ * @description Market ticker identifier
947
+ * @example TRUMP-2024-WIN
948
+ */
949
+ market_ticker: string;
950
+ /**
951
+ * @description Minimum expected position tokens after accounting for slippage (1000000 units = 1 token)
952
+ * @example 9900000
953
+ */
954
+ min_expected_position_token_units: string;
955
+ /**
956
+ * @description Notional amount formatted as USD
957
+ * @example 5.00
958
+ */
959
+ notional_amount_usd: string;
960
+ /**
961
+ * @description Notional amount in USD pips (10000 pips = $1)
962
+ * @example 50000
963
+ */
964
+ notional_amount_usd_pips: string;
965
+ /**
966
+ * @description Notional amount in USDC units (1,000,000 units = 1 USDC). Contract-ready value for createPosition.
967
+ * @example 5000000
968
+ */
969
+ notional_usdc_units: string;
970
+ /**
971
+ * @description Origination fee in basis points
972
+ * @example 100
973
+ */
974
+ origination_fee_bps: number;
975
+ /**
976
+ * @description Origination fee formatted as USD
977
+ * @example 0.05
978
+ */
979
+ origination_fee_usd: string;
980
+ /**
981
+ * @description Origination fee in USD pips
982
+ * @example 500
983
+ */
984
+ origination_fee_usd_pips: string;
985
+ /**
986
+ * @description Origination fee in USDC units (1,000,000 units = 1 USDC). Contract-ready value; on Polymarket the contract pulls collateral + originationFee from the user at createPosition.
987
+ * @example 50000
988
+ */
989
+ origination_fee_usdc_units: string;
990
+ /**
991
+ * @description Protocol component of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
992
+ * @example 100
993
+ */
994
+ protocol_origination_fee_bps: number;
995
+ /**
996
+ * @description Protocol component of the origination fee formatted as USD
997
+ * @example 0.04
998
+ */
999
+ protocol_origination_fee_usd: string;
1000
+ /**
1001
+ * @description Protocol component of the origination fee in USD pips (10000 pips = $1)
1002
+ * @example 400
1003
+ */
1004
+ protocol_origination_fee_usd_pips: string;
1005
+ /**
1006
+ * @description Protocol component of the origination fee in USDC units (1,000,000 units = 1 USDC).
1007
+ * @example 40000
1008
+ */
1009
+ protocol_origination_fee_usdc_units: string;
1010
+ /**
1011
+ * @description Partner component of the origination fee in basis points. `protocolOriginationFeeBps + partnerOriginationFeeBps === originationFeeBps`.
1012
+ * @example 25
1013
+ */
1014
+ partner_origination_fee_bps: number;
1015
+ /**
1016
+ * @description Partner component of the origination fee formatted as USD
1017
+ * @example 0.01
1018
+ */
1019
+ partner_origination_fee_usd: string;
1020
+ /**
1021
+ * @description Partner component of the origination fee in USD pips (10000 pips = $1)
1022
+ * @example 100
1023
+ */
1024
+ partner_origination_fee_usd_pips: string;
1025
+ /**
1026
+ * @description Partner component of the origination fee in USDC units (1,000,000 units = 1 USDC).
1027
+ * @example 10000
1028
+ */
1029
+ partner_origination_fee_usdc_units: string;
1030
+ /**
1031
+ * @description Polymarket venue trading fee rate in basis points. Applied to expectedOpenTradingFeeUsdcUnits. `0` for Kalshi.
1032
+ * @example 100
1033
+ */
1034
+ polymarket_trading_fee_bps: number;
1035
+ /**
1036
+ * @description Position seed for on-chain account derivation
1037
+ * @example abc123
1038
+ */
1039
+ position_seed: string;
1040
+ /**
1041
+ * @description Position seed as 0x-prefixed bytes16 hex. Contract-ready value for createPosition.
1042
+ * @example 0xa1b2c3d4e5f67890abcdef1234567890
1043
+ */
1044
+ position_seed_hex: string;
1045
+ /**
1046
+ * @description On-chain position key (bytes32) that will be derived when the position is created. Matches on_chain_position_key on the position response — use it to link an offer to its future position.
1047
+ * @example 0x1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890
1048
+ */
1049
+ on_chain_position_key: string;
1050
+ /**
1051
+ * @description Market side (yes or no)
1052
+ * @enum {string}
1053
+ */
1054
+ effective_side: "yes" | "no";
1055
+ /** @description Unix timestamp when signature expires */
1056
+ signature_expiry: string;
1057
+ /**
1058
+ * @description Slippage tolerance in basis points
1059
+ * @example 200
1060
+ */
1061
+ slippage_bps: number;
1062
+ /** @description Base64-encoded Solana transaction (present for Solana markets only) */
1063
+ swap_transaction?: string;
1064
+ /**
1065
+ * @description Total amount user must provide formatted as USD
1066
+ * @example 2.73
1067
+ */
1068
+ total_user_amount_usd: string;
1069
+ /**
1070
+ * @description Total amount user must provide in USD pips
1071
+ * @example 27250
1072
+ */
1073
+ total_user_amount_usd_pips: string;
1074
+ /**
1075
+ * @description Total amount user must transfer at createPosition in USDC units (1,000,000 units = 1 USDC). Contract-ready value. On Polymarket = collateral + originationFee; on Kalshi = collateral + tradingFee.
1076
+ * @example 2730000
1077
+ */
1078
+ total_user_amount_usdc_units: string;
1079
+ };
1080
+ };
1081
+ responses: never;
1082
+ parameters: never;
1083
+ requestBodies: never;
1084
+ headers: never;
1085
+ pathItems: never;
1086
+ }
1087
+
1088
+ type Raw = components["schemas"];
1089
+ type Market = CamelizeKeys<Raw["CustomerMarket"]>;
1090
+ type MarketLeverage = CamelizeKeys<Raw["CustomerLeverage"]>;
1091
+ type MarketFees = CamelizeKeys<Raw["CustomerFees"]>;
1092
+ type MarketPrices = CamelizeKeys<Raw["CustomerMarketPrices"]>;
1093
+ type OriginationTier = CamelizeKeys<Raw["CustomerOriginationTier"]>;
1094
+ type Offer = CamelizeKeys<Raw["ApiCustomerOffer"]>;
1095
+ type OpenPosition = CamelizeKeys<Raw["CustomerOpenPosition"]>;
1096
+ type ClosedPosition = CamelizeKeys<Raw["CustomerClosedPosition"]>;
1097
+ type Position = OpenPosition | ClosedPosition;
1098
+ type PositionEntry = CamelizeKeys<Raw["CustomerPositionEntry"]>;
1099
+ type PositionCurrent = CamelizeKeys<Raw["CustomerPositionCurrent"]>;
1100
+ type PositionRisk = CamelizeKeys<Raw["CustomerPositionRisk"]>;
1101
+ type PositionOpenFees = CamelizeKeys<Raw["CustomerPositionOpenFees"]>;
1102
+ type PositionClosedFees = CamelizeKeys<Raw["CustomerPositionClosedFees"]>;
1103
+ type PositionResult = CamelizeKeys<Raw["CustomerPositionResult"]>;
1104
+ type PositionTiming = CamelizeKeys<Raw["CustomerPositionTiming"]>;
1105
+ type PositionFailure = CamelizeKeys<Raw["CustomerPositionFailure"]>;
1106
+ type PositionUnwind = CamelizeKeys<Raw["CustomerPositionUnwind"]>;
1107
+ type PositionUnwindList = CamelizeKeys<Raw["CustomerPositionUnwindList"]>;
1108
+ type ContractInfo = CamelizeKeys<Raw["CustomerContractInfo"]>;
1109
+ type CustomerLimit = CamelizeKeys<Raw["CustomerLimit"]>;
1110
+ type CreateTokenResult = CamelizeKeys<Raw["CreateTokenResult"]>;
1111
+ interface CreateOfferParams {
1112
+ marketTicker: string;
1113
+ effectiveSide: "yes" | "no";
1114
+ leverageBps: number;
1115
+ notionalAmountUsdPips: string;
1116
+ slippageBps: number;
1117
+ pmProvider?: "polymarket" | "kalshi";
1118
+ }
1119
+ declare function isOpenPosition(p: Position): p is OpenPosition;
1120
+ declare function isClosedPosition(p: Position): p is ClosedPosition;
1121
+ declare function leverageMaxBps(lev: MarketLeverage, side: "yes" | "no"): number;
1122
+
1123
+ declare const marketMovedCodes: Set<string>;
1124
+ type QuoteHint = {
1125
+ kind: "use-max-collateral";
1126
+ maxCollateralUsd: number;
1127
+ minCollateralUsd: number;
1128
+ } | {
1129
+ kind: "clamp-leverage";
1130
+ maxLeverageBps?: number;
1131
+ } | {
1132
+ kind: "raise-leverage";
1133
+ minLeverageBps: number;
1134
+ } | {
1135
+ kind: "raise-slippage";
1136
+ currentSlippageBps: number;
1137
+ maxSlippageBps: number;
1138
+ } | {
1139
+ kind: "market-full";
1140
+ } | null;
1141
+ type Params = Record<string, unknown> | null | undefined;
1142
+ declare function quoteErrorHint(code: string | null, params: Params, context: {
1143
+ leverageBps: number;
1144
+ }): QuoteHint;
1145
+ type CorrectedField = "collateral" | "leverage" | "slippage";
1146
+ type HintAdjustment = {
1147
+ field: "collateral";
1148
+ fromValue: number;
1149
+ toValue: number;
1150
+ toLabel: string;
1151
+ reason: "max-collateral";
1152
+ } | {
1153
+ field: "leverage";
1154
+ fromValue: number;
1155
+ toValue: number;
1156
+ toLabel: string;
1157
+ reason: "clamp-max" | "raise-min";
1158
+ } | {
1159
+ field: "slippage";
1160
+ fromValue: number;
1161
+ toValue: number;
1162
+ toLabel: string;
1163
+ reason: "raise-slippage";
1164
+ } | null;
1165
+ declare function hintAdjustment(hint: QuoteHint, current: {
1166
+ collateralUsd: number;
1167
+ leverageBps: number;
1168
+ slippageBps: number;
1169
+ }): HintAdjustment;
1170
+
1171
+ interface Paginated<T> {
1172
+ data: T[];
1173
+ hasMore: boolean;
1174
+ }
1175
+
1176
+ interface AuthProvider {
1177
+ getHeaders(): Promise<Record<string, string>>;
1178
+ refresh?(): Promise<void>;
1179
+ }
1180
+ interface ApiKeyAuthOptions {
1181
+ apiKey: string;
1182
+ walletAddress: string;
1183
+ baseUrl?: string;
1184
+ fetch?: typeof globalThis.fetch;
1185
+ }
1186
+ declare class ApiKeyAuth implements AuthProvider {
1187
+ private jwt;
1188
+ private expiresAt;
1189
+ private refreshPromise;
1190
+ private readonly apiKey;
1191
+ private readonly walletAddress;
1192
+ private readonly baseUrl;
1193
+ private readonly fetchFn;
1194
+ constructor(options: ApiKeyAuthOptions);
1195
+ getHeaders(): Promise<Record<string, string>>;
1196
+ refresh(): Promise<void>;
1197
+ private fetchToken;
1198
+ }
1199
+ interface JwtAuthOptions {
1200
+ token: string | (() => Promise<string>);
1201
+ }
1202
+ declare class JwtAuth implements AuthProvider {
1203
+ private readonly tokenOrFn;
1204
+ constructor(options: JwtAuthOptions);
1205
+ getHeaders(): Promise<Record<string, string>>;
1206
+ }
1207
+
1208
+ interface DimesClientOptions {
1209
+ baseUrl?: string;
1210
+ auth: AuthProvider;
1211
+ fetch?: typeof globalThis.fetch;
1212
+ maxRetries?: number;
1213
+ maxRetryDelayMs?: number;
1214
+ }
1215
+ interface GetMarketsParams {
1216
+ cursor?: string;
1217
+ limit?: number;
1218
+ category?: string;
1219
+ status?: string;
1220
+ provider?: "polymarket" | "kalshi";
1221
+ }
1222
+ interface GetPositionsParams {
1223
+ cursor?: string;
1224
+ limit?: number;
1225
+ status?: "open" | "closed";
1226
+ }
1227
+ declare class DimesClient {
1228
+ private readonly http;
1229
+ constructor(options: DimesClientOptions);
1230
+ getMarkets(params?: GetMarketsParams): Promise<Paginated<Market>>;
1231
+ getMarket(ticker: string): Promise<Market>;
1232
+ createDraftQuote(params: CreateOfferParams): Promise<Offer>;
1233
+ promoteDraftQuote(draftId: string): Promise<Offer>;
1234
+ createQuote(params: CreateOfferParams): Promise<Offer>;
1235
+ getPositions(params?: GetPositionsParams): Promise<Position[]>;
1236
+ cancelPosition(positionId: string): Promise<void>;
1237
+ getContractInfo(): Promise<ContractInfo>;
1238
+ getLimits(): Promise<CustomerLimit>;
1239
+ }
1240
+
1241
+ export { ApiKeyAuth as A, type PositionUnwindList as B, type CreateOfferParams as C, DimesClient as D, hintAdjustment as E, isClosedPosition as F, type GetMarketsParams as G, type HintAdjustment as H, isOpenPosition as I, JwtAuth as J, leverageMaxBps as K, marketMovedCodes as L, type Market as M, quoteErrorHint as N, type Offer as O, type Paginated as P, type QuoteHint as Q, type ApiKeyAuthOptions as a, type AuthProvider as b, type CamelizeKeys as c, type ClosedPosition as d, type ContractInfo as e, type CorrectedField as f, type CreateTokenResult as g, type CustomerLimit as h, type DimesClientOptions as i, type GetPositionsParams as j, type JwtAuthOptions as k, type MarketFees as l, type MarketLeverage as m, type MarketPrices as n, type OpenPosition as o, type OriginationTier as p, type Position as q, type PositionClosedFees as r, type PositionCurrent as s, type PositionEntry as t, type PositionFailure as u, type PositionOpenFees as v, type PositionResult as w, type PositionRisk as x, type PositionTiming as y, type PositionUnwind as z };