@0xmonaco/core 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.
@@ -228,6 +228,12 @@ export class AuthAPIImpl extends BaseAPI {
228
228
  address: responseBody.user.address,
229
229
  username: responseBody.user.username,
230
230
  },
231
+ // Signup signals (0XM-2781): first-time-user gating and referral-landed
232
+ // confirmation for the FE. Only spread them when the server actually sent
233
+ // them, so `AuthState` keeps its original shape against a server that
234
+ // predates the fields (no `isNewUser: undefined` key).
235
+ ...(responseBody.isNewUser !== undefined ? { isNewUser: responseBody.isNewUser } : {}),
236
+ ...(responseBody.referralApplied !== undefined ? { referralApplied: responseBody.referralApplied } : {}),
231
237
  };
232
238
  }
233
239
  /**
@@ -33,7 +33,7 @@
33
33
  * console.log(`Rewards remaining: ${result.rewardsBalance}`);
34
34
  * ```
35
35
  */
36
- import type { GetRewardsBalanceResponse, PitpassAPI, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "@0xmonaco/types";
36
+ import type { GetMyReferralDownlineResponse, GetMyReferralPositionResponse, GetRewardsBalanceResponse, PitpassAPI, TraderCodeAvailabilityResponse, TraderCodeInfoResponse, TraderCodeResponse, TransferRewardsParams, TransferRewardsResponse } from "@0xmonaco/types";
37
37
  import { BaseAPI } from "../base";
38
38
  export declare class PitpassAPIImpl extends BaseAPI implements PitpassAPI {
39
39
  /**
@@ -76,4 +76,16 @@ export declare class PitpassAPIImpl extends BaseAPI implements PitpassAPI {
76
76
  * Transfer earned PitPass rewards into a trading balance.
77
77
  */
78
78
  transferRewards(params: TransferRewardsParams): Promise<TransferRewardsResponse>;
79
+ /**
80
+ * Read the caller's own referral position: their L1 referrer, total earned,
81
+ * and recent rewards. Self-scoped — no id is sent, so it can only ever return
82
+ * your own chain. `referrer` is "" when you were not referred.
83
+ */
84
+ getMyReferralPosition(): Promise<GetMyReferralPositionResponse>;
85
+ /**
86
+ * Read the caller's own downline: earnings by source across L1/L2/L3, the L1
87
+ * direct-referee roster (including referees who haven't traded), and a
88
+ * per-level earnings summary. Self-scoped, read-only.
89
+ */
90
+ getMyReferralDownline(): Promise<GetMyReferralDownlineResponse>;
79
91
  }
@@ -108,4 +108,24 @@ export class PitpassAPIImpl extends BaseAPI {
108
108
  body: JSON.stringify({ token: validated.token, amount: validated.amount }),
109
109
  });
110
110
  }
111
+ /**
112
+ * Read the caller's own referral position: their L1 referrer, total earned,
113
+ * and recent rewards. Self-scoped — no id is sent, so it can only ever return
114
+ * your own chain. `referrer` is "" when you were not referred.
115
+ */
116
+ async getMyReferralPosition() {
117
+ return await this.makeAuthenticatedRequest("/api/v1/pitpass/referrals/me", {
118
+ method: "GET",
119
+ });
120
+ }
121
+ /**
122
+ * Read the caller's own downline: earnings by source across L1/L2/L3, the L1
123
+ * direct-referee roster (including referees who haven't traded), and a
124
+ * per-level earnings summary. Self-scoped, read-only.
125
+ */
126
+ async getMyReferralDownline() {
127
+ return await this.makeAuthenticatedRequest("/api/v1/pitpass/referrals/me/downline", {
128
+ method: "GET",
129
+ });
130
+ }
111
131
  }
@@ -292,9 +292,13 @@ function parseAccountEventData(raw) {
292
292
  return {
293
293
  marginAccountId: readString(data, "marginAccountId"),
294
294
  // Monotonic per-account publish counter (0XM-2498): a plain JSON number on
295
- // the wire, used to order/dedupe frames across reconnect races. Must be a
296
- // non-negative safe integer — anything else is a malformed frame.
297
- sequence: readSequence(data, "sequence"),
295
+ // the wire, used to order/dedupe frames across reconnect races. Present on
296
+ // a live frame and ABSENT on a subscribe-time snapshot row (0XM-2674) — the
297
+ // counter lives in the matching engine's producer process and the snapshot
298
+ // is served by ws-api, which cannot mint one. Read optionally so the
299
+ // snapshot parses; still validated as a non-negative safe integer when
300
+ // present, because a malformed one would corrupt ordering/dedup.
301
+ sequence: readOptionalSequence(data, "sequence"),
298
302
  equity: readString(data, "equity"),
299
303
  collateral: readString(data, "collateral"),
300
304
  freeCollateral: readString(data, "freeCollateral"),
@@ -44,6 +44,8 @@ export declare const COVERED: {
44
44
  get_sweeper_chains: string;
45
45
  get_my_trader_code: string;
46
46
  get_rewards_balance: string;
47
+ get_my_referral_position: string;
48
+ get_my_referral_downline: string;
47
49
  get_self_trade_prevention_default: string;
48
50
  get_trader_code_info: string;
49
51
  set_self_trade_prevention_default: string;
package/dist/coverage.js CHANGED
@@ -44,6 +44,8 @@ export const COVERED = {
44
44
  get_sweeper_chains: "sweeper.getChains",
45
45
  get_my_trader_code: "pitpass.getMyTraderCode",
46
46
  get_rewards_balance: "pitpass.getRewardsBalance",
47
+ get_my_referral_position: "pitpass.getMyReferralPosition",
48
+ get_my_referral_downline: "pitpass.getMyReferralDownline",
47
49
  get_self_trade_prevention_default: "profile.getSelfTradePreventionDefault",
48
50
  get_trader_code_info: "pitpass.getTraderCodeInfo",
49
51
  set_self_trade_prevention_default: "profile.setSelfTradePreventionDefault",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/core",
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",
@@ -19,8 +19,8 @@
19
19
  "viem": "^2.45.2"
20
20
  },
21
21
  "dependencies": {
22
- "@0xmonaco/contracts": "1.0.61",
23
- "@0xmonaco/types": "1.0.61",
22
+ "@0xmonaco/contracts": "1.0.62",
23
+ "@0xmonaco/types": "1.0.62",
24
24
  "@noble/curves": "^1.9.1",
25
25
  "@noble/hashes": "^2.4.0",
26
26
  "http-status-codes": "^2.3.0"