@dimes-dot-fi/sdk 2.3.0 → 2.5.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.
Files changed (44) hide show
  1. package/README.md +10 -0
  2. package/dist/{aliases-Dne14KBa.d.cts → aliases-lNsFUKPA.d.cts} +147 -10
  3. package/dist/{aliases-Dne14KBa.d.ts → aliases-lNsFUKPA.d.ts} +147 -10
  4. package/dist/{chunk-E6YJDY4F.cjs → chunk-ERM4WP6D.cjs} +9 -4
  5. package/dist/chunk-ERM4WP6D.cjs.map +1 -0
  6. package/dist/{chunk-4OKYU5D7.mjs → chunk-GA7ZBK6W.mjs} +9 -4
  7. package/dist/chunk-GA7ZBK6W.mjs.map +1 -0
  8. package/dist/{chunk-IJO5E22G.mjs → chunk-HJ5EVO5A.mjs} +11 -6
  9. package/dist/chunk-HJ5EVO5A.mjs.map +1 -0
  10. package/dist/{chunk-GY6L2QGR.cjs → chunk-L273PAD4.cjs} +14 -9
  11. package/dist/chunk-L273PAD4.cjs.map +1 -0
  12. package/dist/contract/index.cjs +557 -67
  13. package/dist/contract/index.cjs.map +1 -1
  14. package/dist/contract/index.d.cts +69 -8
  15. package/dist/contract/index.d.ts +69 -8
  16. package/dist/contract/index.mjs +544 -54
  17. package/dist/contract/index.mjs.map +1 -1
  18. package/dist/{dimes-client-DJ1d_p31.d.ts → dimes-client-BUAeOsgL.d.cts} +48 -3
  19. package/dist/{dimes-client-D9tohawC.d.cts → dimes-client-DDF-f8yA.d.ts} +48 -3
  20. package/dist/{dimes-error-hSoOierP.d.ts → dimes-error-CkcjExUy.d.ts} +1 -1
  21. package/dist/{dimes-error-E9yPAZb-.d.cts → dimes-error-I7lEZ2V5.d.cts} +1 -1
  22. package/dist/index.cjs +78 -8
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +10 -9
  25. package/dist/index.d.ts +10 -9
  26. package/dist/index.mjs +74 -4
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/{quote-D4QunMtN.d.ts → quote-B_cMLw7P.d.cts} +7 -2
  29. package/dist/{quote-sWguOcoJ.d.cts → quote-Z88cryAN.d.ts} +7 -2
  30. package/dist/react/index.cjs +34 -33
  31. package/dist/react/index.cjs.map +1 -1
  32. package/dist/react/index.d.cts +12 -8
  33. package/dist/react/index.d.ts +12 -8
  34. package/dist/react/index.mjs +7 -6
  35. package/dist/react/index.mjs.map +1 -1
  36. package/dist/{types-BHU4Qq7e.d.ts → types-BvZf3uFL.d.ts} +1 -1
  37. package/dist/{types-Bvj_WDbX.d.cts → types-F2rHf2Qv.d.cts} +1 -1
  38. package/dist/ws/index.d.cts +3 -3
  39. package/dist/ws/index.d.ts +3 -3
  40. package/package.json +1 -1
  41. package/dist/chunk-4OKYU5D7.mjs.map +0 -1
  42. package/dist/chunk-E6YJDY4F.cjs.map +0 -1
  43. package/dist/chunk-GY6L2QGR.cjs.map +0 -1
  44. package/dist/chunk-IJO5E22G.mjs.map +0 -1
package/README.md CHANGED
@@ -78,6 +78,11 @@ const { data: markets } = await client.getMarkets();
78
78
  const market = await client.getMarket("will-btc-hit-100k-2026");
79
79
 
80
80
  console.log(market.leverage.maxBps); // 100000 (10x)
