@0xmonaco/core 1.0.61 → 1.0.64
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.
- package/dist/api/auth/api.js +6 -0
- package/dist/api/pitpass/api.d.ts +13 -1
- package/dist/api/pitpass/api.js +20 -0
- package/dist/api/trading/api.d.ts +6 -4
- package/dist/api/trading/api.js +6 -4
- package/dist/api/websocket/websocket.js +7 -3
- package/dist/coverage.d.ts +2 -0
- package/dist/coverage.js +2 -0
- package/package.json +3 -3
package/dist/api/auth/api.js
CHANGED
|
@@ -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
|
}
|
package/dist/api/pitpass/api.js
CHANGED
|
@@ -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
|
}
|
|
@@ -302,16 +302,18 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
|
|
|
302
302
|
* working set.
|
|
303
303
|
* When neither `page` nor `pageToken` is passed, the SDK drives cursor (pageToken)
|
|
304
304
|
* pagination: it starts a cursor walk from the newest (or oldest, for
|
|
305
|
-
* `orderBy: "ASC"`) row and the response's `nextPageToken` resumes it.
|
|
306
|
-
*
|
|
305
|
+
* `orderBy: "ASC"`) row and the response's `nextPageToken` resumes it. Both modes
|
|
306
|
+
* populate `total`/`totalPages` (bounded by the server count ceiling — see
|
|
307
|
+
* `totalCapped`); only `page` is 0 in cursor mode.
|
|
307
308
|
*
|
|
308
309
|
* @param params - Query parameters for filtering orders
|
|
309
310
|
* @param params.status - Filter by order status (e.g., "SUBMITTED", "FILLED"), or by
|
|
310
311
|
* any of several statuses at once by passing an array (e.g., ["SUBMITTED", "PARTIALLY_FILLED"]) (optional)
|
|
311
312
|
* @param params.tradingPairId - Filter by trading pair UUID (optional)
|
|
312
313
|
* @param params.page - Deprecated: page number for legacy offset pagination (must be > 0).
|
|
313
|
-
* Passing it selects legacy page-number mode, which only sees recent (hot) history
|
|
314
|
-
*
|
|
314
|
+
* Passing it selects legacy page-number mode, which only sees recent (hot) history. Both
|
|
315
|
+
* modes populate `total`/`totalPages` (bounded — see `totalCapped`); use cursor
|
|
316
|
+
* pagination (`pageToken`) instead for full history.
|
|
315
317
|
* @param params.pageSize - Number of orders per page (defaults to 10, must be > 0; max 100
|
|
316
318
|
* in page-number mode, up to 1000 when pageToken is present)
|
|
317
319
|
* @param params.pageToken - Pagination cursor: pass `""` to start a cursor walk from
|
package/dist/api/trading/api.js
CHANGED
|
@@ -468,16 +468,18 @@ export class TradingAPIImpl extends BaseAPI {
|
|
|
468
468
|
* working set.
|
|
469
469
|
* When neither `page` nor `pageToken` is passed, the SDK drives cursor (pageToken)
|
|
470
470
|
* pagination: it starts a cursor walk from the newest (or oldest, for
|
|
471
|
-
* `orderBy: "ASC"`) row and the response's `nextPageToken` resumes it.
|
|
472
|
-
*
|
|
471
|
+
* `orderBy: "ASC"`) row and the response's `nextPageToken` resumes it. Both modes
|
|
472
|
+
* populate `total`/`totalPages` (bounded by the server count ceiling — see
|
|
473
|
+
* `totalCapped`); only `page` is 0 in cursor mode.
|
|
473
474
|
*
|
|
474
475
|
* @param params - Query parameters for filtering orders
|
|
475
476
|
* @param params.status - Filter by order status (e.g., "SUBMITTED", "FILLED"), or by
|
|
476
477
|
* any of several statuses at once by passing an array (e.g., ["SUBMITTED", "PARTIALLY_FILLED"]) (optional)
|
|
477
478
|
* @param params.tradingPairId - Filter by trading pair UUID (optional)
|
|
478
479
|
* @param params.page - Deprecated: page number for legacy offset pagination (must be > 0).
|
|
479
|
-
* Passing it selects legacy page-number mode, which only sees recent (hot) history
|
|
480
|
-
*
|
|
480
|
+
* Passing it selects legacy page-number mode, which only sees recent (hot) history. Both
|
|
481
|
+
* modes populate `total`/`totalPages` (bounded — see `totalCapped`); use cursor
|
|
482
|
+
* pagination (`pageToken`) instead for full history.
|
|
481
483
|
* @param params.pageSize - Number of orders per page (defaults to 10, must be > 0; max 100
|
|
482
484
|
* in page-number mode, up to 1000 when pageToken is present)
|
|
483
485
|
* @param params.pageToken - Pagination cursor: pass `""` to start a cursor walk from
|
|
@@ -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.
|
|
296
|
-
//
|
|
297
|
-
|
|
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"),
|
package/dist/coverage.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.0.64",
|
|
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.
|
|
23
|
-
"@0xmonaco/types": "1.0.
|
|
22
|
+
"@0xmonaco/contracts": "1.0.64",
|
|
23
|
+
"@0xmonaco/types": "1.0.64",
|
|
24
24
|
"@noble/curves": "^1.9.1",
|
|
25
25
|
"@noble/hashes": "^2.4.0",
|
|
26
26
|
"http-status-codes": "^2.3.0"
|