@0xmonaco/types 1.0.73 → 1.0.74-develop.367860f

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 (60) hide show
  1. package/dist/api/index.d.ts +0 -7
  2. package/dist/applications/index.d.ts +14 -15
  3. package/dist/applications/index.js +2 -2
  4. package/dist/applications/requests.d.ts +70 -15
  5. package/dist/applications/requests.js +2 -3
  6. package/dist/applications/responses.d.ts +35 -39
  7. package/dist/applications/responses.js +1 -1
  8. package/dist/buildercodes/index.d.ts +3 -4
  9. package/dist/buildercodes/responses.d.ts +12 -6
  10. package/dist/buildercodes/responses.js +26 -7
  11. package/dist/copy-trading/index.d.ts +7 -7
  12. package/dist/delegated-agents/index.d.ts +15 -5
  13. package/dist/fees/responses.js +2 -2
  14. package/dist/managed-markets/index.d.ts +21 -2
  15. package/dist/margin-accounts/index.d.ts +185 -21
  16. package/dist/market/index.d.ts +76 -6
  17. package/dist/pitpass/index.d.ts +31 -11
  18. package/dist/pitpass/index.js +1 -1
  19. package/dist/pitpass/responses.d.ts +67 -0
  20. package/dist/pitpass/responses.js +92 -8
  21. package/dist/portfolio/index.d.ts +36 -14
  22. package/dist/positions/index.d.ts +81 -14
  23. package/dist/profile/index.d.ts +114 -44
  24. package/dist/sdk/index.d.ts +12 -4
  25. package/dist/trading/index.d.ts +1 -1
  26. package/dist/trading/orders.d.ts +6 -32
  27. package/dist/trading/responses.d.ts +9 -14
  28. package/dist/validation/applications.d.ts +51 -0
  29. package/dist/validation/applications.js +45 -0
  30. package/dist/validation/index.d.ts +2 -0
  31. package/dist/validation/index.js +2 -0
  32. package/dist/validation/managed-markets.d.ts +17 -0
  33. package/dist/validation/managed-markets.js +17 -0
  34. package/dist/validation/margin-accounts.d.ts +44 -3
  35. package/dist/validation/margin-accounts.js +57 -6
  36. package/dist/validation/market.d.ts +45 -0
  37. package/dist/validation/market.js +43 -0
  38. package/dist/validation/positions.d.ts +5 -3
  39. package/dist/validation/positions.js +12 -5
  40. package/dist/validation/profile.d.ts +19 -2
  41. package/dist/validation/profile.js +36 -4
  42. package/dist/validation/trading.d.ts +2 -2
  43. package/dist/validation/vault.d.ts +14 -0
  44. package/dist/validation/vault.js +14 -0
  45. package/dist/websocket/base.d.ts +56 -6
  46. package/dist/websocket/client.d.ts +8 -3
  47. package/dist/websocket/events/index.d.ts +1 -0
  48. package/dist/websocket/events/index.js +1 -0
  49. package/dist/websocket/events/liquidation-events.d.ts +3 -3
  50. package/dist/websocket/events/market-stats-events.d.ts +33 -3
  51. package/dist/websocket/events/market-stats-events.js +3 -2
  52. package/dist/websocket/events/orders-events.d.ts +36 -3
  53. package/dist/websocket/events/position-events.d.ts +33 -15
  54. package/dist/websocket/events/position-valuation-events.d.ts +60 -0
  55. package/dist/websocket/events/position-valuation-events.js +15 -0
  56. package/dist/wire/operations.d.ts +1 -1
  57. package/dist/wire/operations.js +7 -0
  58. package/dist/wire/schema.d.ts +1595 -352
  59. package/dist/withdrawals/index.d.ts +27 -6
  60. package/package.json +2 -2