81
+
82
+ // Narrow to one event (a single game or price window) or one series (the recurring
83
+ // template those events come from). Same params and same market objects as getMarkets.
84
+ const { data: gameMarkets } = await client.getEventMarkets("nba-lal-bos-2026-08-06");
85
+ const { data: seriesMarkets } = await client.getSeriesMarkets("btc-up-or-down-5m");
81
86
  ```
82
87
 
83
88
  ### Execute a quote
@@ -268,8 +273,13 @@ Same API, same contracts, fake USDC. Get a sandbox key via the [Telegram link on
268
273
  |----------|--------|------------|
269
274
  | `GET /markets` | `client.getMarkets()` | `useMarkets()` |
270
275
  | `GET /markets/:ticker` | `client.getMarket(ticker)` | `useMarket(ticker)` |
276
+ | `GET /events/:eventTicker/markets` | `client.getEventMarkets(eventTicker)` | — |
277
+ | `GET /series/:seriesTicker/markets` | `client.getSeriesMarkets(seriesTicker)` | — |
271
278
  | `GET /contract-info` | `client.getContractInfo()` | `useContractInfo()` |
272
279
  | `GET /positions` | `client.getPositions()` | `usePositions()` |
280
+ | `GET /markets/:ticker/positions` | `client.getMarketPositions(ticker)` | — |
281
+ | `GET /events/:eventTicker/positions` | `client.getEventPositions(eventTicker)` | — |
282
+ | `GET /series/:seriesTicker/positions` | `client.getSeriesPositions(seriesTicker)` | — |
273
283
  | `GET /user-limits` | `client.getUserLimits()` | `useUserLimits()` |
274
284
  | `GET /partner-limits` | `client.getPartnerLimits()` | `usePartnerLimits()` |
275
285
  | `POST /draft-quotes` | `client.createDraftQuote()` | — |
@@ -597,6 +597,17 @@ interface components {
597
597
  * @example 20000
598
598
  */
599
599
  leverage_bps: number;
600
+ /**
601
+ * @description Risk mode the position was opened in. adaptive: the live risk engine manages leverage. committed: the position follows the planned unwinds fixed at quote time.
602
+ * @example adaptive
603
+ * @enum {string}
604
+ */
605
+ risk_mode: "adaptive" | "committed";
606
+ /**
607
+ * @description Extra margin locked in the vault on top of collateral, in USDC units (1,000,000 units = 1 USDC). Zero on adaptive positions.
608
+ * @example 0
609
+ */
610
+ locked_margin_usdc_units: string;
600
611
  /**
601
612
  * @description Entry notional formatted as USD
602
613
  * @example 5.00
@@ -686,6 +697,12 @@ interface components {
686
697
  reason: string;
687
698
  };
688
699
  CustomerPositionUnwind: {
700
+ /**
701
+ * @description executed: an unwind that landed on-chain, as recorded by the deleveraging itself. planned: a committed-mode rung that fires if the price reaches triggerPriceUsdPips. triggered: a committed-mode rung whose trigger price was reached, stamped with executedAt. superseded: a committed-mode rung that can no longer fire because a partial close already took the position below its target leverage. Rung rows (planned, triggered, superseded) are the signed ladder and are only returned when the request asks for them; they describe what was promised, while executed rows describe what actually happened.
702
+ * @example executed
703
+ * @enum {string}
704
+ */
705
+ status: "executed" | "planned" | "superseded" | "triggered";
689
706
  /**
690
707
  * @description The market signal that triggered the risk-model inference behind this unwind (e.g. `spread_blowout`, `depth_decay`, `price_drop_severe`). Null for unwinds not tied to an inference run, such as manually triggered deleveraging.
691
708
  * @example spread_blowout
@@ -703,10 +720,15 @@ interface components {
703
720
  */
704
721
  before_leverage_bps: number;
705
722
  /**
706
- * @description ISO 8601 timestamp when the unwind was executed on-chain
723
+ * @description ISO 8601 timestamp when the unwind was executed on-chain. Null on planned unwinds, which have not happened yet.
707
724
  * @example 2025-06-02T14:30:00.000Z
708
725
  */
709
- executed_at: string;
726
+ executed_at?: string | null;
727
+ /**
728
+ * @description Price at which this planned unwind fires, in USD pips (10000 pips = $1). Null on executed unwinds.
729
+ * @example 4200
730
+ */
731
+ trigger_price_usd_pips?: string | null;
710
732
  /**
711
733
  * @description Human-readable explanation of `reason` — a customer-facing sentence describing the market condition that triggered this deleverage. Null whenever `reason` is null.
712
734
  * @example The bid-ask spread widened sharply beyond its recent baseline, signalling thinning liquidity.
@@ -1019,7 +1041,7 @@ interface components {
1019
1041
  */
1020
1042
  side: "yes" | "no";
1021
1043
  /**
1022
- * @description Simplified position status
1044
+ * @description Simplified position status. A position that was deleveraged almost entirely and then force-sold for a trivial remainder reports 'settled' once the market resolves against it. The 'status' query parameter still filters on the underlying mechanism, so such a position is returned by status=liquidated.
1023
1045
  * @enum {string}
1024
1046
  */
1025
1047
  status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
@@ -1052,6 +1074,8 @@ interface components {
1052
1074
  * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
1053
1075
  */
1054
1076
  wallet_address: string;
1077
+ /** @description The committed-mode ladder this position was opened on: one row per planned unwind, each with a status of planned, triggered or superseded. Only present when the request includes `expand=planned_unwinds`; omitted otherwise, and empty on adaptive positions. */
1078
+ planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1055
1079
  /**
1056
1080
  * @deprecated
1057
1081
  * @description Deprecated — use `pendingOperation` (a deferred close now surfaces as `{ type: 'close', phase: 'awaiting_settlement' }`). Details of a close request that could not complete and was deferred. Null unless the customer requested a close that is now waiting on market settlement to redeem the remaining tokens.
@@ -1220,7 +1244,7 @@ interface components {
1220
1244
  */
1221
1245
  side: "yes" | "no";
1222
1246
  /**
1223
- * @description Simplified position status
1247
+ * @description Simplified position status. A position that was deleveraged almost entirely and then force-sold for a trivial remainder reports 'settled' once the market resolves against it. The 'status' query parameter still filters on the underlying mechanism, so such a position is returned by status=liquidated.
1224
1248
  * @enum {string}
1225
1249
  */
1226
1250
  status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
@@ -1249,11 +1273,13 @@ interface components {
1249
1273
  * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
1250
1274
  */
1251
1275
  wallet_address: string;
1276
+ /** @description The committed-mode ladder this position was opened on: one row per planned unwind, each with a status of planned, triggered or superseded. Only present when the request includes `expand=planned_unwinds`; omitted otherwise, and empty on adaptive positions. */
1277
+ planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1252
1278
  /**
1253
- * @description Reason the position was closed
1279
+ * @description Reason the position was closed. Reports 'settled' for a position that was deleveraged almost entirely and then force-sold for a trivial remainder on a market that resolved against it.
1254
1280
  * @enum {string}
1255
1281
  */
1256
- close_reason: "closed" | "liquidated" | "reverted" | "settled";
1282
+ close_reason: "cancelled" | "closed" | "liquidated" | "reverted" | "settled";
1257
1283
  /**
1258
1284
  * @description Why the position was reverted before it opened. Non-null only when `close_reason` is `reverted`: `exchange_unavailable` (the prediction-market venue was temporarily unavailable — safe to retry), `slippage_exceeded` (price moved beyond tolerance before the order filled), or `unknown`.
1259
1285
  * @enum {string|null}
@@ -1417,10 +1443,67 @@ interface components {
1417
1443
  */
1418
1444
  allow_partial_fill: boolean;
1419
1445
  /**
1420
- * @description Minimum fill the user will accept, in basis points. Only valid when allowPartialFill=true (rejected otherwise). Must be in [2000, 5000] and divisible by 500 (5% steps). Capped from below by max(2000, ceil(MIN_COLLATERAL × 10000 / requestedCollateral)).
1446
+ * @description Minimum fill the user will accept, in basis points. Only valid when allowPartialFill=true (rejected otherwise). Must be in [2000, 7000] and divisible by 500 (5% steps). Capped from below by max(2000, ceil(MIN_COLLATERAL × 10000 / requestedCollateral)).
1421
1447
  * @example 5000
1422
1448
  */
1423
1449
  min_fill_bps?: number;
1450
+ /**
1451
+ * @description Risk mode for the resulting position. adaptive: the live risk engine manages leverage. committed: the quote carries a fixed set of price-triggered unwinds and the user posts extra margin. A committed request is answered in committed mode or not at all — when the market, price or leverage rules the mode out, the quote is rejected with QUOTE_COMMITTED_RISK_MODE_UNAVAILABLE carrying the reason. Take a draft quote first to see whether the mode is on offer.
1452
+ * @default adaptive
1453
+ * @example committed
1454
+ * @enum {string}
1455
+ */
1456
+ risk_mode: "adaptive" | "committed";
1457
+ };
1458
+ CommittedUnwindUnavailableReason: {
1459
+ /**
1460
+ * @description Machine-readable reason committed mode cannot be offered for this quote
1461
+ * @example cryptoMarket
1462
+ * @enum {string}
1463
+ */
1464
+ code: "cryptoMarket" | "illegibleMarginTooLarge" | "illegibleTooManyUnwinds" | "invertedRiskBands" | "lateGameSoccer" | "notOfferedOnDeskQuotes";
1465
+ /** @description Human-readable explanation of the same reason */
1466
+ message: string;
1467
+ };
1468
+ PlannedUnwind: {
1469
+ /**
1470
+ * @description Order in which this unwind fires, starting at 0
1471
+ * @example 0
1472
+ */
1473
+ sequence: number;
1474
+ /**
1475
+ * @description Price at which this unwind fires, in USD pips (10000 pips = $1)
1476
+ * @example 4200
1477
+ */
1478
+ trigger_price_usd_pips: string;
1479
+ /**
1480
+ * @description Book leverage the position is unwound to when this fires, in basis points (10000 = 1x)
1481
+ * @example 15000
1482
+ */
1483
+ target_leverage_bps: number;
1484
+ /**
1485
+ * @description Estimated token units sold to reach the target (1000000 units = 1 token). An estimate only — the executed amount depends on the fill.
1486
+ * @example 30000000
1487
+ */
1488
+ token_units_to_sell_estimate: string;
1489
+ };
1490
+ CommittedUnwinds: {
1491
+ /** @description Whether committed mode can be offered for this quote */
1492
+ available: boolean;
1493
+ /** @description Why committed mode is unavailable. Null when it is available. */
1494
+ unavailable_reason?: components["schemas"]["CommittedUnwindUnavailableReason"] | null;
1495
+ /**
1496
+ * @description Extra margin the user must post on top of collateral, in USDC units (1000000 units = 1 USDC)
1497
+ * @example 67000000
1498
+ */
1499
+ margin_required_usdc_units?: string | null;
1500
+ /**
1501
+ * @description Price at which selling the remaining tokens repays the loan in full, in USD pips
1502
+ * @example 2700
1503
+ */
1504
+ debt_clear_price_usd_pips?: string | null;
1505
+ /** @description The pre-committed unwinds, in the order they fire. Empty when committed mode is unavailable. */
1506
+ planned_unwinds?: components["schemas"]["PlannedUnwind"][] | null;
1424
1507
  };
1425
1508
  CustomerOfferMaxGain: {
1426
1509
  /**
@@ -1517,6 +1600,25 @@ interface components {
1517
1600
  * @example 0x1234567890123456789012345678901234567890
1518
1601
  */
1519
1602
  polygon_vault_contract_address: string;
1603
+ /**
1604
+ * @description Vault function this quote's signature authorizes. createPositionWithMargin for committed quotes, createPosition otherwise. A signature for one will not authorize the other.
1605
+ * @example createPosition
1606
+ * @enum {string}
1607
+ */
1608
+ polygon_vault_function_name: "createPosition" | "createPositionWithMargin";
1609
+ /**
1610
+ * @description Risk mode this quote was issued in. A committed request is answered in committed mode or rejected, so this only reports adaptive when adaptive was asked for.
1611
+ * @example adaptive
1612
+ * @enum {string}
1613
+ */
1614
+ risk_mode: "adaptive" | "committed";
1615
+ /** @description Committed-unwind mode for this quote: the pre-committed unwinds and the extra margin they require, or the reason the mode cannot be offered. */
1616
+ committed_unwinds?: components["schemas"]["CommittedUnwinds"];
1617
+ /**
1618
+ * @description Extra margin locked in the vault on top of collateral, in USDC units (1,000,000 units = 1 USDC). Zero on adaptive quotes. Included in totalUserAmountUsdcUnits.
1619
+ * @example 0
1620
+ */
1621
+ margin_usdc_units: string;
1520
1622
  /**
1521
1623
  * @description Expected trading fee formatted as USD
1522
1624
  * @example 0.02
@@ -1714,11 +1816,20 @@ interface components {
1714
1816
  */
1715
1817
  total_user_amount_usd_pips: string;
1716
1818
  /**
1717
- * @description Total amount user must transfer at createPosition in USDC units (1,000,000 units = 1 USDC). Contract-ready value. On Polymarket = collateral + originationFee.
1819
+ * @description Total amount user must transfer at position creation in USDC units (1,000,000 units = 1 USDC). Contract-ready value = collateral + originationFee + expected open trading fee + committed-mode margin.
1718
1820
  * @example 2730000
1719
1821
  */
1720
1822
  total_user_amount_usdc_units: string;
1721
1823
  };
1824
+ PromoteOfferBody: {
1825
+ /**
1826
+ * @description Risk mode for the promoted offer. The draft carries the committed unwinds it was quoted with; this chooses whether the promoted offer opens on them. Omitted means adaptive.
1827
+ * @default adaptive
1828
+ * @example committed
1829
+ * @enum {string}
1830
+ */
1831
+ risk_mode: "adaptive" | "committed";
1832
+ };
1722
1833
  };
1723
1834
  responses: never;
1724
1835
  parameters: never;
@@ -1728,7 +1839,23 @@ interface components {
1728
1839
  }
1729
1840
 
1730
1841
  type Raw = components["schemas"];
1731
- type Market = CamelizeKeys<Raw["CustomerMarket"]>;
1842
+ /**
1843
+ * The event a market belongs to — the real-world happening it resolves against (one game, one
1844
+ * hourly price window). `seriesTicker` names the recurring template the event came from, and is
1845
+ * null for events with no series.
1846
+ *
1847
+ * Hand-written rather than derived from `Raw` because `generated.ts` is currently pinned to an API
1848
+ * version that predates this block. Delete this and let `CustomerMarket` supply `event` the next
1849
+ * time the types are regenerated against a spec that has it.
1850
+ */
1851
+ interface MarketEvent {
1852
+ seriesTicker: string | null;
1853
+ ticker: string;
1854
+ title: string | null;
1855
+ }
1856
+ type Market = CamelizeKeys<Raw["CustomerMarket"]> & {
1857
+ event: MarketEvent;
1858
+ };
1732
1859
  type MarketLeverage = CamelizeKeys<Raw["CustomerLeverage"]>;
1733
1860
  type MarketMaxLeveragePerNotional = CamelizeKeys<Raw["CustomerMaxMarketLeveragePerNotional"]>;
1734
1861
  type MarketSidedMaxLeveragePerNotional = CamelizeKeys<Raw["CustomerSidedMaxMarketLeveragePerNotional"]>;
@@ -1770,6 +1897,7 @@ type FeeRatesOriginationTier = CamelizeKeys<Raw["CustomerOriginationFeeTier"]>;
1770
1897
  type FeeRatesMarket = CamelizeKeys<Raw["CustomerFeeRatesMarket"]>;
1771
1898
  type FeeRates = CamelizeKeys<Raw["CustomerFeeRates"]>;
1772
1899
  type FeeReport = CamelizeKeys<Raw["CustomerFeeReport"]>;
1900
+ type RiskMode = "adaptive" | "committed";
1773
1901
  interface CreateQuoteParams {
1774
1902
  marketTicker: string;
1775
1903
  effectiveSide: "yes" | "no";
@@ -1779,6 +1907,15 @@ interface CreateQuoteParams {
1779
1907
  pmProvider?: "polymarket" | "kalshi";
1780
1908
  allowPartialFill?: boolean;
1781
1909
  minFillBps?: number;
1910
+ /**
1911
+ * Ask for a committed deleverage plan (a fixed ladder of trigger prices, backed by a refundable
1912
+ * margin deposit) instead of the adaptive risk engine. Defaults to `adaptive`.
1913
+ *
1914
+ * A committed request is answered in committed mode or rejected with
1915
+ * `quote_committed_risk_mode_unavailable` — you never get an adaptive quote back from it. Take a
1916
+ * draft first and read `committedUnwinds.available` to know whether the mode is on offer.
1917
+ */
1918
+ riskMode?: RiskMode;
1782
1919
  }
1783
1920
  /** @deprecated Renamed to {@link CreateQuoteParams}. Kept as an alias for backward compatibility. */
1784
1921
  type CreateOfferParams = CreateQuoteParams;
@@ -1793,4 +1930,4 @@ declare function isOpenPosition(p: Position): p is OpenPosition;
1793
1930
  declare function isClosedPosition(p: Position): p is ClosedPosition;
1794
1931
  declare function leverageMaxBps(lev: MarketLeverage, side: "yes" | "no"): number;
1795
1932
 
1796
- export { type PositionFailure as A, type PositionOpenFees as B, type CreateQuoteParams as C, type PositionPartialClose as D, type PositionResult as E, type FeeRates as F, type PositionRisk as G, type PositionTiming as H, type PositionUnwind as I, type PositionUnwindList as J, isClosedPosition as K, isOpenPosition as L, type Market as M, leverageMaxBps as N, type Offer as O, type Position as P, type Quote as Q, type MarketPolymarket as a, type MarketLeverage as b, type PositionTransactions as c, type PositionPartialCloseList as d, type ContractInfo as e, type CustomerLimit as f, type FeeReportParams as g, type FeeReport as h, type CamelizeKeys as i, type CloseAttempt as j, type ClosedPosition as k, type CreateOfferParams as l, type CreateTokenResult as m, type FeeRatesMarket as n, type FeeRatesOriginationTier as o, type MarketFees as p, type MarketMaxLeveragePerNotional as q, type MarketPrices as r, type MarketSidedEligibility as s, type MarketSidedMaxLeveragePerNotional as t, type OpenPosition as u, type OriginationTier as v, type PendingOperation as w, type PositionClosedFees as x, type PositionCurrent as y, type PositionEntry as z };
1933
+ export { type PositionCurrent as A, type PositionEntry as B, type CreateQuoteParams as C, type PositionFailure as D, type PositionOpenFees as E, type FeeRates as F, type PositionPartialClose as G, type PositionResult as H, type PositionRisk as I, type PositionTiming as J, type PositionUnwind as K, isClosedPosition as L, type Market as M, isOpenPosition as N, type Offer as O, type Position as P, type Quote as Q, type RiskMode as R, leverageMaxBps as S, type MarketPolymarket as a, type MarketLeverage as b, type PositionTransactions as c, type PositionUnwindList as d, type PositionPartialCloseList as e, type ContractInfo as f, type CustomerLimit as g, type FeeReportParams as h, type FeeReport as i, type CamelizeKeys as j, type CloseAttempt as k, type ClosedPosition as l, type CreateOfferParams as m, type CreateTokenResult as n, type FeeRatesMarket as o, type FeeRatesOriginationTier as p, type MarketEvent as q, type MarketFees as r, type MarketMaxLeveragePerNotional as s, type MarketPrices as t, type MarketSidedEligibility as u, type MarketSidedMaxLeveragePerNotional as v, type OpenPosition as w, type OriginationTier as x, type PendingOperation as y, type PositionClosedFees as z };
@@ -597,6 +597,17 @@ interface components {
597
597
  * @example 20000
598
598
  */
599
599
  leverage_bps: number;
600
+ /**
601
+ * @description Risk mode the position was opened in. adaptive: the live risk engine manages leverage. committed: the position follows the planned unwinds fixed at quote time.
602
+ * @example adaptive
603
+ * @enum {string}
604
+ */
605
+ risk_mode: "adaptive" | "committed";
606
+ /**
607
+ * @description Extra margin locked in the vault on top of collateral, in USDC units (1,000,000 units = 1 USDC). Zero on adaptive positions.
608
+ * @example 0
609
+ */
610
+ locked_margin_usdc_units: string;
600
611
  /**
601
612
  * @description Entry notional formatted as USD
602
613
  * @example 5.00
@@ -686,6 +697,12 @@ interface components {
686
697
  reason: string;
687
698
  };
688
699
  CustomerPositionUnwind: {
700
+ /**
701
+ * @description executed: an unwind that landed on-chain, as recorded by the deleveraging itself. planned: a committed-mode rung that fires if the price reaches triggerPriceUsdPips. triggered: a committed-mode rung whose trigger price was reached, stamped with executedAt. superseded: a committed-mode rung that can no longer fire because a partial close already took the position below its target leverage. Rung rows (planned, triggered, superseded) are the signed ladder and are only returned when the request asks for them; they describe what was promised, while executed rows describe what actually happened.
702
+ * @example executed
703
+ * @enum {string}
704
+ */
705
+ status: "executed" | "planned" | "superseded" | "triggered";
689
706
  /**
690
707
  * @description The market signal that triggered the risk-model inference behind this unwind (e.g. `spread_blowout`, `depth_decay`, `price_drop_severe`). Null for unwinds not tied to an inference run, such as manually triggered deleveraging.
691
708
  * @example spread_blowout
@@ -703,10 +720,15 @@ interface components {
703
720
  */
704
721
  before_leverage_bps: number;
705
722
  /**
706
- * @description ISO 8601 timestamp when the unwind was executed on-chain
723
+ * @description ISO 8601 timestamp when the unwind was executed on-chain. Null on planned unwinds, which have not happened yet.
707
724
  * @example 2025-06-02T14:30:00.000Z
708
725
  */
709
- executed_at: string;
726
+ executed_at?: string | null;
727
+ /**
728
+ * @description Price at which this planned unwind fires, in USD pips (10000 pips = $1). Null on executed unwinds.
729
+ * @example 4200
730
+ */
731
+ trigger_price_usd_pips?: string | null;
710
732
  /**
711
733
  * @description Human-readable explanation of `reason` — a customer-facing sentence describing the market condition that triggered this deleverage. Null whenever `reason` is null.
712
734
  * @example The bid-ask spread widened sharply beyond its recent baseline, signalling thinning liquidity.
@@ -1019,7 +1041,7 @@ interface components {
1019
1041
  */
1020
1042
  side: "yes" | "no";
1021
1043
  /**
1022
- * @description Simplified position status
1044
+ * @description Simplified position status. A position that was deleveraged almost entirely and then force-sold for a trivial remainder reports 'settled' once the market resolves against it. The 'status' query parameter still filters on the underlying mechanism, so such a position is returned by status=liquidated.
1023
1045
  * @enum {string}
1024
1046
  */
1025
1047
  status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
@@ -1052,6 +1074,8 @@ interface components {
1052
1074
  * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
1053
1075
  */
1054
1076
  wallet_address: string;
1077
+ /** @description The committed-mode ladder this position was opened on: one row per planned unwind, each with a status of planned, triggered or superseded. Only present when the request includes `expand=planned_unwinds`; omitted otherwise, and empty on adaptive positions. */
1078
+ planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1055
1079
  /**
1056
1080
  * @deprecated
1057
1081
  * @description Deprecated — use `pendingOperation` (a deferred close now surfaces as `{ type: 'close', phase: 'awaiting_settlement' }`). Details of a close request that could not complete and was deferred. Null unless the customer requested a close that is now waiting on market settlement to redeem the remaining tokens.
@@ -1220,7 +1244,7 @@ interface components {
1220
1244
  */
1221
1245
  side: "yes" | "no";
1222
1246
  /**
1223
- * @description Simplified position status
1247
+ * @description Simplified position status. A position that was deleveraged almost entirely and then force-sold for a trivial remainder reports 'settled' once the market resolves against it. The 'status' query parameter still filters on the underlying mechanism, so such a position is returned by status=liquidated.
1224
1248
  * @enum {string}
1225
1249
  */
1226
1250
  status: "pending" | "open" | "unwinding" | "closing" | "settling" | "closed" | "settled" | "liquidated" | "cancelled";
@@ -1249,11 +1273,13 @@ interface components {
1249
1273
  * @example 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
1250
1274
  */
1251
1275
  wallet_address: string;
1276
+ /** @description The committed-mode ladder this position was opened on: one row per planned unwind, each with a status of planned, triggered or superseded. Only present when the request includes `expand=planned_unwinds`; omitted otherwise, and empty on adaptive positions. */
1277
+ planned_unwinds?: components["schemas"]["CustomerPositionUnwindList"] | null;
1252
1278
  /**
1253
- * @description Reason the position was closed
1279
+ * @description Reason the position was closed. Reports 'settled' for a position that was deleveraged almost entirely and then force-sold for a trivial remainder on a market that resolved against it.
1254
1280
  * @enum {string}
1255
1281
  */
1256
- close_reason: "closed" | "liquidated" | "reverted" | "settled";
1282
+ close_reason: "cancelled" | "closed" | "liquidated" | "reverted" | "settled";
1257
1283
  /**
1258
1284
  * @description Why the position was reverted before it opened. Non-null only when `close_reason` is `reverted`: `exchange_unavailable` (the prediction-market venue was temporarily unavailable — safe to retry), `slippage_exceeded` (price moved beyond tolerance before the order filled), or `unknown`.
1259
1285
  * @enum {string|null}
@@ -1417,10 +1443,67 @@ interface components {
1417
1443
  */
1418
1444
  allow_partial_fill: boolean;
1419
1445
  /**
1420
- * @description Minimum fill the user will accept, in basis points. Only valid when allowPartialFill=true (rejected otherwise). Must be in [2000, 5000] and divisible by 500 (5% steps). Capped from below by max(2000, ceil(MIN_COLLATERAL × 10000 / requestedCollateral)).
1446
+ * @description Minimum fill the user will accept, in basis points. Only valid when allowPartialFill=true (rejected otherwise). Must be in [2000, 7000] and divisible by 500 (5% steps). Capped from below by max(2000, ceil(MIN_COLLATERAL × 10000 / requestedCollateral)).
1421
1447
  * @example 5000
1422
1448
  */
1423
1449
  min_fill_bps?: number;
1450
+ /**
1451
+ * @description Risk mode for the resulting position. adaptive: the live risk engine manages leverage. committed: the quote carries a fixed set of price-triggered unwinds and the user posts extra margin. A committed request is answered in committed mode or not at all — when the market, price or leverage rules the mode out, the quote is rejected with QUOTE_COMMITTED_RISK_MODE_UNAVAILABLE carrying the reason. Take a draft quote first to see whether the mode is on offer.
1452
+ * @default adaptive
1453
+ * @example committed
1454
+ * @enum {string}
1455
+ */
1456
+ risk_mode: "adaptive" | "committed";
1457
+ };
1458
+ CommittedUnwindUnavailableReason: {
1459
+ /**
1460
+ * @description Machine-readable reason committed mode cannot be offered for this quote
1461
+ * @example cryptoMarket
1462
+ * @enum {string}
1463
+ */
1464
+ code: "cryptoMarket" | "illegibleMarginTooLarge" | "illegibleTooManyUnwinds" | "invertedRiskBands" | "lateGameSoccer" | "notOfferedOnDeskQuotes";
1465
+ /** @description Human-readable explanation of the same reason */
1466
+ message: string;
1467
+ };
1468
+ PlannedUnwind: {
1469
+ /**
1470
+ * @description Order in which this unwind fires, starting at 0
1471
+ * @example 0
1472
+ */
1473
+ sequence: number;
1474
+ /**
1475
+ * @description Price at which this unwind fires, in USD pips (10000 pips = $1)
1476
+ * @example 4200
1477
+ */
1478
+ trigger_price_usd_pips: string;
1479
+ /**
1480
+ * @description Book leverage the position is unwound to when this fires, in basis points (10000 = 1x)
1481
+ * @example 15000
1482
+ */
1483
+ target_leverage_bps: number;
1484
+ /**
1485
+ * @description Estimated token units sold to reach the target (1000000 units = 1 token). An estimate only — the executed amount depends on the fill.
1486
+ * @example 30000000
1487
+ */
1488
+ token_units_to_sell_estimate: string;
1489
+ };
1490
+ CommittedUnwinds: {
1491
+ /** @description Whether committed mode can be offered for this quote */
1492
+ available: boolean;
1493
+ /** @description Why committed mode is unavailable. Null when it is available. */
1494
+ unavailable_reason?: components["schemas"]["CommittedUnwindUnavailableReason"] | null;
1495
+ /**
1496
+ * @description Extra margin the user must post on top of collateral, in USDC units (1000000 units = 1 USDC)
1497
+ * @example 67000000
1498
+ */
1499
+ margin_required_usdc_units?: string | null;
1500
+ /**
1501
+ * @description Price at which selling the remaining tokens repays the loan in full, in USD pips
1502
+ * @example 2700
1503
+ */
1504
+ debt_clear_price_usd_pips?: string | null;
1505
+ /** @description The pre-committed unwinds, in the order they fire. Empty when committed mode is unavailable. */
1506
+ planned_unwinds?: components["schemas"]["PlannedUnwind"][] | null;
1424
1507
  };
1425
1508
  CustomerOfferMaxGain: {
1426
1509
  /**
@@ -1517,6 +1600,25 @@ interface components {
1517
1600
  * @example 0x1234567890123456789012345678901234567890
1518
1601
  */
1519
1602
  polygon_vault_contract_address: string;
1603
+ /**
1604
+ * @description Vault function this quote's signature authorizes. createPositionWithMargin for committed quotes, createPosition otherwise. A signature for one will not authorize the other.
1605
+ * @example createPosition
1606
+ * @enum {string}
1607
+ */
1608
+ polygon_vault_function_name: "createPosition" | "createPositionWithMargin";
1609
+ /**
1610
+ * @description Risk mode this quote was issued in. A committed request is answered in committed mode or rejected, so this only reports adaptive when adaptive was asked for.
1611
+ * @example adaptive
1612
+ * @enum {string}
1613
+ */
1614
+ risk_mode: "adaptive" | "committed";
1615
+ /** @description Committed-unwind mode for this quote: the pre-committed unwinds and the extra margin they require, or the reason the mode cannot be offered. */
1616
+ committed_unwinds?: components["schemas"]["CommittedUnwinds"];
1617
+ /**
1618
+ * @description Extra margin locked in the vault on top of collateral, in USDC units (1,000,000 units = 1 USDC). Zero on adaptive quotes. Included in totalUserAmountUsdcUnits.
1619
+ * @example 0
1620
+ */
1621
+ margin_usdc_units: string;
1520
1622
  /**
1521
1623
  * @description Expected trading fee formatted as USD
1522
1624
  * @example 0.02
@@ -1714,11 +1816,20 @@ interface components {
1714
1816
  */
1715
1817
  total_user_amount_usd_pips: string;
1716
1818
  /**
1717
- * @description Total amount user must transfer at createPosition in USDC units (1,000,000 units = 1 USDC). Contract-ready value. On Polymarket = collateral + originationFee.
1819
+ * @description Total amount user must transfer at position creation in USDC units (1,000,000 units = 1 USDC). Contract-ready value = collateral + originationFee + expected open trading fee + committed-mode margin.
1718
1820
  * @example 2730000
1719
1821
  */
1720
1822
  total_user_amount_usdc_units: string;
1721
1823
  };
1824
+ PromoteOfferBody: {
1825
+ /**
1826
+ * @description Risk mode for the promoted offer. The draft carries the committed unwinds it was quoted with; this chooses whether the promoted offer opens on them. Omitted means adaptive.
1827
+ * @default adaptive
1828
+ * @example committed
1829
+ * @enum {string}
1830
+ */
1831
+ risk_mode: "adaptive" | "committed";
1832
+ };
1722
1833
  };
1723
1834
  responses: never;
1724
1835
  parameters: never;
@@ -1728,7 +1839,23 @@ interface components {
1728
1839
  }
1729
1840
 
1730
1841
  type Raw = components["schemas"];
1731
- type Market = CamelizeKeys<Raw["CustomerMarket"]>;
1842
+ /**
1843
+ * The event a market belongs to — the real-world happening it resolves against (one game, one
1844
+ * hourly price window). `seriesTicker` names the recurring template the event came from, and is
1845
+ * null for events with no series.
1846
+ *
1847
+ * Hand-written rather than derived from `Raw` because `generated.ts` is currently pinned to an API
1848
+ * version that predates this block. Delete this and let `CustomerMarket` supply `event` the next
1849
+ * time the types are regenerated against a spec that has it.
1850
+ */
1851
+ interface MarketEvent {
1852
+ seriesTicker: string | null;
1853
+ ticker: string;
1854
+ title: string | null;
1855
+ }
1856
+ type Market = CamelizeKeys<Raw["CustomerMarket"]> & {
1857
+ event: MarketEvent;
1858
+ };
1732
1859
  type MarketLeverage = CamelizeKeys<Raw["CustomerLeverage"]>;
1733
1860
  type MarketMaxLeveragePerNotional = CamelizeKeys<Raw["CustomerMaxMarketLeveragePerNotional"]>;
1734
1861
  type MarketSidedMaxLeveragePerNotional = CamelizeKeys<Raw["CustomerSidedMaxMarketLeveragePerNotional"]>;
@@ -1770,6 +1897,7 @@ type FeeRatesOriginationTier = CamelizeKeys<Raw["CustomerOriginationFeeTier"]>;
1770
1897
  type FeeRatesMarket = CamelizeKeys<Raw["CustomerFeeRatesMarket"]>;
1771
1898
  type FeeRates = CamelizeKeys<Raw["CustomerFeeRates"]>;
1772
1899
  type FeeReport = CamelizeKeys<Raw["CustomerFeeReport"]>;
1900
+ type RiskMode = "adaptive" | "committed";
1773
1901
  interface CreateQuoteParams {
1774
1902
  marketTicker: string;
1775
1903
  effectiveSide: "yes" | "no";
@@ -1779,6 +1907,15 @@ interface CreateQuoteParams {
1779
1907
  pmProvider?: "polymarket" | "kalshi";
1780
1908
  allowPartialFill?: boolean;
1781
1909
  minFillBps?: number;
1910
+ /**
1911
+ * Ask for a committed deleverage plan (a fixed ladder of trigger prices, backed by a refundable
1912
+ * margin deposit) instead of the adaptive risk engine. Defaults to `adaptive`.
1913
+ *
1914
+ * A committed request is answered in committed mode or rejected with
1915
+ * `quote_committed_risk_mode_unavailable` — you never get an adaptive quote back from it. Take a
1916
+ * draft first and read `committedUnwinds.available` to know whether the mode is on offer.
1917
+ */
1918
+ riskMode?: RiskMode;
1782
1919
  }
1783
1920
  /** @deprecated Renamed to {@link CreateQuoteParams}. Kept as an alias for backward compatibility. */
1784
1921
  type CreateOfferParams = CreateQuoteParams;
@@ -1793,4 +1930,4 @@ declare function isOpenPosition(p: Position): p is OpenPosition;
1793
1930
  declare function isClosedPosition(p: Position): p is ClosedPosition;
1794
1931
  declare function leverageMaxBps(lev: MarketLeverage, side: "yes" | "no"): number;
1795
1932
 
1796
- export { type PositionFailure as A, type PositionOpenFees as B, type CreateQuoteParams as C, type PositionPartialClose as D, type PositionResult as E, type FeeRates as F, type PositionRisk as G, type PositionTiming as H, type PositionUnwind as I, type PositionUnwindList as J, isClosedPosition as K, isOpenPosition as L, type Market as M, leverageMaxBps as N, type Offer as O, type Position as P, type Quote as Q, type MarketPolymarket as a, type MarketLeverage as b, type PositionTransactions as c, type PositionPartialCloseList as d, type ContractInfo as e, type CustomerLimit as f, type FeeReportParams as g, type FeeReport as h, type CamelizeKeys as i, type CloseAttempt as j, type ClosedPosition as k, type CreateOfferParams as l, type CreateTokenResult as m, type FeeRatesMarket as n, type FeeRatesOriginationTier as o, type MarketFees as p, type MarketMaxLeveragePerNotional as q, type MarketPrices as r, type MarketSidedEligibility as s, type MarketSidedMaxLeveragePerNotional as t, type OpenPosition as u, type OriginationTier as v, type PendingOperation as w, type PositionClosedFees as x, type PositionCurrent as y, type PositionEntry as z };
1933
+ export { type PositionCurrent as A, type PositionEntry as B, type CreateQuoteParams as C, type PositionFailure as D, type PositionOpenFees as E, type FeeRates as F, type PositionPartialClose as G, type PositionResult as H, type PositionRisk as I, type PositionTiming as J, type PositionUnwind as K, isClosedPosition as L, type Market as M, isOpenPosition as N, type Offer as O, type Position as P, type Quote as Q, type RiskMode as R, leverageMaxBps as S, type MarketPolymarket as a, type MarketLeverage as b, type PositionTransactions as c, type PositionUnwindList as d, type PositionPartialCloseList as e, type ContractInfo as f, type CustomerLimit as g, type FeeReportParams as h, type FeeReport as i, type CamelizeKeys as j, type CloseAttempt as k, type ClosedPosition as l, type CreateOfferParams as m, type CreateTokenResult as n, type FeeRatesMarket as o, type FeeRatesOriginationTier as p, type MarketEvent as q, type MarketFees as r, type MarketMaxLeveragePerNotional as s, type MarketPrices as t, type MarketSidedEligibility as u, type MarketSidedMaxLeveragePerNotional as v, type OpenPosition as w, type OriginationTier as x, type PendingOperation as y, type PositionClosedFees as z };
@@ -71,7 +71,7 @@ function formatPipsUsd(value) {
71
71
  }
72
72
 
73
73
  // src/errors/error-messages.ts
74
- var minFillBpsMaxForMessage = 5e3;
74
+ var minFillBpsMaxForMessage = 7e3;
75
75
  var friendlyByCode = {
76
76
  invalid_evm_address: "Invalid EVM address.",
77
77
  invalid_solana_address: "Invalid Solana address.",
@@ -80,6 +80,7 @@ var friendlyByCode = {
80
80
  customer_auth_invalid_wallet_address: "Invalid wallet address.",
81
81
  unauthorized: "Session expired. Please reconnect your wallet.",
82
82
  forbidden: "You do not have access to this resource.",
83
+ beta_feature_not_enabled: "This is a beta feature and it is not enabled for your account. Contact us to have it enabled.",
83
84
  array_out_of_bounds: "Internal indexing error. Please try again.",
84
85
  batch_compute_not_available: "Cached pricing is temporarily unavailable. Try again shortly.",
85
86
  internal_server_error: "Something went wrong on our side. Please try again.",
@@ -239,7 +240,7 @@ var friendlyByCode = {
239
240
  return tolerance ? `Liquidation price is too close to entry (minimum buffer ${tolerance}). Reduce leverage.` : "Liquidation price is not viable at this leverage. Reduce leverage.";
240
241
  },
241
242
  quote_min_fill_bps_requires_fak: "Partial-fill request was malformed. Please re-quote.",
242
- quote_min_fill_bps_out_of_range: "Minimum fill must be between 20% and 50%.",
243
+ quote_min_fill_bps_out_of_range: "Minimum fill must be between 20% and 70%.",
243
244
  quote_min_fill_bps_step_invalid: "Minimum fill must be set in 5% steps.",
244
245
  quote_min_fill_bps_below_floor: (params) => {
245
246
  const floorRaw = getParam(params, "floorMinFillBps");
@@ -258,6 +259,8 @@ var friendlyByCode = {
258
259
  quote_market_not_found: "Market not found.",
259
260
  quote_market_risk_too_high: "Market risk is too high right now. Try again later.",
260
261
  quote_market_unsupported_category: "This market category is not supported.",
262
+ quote_market_unsupported_crypto_asset: "This market's underlying asset is not supported.",
263
+ quote_market_unsupported_sport: "This sport is not supported.",
261
264
  quote_market_no_prices: "No price data available for this market.",
262
265
  quote_market_missing_polymarket_condition_id: "This market is missing required Polymarket data.",
263
266
  quote_polymarket_market_closed: "This Polymarket market is closed and not accepting new positions.",
@@ -283,7 +286,9 @@ var friendlyByCode = {
283
286
  evm_transaction_failed: "EVM transaction failed.",
284
287
  position_transition_conflicting_operation: "Another operation on this position is in progress. Try again shortly.",
285
288
  position_transition_invalid_state: "Position is not in a state that allows this action.",
286
- quote_creation_disabled: "Quote creation is temporarily disabled. Try again shortly."
289
+ quote_creation_disabled: "Quote creation is temporarily disabled. Try again shortly.",
290
+ quote_committed_plan_more_restrictive: "The committed deleveraging plan has moved against the terms you were shown. Refresh the quote to see the current plan.",
291
+ quote_committed_risk_mode_unavailable: "Committed mode isn't available for this position. Open it in adaptive mode instead."
287
292
  };
288
293
  function humanizeCode(code) {
289
294
  const spaced = code.replace(/_/g, " ");
@@ -340,4 +345,4 @@ var DimesContractError = class extends DimesError {
340
345
 
341
346
 
342
347
  exports.resolveFriendlyMessage = resolveFriendlyMessage; exports.formatErrorMessage = formatErrorMessage; exports.DimesError = DimesError; exports.DimesApiError = DimesApiError; exports.DimesContractError = DimesContractError;
343
- //# sourceMappingURL=chunk-E6YJDY4F.cjs.map
348
+ //# sourceMappingURL=chunk-ERM4WP6D.cjs.map