@0xmonaco/types 1.0.61 → 1.0.62

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.
@@ -9,7 +9,7 @@
9
9
  * Query parameters for listing application orders.
10
10
  */
11
11
  export interface ListAppOrdersParams {
12
- /** Page number (starts from 1) */
12
+ /** Page number (starts from 1, at most 10,000 — the last page the listing counts towards) */
13
13
  page?: number;
14
14
  /** Items per page (max 100) */
15
15
  pageSize?: number;
@@ -43,7 +43,7 @@ export interface ListAppUsersParams {
43
43
  * Query parameters for listing application movements.
44
44
  */
45
45
  export interface ListAppMovementsParams {
46
- /** Page number (starts from 1) */
46
+ /** Page number (starts from 1, at most 10,000 — the last page the listing counts towards) */
47
47
  page?: number;
48
48
  /** Items per page (max 100) */
49
49
  pageSize?: number;
@@ -162,13 +162,21 @@ export interface AppBalance {
162
162
  */
163
163
  export interface ListAppOrdersResponse {
164
164
  orders: AppOrder[];
165
- /** Total matching orders */
165
+ /**
166
+ * Matching orders. Exact up to 10,000 pages of the requested page size
167
+ * (`pageSize` x 10,000 rows) and saturates there, so an application with
168
+ * more matching orders than the listing can page through reads the cap,
169
+ * not its lifetime total.
170
+ */
166
171
  total: number;
167
172
  /** Current page number */
168
173
  page: number;
169
174
  /** Items per page */
170
175
  pageSize: number;
171
- /** Total number of pages */
176
+ /**
177
+ * Number of pages at the requested page size. Exact up to 10,000 and
178
+ * saturates there, the last page this listing can reach.
179
+ */
172
180
  totalPages: number;
173
181
  }
174
182
  /**
@@ -190,13 +198,21 @@ export interface ListAppUsersResponse {
190
198
  */
191
199
  export interface ListAppMovementsResponse {
192
200
  movements: AppMovement[];
193
- /** Total matching movements */
201
+ /**
202
+ * Matching movements. Exact up to 10,000 pages of the requested page size
203
+ * (`pageSize` x 10,000 rows) and saturates there, so an application with
204
+ * more matching movements than the listing can page through reads the cap,
205
+ * not its lifetime total.
206
+ */
194
207
  total: number;
195
208
  /** Current page number */
196
209
  page: number;
197
210
  /** Items per page */
198
211
  pageSize: number;
199
- /** Total number of pages */
212
+ /**
213
+ * Number of pages at the requested page size. Exact up to 10,000 and
214
+ * saturates there, the last page this listing can reach.
215
+ */
200
216
  totalPages: number;
201
217
  }
202
218
  /**
@@ -43,6 +43,21 @@ export interface AuthState {
43
43
  expiresAt: number;
44
44
  /** Information about the authenticated user */
45
45
  user: User;
46
+ /**
47
+ * True when this verify created the user — the wallet's first-ever sign-in on
48
+ * this application. Gate first-time UX (e.g. the optional "have a referral
49
+ * code?" input) on it. Absent on responses from a server that predates the
50
+ * field.
51
+ */
52
+ isNewUser?: boolean;
53
+ /**
54
+ * True when a PitPass referral relationship was recorded on this verify: a
55
+ * valid, non-self TraderCode was presented on the wallet's first-ever sign-in
56
+ * and resolved to a known referrer. Use it to confirm the referral landed on
57
+ * the signup-success screen. Absent on responses from a server that predates
58
+ * the field.
59
+ */
60
+ referralApplied?: boolean;
46
61
  }
47
62
  export interface ApplicationInfo {
48
63
  /** Unique identifier for the application */
@@ -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 { GetRewardsBalanceResponse, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "./responses";
7
+ import type { GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetRewardsBalanceResponse, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "./responses";
8
8
  /**
9
9
  * PitPass TraderCode API interface.
10
10
  *
@@ -91,6 +91,30 @@ export interface PitpassAPI extends BaseAPI {
91
91
  * @returns Promise resolving to the post-transfer rewards and trading balances
92
92
  */
93
93
  transferRewards(params: TransferRewardsParams): Promise<TransferRewardsResponse>;
94
+ /**
95
+ * Read your own referral position: your direct (L1) referrer, total earned,
96
+ * and most recent reward rows.
97
+ *
98
+ * Self-scoped — the server derives your identity from the session, so you can
99
+ * only ever read your own chain. `referrer` is the empty string when you were
100
+ * not referred (use it to gate the "already referred" UX). Every other user is
101
+ * identified by their public wallet address (with a `display` handle-or-wallet
102
+ * variant), never an internal id.
103
+ *
104
+ * @returns Promise resolving to your referrer, total earned, and recent rewards
105
+ */
106
+ getMyReferralPosition(): Promise<GetMyReferralPositionResponse>;
107
+ /**
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.
111
+ *
112
+ * Self-scoped and read-only. Every source and referee is a public wallet
113
+ * address plus a `display` handle-or-wallet variant, never an internal id.
114
+ *
115
+ * @returns Promise resolving to earnings-by-source, the direct-referee roster, and a summary
116
+ */
117
+ getMyReferralDownline(): Promise<GetMyReferralDownlineResponse>;
94
118
  }
95
- export type { GetRewardsBalanceResponse, RewardsBalanceEntry, SetTraderCodeParams, TraderCodeAvailabilityReason, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse, } from "./responses";
96
- export { GetRewardsBalanceResponseSchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
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";
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * Types for PitPass TraderCode API: code lookup, rewards balance, and transfer.
5
5
  */
6
- export { GetRewardsBalanceResponseSchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
6
+ export { GetMyReferralDownlineResponseSchema, GetMyReferralPositionResponseSchema, GetRewardsBalanceResponseSchema, ReferralDirectRefereeSchema, ReferralEarningsSourceSchema, ReferralEarningsSummarySchema, ReferralRewardEntrySchema, RewardsBalanceEntrySchema, SetTraderCodeParamsSchema, TraderCodeAvailabilityReasonSchema, TraderCodeAvailabilityResponseSchema, TraderCodeInfoResponseSchema, TraderCodeResponseSchema, TransferRewardsParamsSchema, TransferRewardsResponseSchema, } from "./responses";
@@ -67,6 +67,75 @@ export declare const TransferRewardsResponseSchema: z.ZodObject<{
67
67
  rewardsBalance: z.ZodString;
68
68
  tradingBalance: z.ZodString;
69
69
  }, z.core.$strip>;
70
+ /** A single reward the caller has earned (one row per referred trade × level). */
71
+ export declare const ReferralRewardEntrySchema: z.ZodObject<{
72
+ source: z.ZodString;
73
+ sourceDisplay: z.ZodString;
74
+ level: z.ZodNumber;
75
+ amount: z.ZodString;
76
+ token: z.ZodString;
77
+ rateApplied: z.ZodString;
78
+ createdAt: z.ZodString;
79
+ }, z.core.$strip>;
80
+ /** The caller's own referral position: who referred them and what they've earned. */
81
+ export declare const GetMyReferralPositionResponseSchema: z.ZodObject<{
82
+ referrer: z.ZodString;
83
+ referrerDisplay: z.ZodString;
84
+ totalEarned: z.ZodString;
85
+ rewards: z.ZodArray<z.ZodObject<{
86
+ source: z.ZodString;
87
+ sourceDisplay: z.ZodString;
88
+ level: z.ZodNumber;
89
+ amount: z.ZodString;
90
+ token: z.ZodString;
91
+ rateApplied: z.ZodString;
92
+ createdAt: z.ZodString;
93
+ }, z.core.$strip>>;
94
+ }, z.core.$strip>;
95
+ /** One aggregated earnings row per (source trader, level, token) the caller earns from. */
96
+ export declare const ReferralEarningsSourceSchema: z.ZodObject<{
97
+ source: z.ZodString;
98
+ sourceDisplay: z.ZodString;
99
+ level: z.ZodNumber;
100
+ totalEarned: z.ZodString;
101
+ token: z.ZodString;
102
+ }, z.core.$strip>;
103
+ /** One direct (L1) referee of the caller, whether or not they have traded yet. */
104
+ export declare const ReferralDirectRefereeSchema: z.ZodObject<{
105
+ wallet: z.ZodString;
106
+ display: z.ZodString;
107
+ referredAt: z.ZodString;
108
+ totalEarned: z.ZodString;
109
+ }, z.core.$strip>;
110
+ /** Per-level breakdown of the caller's total referral earnings. */
111
+ export declare const ReferralEarningsSummarySchema: z.ZodObject<{
112
+ totalEarned: z.ZodString;
113
+ level1Earned: z.ZodString;
114
+ level2Earned: z.ZodString;
115
+ level3Earned: z.ZodString;
116
+ }, z.core.$strip>;
117
+ /** The caller's own downline: who they earn from, their L1 roster, and a summary. */
118
+ export declare const GetMyReferralDownlineResponseSchema: z.ZodObject<{
119
+ earningsBySource: z.ZodArray<z.ZodObject<{
120
+ source: z.ZodString;
121
+ sourceDisplay: z.ZodString;
122
+ level: z.ZodNumber;
123
+ totalEarned: z.ZodString;
124
+ token: z.ZodString;
125
+ }, z.core.$strip>>;
126
+ directReferees: z.ZodArray<z.ZodObject<{
127
+ wallet: z.ZodString;
128
+ display: z.ZodString;
129
+ referredAt: z.ZodString;
130
+ totalEarned: z.ZodString;
131
+ }, z.core.$strip>>;
132
+ summary: z.ZodObject<{
133
+ totalEarned: z.ZodString;
134
+ level1Earned: z.ZodString;
135
+ level2Earned: z.ZodString;
136
+ level3Earned: z.ZodString;
137
+ }, z.core.$strip>;
138
+ }, z.core.$strip>;
70
139
  export type RewardsBalanceEntry = z.infer<typeof RewardsBalanceEntrySchema>;
71
140
  export type GetRewardsBalanceResponse = z.infer<typeof GetRewardsBalanceResponseSchema>;
72
141
  export type TraderCodeResponse = z.infer<typeof TraderCodeResponseSchema>;
@@ -76,3 +145,9 @@ export type SetTraderCodeParams = z.infer<typeof SetTraderCodeParamsSchema>;
76
145
  export type TraderCodeInfoResponse = z.infer<typeof TraderCodeInfoResponseSchema>;
77
146
  export type TransferRewardsParams = z.infer<typeof TransferRewardsParamsSchema>;
78
147
  export type TransferRewardsResponse = z.infer<typeof TransferRewardsResponseSchema>;
148
+ export type ReferralRewardEntry = z.infer<typeof ReferralRewardEntrySchema>;
149
+ export type GetMyReferralPositionResponse = z.infer<typeof GetMyReferralPositionResponseSchema>;
150
+ export type ReferralEarningsSource = z.infer<typeof ReferralEarningsSourceSchema>;
151
+ export type ReferralDirectReferee = z.infer<typeof ReferralDirectRefereeSchema>;
152
+ export type ReferralEarningsSummary = z.infer<typeof ReferralEarningsSummarySchema>;
153
+ export type GetMyReferralDownlineResponse = z.infer<typeof GetMyReferralDownlineResponseSchema>;
@@ -101,3 +101,81 @@ export const TransferRewardsResponseSchema = z.object({
101
101
  /** Your trading balance for the token after the transfer, RAW atomic units. */
102
102
  tradingBalance: z.string(),
103
103
  });
104
+ /** A single reward the caller has earned (one row per referred trade × level). */
105
+ export const ReferralRewardEntrySchema = z.object({
106
+ /** Public wallet address of the trader (taker) whose trade generated this reward. */
107
+ source: z.string(),
108
+ /** Human-facing name for the source: their custom handle if claimed, else the wallet. */
109
+ sourceDisplay: z.string(),
110
+ /** Referral level (1 = direct/30%, 2 = 15%, 3 = 5%). */
111
+ level: z.number(),
112
+ /** Reward amount, in RAW atomic units of the token. */
113
+ amount: z.string(),
114
+ /** Reward token contract address (0x-prefixed). */
115
+ token: z.string(),
116
+ /** The referral rate applied, as a decimal fraction (e.g. `0.30` for L1). */
117
+ rateApplied: z.string(),
118
+ /** RFC 3339 timestamp when the reward row was recorded. */
119
+ createdAt: z.string(),
120
+ });
121
+ /** The caller's own referral position: who referred them and what they've earned. */
122
+ export const GetMyReferralPositionResponseSchema = z.object({
123
+ /**
124
+ * Public wallet address of the caller's direct (L1) referrer. Empty string
125
+ * when the caller was not referred. Only the direct referrer is exposed.
126
+ */
127
+ referrer: z.string(),
128
+ /** Human-facing name for the referrer: their custom handle if claimed, else the wallet (empty when not referred). */
129
+ referrerDisplay: z.string(),
130
+ /** Total reward amount earned across every level and token, in RAW atomic units. */
131
+ totalEarned: z.string(),
132
+ /** The caller's most recent reward rows, newest first (bounded server-side). */
133
+ rewards: z.array(ReferralRewardEntrySchema),
134
+ });
135
+ /** One aggregated earnings row per (source trader, level, token) the caller earns from. */
136
+ export const ReferralEarningsSourceSchema = z.object({
137
+ /** Public wallet address of the trader (taker) the caller earns from. */
138
+ source: z.string(),
139
+ /** Human-facing name for the source: their custom handle if claimed, else the wallet. */
140
+ sourceDisplay: z.string(),
141
+ /** Referral level the caller earns from this source at (1/2/3). */
142
+ level: z.number(),
143
+ /** Total earned from this source at this level and token, in RAW atomic units. */
144
+ totalEarned: z.string(),
145
+ /** Reward token contract address (0x-prefixed). */
146
+ token: z.string(),
147
+ });
148
+ /** One direct (L1) referee of the caller, whether or not they have traded yet. */
149
+ export const ReferralDirectRefereeSchema = z.object({
150
+ /** Public wallet address of the direct referee. */
151
+ wallet: z.string(),
152
+ /** Human-facing name for the referee: their custom handle if claimed, else the wallet. */
153
+ display: z.string(),
154
+ /** RFC 3339 timestamp when the referral relationship was recorded. */
155
+ referredAt: z.string(),
156
+ /** Total the caller has earned from this referee's own (L1) trades, RAW units. `0` if they haven't traded. */
157
+ totalEarned: z.string(),
158
+ });
159
+ /** Per-level breakdown of the caller's total referral earnings. */
160
+ export const ReferralEarningsSummarySchema = z.object({
161
+ /** Total earned across all levels and tokens, in RAW atomic units. */
162
+ totalEarned: z.string(),
163
+ /** Total earned from direct (L1) referees, in RAW atomic units. */
164
+ level1Earned: z.string(),
165
+ /** Total earned from L2 downline, in RAW atomic units. */
166
+ level2Earned: z.string(),
167
+ /** Total earned from L3 downline, in RAW atomic units. */
168
+ level3Earned: z.string(),
169
+ });
170
+ /** The caller's own downline: who they earn from, their L1 roster, and a summary. */
171
+ export const GetMyReferralDownlineResponseSchema = z.object({
172
+ /** One row per (source trader, level, token) the caller earns from, across L1/L2/L3. */
173
+ earningsBySource: z.array(ReferralEarningsSourceSchema),
174
+ /** The caller's direct (L1) referees, newest first, including those who haven't traded. */
175
+ directReferees: z.array(ReferralDirectRefereeSchema),
176
+ /**
177
+ * Total earned broken down by level (L1/L2/L3). The server always populates
178
+ * this — even a brand-new user gets a zeroed summary — so it is required.
179
+ */
180
+ summary: ReferralEarningsSummarySchema,
181
+ });
@@ -9,6 +9,22 @@
9
9
  * A lost key or terminal update need not have a later replacement. Each
10
10
  * frame carries the account's full current health, so consume it as a
11
11
  * terminal-state snapshot per margin account, never as an additive delta.
12
+ *
13
+ * A subscribe-time snapshot arrives ahead of the live diffs, carrying one row
14
+ * per margin account you own IN THE APPLICATION YOU AUTHENTICATED UNDER -
15
+ * including FLAT accounts, which the live producer never emits for. Live
16
+ * delivery is wider: it is per user and carries no application filter, so if
17
+ * the same wallet trades through more than one application you also receive
18
+ * live frames for those accounts. Do NOT treat an account absent from the
19
+ * snapshot as deleted - merge per `marginAccountId` rather than replacing your
20
+ * whole map. Snapshot rows are this same payload with `sequence` absent; see
21
+ * that field.
22
+ *
23
+ * Live frames emitted before your subscription activated are buffered during
24
+ * the snapshot read and delivered after it, so one can supersede a newer
25
+ * snapshot row. A later frame normally corrects that within the ~30s
26
+ * keepalive; if the account went flat in that window and its final frame never
27
+ * arrived, reconnect to re-seed.
12
28
  */
13
29
  /**
14
30
  * Account event data carrying the current margin health of a single account.
@@ -17,23 +33,33 @@ export interface AccountEventData {
17
33
  /** Margin account this update describes (UUID) */
18
34
  marginAccountId: string;
19
35
  /**
20
- * Monotonic per-account counter within one producer run. It advances only on
21
- * published frames, may SKIP values (at-most-once publishing/delivery), and
22
- * resets to zero when the producer restarts — which can happen while your
23
- * WebSocket stays connected, because the socket is owned by a different
24
- * service. It is therefore never a gap detector and never a cross-restart
25
- * total order.
36
+ * Monotonic per-account counter within one producer run, on LIVE frames
37
+ * only. It advances only on published frames, may SKIP values (at-most-once
38
+ * publishing/delivery), and resets to zero when the producer restarts —
39
+ * which can happen while your WebSocket stays connected, because the socket
40
+ * is owned by a different service. It is therefore never a gap detector and
41
+ * never a cross-restart total order.
42
+ *
43
+ * Dedupe rule, LIVE FRAMES ONLY: order them per account by `updatedAt`,
44
+ * newest wins, and use `sequence` only to break ties between frames carrying
45
+ * the SAME `updatedAt` (those come from the same producer run). A snapshot
46
+ * row is not ranked this way — see below.
26
47
  *
27
- * Dedupe rule: order frames per account by `updatedAt`, newest wins; use
28
- * `sequence` only to break ties between frames carrying the SAME `updatedAt`
29
- * (those come from the same producer run).
48
+ * **Absent on a subscribe-time snapshot row.** The counter belongs to the
49
+ * matching engine's own producer process and the snapshot is served by a
50
+ * different service, which cannot mint one; a `0` would be worse than
51
+ * absent, because it is indistinguishable from a restarted producer's first
52
+ * frame and would make you drop live frames behind the baseline.
30
53
  *
31
- * There is no subscribe-time snapshot: an account with active exposure
32
- * delivers a baseline within ~30s (keepalive republish), but a FLAT account
33
- * is silent until it re-activates — fetch the margin-accounts REST endpoint
34
- * when an immediate flat baseline is needed.
54
+ * A snapshot row's `updatedAt` is the instant that account's state was
55
+ * PERSISTED (a database write), while a live frame's is when the engine
56
+ * SAMPLED it. Those clocks are not comparable under persistence lag, so the
57
+ * rule is simply that **a live frame always supersedes a snapshot row for the
58
+ * same `marginAccountId`** — rank `updatedAt` only between live frames, with
59
+ * `sequence` breaking ties inside one producer run, which a snapshot is not
60
+ * part of. Treat `undefined` as "unknown", never as zero.
35
61
  */
36
- sequence: number;
62
+ sequence?: number;
37
63
  /** Mark-inclusive account equity: collateral + unrealized PnL + funding (decimal string) */
38
64
  equity: string;
39
65
  /** Raw deposited collateral in USD (decimal string) */
@@ -9,4 +9,20 @@
9
9
  * A lost key or terminal update need not have a later replacement. Each
10
10
  * frame carries the account's full current health, so consume it as a
11
11
  * terminal-state snapshot per margin account, never as an additive delta.
12
+ *
13
+ * A subscribe-time snapshot arrives ahead of the live diffs, carrying one row
14
+ * per margin account you own IN THE APPLICATION YOU AUTHENTICATED UNDER -
15
+ * including FLAT accounts, which the live producer never emits for. Live
16
+ * delivery is wider: it is per user and carries no application filter, so if
17
+ * the same wallet trades through more than one application you also receive
18
+ * live frames for those accounts. Do NOT treat an account absent from the
19
+ * snapshot as deleted - merge per `marginAccountId` rather than replacing your
20
+ * whole map. Snapshot rows are this same payload with `sequence` absent; see
21
+ * that field.
22
+ *
23
+ * Live frames emitted before your subscription activated are buffered during
24
+ * the snapshot read and delivered after it, so one can supersede a newer
25
+ * snapshot row. A later frame normally corrects that within the ~30s
26
+ * keepalive; if the account went flat in that window and its final frame never
27
+ * arrived, reconnect to re-seed.
12
28
  */
@@ -10,6 +10,6 @@
10
10
  * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
11
  * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
12
  */
13
- export declare const OPERATION_IDS: readonly ["attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_managed_market_assignments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["attach_position_tp_sl", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_close_all_positions", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "cancel_twap_order", "check_trader_code_availability", "claim_buildercode_rewards", "claim_managed_market_lease", "clear_trader_code", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "create_twap_order", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_buildercode_payout_summary", "get_buildercode_rewards_balance", "get_buildercodes_config", "get_candles", "get_conditional_order", "get_faucet_info", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_my_fee_tier", "get_my_referral_downline", "get_my_referral_position", "get_my_trader_code", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_assets", "get_portfolio_chart", "get_portfolio_margin", "get_portfolio_performance", "get_portfolio_realized_pnl", "get_portfolio_stats", "get_portfolio_summary", "get_position", "get_position_pnl_history", "get_position_risk", "get_pulse", "get_rewards_balance", "get_screener", "get_self_trade_prevention_default", "get_sub_account_limits", "get_sweeper_chains", "get_trade_by_id", "get_trader_code_info", "get_trades", "get_trading_pair_by_id", "get_twap_order", "get_twap_order_tca", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_all_funding_history", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_buildercode_payouts", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_managed_market_assignments", "list_margin_accounts", "list_pending_withdrawals", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "list_twap_orders", "mint_tokens", "refresh_managed_market_quotes", "refresh_session", "register_deposit_address", "replace_order", "revoke_delegated_agent", "revoke_session", "set_self_trade_prevention_default", "set_trader_code", "simulate_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "transfer_rewards", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -49,6 +49,8 @@ export const OPERATION_IDS = [
49
49
  "get_market_metadata",
50
50
  "get_market_stats",
51
51
  "get_my_fee_tier",
52
+ "get_my_referral_downline",
53
+ "get_my_referral_position",
52
54
  "get_my_trader_code",
53
55
  "get_open_interest",
54
56
  "get_order_by_id",
@@ -2166,6 +2166,61 @@ export interface paths {
2166
2166
  patch?: never;
2167
2167
  trace?: never;
2168
2168
  };
2169
+ "/api/v1/pitpass/referrals/me": {
2170
+ parameters: {
2171
+ query?: never;
2172
+ header?: never;
2173
+ path?: never;
2174
+ cookie?: never;
2175
+ };
2176
+ /**
2177
+ * Get your referral position
2178
+ * @description Read your own referral position (self-scoped).
2179
+ *
2180
+ * Return the authenticated caller's referral position: their direct (L1)
2181
+ * referrer, the total rewards they have earned, and their most recent reward
2182
+ * rows. Self-scoped — identity comes only from the session, never a path id,
2183
+ * so a caller can only ever read their own chain. Every other user is
2184
+ * identified by their public wallet address, never an internal id. An empty
2185
+ * `referrer` means the caller was not referred.
2186
+ */
2187
+ get: operations["get_my_referral_position"];
2188
+ put?: never;
2189
+ post?: never;
2190
+ delete?: never;
2191
+ options?: never;
2192
+ head?: never;
2193
+ patch?: never;
2194
+ trace?: never;
2195
+ };
2196
+ "/api/v1/pitpass/referrals/me/downline": {
2197
+ parameters: {
2198
+ query?: never;
2199
+ header?: never;
2200
+ path?: never;
2201
+ cookie?: never;
2202
+ };
2203
+ /**
2204
+ * Get your referral downline and earnings
2205
+ * @description Read your own downline earnings (self-scoped).
2206
+ *
2207
+ * Return who the authenticated caller earns from and how much: an
2208
+ * earnings-by-source breakdown aggregated from the caller's reward rows across
2209
+ * all three reward levels (L1/L2/L3), their L1 direct-referee roster (including
2210
+ * referees who have not traded yet), and a per-level earnings summary.
2211
+ * Self-scoped — identity comes only from the session, never a path id. Every
2212
+ * source and referee is identified by their public wallet address, never an
2213
+ * internal id.
2214
+ */
2215
+ get: operations["get_my_referral_downline"];
2216
+ put?: never;
2217
+ post?: never;
2218
+ delete?: never;
2219
+ options?: never;
2220
+ head?: never;
2221
+ patch?: never;
2222
+ trace?: never;
2223
+ };
2169
2224
  "/api/v1/pitpass/rewards/balance": {
2170
2225
  parameters: {
2171
2226
  query?: never;
@@ -4811,6 +4866,33 @@ export interface components {
4811
4866
  /** @description Six-row fee schedule for the requested pair, ascending by tier */
4812
4867
  feeSchedule?: components["schemas"]["FeeTierScheduleRow"][] | null;
4813
4868
  };
4869
+ GetMyReferralDownlineResponse: {
4870
+ /** @description One row per (source trader, level, token) the caller earns from, across all three reward levels. Comes straight from the caller's reward rows — no tree walk. */
4871
+ earningsBySource?: components["schemas"]["ReferralEarningsSource"][] | null;
4872
+ /** @description The caller's direct (L1) referees, newest first, including referees who have not traded yet (0 earned). Bounded to the most recent 500 EFFECTIVE referees (after per-wallet dedupe and the winning-edge filter). The earnings views (`earnings_by_source` and the summary) are unbounded and count every level, so a caller past the roster cap still sees their full earnings; only this roster listing is capped. */
4873
+ directReferees?: components["schemas"]["ReferralDirectReferee"][] | null;
4874
+ /** @description Total earned broken down by level (L1/L2/L3). */
4875
+ summary?: components["schemas"]["ReferralEarningsSummary"] | null;
4876
+ };
4877
+ GetMyReferralPositionResponse: {
4878
+ /**
4879
+ * @description Public wallet address of the caller's direct (L1) referrer — who referred them. Empty when the caller was not referred. Never exposes L2/L3 upline or any internal id.
4880
+ * @example 0x0000000000000000000000000000000000000002
4881
+ */
4882
+ referrer?: string | null;
4883
+ /**
4884
+ * @description Total reward amount the caller has earned, summed across every level and token, in RAW atomic units.
4885
+ * @example 1400000
4886
+ */
4887
+ totalEarned?: string | null;
4888
+ /**
4889
+ * @description Human-facing name for the referrer: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `referrer`). Empty when the caller was not referred. Render this instead of raw hex.
4890
+ * @example cooltrader123
4891
+ */
4892
+ referrerDisplay?: string | null;
4893
+ /** @description The caller's most recent reward rows, newest first. Bounded server-side — not the full history. */
4894
+ rewards?: components["schemas"]["ReferralRewardEntry"][] | null;
4895
+ };
4814
4896
  /** @description Latest public open interest for a trading pair. */
4815
4897
  GetOpenInterestResponse: {
4816
4898
  /**
@@ -6028,7 +6110,7 @@ export interface components {
6028
6110
  movements?: components["schemas"]["ApplicationMovement"][] | null;
6029
6111
  /**
6030
6112
  * Format: uint32
6031
- * @description Total matching movements
6113
+ * @description Matching movements. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so an application with more matching movements than the listing can page through reads the cap, not its lifetime total.
6032
6114
  * @example 150
6033
6115
  */
6034
6116
  total?: number | null;
@@ -6046,7 +6128,7 @@ export interface components {
6046
6128
  pageSize?: number | null;
6047
6129
  /**
6048
6130
  * Format: uint32
6049
- * @description Total number of pages
6131
+ * @description Number of pages at the requested page size. Exact up to 10,000 and saturates there, the last page this listing can reach.
6050
6132
  * @example 8
6051
6133
  */
6052
6134
  totalPages?: number | null;
@@ -6055,7 +6137,7 @@ export interface components {
6055
6137
  orders?: components["schemas"]["ApplicationOrder"][] | null;
6056
6138
  /**
6057
6139
  * Format: uint32
6058
- * @description Total matching orders
6140
+ * @description Matching orders. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so an application with more matching orders than the listing can page through reads the cap, not its lifetime total.
6059
6141
  * @example 150
6060
6142
  */
6061
6143
  total?: number | null;
@@ -6073,7 +6155,7 @@ export interface components {
6073
6155
  pageSize?: number | null;
6074
6156
  /**
6075
6157
  * Format: uint32
6076
- * @description Total number of pages
6158
+ * @description Number of pages at the requested page size. Exact up to 10,000 and saturates there, the last page this listing can reach.
6077
6159
  * @example 8
6078
6160
  */
6079
6161
  totalPages?: number | null;
@@ -7295,6 +7377,136 @@ export interface components {
7295
7377
  */
7296
7378
  relevance?: number | null;
7297
7379
  };
7380
+ /** @description One direct (L1) referee of the caller, whether or not they have traded yet. */
7381
+ ReferralDirectReferee: {
7382
+ /**
7383
+ * @description Public wallet address of the direct referee. Never an internal id.
7384
+ * @example 0x0000000000000000000000000000000000000002
7385
+ */
7386
+ wallet?: string | null;
7387
+ /**
7388
+ * @description RFC 3339 timestamp when the referral relationship was recorded (the referee's sign-up under the caller).
7389
+ * @example 2026-07-07T18:00:00Z
7390
+ */
7391
+ referredAt?: string | null;
7392
+ /**
7393
+ * @description Total the caller has earned from this referee's own (L1) trades, in RAW atomic units. `0` for a referee who has not traded yet.
7394
+ * @example 900000
7395
+ */
7396
+ totalEarned?: string | null;
7397
+ /**
7398
+ * @description Human-facing name for the referee: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `wallet`). Render this instead of raw hex.
7399
+ * @example cooltrader123
7400
+ */
7401
+ display?: string | null;
7402
+ };
7403
+ /**
7404
+ * @description One aggregated earnings row per (source trader, level, token) the caller
7405
+ * earns from.
7406
+ */
7407
+ ReferralEarningsSource: {
7408
+ /**
7409
+ * @description Public wallet address of the trader (taker) the caller earns from. Never an internal id.
7410
+ * @example 0x0000000000000000000000000000000000000002
7411
+ */
7412
+ source?: string | null;
7413
+ /**
7414
+ * Format: int32
7415
+ * @description Referral level the caller earns from this source at: 1 (direct), 2, or 3.
7416
+ * @example 1
7417
+ */
7418
+ level?: number | null;
7419
+ /**
7420
+ * @description Total earned from this source at this level and token, in RAW atomic units.
7421
+ * @example 900000
7422
+ */
7423
+ totalEarned?: string | null;
7424
+ /**
7425
+ * @description Reward token contract address (0x-prefixed).
7426
+ * @example 0x0000000000000000000000000000000000000002
7427
+ */
7428
+ token?: string | null;
7429
+ /**
7430
+ * @description Human-facing name for the source: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `source`). Render this instead of raw hex.
7431
+ * @example cooltrader123
7432
+ */
7433
+ sourceDisplay?: string | null;
7434
+ };
7435
+ /**
7436
+ * @description Per-level breakdown of the caller's total referral earnings.
7437
+ *
7438
+ * These are ALL-TIME CREDITED earnings — a raw sum of the immutable
7439
+ * `referral_rewards` audit rows — and match the `total_earned` on the referral
7440
+ * position. They are NOT the caller's current spendable rewards balance:
7441
+ * `GetRewardsBalance` reports the live bucket, which `TransferRewards` draws
7442
+ * down, so the two diverge after any transfer. Read the rewards balance for
7443
+ * current availability. Denominated in the single reward token's atomic units
7444
+ * (Monaco pays PitPass rewards in one token — the quote asset); if a deployment
7445
+ * ever pays in more than one reward token, atomic units across tokens are not
7446
+ * additive, so read the per-token `earnings_by_source` rows for a correct
7447
+ * breakdown.
7448
+ */
7449
+ ReferralEarningsSummary: {
7450
+ /**
7451
+ * @description All-time credited earnings across all levels, in the reward token's RAW atomic units (see the message note — this is not the spendable rewards balance).
7452
+ * @example 1400000
7453
+ */
7454
+ totalEarned?: string | null;
7455
+ /**
7456
+ * @description Total earned from direct (L1) referees, in RAW atomic units.
7457
+ * @example 900000
7458
+ */
7459
+ level1Earned?: string | null;
7460
+ /**
7461
+ * @description Total earned from L2 downline, in RAW atomic units.
7462
+ * @example 400000
7463
+ */
7464
+ level2Earned?: string | null;
7465
+ /**
7466
+ * @description Total earned from L3 downline, in RAW atomic units.
7467
+ * @example 100000
7468
+ */
7469
+ level3Earned?: string | null;
7470
+ };
7471
+ /** @description A single reward the caller has earned, one row per referred trade × level. */
7472
+ ReferralRewardEntry: {
7473
+ /**
7474
+ * @description Public wallet address of the trader (taker) whose trade generated this reward. Never an internal id.
7475
+ * @example 0x0000000000000000000000000000000000000002
7476
+ */
7477
+ source?: string | null;
7478
+ /**
7479
+ * Format: int32
7480
+ * @description Referral level this reward was paid at: 1 (direct, 30%), 2 (15%), or 3 (5%).
7481
+ * @example 1
7482
+ */
7483
+ level?: number | null;
7484
+ /**
7485
+ * @description Reward amount, in RAW atomic units of the token.
7486
+ * @example 1200000
7487
+ */
7488
+ amount?: string | null;
7489
+ /**
7490
+ * @description Reward token contract address (0x-prefixed).
7491
+ * @example 0x0000000000000000000000000000000000000002
7492
+ */
7493
+ token?: string | null;
7494
+ /**
7495
+ * @description The referral rate applied to the source's fee for this reward, as a decimal fraction (e.g. `0.30` for L1).
7496
+ * @example 0.30
7497
+ */
7498
+ rateApplied?: string | null;
7499
+ /**
7500
+ * @description RFC 3339 timestamp when the reward row was recorded.
7501
+ * @example 2026-07-07T18:00:00Z
7502
+ */
7503
+ createdAt?: string | null;
7504
+ /**
7505
+ * @description Human-facing name for the source: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `source`). Render this instead of raw hex.
7506
+ * @example cooltrader123
7507
+ */
7508
+ sourceDisplay?: string | null;
7509
+ };
7298
7510
  RefreshManagedMarketQuotesRequest: {
7299
7511
  launchId?: string | null;
7300
7512
  ownerId?: string | null;
@@ -8853,6 +9065,16 @@ export interface components {
8853
9065
  */
8854
9066
  expiresAt?: number | null;
8855
9067
  user?: components["schemas"]["UserInfo"];
9068
+ /**
9069
+ * @description True when this verify created the user row — the wallet's first sign-in to THIS application. Identity is per `(wallet, application)`, so a wallet already registered on another application is still `is_new_user` on its first sign-in to a new one. Use it to gate first-time UX (e.g. showing the optional "have a referral code?" input only to new users) and to confirm a fresh sign-up. False for every returning verify on this application.
9070
+ * @example true
9071
+ */
9072
+ isNewUser?: boolean | null;
9073
+ /**
9074
+ * @description True when a PitPass referral relationship was recorded on this verify: a valid, non-self TraderCode presented on the wallet's first sign-in to THIS application resolved to a known referrer. Scoped like `is_new_user` (per `(wallet, application)`), so a wallet already registered on another application can still see this on its first sign-in to a new one. False for a returning user of this application, an absent or unknown code, or a self-referral. Confirms the referral landed for the signup success screen.
9075
+ * @example true
9076
+ */
9077
+ referralApplied?: boolean | null;
8856
9078
  };
8857
9079
  Withdrawal: {
8858
9080
  /**
@@ -13600,6 +13822,88 @@ export interface operations {
13600
13822
  };
13601
13823
  };
13602
13824
  };
13825
+ get_my_referral_position: {
13826
+ parameters: {
13827
+ query?: never;
13828
+ header?: never;
13829
+ path?: never;
13830
+ cookie?: never;
13831
+ };
13832
+ requestBody?: never;
13833
+ responses: {
13834
+ /** @description OK */
13835
+ 200: {
13836
+ headers: {
13837
+ [name: string]: unknown;
13838
+ };
13839
+ content: {
13840
+ "application/json": components["schemas"]["GetMyReferralPositionResponse"];
13841
+ };
13842
+ };
13843
+ /** @description Authentication required */
13844
+ 401: {
13845
+ headers: {
13846
+ [name: string]: unknown;
13847
+ };
13848
+ content?: never;
13849
+ };
13850
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
13851
+ 429: {
13852
+ headers: {
13853
+ [name: string]: unknown;
13854
+ };
13855
+ content?: never;
13856
+ };
13857
+ /** @description Internal server error */
13858
+ 500: {
13859
+ headers: {
13860
+ [name: string]: unknown;
13861
+ };
13862
+ content?: never;
13863
+ };
13864
+ };
13865
+ };
13866
+ get_my_referral_downline: {
13867
+ parameters: {
13868
+ query?: never;
13869
+ header?: never;
13870
+ path?: never;
13871
+ cookie?: never;
13872
+ };
13873
+ requestBody?: never;
13874
+ responses: {
13875
+ /** @description OK */
13876
+ 200: {
13877
+ headers: {
13878
+ [name: string]: unknown;
13879
+ };
13880
+ content: {
13881
+ "application/json": components["schemas"]["GetMyReferralDownlineResponse"];
13882
+ };
13883
+ };
13884
+ /** @description Authentication required */
13885
+ 401: {
13886
+ headers: {
13887
+ [name: string]: unknown;
13888
+ };
13889
+ content?: never;
13890
+ };
13891
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
13892
+ 429: {
13893
+ headers: {
13894
+ [name: string]: unknown;
13895
+ };
13896
+ content?: never;
13897
+ };
13898
+ /** @description Internal server error */
13899
+ 500: {
13900
+ headers: {
13901
+ [name: string]: unknown;
13902
+ };
13903
+ content?: never;
13904
+ };
13905
+ };
13906
+ };
13603
13907
  get_rewards_balance: {
13604
13908
  parameters: {
13605
13909
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "1.0.61",
3
+ "version": "1.0.62",
4
4
  "type": "module",
5
5
  "homepage": "https://docs.0xmonaco.com/sdk/typescript",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "lint": "biome lint ."
17
17
  },
18
18
  "dependencies": {
19
- "@0xmonaco/contracts": "1.0.61",
19
+ "@0xmonaco/contracts": "1.0.62",
20
20
  "zod": "^4.1.12"
21
21
  },
22
22
  "peerDependencies": {