@@ -9,7 +9,17 @@ export interface MarginAccountSummary {
9
9
  selectedTradingPairIds?: string[];
10
10
  tradingPairId?: string;
11
11
  strategyKey?: string;
12
- accountState: string;
12
+ /**
13
+ * The risk bucket's lifecycle state: `NORMAL`, `PENDING_LIQUIDATION`,
14
+ * `LIQUIDATING`, `BAD_DEBT` or `CLOSED`. Present only on risk-bucket rows —
15
+ * a parent margin account has no lifecycle of its own; liquidation and bad
16
+ * debt live in its risk buckets.
17
+ */
18
+ riskBucketState?: string;
19
+ /** The margin account's sub-account key; `default` is the default margin account. */
20
+ subaccountKey?: string;
21
+ /** The margin account's state: `ACTIVE`, or `CLOSED` for a closed sub-account. */
22
+ marginAccountState?: string;
13
23
  equity: string;
14
24
  initialMarginRequired: string;
15
25
  maintenanceMarginRequired: string;
@@ -19,13 +29,21 @@ export interface MarginAccountSummary {
19
29
  * The largest amount a transfer-out of this scope will actually accept.
20
30
  *
21
31
  * Not a clamped `freeCollateral`. Free collateral is equity headroom, and
22
- * equity includes realized PnL, accrued funding and mark-to-market gains
23
- * that are not principal a transfer can move — so the two can differ
24
- * without limit. An unrealized gain never counts toward this figure.
32
+ * equity includes mark-to-market gains that a transfer cannot move — so the
33
+ * two can differ without limit. An unrealized gain never counts toward this
34
+ * figure.
25
35
  *
26
- * For a risk bucket this is capped by the bucket's allocated collateral;
27
- * for a parent margin account, by deposited collateral that no risk bucket
28
- * has earmarked. Size transfers against this field, not `freeCollateral`.
36
+ * For a risk bucket this is the bucket's allocated collateral plus its
37
+ * realized PnL, less what its positions and resting orders require (the
38
+ * bucket's allocation may go negative, which is how realized profit leaves
39
+ * a live bucket); for a parent margin account, net deposits plus settled
40
+ * realized PnL that no risk bucket has allocated. Every smaller amount is
41
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` (under
42
+ * liquidation or frozen as bad debt) and on one whose realized loss has used
43
+ * up its allocation; the parent margin account is charged at most a risk
44
+ * bucket's allocation. Size transfers against this field, not
45
+ * `freeCollateral`. Truncated toward zero at the quote asset's precision,
46
+ * so the printed amount itself is always accepted.
29
47
  */
30
48
  withdrawableCollateral: string;
31
49
  totalPositionNotional: string;
@@ -71,7 +89,8 @@ export interface MarginAccountSummary {
71
89
  *
72
90
  * Present only on risk-bucket rows served from a live risk engine snapshot;
73
91
  * absent (the key is omitted, never null) on parent rows and on
74
- * persisted-fallback reads.
92
+ * persisted-fallback reads. Truncated toward zero at the quote asset's
93
+ * precision, like `withdrawableCollateral`.
75
94
  */
76
95
  availableOrderCollateral?: string;
77
96
  /**
@@ -88,16 +107,52 @@ export interface MarginAccountSummary {
88
107
  copyLeaderHandle?: string;
89
108
  }
90
109
  export interface ListMarginAccountsParams {
91
- page?: number;
110
+ /** Number of items per page, 1 to 1000 (default 20) */
92
111
  pageSize?: number;
112
+ /**
113
+ * Pagination cursor with two states:
114
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
115
+ * no prior position, from the lowest margin account id.
116
+ * - Non-empty: an opaque cursor from a previous response's
117
+ * `nextPageToken`; results resume immediately after that position.
118
+ *
119
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
120
+ * sending one is a `400`. The walk seeks on
121
+ * `(marginAccountId, tradingPairId, riskBucketId, strategyKey)` over the
122
+ * repriced set the server builds per request — the parent account row ahead
123
+ * of its own bucket rows — so a bucket that opens or closes mid-walk no
124
+ * longer shifts the rows behind it across the resume point. The strategy key
125
+ * is part of the key because an auto bucket the engine has not materialized
126
+ * yet carries no `riskBucketId`, and one account and pair can hold several
127
+ * strategies; such a row sorts under the id its bucket will carry once the
128
+ * engine projects it, so provisioning completing mid-walk cannot serve the
129
+ * same risk bucket twice. The filters must match the request that minted the
130
+ * token.
131
+ */
132
+ pageToken?: string;
133
+ /**
134
+ * Keep only risk-bucket rows in this state (see
135
+ * {@link MarginAccountSummary.riskBucketState}). A parent margin account row
136
+ * has no state, so any filter excludes it.
137
+ */
93
138
  state?: string;
94
139
  tradingPairId?: string;
95
140
  }
96
141
  export interface ListMarginAccountsResponse {
97
142
  accounts: MarginAccountSummary[];
143
+ /**
144
+ * Rows matching the filters. Exact — a user's margin accounts and risk
145
+ * buckets are a small bounded set, counted in memory after the repricing
146
+ * pass.
147
+ */
98
148
  total: number;
99
- page: number;
100
149
  pageSize: number;
150
+ /**
151
+ * Cursor for the next page, `""` once the walk is exhausted. The whole set
152
+ * is already in memory, so each page over-fetches one row and an empty token
153
+ * is definitive — follow a non-empty token, stop on an empty one.
154
+ */
155
+ nextPageToken: string;
101
156
  }
102
157
  export interface GetMarginAccountSummaryParams {
103
158
  tradingPairId?: string;
@@ -118,13 +173,13 @@ export interface GetAvailableCollateralResponse {
118
173
  * margin account yet.
119
174
  *
120
175
  * This is **not** trading headroom for existing cross exposure. It is
121
- * bounded by allocation (principal not earmarked by risk buckets) as well
122
- * as by margin requirements, and an unrealized gain does not raise it: a
176
+ * bounded by allocation (net deposits plus settled realized PnL not
177
+ * allocated to risk buckets) as well as by margin requirements, and an unrealized gain does not raise it: a
123
178
  * mark-to-market gain is initial margin against existing cross exposure but
124
179
  * may not fund an exit. `MarginAccountSummary.freeCollateral` credits that
125
180
  * gain in full and remains the trading-margin headroom for existing cross
126
181
  * exposure — but a **new** isolated or first-use position allocates
127
- * principal through the same gate this field measures, so size those from
182
+ * collateral through the same gate this field measures, so size those from
128
183
  * this field.
129
184
  *
130
185
  * Note the two `margin*` fields answer opposite questions:
@@ -158,6 +213,8 @@ export interface TransferCollateralToParentMarginAccountRequest {
158
213
  */
159
214
  export interface TransferCollateralToIsolatedRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
160
215
  marginMode?: "ISOLATED";
216
+ /** The margin account whose bucket is funded: omit for the default account, or name an open sub-account. */
217
+ marginAccountId?: string;
161
218
  tradingPairId: string;
162
219
  strategyKey?: string;
163
220
  selectedTradingPairIds?: never;
@@ -192,6 +249,8 @@ export interface TransferCollateralToIsolatedRiskBucketRequest extends TransferC
192
249
  */
193
250
  export interface TransferCollateralToCrossRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
194
251
  marginMode: "CROSS";
252
+ /** The margin account whose cross bucket is funded: omit for the default account, or name an open sub-account. */
253
+ marginAccountId?: string;
195
254
  /**
196
255
  * Removed. This used to declare — and on every top-up REPLACE — the cross
197
256
  * bucket's scope, which let a partial list silently evict every flat pair it
@@ -221,6 +280,10 @@ export interface TransferCollateralResponse {
221
280
  status: string;
222
281
  newEquity: string;
223
282
  newTotalCollateralValue: string;
283
+ /**
284
+ * The largest amount a further transfer-out will accept after this one,
285
+ * truncated toward zero at the collateral asset's precision.
286
+ */
224
287
  newWithdrawableCollateral: string;
225
288
  /**
226
289
  * Whether the transfer was committed to a position's stored margin. Present
@@ -235,8 +298,21 @@ export interface TransferCollateralResponse {
235
298
  }
236
299
  export interface GetMarginAccountMovementsParams {
237
300
  movementType?: string;
238
- page?: number;
301
+ /** Items per page, 1 to 1000 (default 20). */
239
302
  pageSize?: number;
303
+ /**
304
+ * Pagination cursor with two states:
305
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
306
+ * no prior position, from the newest row — this listing always sorts
307
+ * newest-first.
308
+ * - Non-empty: an opaque cursor from a previous response's
309
+ * `nextPageToken`; results resume immediately after that position.
310
+ *
311
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
312
+ * sending one is a 400. Filters must match the request that produced the
313
+ * token, or the request is rejected.
314
+ */
315
+ pageToken?: string;
240
316
  }
241
317
  export interface MarginAccountMovement {
242
318
  movementId: string;
@@ -248,15 +324,17 @@ export interface MarginAccountMovement {
248
324
  }
249
325
  export interface GetMarginAccountMovementsResponse {
250
326
  movements: MarginAccountMovement[];
327
+ pageSize: number;
251
328
  /**
252
- * Matching movements. Exact up to 10,000 pages of the requested page size
253
- * (`pageSize` x 10,000 rows) and saturates there, so a caller with more
254
- * movements than the listing can page through reads the cap, not its
255
- * lifetime total. `page` is capped at 10,000.
329
+ * Cursor for the next page, minted from the last row of an over-fetched
330
+ * page: this listing is one ordered read, so a page shorter than `pageSize`
331
+ * proves the walk is exhausted and this is `""`. A non-empty token always
332
+ * has at least one further row behind it.
333
+ *
334
+ * The response carries no item count: the underlying ledger is too large to
335
+ * count behind a filter.
256
336
  */
257
- total: number;
258
- page: number;
259
- pageSize: number;
337
+ nextPageToken: string;
260
338
  }
261
339
  export interface SimulateOrderRiskRequest {
262
340
  tradingPairId: string;
@@ -291,6 +369,8 @@ export interface SimulateOrderRiskRequest {
291
369
  }
292
370
  export type SimulateIsolatedRiskBucketOrderRiskRequest = SimulateOrderRiskRequest & {
293
371
  marginMode?: "ISOLATED";
372
+ /** The margin account previewed: omit for the default account, or name an open sub-account. */
373
+ marginAccountId?: string;
294
374
  strategyKey?: string;
295
375
  selectedTradingPairIds?: never;
296
376
  };
@@ -305,6 +385,8 @@ export type SimulateIsolatedRiskBucketOrderRiskRequest = SimulateOrderRiskReques
305
385
  */
306
386
  export type SimulateCrossRiskBucketOrderRiskRequest = SimulateOrderRiskRequest & {
307
387
  marginMode: "CROSS";
388
+ /** The margin account previewed: omit for the default account, or name an open sub-account. */
389
+ marginAccountId?: string;
308
390
  /**
309
391
  * Removed. This used to declare the scope the preview ran against (required,
310
392
  * containing `tradingPairId`, covering every open cross position) while the
@@ -416,7 +498,89 @@ export interface SimulateOrderRiskResponse {
416
498
  */
417
499
  referencePrice?: string;
418
500
  }
501
+ /**
502
+ * Open a margin sub-account: another margin account of the caller, keyed by
503
+ * `subaccountKey`, with its own collateral and risk buckets. Keys are up to 64
504
+ * letters, digits, `_`, `-`, `.` or `:`; `copy:` keys are reserved and
505
+ * `default` names the default margin account. Re-creating the key of a closed
506
+ * sub-account re-opens it.
507
+ */
508
+ export interface CreateMarginSubAccountRequest {
509
+ subaccountKey: string;
510
+ label?: string;
511
+ }
512
+ export interface CreateMarginSubAccountResponse {
513
+ marginAccountId: string;
514
+ subaccountKey: string;
515
+ marginAccountState: string;
516
+ label?: string;
517
+ }
518
+ /** One margin account's own PnL (default or sub-account); the owner's accounts sum to the owner-wide figure. */
519
+ export interface MarginAccountPnl {
520
+ marginAccountId: string;
521
+ /** Settled on the account plus still held in its open risk buckets. */
522
+ realizedPnl: string;
523
+ /** The account's open positions repriced at the latest risk marks. */
524
+ unrealizedPnl: string;
525
+ }
526
+ export interface CloseMarginSubAccountResponse {
527
+ marginAccountId: string;
528
+ /** The default margin account that received the remaining collateral. */
529
+ defaultMarginAccountId: string;
530
+ /** Collateral moved to the default margin account. */
531
+ amount: string;
532
+ }
533
+ /** One side of a collateral transfer: the spot wallet, or a margin account. */
534
+ export type CollateralTransferEndpoint = {
535
+ wallet: true;
536
+ marginAccountId?: never;
537
+ riskBucketId?: never;
538
+ } | {
539
+ wallet?: never;
540
+ marginAccountId: string;
541
+ riskBucketId?: string;
542
+ };
543
+ /**
544
+ * Move collateral between the spot wallet and the caller's margin accounts.
545
+ * Supported: wallet to the default margin account and back, and margin
546
+ * account to margin account.
547
+ */
548
+ export interface TransferMarginCollateralRequest {
549
+ asset: string;
550
+ amount: string;
551
+ from: CollateralTransferEndpoint;
552
+ to: CollateralTransferEndpoint;
553
+ }
554
+ export interface TransferMarginCollateralResponse {
555
+ movementId: string;
556
+ amount: string;
557
+ fromMarginAccountId?: string;
558
+ toMarginAccountId?: string;
559
+ toRiskBucketId?: string;
560
+ }
419
561
  export interface MarginAccountsAPI extends BaseAPI {
562
+ /**
563
+ * Open a margin sub-account. Refused past the owner's cap on open sub-accounts (10 at the
564
+ * first volume tier, up to 50, or an admin override); copy-trading sub-accounts do not count.
565
+ */
566
+ createMarginSubAccount(request: CreateMarginSubAccountRequest): Promise<CreateMarginSubAccountResponse>;
567
+ /**
568
+ * Close a flat margin sub-account in one call: its flat, solvent risk buckets close and all of
569
+ * its collateral moves to the default margin account. A risk bucket in liquidation or bad debt
570
+ * refuses the close.
571
+ */
572
+ closeMarginSubAccount(marginAccountId: string): Promise<CloseMarginSubAccountResponse>;
573
+ /** One of the caller's margin accounts' own realized and unrealized PnL. */
574
+ getMarginAccountPnl(marginAccountId: string): Promise<MarginAccountPnl>;
575
+ transferMarginCollateral(request: TransferMarginCollateralRequest): Promise<TransferMarginCollateralResponse>;
576
+ /**
577
+ * Move collateral from the default margin account to one of the caller's sub-accounts, in one
578
+ * sequenced step. The default margin account itself is refused; fund it with the
579
+ * parent-margin-account routes.
580
+ */
581
+ transferCollateralToSubAccount(marginAccountId: string, amount: string): Promise<TransferMarginCollateralResponse>;
582
+ /** Move collateral from one of the caller's sub-accounts back to the default margin account. */
583
+ transferCollateralFromSubAccount(marginAccountId: string, amount: string): Promise<TransferMarginCollateralResponse>;
420
584
  listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
421
585
  getParentMarginAccountSummary(params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
422
586
  /**
@@ -48,6 +48,12 @@ export interface TradingPair {
48
48
  category: string;
49
49
  /** Whether the market is active */
50
50
  isActive: boolean;
51
+ /**
52
+ * Isolated-only market: cross margin may only reduce a position here. A
53
+ * CROSS order that is not reduce-only is rejected with the error code
54
+ * `CROSS_MARGIN_NOT_ALLOWED`; open the position with `marginMode: "ISOLATED"`.
55
+ */
56
+ isolatedOnly: boolean;
51
57
  /** Maker fee in basis points */
52
58
  makerFeeBps: number;
53
59
  /** Taker fee in basis points */
@@ -486,30 +492,94 @@ export interface FundingRecord {
486
492
  export interface ListFundingHistoryParams {
487
493
  startTime?: string;
488
494
  endTime?: string;
489
- page?: number;
495
+ /** Number of items per page, 1 to 1000 (default 50) */
490
496
  pageSize?: number;
491
- /** Sort direction for epoch: "ASC" or "DESC" (default DESC). */
497
+ /** Sort direction for `settledAt`: "ASC" or "DESC" (default DESC). */
492
498
  orderBy?: "ASC" | "DESC";
499
+ /**
500
+ * Pagination cursor with two states:
501
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
502
+ * no prior position, from the newest settlement (the oldest when
503
+ * `orderBy` is `"ASC"`).
504
+ * - Non-empty: an opaque cursor from a previous response's
505
+ * `nextPageToken`; results resume immediately after that position.
506
+ *
507
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
508
+ * sending one is a `400`. The walk seeks on `(settledAt, id)` in the
509
+ * requested direction. Filters and `orderBy` must match the request that
510
+ * minted the token.
511
+ */
512
+ pageToken?: string;
493
513
  }
494
514
  export interface ListFundingHistoryResponse {
495
515
  records: FundingRecord[];
516
+ /**
517
+ * Settlements matching the filter, bounded by the server count ceiling — see
518
+ * `totalCapped`. A lower bound when `totalCapped` is `true`.
519
+ */
496
520
  total: number;
497
- page: number;
521
+ /** Items per page */
498
522
  pageSize: number;
523
+ /**
524
+ * Cursor for the next page, minted from the last row of an over-fetched
525
+ * page. This listing is one ordered read, so a page shorter than `pageSize`
526
+ * proves the walk is exhausted and this is `""`. A non-empty token always
527
+ * has at least one further row behind it.
528
+ */
529
+ nextPageToken: string;
530
+ /**
531
+ * `true` when MORE than the server ceiling of settlements matched, so the
532
+ * count stopped at the ceiling and `total` is a lower bound. `false` when
533
+ * `total` is the exact count — including exactly the ceiling, which is
534
+ * still reported exactly.
535
+ */
536
+ totalCapped: boolean;
499
537
  }
500
538
  export interface ListAllFundingHistoryParams {
501
539
  startTime?: string;
502
540
  endTime?: string;
503
- page?: number;
541
+ /** Number of items per page, 1 to 1000 (default 50) */
504
542
  pageSize?: number;
505
- /** Sort direction for settledAt (default DESC). */
543
+ /** Sort direction for `settledAt` (default DESC). */
506
544
  orderBy?: "ASC" | "DESC";
545
+ /**
546
+ * Pagination cursor with two states:
547
+ * - Omitted (`undefined`) or empty string (`""`): start a cursor walk with
548
+ * no prior position, from the newest settlement (the oldest when
549
+ * `orderBy` is `"ASC"`).
550
+ * - Non-empty: an opaque cursor from a previous response's
551
+ * `nextPageToken`; results resume immediately after that position.
552
+ *
553
+ * Page-number pagination was removed (0XM-2788): there is no `page`, and
554
+ * sending one is a `400`. The walk seeks on `(settledAt, id)` in the
555
+ * requested direction. Filters and `orderBy` must match the request that
556
+ * minted the token.
557
+ */
558
+ pageToken?: string;
507
559
  }
508
560
  export interface ListAllFundingHistoryResponse {
509
561
  records: FundingRecord[];
562
+ /**
563
+ * Settlements matching the filter, bounded by the server count ceiling — see
564
+ * `totalCapped`. A lower bound when `totalCapped` is `true`.
565
+ */
510
566
  total: number;
511
- page: number;
567
+ /** Items per page */
512
568
  pageSize: number;
569
+ /**
570
+ * Cursor for the next page, minted from the last row of an over-fetched
571
+ * page. This listing is one ordered read, so a page shorter than `pageSize`
572
+ * proves the walk is exhausted and this is `""`. A non-empty token always
573
+ * has at least one further row behind it.
574
+ */
575
+ nextPageToken: string;
576
+ /**
577
+ * `true` when MORE than the server ceiling of settlements matched, so the
578
+ * count stopped at the ceiling and `total` is a lower bound. `false` when
579
+ * `total` is the exact count — including exactly the ceiling, which is
580
+ * still reported exactly.
581
+ */
582
+ totalCapped: boolean;
513
583
  }
514
584
  export interface OpenInterest {
515
585
  tradingPairId: string;
@@ -4,7 +4,7 @@
4
4
  * Types for PitPass TraderCode API: code lookup, rewards balance, and transfer.
5
5
  */
6
6
  import type { BaseAPI } from "../api";
7
- import type { GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetRewardsBalanceResponse, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "./responses";
7
+ import type { GetMyReferralDownlineParams, GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetMyReferralTreeParams, GetMyReferralTreeResponse, GetRewardsBalanceResponse, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "./responses";
8
8
  /**
9
9
  * PitPass TraderCode API interface.
10
10
  *
@@ -92,8 +92,9 @@ export interface PitpassAPI extends BaseAPI {
92
92
  */
93
93
  transferRewards(params: TransferRewardsParams): Promise<TransferRewardsResponse>;
94
94
  /**
95
- * Read your own referral position: your direct (L1) referrer, total earned,
96
- * and most recent reward rows.
95
+ * Read your own referral position: your referral chain upward (`upline`, L1
96
+ * then L2 then L3), your direct referrer, total earned, and most recent
97
+ * reward rows.
97
98
  *
98
99
  * Self-scoped — the server derives your identity from the session, so you can
99
100
  * only ever read your own chain. `referrer` is the empty string when you were
@@ -101,20 +102,39 @@ export interface PitpassAPI extends BaseAPI {
101
102
  * identified by their public wallet address (with a `display` handle-or-wallet
102
103
  * variant), never an internal id.
103
104
  *
104
- * @returns Promise resolving to your referrer, total earned, and recent rewards
105
+ * @returns Promise resolving to your upline, referrer, total earned, and recent rewards
105
106
  */
106
107
  getMyReferralPosition(): Promise<GetMyReferralPositionResponse>;
107
108
  /**
108
- * Read your own downline: who you earn from and how much (earnings by source
109
- * across L1/L2/L3), your L1 direct-referee roster (including referees who have
110
- * not traded yet), and a per-level earnings summary.
109
+ * Read your own downline: one page of who you earn from and how much
110
+ * (earnings by source across every reward level, largest first), your L1
111
+ * direct-referee roster (including referees who have not traded yet), and a
112
+ * per-level earnings summary that covers every level and source on every
113
+ * page. Without `pageSize` / `pageToken` you get the first page (100 rows),
114
+ * not every row: follow `nextPageToken` until it is empty.
111
115
  *
112
116
  * Self-scoped and read-only. Every source and referee is a public wallet
113
117
  * address plus a `display` handle-or-wallet variant, never an internal id.
114
118
  *
115
- * @returns Promise resolving to earnings-by-source, the direct-referee roster, and a summary
119
+ * @param params - Optional `pageSize` (1-500, default 100) and `pageToken`
120
+ * @returns Promise resolving to the earnings page, the direct-referee roster, a summary, and the next page token
116
121
  */
117
- getMyReferralDownline(): Promise<GetMyReferralDownlineResponse>;
122
+ getMyReferralDownline(params?: GetMyReferralDownlineParams): Promise<GetMyReferralDownlineResponse>;
123
+ /**
124
+ * Read one level of your own referral tree: the wallets `parent` directly
125
+ * referred (yourself when `parent` is omitted), a page at a time, newest
126
+ * first. Expand a node by calling again with `parent` set to its wallet;
127
+ * nodes with `refereeCount > 0` are expandable, down to the deepest level
128
+ * PitPass rewards (configured by Monaco, at most 10).
129
+ *
130
+ * Self-scoped: `parent` must be you or one of your own referees above that
131
+ * deepest level — any other wallet is a 404. Each wallet appears once, under the referrer that
132
+ * earns from it.
133
+ *
134
+ * @param params - Optional `parent` wallet, `pageSize` (1-200), and `pageToken`
135
+ * @returns Promise resolving to the page of nodes and the next page token
136
+ */
137
+ getMyReferralTree(params?: GetMyReferralTreeParams): Promise<GetMyReferralTreeResponse>;
118
138
  }
119
- export type { GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetRewardsBalanceResponse, ReferralDirectReferee, ReferralEarningsSource, ReferralEarningsSummary, ReferralRewardEntry, RewardsBalanceEntry, SetTraderCodeParams, TraderCodeAvailabilityReason, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse, } from "./responses";
120
- export { GetMyReferralDownlineResponseSchema, GetMyReferralPositionResponseSchema, GetRewardsBalanceResponseSchema, ReferralDirectRefereeSchema, ReferralEarningsSourceSchema, ReferralEarningsSummarySchema, ReferralRewardEntrySchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
139
+ export type { GetMyReferralDownlineParams, GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetMyReferralTreeParams, GetMyReferralTreeResponse, GetRewardsBalanceResponse, LevelEarnings, ReferralDirectReferee, ReferralEarningsSource, ReferralEarningsSummary, ReferralRewardEntry, ReferralTreeNode, ReferralUplineEntry, RewardsBalanceEntry, SetTraderCodeParams, TraderCodeAvailabilityReason, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse, } from "./responses";
140
+ export { GetMyReferralDownlineParamsSchema, GetMyReferralDownlineResponseSchema, GetMyReferralPositionResponseSchema, GetMyReferralTreeParamsSchema, GetMyReferralTreeResponseSchema, GetRewardsBalanceResponseSchema, LevelEarningsSchema, ReferralDirectRefereeSchema, ReferralEarningsSourceSchema, ReferralEarningsSummarySchema, ReferralRewardEntrySchema, ReferralTreeNodeSchema, ReferralUplineEntrySchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * Types for PitPass TraderCode API: code lookup, rewards balance, and transfer.
5
5
  */
6
- export { GetMyReferralDownlineResponseSchema, GetMyReferralPositionResponseSchema, GetRewardsBalanceResponseSchema, ReferralDirectRefereeSchema, ReferralEarningsSourceSchema, ReferralEarningsSummarySchema, ReferralRewardEntrySchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
6
+ export { GetMyReferralDownlineParamsSchema, GetMyReferralDownlineResponseSchema, GetMyReferralPositionResponseSchema, GetMyReferralTreeParamsSchema, GetMyReferralTreeResponseSchema, GetRewardsBalanceResponseSchema, LevelEarningsSchema, ReferralDirectRefereeSchema, ReferralEarningsSourceSchema, ReferralEarningsSummarySchema, ReferralRewardEntrySchema, ReferralTreeNodeSchema, ReferralUplineEntrySchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
@@ -77,6 +77,12 @@ export declare const ReferralRewardEntrySchema: z.ZodObject<{
77
77
  rateApplied: z.ZodString;
78
78
  createdAt: z.ZodString;
79
79
  }, z.core.$strip>;
80
+ /** One ancestor in the caller's referral chain. */
81
+ export declare const ReferralUplineEntrySchema: z.ZodObject<{
82
+ wallet: z.ZodString;
83
+ display: z.ZodString;
84
+ level: z.ZodNumber;
85
+ }, z.core.$strip>;
80
86
  /** The caller's own referral position: who referred them and what they've earned. */
81
87
  export declare const GetMyReferralPositionResponseSchema: z.ZodObject<{
82
88
  referrer: z.ZodString;
@@ -91,6 +97,11 @@ export declare const GetMyReferralPositionResponseSchema: z.ZodObject<{
91
97
  rateApplied: z.ZodString;
92
98
  createdAt: z.ZodString;
93
99
  }, z.core.$strip>>;
100
+ upline: z.ZodArray<z.ZodObject<{
101
+ wallet: z.ZodString;
102
+ display: z.ZodString;
103
+ level: z.ZodNumber;
104
+ }, z.core.$strip>>;
94
105
  }, z.core.$strip>;
95
106
  /** One aggregated earnings row per (source trader, level, token) the caller earns from. */
96
107
  export declare const ReferralEarningsSourceSchema: z.ZodObject<{
@@ -107,12 +118,26 @@ export declare const ReferralDirectRefereeSchema: z.ZodObject<{
107
118
  referredAt: z.ZodString;
108
119
  totalEarned: z.ZodString;
109
120
  }, z.core.$strip>;
121
+ /** What the caller has earned at one referral level. */
122
+ export declare const LevelEarningsSchema: z.ZodObject<{
123
+ level: z.ZodNumber;
124
+ earned: z.ZodString;
125
+ }, z.core.$strip>;
110
126
  /** Per-level breakdown of the caller's total referral earnings. */
111
127
  export declare const ReferralEarningsSummarySchema: z.ZodObject<{
112
128
  totalEarned: z.ZodString;
113
129
  level1Earned: z.ZodString;
114
130
  level2Earned: z.ZodString;
115
131
  level3Earned: z.ZodString;
132
+ byLevel: z.ZodArray<z.ZodObject<{
133
+ level: z.ZodNumber;
134
+ earned: z.ZodString;
135
+ }, z.core.$strip>>;
136
+ }, z.core.$strip>;
137
+ /** Query parameters for reading the caller's downline. */
138
+ export declare const GetMyReferralDownlineParamsSchema: z.ZodObject<{
139
+ pageSize: z.ZodOptional<z.ZodNumber>;
140
+ pageToken: z.ZodOptional<z.ZodString>;
116
141
  }, z.core.$strip>;
117
142
  /** The caller's own downline: who they earn from, their L1 roster, and a summary. */
118
143
  export declare const GetMyReferralDownlineResponseSchema: z.ZodObject<{
@@ -134,7 +159,43 @@ export declare const GetMyReferralDownlineResponseSchema: z.ZodObject<{
134
159
  level1Earned: z.ZodString;
135
160
  level2Earned: z.ZodString;
136
161
  level3Earned: z.ZodString;
162
+ byLevel: z.ZodArray<z.ZodObject<{
163
+ level: z.ZodNumber;
164
+ earned: z.ZodString;
165
+ }, z.core.$strip>>;
137
166
  }, z.core.$strip>;
167
+ nextPageToken: z.ZodString;
168
+ }, z.core.$strip>;
169
+ /** Query parameters for reading one level of the caller's referral tree. */
170
+ export declare const GetMyReferralTreeParamsSchema: z.ZodObject<{
171
+ parent: z.ZodOptional<z.ZodString>;
172
+ pageSize: z.ZodOptional<z.ZodNumber>;
173
+ pageToken: z.ZodOptional<z.ZodString>;
174
+ }, z.core.$strip>;
175
+ /** One wallet in the caller's referral tree. */
176
+ export declare const ReferralTreeNodeSchema: z.ZodObject<{
177
+ wallet: z.ZodString;
178
+ display: z.ZodString;
179
+ level: z.ZodNumber;
180
+ parent: z.ZodString;
181
+ referredAt: z.ZodString;
182
+ refereeCount: z.ZodNumber;
183
+ totalEarned: z.ZodString;
184
+ }, z.core.$strip>;
185
+ /** One page of one level of the caller's referral tree. */
186
+ export declare const GetMyReferralTreeResponseSchema: z.ZodObject<{
187
+ parent: z.ZodString;
188
+ parentLevel: z.ZodNumber;
189
+ nodes: z.ZodArray<z.ZodObject<{
190
+ wallet: z.ZodString;
191
+ display: z.ZodString;
192
+ level: z.ZodNumber;
193
+ parent: z.ZodString;
194
+ referredAt: z.ZodString;
195
+ refereeCount: z.ZodNumber;
196
+ totalEarned: z.ZodString;
197
+ }, z.core.$strip>>;
198
+ nextPageToken: z.ZodString;
138
199
  }, z.core.$strip>;
139
200
  export type RewardsBalanceEntry = z.infer<typeof RewardsBalanceEntrySchema>;
140
201
  export type GetRewardsBalanceResponse = z.infer<typeof GetRewardsBalanceResponseSchema>;
@@ -150,4 +211,10 @@ export type GetMyReferralPositionResponse = z.infer<typeof GetMyReferralPosition
150
211
  export type ReferralEarningsSource = z.infer<typeof ReferralEarningsSourceSchema>;
151
212
  export type ReferralDirectReferee = z.infer<typeof ReferralDirectRefereeSchema>;
152
213
  export type ReferralEarningsSummary = z.infer<typeof ReferralEarningsSummarySchema>;
214
+ export type LevelEarnings = z.infer<typeof LevelEarningsSchema>;
215
+ export type GetMyReferralDownlineParams = z.infer<typeof GetMyReferralDownlineParamsSchema>;
153
216
  export type GetMyReferralDownlineResponse = z.infer<typeof GetMyReferralDownlineResponseSchema>;
217
+ export type ReferralUplineEntry = z.infer<typeof ReferralUplineEntrySchema>;
218
+ export type GetMyReferralTreeParams = z.infer<typeof GetMyReferralTreeParamsSchema>;
219
+ export type ReferralTreeNode = z.infer<typeof ReferralTreeNodeSchema>;
220
+ export type GetMyReferralTreeResponse = z.infer<typeof GetMyReferralTreeResponseSchema>;