@0xmonaco/types 1.0.88 → 1.0.91

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.
@@ -48,8 +48,10 @@ export interface BuildercodesAPI extends BaseAPI {
48
48
  * The bucket is resolved from the authenticated caller's own wallet address,
49
49
  * so a caller can only ever claim their own accrued balance. A wallet that
50
50
  * has never been an enrolled frontend's payout address has nothing to claim.
51
- * A wallet that *used to be* a payout address keeps what it accrued back then
52
- * and can still claim it — payout-address changes are not retroactive.
51
+ * Shortly after Monaco moves a frontend's payout address to a new wallet, the
52
+ * unclaimed balance accrued to the old wallet moves with it. A wallet that
53
+ * *used to be* a payout address can still claim whatever remains in its
54
+ * bucket.
53
55
  *
54
56
  * Throws 403 when the session is a delegated agent — a permanent
55
57
  * restriction on that session type, not a rollout state. No program switch
@@ -34,10 +34,8 @@ export declare const SimulateFeeResponseSchema: z.ZodObject<{
34
34
  applicationMakerFee: z.ZodOptional<z.ZodString>;
35
35
  applicationMakerFeeBps: z.ZodOptional<z.ZodNumber>;
36
36
  monacoMakerRebate: z.ZodString;
37
- monacoMakerRebateBps: z.ZodNumber;
38
37
  monacoMakerRebateBpsExact: z.ZodString;
39
38
  monacoTakerFee: z.ZodString;
40
- monacoTakerFeeBps: z.ZodNumber;
41
39
  monacoTakerFeeBpsExact: z.ZodString;
42
40
  notional: z.ZodString;
43
41
  takerTotalPayment: z.ZodString;
@@ -69,12 +69,6 @@ export const SimulateFeeResponseSchema = z.object({
69
69
  applicationMakerFeeBps: z.number().optional(),
70
70
  /** Monaco protocol maker rebate (negative = rebate) */
71
71
  monacoMakerRebate: z.string(),
72
- /**
73
- * Monaco maker rebate in basis points.
74
- * @deprecated Integer field cannot represent fractional tiered rebates (e.g. -1.15); it
75
- * echoes the flat trading-pair column, not the tier-resolved rate. Use monacoMakerRebateBpsExact.
76
- */
77
- monacoMakerRebateBps: z.number(),
78
72
  /**
79
73
  * Tier-resolved Monaco maker rebate as a decimal basis-points string (negative is a
80
74
  * rebate), e.g. "-1" — the exact rate the ledger credits this caller.
@@ -82,12 +76,6 @@ export const SimulateFeeResponseSchema = z.object({
82
76
  monacoMakerRebateBpsExact: z.string(),
83
77
  /** Monaco protocol taker fee */
84
78
  monacoTakerFee: z.string(),
85
- /**
86
- * Monaco taker fee in basis points.
87
- * @deprecated Integer field cannot represent fractional tiered rates (e.g. 6.5); it echoes
88
- * the flat trading-pair column, not the tier-resolved rate. Use monacoTakerFeeBpsExact.
89
- */
90
- monacoTakerFeeBps: z.number(),
91
79
  /**
92
80
  * Tier-resolved Monaco taker fee as a decimal basis-points string, e.g. "6.5" — the exact
93
81
  * rate the ledger charges this caller (equals monacoTakerFee / notional).
@@ -221,10 +221,26 @@ export interface TransferCollateralRequest {
221
221
  * bucket, which has no trading pair and so cannot be named any other way.
222
222
  */
223
223
  marginMode?: MarginMode;
224
+ /**
225
+ * Submission identity (1-64 of `A-Za-z0-9._:-`), shared with order create.
226
+ * Retrying the same key and request within 15 minutes returns the first
227
+ * transfer's result, its `movementId` included, and moves nothing again.
228
+ * Generate one per intended transfer and keep it across its retries; a
229
+ * different request under the same key fails with `IDEMPOTENCY_KEY_CONFLICT`.
230
+ */
231
+ idempotencyKey?: string;
224
232
  }
225
233
  export interface TransferCollateralToParentMarginAccountRequest {
226
234
  asset: string;
227
235
  amount: string;
236
+ /**
237
+ * Submission identity (1-64 of `A-Za-z0-9._:-`), shared with order create.
238
+ * Retrying the same key and request within 15 minutes returns the first
239
+ * transfer's result, its `movementId` included, and moves nothing again.
240
+ * Generate one per intended transfer and keep it across its retries; a
241
+ * different request under the same key fails with `IDEMPOTENCY_KEY_CONFLICT`.
242
+ */
243
+ idempotencyKey?: string;
228
244
  }
229
245
  /**
230
246
  * Fund a pair's isolated risk bucket from the parent margin account's
@@ -289,6 +305,14 @@ export type TransferCollateralToRiskBucketRequest = TransferCollateralToIsolated
289
305
  export interface TransferCollateralFromParentMarginAccountRequest {
290
306
  asset: string;
291
307
  amount: string;
308
+ /**
309
+ * Submission identity (1-64 of `A-Za-z0-9._:-`), shared with order create.
310
+ * Retrying the same key and request within 15 minutes returns the first
311
+ * transfer's result, its `movementId` included, and moves nothing again.
312
+ * Generate one per intended transfer and keep it across its retries; a
313
+ * different request under the same key fails with `IDEMPOTENCY_KEY_CONFLICT`.
314
+ */
315
+ idempotencyKey?: string;
292
316
  }
293
317
  export interface TransferCollateralResponse {
294
318
  movementId: string;
@@ -582,6 +606,14 @@ export interface TransferMarginCollateralRequest {
582
606
  amount: string;
583
607
  from: CollateralTransferEndpoint;
584
608
  to: CollateralTransferEndpoint;
609
+ /**
610
+ * Submission identity (1-64 of `A-Za-z0-9._:-`), shared with order create.
611
+ * Retrying the same key and request within 15 minutes returns the first
612
+ * transfer's result, its `movementId` included, and moves nothing again.
613
+ * Generate one per intended transfer and keep it across its retries; a
614
+ * different request under the same key fails with `IDEMPOTENCY_KEY_CONFLICT`.
615
+ */
616
+ idempotencyKey?: string;
585
617
  }
586
618
  export interface TransferMarginCollateralResponse {
587
619
  movementId: string;
@@ -423,6 +423,12 @@ export interface PerpMarketConfig {
423
423
  */
424
424
  riskTiers: RiskTier[];
425
425
  updatedAt: string;
426
+ /**
427
+ * Quote notional `Q_m` that each funding premium sample walks through each
428
+ * side of the book to read the market's impact bid and impact ask. Set per
429
+ * market; markets start at `"2000"`.
430
+ */
431
+ fundingImpactNotional: string;
426
432
  }
427
433
  export interface PerpMarketSummary {
428
434
  tradingPairId: string;
@@ -605,6 +611,124 @@ export interface OpenInterest {
605
611
  openInterestNotional: string;
606
612
  updatedAt: string;
607
613
  }
614
+ /** Public account-positioning snapshot and distinct active-trader counts; responses may be cached for up to 30 seconds. */
615
+ export interface TraderMetrics {
616
+ tradingPairId: string;
617
+ quoteAssetSymbol: string;
618
+ /** Snapshot calculation time as Unix milliseconds. */
619
+ asOf: number;
620
+ /** Position split fields are suppressed when either side has fewer than five accounts. */
621
+ positionMetricsSuppressed: boolean;
622
+ longAccountCount: number | null;
623
+ shortAccountCount: number | null;
624
+ /** Account shares and ratios are rounded to six decimal places. */
625
+ longAccountShare: string | null;
626
+ shortAccountShare: string | null;
627
+ accountRatio: string | null;
628
+ activeTraderWindows: ActiveTraderWindow[];
629
+ }
630
+ /** Distinct user IDs in executed trades for one rolling window; includes liquidation and ADL system IDs. */
631
+ export interface ActiveTraderWindow {
632
+ window: "1h" | "24h" | "7d";
633
+ activeTraderCount: number | null;
634
+ takerBuyerCount: number | null;
635
+ takerSellerCount: number | null;
636
+ /** All three counts are null when any cohort in this window is below five users. */
637
+ suppressed: boolean;
638
+ }
639
+ export type TradeFlowInterval = "1m" | "5m" | "1h";
640
+ export interface GetTradeFlowParams {
641
+ interval: TradeFlowInterval;
642
+ /** Inclusive start time as Unix milliseconds. */
643
+ startTime: number;
644
+ /** Exclusive end time as Unix milliseconds. */
645
+ endTime: number;
646
+ }
647
+ export interface TradeFlowBucket {
648
+ /** UTC-aligned bucket start as Unix milliseconds. */
649
+ bucketStart: number;
650
+ takerBuyNotional: string;
651
+ takerSellNotional: string;
652
+ /** Taker buy/sell ratio rounded to six decimal places. */
653
+ buySellRatio: string | null;
654
+ netNotional: string;
655
+ cumulativeVolumeDelta: string;
656
+ tradeCount: number;
657
+ }
658
+ export interface TradeFlow {
659
+ tradingPairId: string;
660
+ quoteAssetSymbol: string;
661
+ interval: TradeFlowInterval;
662
+ /** Inclusive selected start time as Unix milliseconds. */
663
+ startTime: number;
664
+ /** Exclusive selected end time as Unix milliseconds. */
665
+ endTime: number;
666
+ /** Buckets without executed trades are omitted. */
667
+ buckets: TradeFlowBucket[];
668
+ }
669
+ export interface ListLiquidationEventsParams {
670
+ /** Inclusive event-time lower bound as Unix milliseconds. */
671
+ startTime?: number;
672
+ /** Exclusive event-time upper bound as Unix milliseconds. */
673
+ endTime?: number;
674
+ /** Requested page size, from 1 through 1000 (defaults to 50). */
675
+ pageSize?: number;
676
+ /** Opaque cursor returned by the previous page; pages continue toward older rows. */
677
+ pageToken?: string;
678
+ }
679
+ export interface LiquidationHistoryEvent {
680
+ eventId: string;
681
+ /** Event time as Unix milliseconds. */
682
+ timestamp: number;
683
+ tradingPairId: string;
684
+ wallet: string;
685
+ side: "LONG" | "SHORT";
686
+ /** Absolute position size in base-asset units. */
687
+ positionSize: string;
688
+ /** Mark price captured for this event, in quote units per base unit. */
689
+ markPrice: string;
690
+ /** Position size × event-time mark price, in quote-asset units. */
691
+ markNotional: string;
692
+ quoteAssetSymbol: string;
693
+ }
694
+ export interface ListLiquidationEventsResponse {
695
+ tradingPairId: string;
696
+ /** Events are ordered newest first. */
697
+ events: LiquidationHistoryEvent[];
698
+ pageSize: number;
699
+ nextPageToken: string;
700
+ }
701
+ export type LiquidationMetricsInterval = "1m" | "5m" | "1h";
702
+ export interface GetLiquidationMetricsParams {
703
+ interval: LiquidationMetricsInterval;
704
+ /** Inclusive range start as Unix milliseconds. */
705
+ startTime: number;
706
+ /** Exclusive range end as Unix milliseconds. */
707
+ endTime: number;
708
+ }
709
+ export interface LiquidationSideMetrics {
710
+ /** Number of stored liquidation-event rows on this side in the bucket. */
711
+ eventCount: number;
712
+ /** Sum of event position sizes in base-asset units. */
713
+ positionSize: string;
714
+ /** Sum of each row's position size × event-time mark in quote units. */
715
+ markNotional: string;
716
+ }
717
+ export interface LiquidationMetricsBucket {
718
+ /** UTC-aligned bucket start as Unix milliseconds. */
719
+ bucketStart: number;
720
+ long: LiquidationSideMetrics;
721
+ short: LiquidationSideMetrics;
722
+ }
723
+ export interface LiquidationMetrics {
724
+ tradingPairId: string;
725
+ quoteAssetSymbol: string;
726
+ interval: LiquidationMetricsInterval;
727
+ startTime: number;
728
+ endTime: number;
729
+ /** Buckets with no liquidation rows on either side are omitted. */
730
+ buckets: LiquidationMetricsBucket[];
731
+ }
608
732
  /**
609
733
  * Market API interface.
610
734
  * Provides methods for fetching market metadata and trading pair information.
@@ -682,4 +806,12 @@ export interface MarketAPI extends BaseAPI {
682
806
  */
683
807
  listAllFundingHistory(params?: ListAllFundingHistoryParams): Promise<ListAllFundingHistoryResponse>;
684
808
  getOpenInterest(tradingPairId: string): Promise<OpenInterest>;
809
+ /** Fetch current public positioning and active-trader aggregates for a perp. */
810
+ getTraderMetrics(tradingPairId: string): Promise<TraderMetrics>;
811
+ /** Fetch bounded taker buy/sell quote flow and cumulative volume delta. */
812
+ getTradeFlow(tradingPairId: string, params: GetTradeFlowParams): Promise<TradeFlow>;
813
+ /** Fetch persisted per-fill liquidation events with a stable keyset cursor. */
814
+ listLiquidationEvents(tradingPairId: string, params?: ListLiquidationEventsParams): Promise<ListLiquidationEventsResponse>;
815
+ /** Fetch bounded UTC-aligned long/short liquidation totals by side. */
816
+ getLiquidationMetrics(tradingPairId: string, params: GetLiquidationMetricsParams): Promise<LiquidationMetrics>;
685
817
  }
@@ -28,6 +28,12 @@ export interface PortfolioSummaryCurrent {
28
28
  spotEquity?: string;
29
29
  perpsEquity: string;
30
30
  unrealizedPnl?: string;
31
+ /**
32
+ * What the user can spend or withdraw now: USDC available on spot plus the
33
+ * parent margin account's `withdrawableCollateral`. Other spot assets and
34
+ * unrealized margin gains are not counted. Served even when the valuation
35
+ * is partial.
36
+ */
31
37
  availableValue?: string;
32
38
  }
33
39
  export interface PortfolioSummaryActivity {
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import type { Address } from "viem";
7
7
  import type { BaseAPI } from "../api";
8
- import type { OrderSide, OrderStatus, OrderType, SelfTradePreventionMode, TimeInForce } from "../trading";
8
+ import type { OrderSide, OrderStatus, OrderType, SelfTradePreventionMode, TimeInForce, TradingMode } from "../trading";
9
9
  /**
10
10
  * Account movement/transaction information.
11
11
  * Represents transactions/movements returned in the profile's recent_movements array.
@@ -276,31 +276,56 @@ export interface UserTrade {
276
276
  tradeId: string;
277
277
  /** Trading pair identifier (UUID) */
278
278
  tradingPairId: string;
279
+ /** Trading mode of the pair the trade executed on */
280
+ tradingMode: TradingMode;
281
+ /** Maker order identifier (UUID) */
282
+ makerOrderId: string;
283
+ /** Taker order identifier (UUID) */
284
+ takerOrderId: string;
279
285
  /** Execution price (as string to preserve precision) */
280
286
  price: string;
281
287
  /** Executed quantity (as string to preserve precision) */
282
288
  quantity: string;
283
- /** Quote volume (price * quantity, as string to preserve precision) */
284
- quoteVolume: string;
285
- /** Side of the trade */
289
+ /** `quantity` in the smallest base-token unit */
290
+ quantityRaw: string;
291
+ /** Quote volume (price * quantity, as string to preserve precision). Absent when the trade has none recorded. */
292
+ quoteVolume?: string;
293
+ /** `quoteVolume` in the smallest quote-token unit. Absent when `quoteVolume` is. */
294
+ quoteVolumeRaw?: string;
295
+ /** This user's side of the trade */
286
296
  side: OrderSide;
287
297
  /**
288
298
  * Total fee paid for this trade (as string to preserve precision). For a
289
299
  * taker this is Monaco's taker fee plus the frontend's builder fee; for a
290
300
  * maker it is the maker fee (negative for a rebate) plus the frontend's
291
- * maker add-on. Equals `monacoFee + builderFee`.
292
- */
293
- fee: string;
294
- /** Monaco's component of `fee`. Absent from servers older than this field. */
295
- monacoFee?: string;
301
+ * maker add-on. Equals `monacoFee + builderFee`. Absent when the trade has
302
+ * no fee recorded for this user's side.
303
+ */
304
+ fee?: string;
305
+ /** `fee` in the smallest quote-token unit. Absent when `fee` is. */
306
+ feeRaw?: string;
307
+ /** Token address the fee was charged in. Absent when none is recorded. */
308
+ feeToken?: string;
309
+ /** Monaco's component of `fee`. `null` when `fee` is absent; absent from servers older than this field. */
310
+ monacoFee?: string | null;
311
+ /** `monacoFee` in the smallest quote-token unit. `null` when `monacoFee` is. */
312
+ monacoFeeRaw?: string | null;
296
313
  /**
297
314
  * The frontend's builder fee component of `fee`: the builder fee for a
298
315
  * taker, the maker add-on for a maker. Absent from servers older than this
299
316
  * field.
300
317
  */
301
318
  builderFee?: string;
302
- /** Timestamp when the trade was executed (ISO string) */
303
- executedAt: string;
319
+ /** `builderFee` in the smallest quote-token unit. Absent from servers older than this field. */
320
+ builderFeeRaw?: string;
321
+ /** Settlement status. Absent when the trade has none recorded. */
322
+ settlementStatus?: "PENDING" | "SETTLED" | "FAILED";
323
+ /** On-chain settlement transaction hash. Absent until one is recorded. */
324
+ settlementTxHash?: string;
325
+ /** This user's role in the fill. A self-trade reads as `MAKER`. */
326
+ liquidityRole: "MAKER" | "TAKER";
327
+ /** Timestamp when the trade was executed (RFC 3339). Absent when none is recorded. */
328
+ executedAt?: string;
304
329
  }
305
330
  /**
306
331
  * Query parameters for getting user trades
@@ -310,6 +335,18 @@ export interface GetUserTradesParams {
310
335
  pageSize?: number;
311
336
  /** Filter by trading pair ID (UUID) */
312
337
  tradingPairId?: string;
338
+ /**
339
+ * Filter by margin account ID (UUID): only trades whose side for this user
340
+ * was placed from that account. A self-trade is read as its maker side, so
341
+ * it matches through its maker order's account.
342
+ */
343
+ marginAccountId?: string;
344
+ /**
345
+ * Filter by order ID (UUID): only trades whose side for this user was
346
+ * placed by that order. A self-trade is read as its maker side, so it
347
+ * matches its maker order only.
348
+ */
349
+ orderId?: string;
313
350
  /**
314
351
  * Pagination cursor:
315
352
  * - Omitted or empty string (`""`): start a cursor walk from the newest row
@@ -321,7 +358,7 @@ export interface GetUserTradesParams {
321
358
  * is no page-number mode: a `page` param is rejected with a
322
359
  * `ValidationError` before the request is sent (the REST endpoint itself
323
360
  * answers `400`). An unfiltered response carries a bounded `total` (see
324
- * `totalCapped`); one filtered by `tradingPairId` carries none.
361
+ * `totalCapped`); a filtered one carries none.
325
362
  */
326
363
  pageToken?: string;
327
364
  }
@@ -70,7 +70,8 @@ export interface SDKConfig {
70
70
  * client (e.g. `waitForTransactionReceipt` during vault deposits). Sei
71
71
  * produces sub-second blocks, so a value near the chain's block time
72
72
  * confirms transactions much sooner than viem's 4000ms default. Defaults to
73
- * 750ms when omitted. Must be a positive finite number when provided.
73
+ * 200ms (about half a Sei block) when omitted. Must be a positive finite number when
74
+ * provided.
74
75
  */
75
76
  pollingInterval?: number;
76
77
  /**
@@ -105,8 +105,108 @@ export interface GetSweeperChainsResponse {
105
105
  chains: SweeperChain[];
106
106
  }
107
107
  /**
108
- * Sweeper API interface. The register endpoint requires authentication;
109
- * the chain listing is public.
108
+ * Where a sweeper deposit is.
109
+ *
110
+ * - `RECEIVED` — indexed, not yet swept (a balance below the asset's minimum
111
+ * waits for a later deposit).
112
+ * - `BURNED` — swept off its source chain; for a CCTP deposit, the burn is not
113
+ * yet queued for attestation. Deposits bridged by a route other than CCTP
114
+ * stay here.
115
+ * - `ATTESTING` — waiting for Circle's attestation.
116
+ * - `ATTESTED` — attested, not yet minted on the hub.
117
+ * - `SETTLING` — minted on the hub, being swept into the exchange.
118
+ * - `DEPOSITED` — credited to the exchange.
119
+ * - `FAILED` — the sweep returned the funds to the depositor's wallet (see
120
+ * {@link SweeperDeposit.failureReason}).
121
+ *
122
+ * A deposit on the hub chain goes straight from `RECEIVED` to `DEPOSITED`.
123
+ */
124
+ export type SweeperDepositStatus = "RECEIVED" | "BURNED" | "ATTESTING" | "ATTESTED" | "SETTLING" | "DEPOSITED" | "FAILED";
125
+ /**
126
+ * One transfer into one of the caller's deposit addresses, and how far it has
127
+ * got. Amounts are raw base units of the source-chain token (decimal strings —
128
+ * they can exceed `Number.MAX_SAFE_INTEGER`); timestamps are RFC 3339 and
129
+ * record when the sweeper observed each step.
130
+ *
131
+ * Sweeps move balances rather than single transfers, so a sweep that collected
132
+ * several deposits is attributed to each of them first in, first out.
133
+ */
134
+ export interface SweeperDeposit {
135
+ /** The deposit transaction's hash, lowercase */
136
+ txHash: string;
137
+ /** EVM chain id the deposit was made on, as listed by {@link SweeperAPI.getChains} */
138
+ sourceChainId: number;
139
+ /** The source chain's CCTP domain, once the deposit's CCTP burn is known; absent for hub deposits */
140
+ sourceDomain?: number | null;
141
+ /** The address the deposit is credited to (the caller's own), lowercase */
142
+ beneficiary: string;
143
+ /** Client id of the application the deposit address was registered under */
144
+ clientId: string;
145
+ /** The ledger the deposit address asks to be credited to */
146
+ depositTarget: "SPOT" | "MARGIN";
147
+ /** The deposited token's address on the source chain, lowercase */
148
+ token: string;
149
+ /** Amount deposited, raw base units of `token` */
150
+ amountRaw: string;
151
+ /**
152
+ * Amount credited to the exchange, once `DEPOSITED`. Absent when one CCTP
153
+ * burn carried several deposits (its fee cannot be split between them).
154
+ */
155
+ creditedAmountRaw?: string | null;
156
+ /**
157
+ * `amountRaw` minus `creditedAmountRaw`: Circle's fast-lane fee for a CCTP
158
+ * deposit, `"0"` on the hub. Absent whenever `creditedAmountRaw` is.
159
+ */
160
+ feeChargedRaw?: string | null;
161
+ /** The CCTP lane the burn requested, once the burn is known; absent for hub deposits */
162
+ transferType?: "FAST" | "STANDARD" | null;
163
+ /** Where the deposit is */
164
+ status: SweeperDepositStatus;
165
+ /** Why the deposit `FAILED`: `REFUNDED` — the exchange was paused, the user is blocked, or the token is not accepted */
166
+ failureReason?: "REFUNDED" | null;
167
+ /** The source-chain transaction that swept the deposit (the CCTP burn for a remote deposit) */
168
+ sweepTx?: string | null;
169
+ /** The hub transaction that deposited the funds into the exchange (the sweep itself for a hub deposit) */
170
+ settleTx?: string | null;
171
+ /** When Circle's attestation was first seen */
172
+ attestedAt?: string | null;
173
+ /** When the deposit was seen `DEPOSITED` */
174
+ settledAt?: string | null;
175
+ /** When the deposit was seen `FAILED` */
176
+ failedAt?: string | null;
177
+ /** When the sweeper indexed the deposit */
178
+ createdAt: string;
179
+ /** When the sweeper last observed progress on the deposit */
180
+ updatedAt: string;
181
+ }
182
+ /** The caller's sweeper deposits made by one transaction. */
183
+ export interface GetSweeperDepositStatusResponse {
184
+ /**
185
+ * In chain then log order; empty until the sweeper has indexed the
186
+ * transaction (and for a transaction with no deposit of the caller's).
187
+ */
188
+ deposits: SweeperDeposit[];
189
+ }
190
+ /** Paging for {@link SweeperAPI.listDeposits}. */
191
+ export interface ListSweeperDepositsParams {
192
+ /** Deposits per page, 1 to 100 (default 20). */
193
+ pageSize?: number;
194
+ /**
195
+ * The previous response's `nextPageToken`; omit (or pass `""`) to start
196
+ * from the newest deposit.
197
+ */
198
+ pageToken?: string;
199
+ }
200
+ /** One page of the caller's sweeper deposits. */
201
+ export interface ListSweeperDepositsResponse {
202
+ /** This page, newest recorded first */
203
+ deposits: SweeperDeposit[];
204
+ /** Cursor for the next page; empty when this page is the last */
205
+ nextPageToken: string;
206
+ }
207
+ /**
208
+ * Sweeper API interface. Registration and deposit status require
209
+ * authentication; the chain listing is public.
110
210
  */
111
211
  export interface SweeperAPI extends BaseAPI {
112
212
  /**
@@ -140,4 +240,30 @@ export interface SweeperAPI extends BaseAPI {
140
240
  * changes only with operator configuration, so it is safe to cache briefly.
141
241
  */
142
242
  getChains(): Promise<GetSweeperChainsResponse>;
243
+ /**
244
+ * Where the caller's deposits made by one transaction are — look a deposit
245
+ * up by the hash of the transaction that sent funds to the caller's deposit
246
+ * address, on any supported chain, and poll until `DEPOSITED` (or
247
+ * `FAILED`).
248
+ *
249
+ * Authenticated: only deposits credited to the session's own address are
250
+ * returned. The list is empty until the sweeper has indexed the
251
+ * transaction, so an empty answer right after sending is expected.
252
+ *
253
+ * Throws on a malformed hash (before sending).
254
+ */
255
+ getDepositStatus(txHash: string): Promise<GetSweeperDepositStatusResponse>;
256
+ /**
257
+ * The caller's sweeper deposits, newest first, as the same
258
+ * {@link SweeperDeposit} entries {@link getDepositStatus} returns — a way to
259
+ * find a deposit whose transaction hash was lost. A swept CCTP deposit is
260
+ * listed once, by its source-chain transfer; a burn made straight to the
261
+ * hub deposit address is listed by its hub mint.
262
+ *
263
+ * Walk by cursor: omit `pageToken` to start, then pass each response's
264
+ * `nextPageToken` until it comes back empty. Authenticated: only the
265
+ * session's own deposits. Throws on an out-of-range `pageSize` (before
266
+ * sending).
267
+ */
268
+ listDeposits(params?: ListSweeperDepositsParams): Promise<ListSweeperDepositsResponse>;
143
269
  }
@@ -159,7 +159,7 @@ export interface Order {
159
159
  *
160
160
  * The snapshot frame alone does not close a reconnect gap: an order that
161
161
  * filled or was cancelled while the socket was down is in neither the
162
- * resting snapshot nor the stream. Recover those explicitly — `listUserTrades`
162
+ * resting snapshot nor the stream. Recover those explicitly — `getUserTrades`
163
163
  * for fills, and a targeted `getOrder` for anything local state believes is
164
164
  * resting that the snapshot no longer lists.
165
165
  *
@@ -30,12 +30,14 @@ export declare const TransferCollateralSchema: z.ZodObject<{
30
30
  ISOLATED: "ISOLATED";
31
31
  CROSS: "CROSS";
32
32
  }>>;
33
+ idempotencyKey: z.ZodOptional<z.ZodString>;
33
34
  }, z.core.$strip>;
34
35
  }, z.core.$strip>;
35
36
  export declare const TransferCollateralToParentMarginAccountSchema: z.ZodObject<{
36
37
  request: z.ZodObject<{
37
38
  asset: z.ZodString;
38
39
  amount: z.ZodString;
40
+ idempotencyKey: z.ZodOptional<z.ZodString>;
39
41
  }, z.core.$strip>;
40
42
  }, z.core.$strip>;
41
43
  export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
@@ -48,6 +50,7 @@ export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
48
50
  }, z.core.$loose>, z.ZodUnion<readonly [z.ZodObject<{
49
51
  asset: z.ZodString;
50
52
  amount: z.ZodString;
53
+ idempotencyKey: z.ZodOptional<z.ZodString>;
51
54
  tradingPairId: z.ZodUUID;
52
55
  strategyKey: z.ZodOptional<z.ZodString>;
53
56
  marginMode: z.ZodOptional<z.ZodLiteral<"ISOLATED">>;
@@ -57,6 +60,7 @@ export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
57
60
  }, z.core.$strict>, z.ZodObject<{
58
61
  asset: z.ZodString;
59
62
  amount: z.ZodString;
63
+ idempotencyKey: z.ZodOptional<z.ZodString>;
60
64
  marginMode: z.ZodLiteral<"CROSS">;
61
65
  marginAccountId: z.ZodOptional<z.ZodUUID>;
62
66
  selectedTradingPairIds: z.ZodOptional<z.ZodNever>;
@@ -68,6 +72,7 @@ export declare const TransferCollateralFromParentMarginAccountSchema: z.ZodObjec
68
72
  request: z.ZodObject<{
69
73
  asset: z.ZodString;
70
74
  amount: z.ZodString;
75
+ idempotencyKey: z.ZodOptional<z.ZodString>;
71
76
  }, z.core.$strip>;
72
77
  }, z.core.$strip>;
73
78
  export declare const GetMarginAccountMovementsSchema: z.ZodObject<{
@@ -200,6 +205,7 @@ export declare const CloseMarginSubAccountSchema: z.ZodObject<{
200
205
  export declare const SubAccountCollateralTransferSchema: z.ZodObject<{
201
206
  marginAccountId: z.ZodUUID;
202
207
  amount: z.ZodString;
208
+ idempotencyKey: z.ZodOptional<z.ZodString>;
203
209
  }, z.core.$strip>;
204
210
  export declare const GetMarginAccountPnlSchema: z.ZodObject<{
205
211
  marginAccountId: z.ZodUUID;
@@ -220,5 +226,6 @@ export declare const TransferMarginCollateralSchema: z.ZodObject<{
220
226
  marginAccountId: z.ZodUUID;
221
227
  riskBucketId: z.ZodOptional<z.ZodUUID>;
222
228
  }, z.core.$strict>]>;
229
+ idempotencyKey: z.ZodOptional<z.ZodString>;
223
230
  }, z.core.$strict>;
224
231
  }, z.core.$strip>;
@@ -2,7 +2,7 @@
2
2
  * Margin Account API Validation Schemas
3
3
  */
4
4
  import { z } from "zod";
5
- import { MarketSlippageToleranceBpsSchema, OrderSideSchema, OrderTypeSchema, PositionSideSchema, PositiveDecimalStringSchema, UUIDSchema } from "./trading";
5
+ import { MarketSlippageToleranceBpsSchema, OrderIdempotencyKeySchema, OrderSideSchema, OrderTypeSchema, PositionSideSchema, PositiveDecimalStringSchema, UUIDSchema, } from "./trading";
6
6
  const CursorPaginationSchema = z.object({
7
7
  /**
8
8
  * Rejected, not ignored. A non-strict object would let a JS or `any` caller
@@ -41,6 +41,7 @@ const TransferCollateralRequestSchema = z
41
41
  // A cross risk bucket has no trading pair, so CROSS is the only way to name
42
42
  // one on the way out (0XM-2420). The two never combine.
43
43
  marginMode: z.enum(["ISOLATED", "CROSS"]).optional(),
44
+ idempotencyKey: OrderIdempotencyKeySchema.optional(),
44
45
  })
45
46
  .refine((request) => !(request.marginMode === "CROSS" && request.tradingPairId !== undefined), {
46
47
  message: "tradingPairId is not supported for CROSS risk buckets",
@@ -49,6 +50,7 @@ const TransferCollateralRequestSchema = z
49
50
  const ParentMarginAccountCollateralRequestSchema = z.object({
50
51
  asset: z.string().trim().min(1, "Asset cannot be empty"),
51
52
  amount: PositiveDecimalStringSchema,
53
+ idempotencyKey: OrderIdempotencyKeySchema.optional(),
52
54
  });
53
55
  const RiskBucketRequestSchema = z.object({
54
56
  tradingPairId: UUIDSchema,
@@ -256,6 +258,7 @@ export const CloseMarginSubAccountSchema = z.object({
256
258
  export const SubAccountCollateralTransferSchema = z.object({
257
259
  marginAccountId: UUIDSchema,
258
260
  amount: PositiveDecimalStringSchema,
261
+ idempotencyKey: OrderIdempotencyKeySchema.optional(),
259
262
  });
260
263
  export const GetMarginAccountPnlSchema = z.object({
261
264
  marginAccountId: UUIDSchema,
@@ -271,6 +274,7 @@ export const TransferMarginCollateralSchema = z.object({
271
274
  amount: PositiveDecimalStringSchema,
272
275
  from: CollateralTransferEndpointSchema,
273
276
  to: CollateralTransferEndpointSchema,
277
+ idempotencyKey: OrderIdempotencyKeySchema.optional(),
274
278
  })
275
279
  .strict(),
276
280
  });
@@ -84,6 +84,8 @@ export declare const GetUserTradesSchema: z.ZodObject<{
84
84
  page: z.ZodOptional<z.ZodNever>;
85
85
  pageSize: z.ZodOptional<z.ZodNumber>;
86
86
  tradingPairId: z.ZodOptional<z.ZodUUID>;
87
+ marginAccountId: z.ZodOptional<z.ZodUUID>;
88
+ orderId: z.ZodOptional<z.ZodUUID>;
87
89
  pageToken: z.ZodOptional<z.ZodString>;
88
90
  }, z.core.$strip>;
89
91
  /**
@@ -63,6 +63,8 @@ export const GetUserTradesSchema = z.object({
63
63
  page: z.never().optional(),
64
64
  pageSize: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(1000, "Page size cannot exceed 1000").optional(),
65
65
  tradingPairId: UUIDSchema.optional(),
66
+ marginAccountId: UUIDSchema.optional(),
67
+ orderId: UUIDSchema.optional(),
66
68
  pageToken: z.string().optional(),
67
69
  });
68
70
  /**