@0xmonaco/core 0.8.7-develop.34bd452 → 0.8.7-develop.5d0e403

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 (41) hide show
  1. package/dist/api/applications/api.d.ts +61 -8
  2. package/dist/api/applications/api.js +71 -7
  3. package/dist/api/auth/api.d.ts +7 -26
  4. package/dist/api/auth/api.js +6 -42
  5. package/dist/api/base.d.ts +35 -0
  6. package/dist/api/base.js +60 -0
  7. package/dist/api/delegated-agents/api.d.ts +2 -1
  8. package/dist/api/delegated-agents/api.js +4 -0
  9. package/dist/api/faucet/api.d.ts +25 -0
  10. package/dist/api/faucet/api.js +29 -0
  11. package/dist/api/faucet/index.d.ts +1 -0
  12. package/dist/api/faucet/index.js +1 -0
  13. package/dist/api/index.d.ts +4 -0
  14. package/dist/api/index.js +4 -0
  15. package/dist/api/margin-accounts/api.d.ts +2 -2
  16. package/dist/api/margin-accounts/api.js +4 -4
  17. package/dist/api/market/api.d.ts +3 -1
  18. package/dist/api/market/api.js +8 -0
  19. package/dist/api/perp/routes.d.ts +60 -1
  20. package/dist/api/perp/routes.js +27 -1
  21. package/dist/api/sub-accounts/api.d.ts +62 -0
  22. package/dist/api/sub-accounts/api.js +80 -0
  23. package/dist/api/sub-accounts/index.d.ts +1 -0
  24. package/dist/api/sub-accounts/index.js +1 -0
  25. package/dist/api/trades/api.d.ts +12 -1
  26. package/dist/api/trades/api.js +13 -1
  27. package/dist/api/trading/api.d.ts +4 -0
  28. package/dist/api/trading/api.js +6 -0
  29. package/dist/api/whitelist/api.d.ts +27 -0
  30. package/dist/api/whitelist/api.js +32 -0
  31. package/dist/api/whitelist/index.d.ts +1 -0
  32. package/dist/api/whitelist/index.js +1 -0
  33. package/dist/api/withdrawals/api.d.ts +15 -0
  34. package/dist/api/withdrawals/api.js +27 -0
  35. package/dist/api/withdrawals/index.d.ts +1 -0
  36. package/dist/api/withdrawals/index.js +1 -0
  37. package/dist/coverage.d.ts +7 -0
  38. package/dist/coverage.js +7 -0
  39. package/dist/sdk.d.ts +23 -1
  40. package/dist/sdk.js +51 -0
  41. package/package.json +3 -3
@@ -31,6 +31,11 @@ export class MarketAPIImpl extends BaseAPI {
31
31
  const url = queryString ? `/api/v1/market/pairs?${queryString}` : "/api/v1/market/pairs";
32
32
  return await this.makePublicRequest(url);
33
33
  }
34
+ async getTradingPair(tradingPairId) {
35
+ validate(GetMarketMetadataSchema, { tradingPairId });
36
+ const response = await this.makePublicRequest(perpRoutes.market.getTradingPair(tradingPairId));
37
+ return response.trading_pair;
38
+ }
34
39
  async getTradingPairBySymbol(symbol) {
35
40
  // Backend endpoint expects UUID, not symbol, so we fetch all pairs and filter
36
41
  const response = await this.getPaginatedTradingPairs({ page_size: 100 });
@@ -94,4 +99,7 @@ export class MarketAPIImpl extends BaseAPI {
94
99
  validate(GetMarketMetadataSchema, { tradingPairId });
95
100
  return await this.makePublicRequest(perpRoutes.market.getOpenInterest(tradingPairId));
96
101
  }
102
+ async getScreener(params) {
103
+ return await this.makePublicRequest(perpRoutes.market.getScreener(params));
104
+ }
97
105
  }
@@ -29,9 +29,14 @@ export declare const perpRoutes: {
29
29
  };
30
30
  readonly delegatedAgents: {
31
31
  readonly list: () => string;
32
+ readonly owners: () => string;
32
33
  readonly byId: (delegatedAgentId: string) => string;
33
34
  readonly sessions: () => string;
34
35
  };
36
+ readonly withdrawals: {
37
+ readonly initiate: () => string;
38
+ readonly byIndex: (withdrawalIndex: number) => string;
39
+ };
35
40
  readonly market: {
36
41
  readonly listTradingPairs: (params?: {
37
42
  page?: number;
@@ -60,6 +65,12 @@ export declare const perpRoutes: {
60
65
  page_size?: number;
61
66
  }) => string;
62
67
  readonly getOpenInterest: (tradingPairId: string) => string;
68
+ readonly getScreener: (params?: {
69
+ page?: number;
70
+ page_size?: number;
71
+ market_type?: string;
72
+ is_active?: boolean;
73
+ }) => string;
63
74
  };
64
75
  readonly orderbook: {
65
76
  readonly get: (tradingPairId: string, params?: {
@@ -74,6 +85,7 @@ export declare const perpRoutes: {
74
85
  skip?: number;
75
86
  limit?: number;
76
87
  }) => string;
88
+ readonly byId: (tradeId: string) => string;
77
89
  readonly user: (params?: {
78
90
  margin_account_id?: string;
79
91
  trading_pair_id?: string;
@@ -81,6 +93,53 @@ export declare const perpRoutes: {
81
93
  page_size?: number;
82
94
  }) => string;
83
95
  };
96
+ readonly applications: {
97
+ readonly orders: (params?: {
98
+ page?: number;
99
+ page_size?: number;
100
+ status?: string;
101
+ user_id?: string;
102
+ trading_pair_id?: string;
103
+ side?: string;
104
+ order_type?: string;
105
+ }) => string;
106
+ readonly users: (params?: {
107
+ page?: number;
108
+ page_size?: number;
109
+ is_active?: boolean;
110
+ account_type?: string;
111
+ address?: string;
112
+ }) => string;
113
+ readonly movements: (params?: {
114
+ page?: number;
115
+ page_size?: number;
116
+ user_id?: string;
117
+ transaction_type?: string;
118
+ entry_type?: string;
119
+ asset_id?: string;
120
+ }) => string;
121
+ readonly balances: (params?: {
122
+ page?: number;
123
+ page_size?: number;
124
+ user_id?: string;
125
+ asset_id?: string;
126
+ }) => string;
127
+ readonly stats: (params?: {
128
+ since?: string;
129
+ }) => string;
130
+ };
131
+ readonly subAccounts: {
132
+ readonly list: () => string;
133
+ readonly createLimit: () => string;
134
+ readonly getLimits: (subAccountId: string) => string;
135
+ readonly limit: (subAccountId: string, assetId: string) => string;
136
+ };
137
+ readonly faucet: {
138
+ readonly mint: () => string;
139
+ };
140
+ readonly whitelist: {
141
+ readonly submit: () => string;
142
+ };
84
143
  readonly positions: {
85
144
  readonly list: (params?: {
86
145
  margin_account_id?: string;
@@ -110,7 +169,7 @@ export declare const perpRoutes: {
110
169
  state?: string;
111
170
  trading_pair_id?: string;
112
171
  }) => string;
113
- readonly create: () => string;
172
+ readonly ensureParent: () => string;
114
173
  readonly summary: (marginAccountId: string) => string;
115
174
  readonly availableCollateral: (params?: {
116
175
  asset?: string;
@@ -32,9 +32,14 @@ export const perpRoutes = {
32
32
  },
33
33
  delegatedAgents: {
34
34
  list: () => `${API_V1}/delegated-agents`,
35
+ owners: () => `${API_V1}/delegated-agents/owners`,
35
36
  byId: (delegatedAgentId) => `${API_V1}/delegated-agents/${encodeSegment(delegatedAgentId)}`,
36
37
  sessions: () => `${API_V1}/delegated-agents/sessions`,
37
38
  },
39
+ withdrawals: {
40
+ initiate: () => `${API_V1}/withdrawals`,
41
+ byIndex: (withdrawalIndex) => `${API_V1}/withdrawals/${encodeSegment(String(withdrawalIndex))}`,
42
+ },
38
43
  market: {
39
44
  listTradingPairs: (params) => withQuery(`${API_V1}/market/pairs`, params),
40
45
  getTradingPair: (tradingPairId) => `${API_V1}/market/pairs/${encodeSegment(tradingPairId)}`,
@@ -47,14 +52,35 @@ export const perpRoutes = {
47
52
  getFundingState: (tradingPairId) => `${API_V1}/market/pairs/${encodeSegment(tradingPairId)}/funding`,
48
53
  listFundingHistory: (tradingPairId, params) => withQuery(`${API_V1}/market/pairs/${encodeSegment(tradingPairId)}/funding/history`, params),
49
54
  getOpenInterest: (tradingPairId) => `${API_V1}/market/pairs/${encodeSegment(tradingPairId)}/open-interest`,
55
+ getScreener: (params) => withQuery(`${API_V1}/market/screener`, params),
50
56
  },
51
57
  orderbook: {
52
58
  get: (tradingPairId, params) => withQuery(`${API_V1}/orderbook/${encodeSegment(tradingPairId)}`, params),
53
59
  },
54
60
  trades: {
55
61
  publicByPair: (tradingPairId, params) => withQuery(`${API_V1}/trades/${encodeSegment(tradingPairId)}`, params),
62
+ byId: (tradeId) => `${API_V1}/trades/by-id/${encodeSegment(tradeId)}`,
56
63
  user: (params) => withQuery(`${API_V1}/accounts/trades`, params),
57
64
  },
65
+ applications: {
66
+ orders: (params) => withQuery(`${API_V1}/applications/orders`, params),
67
+ users: (params) => withQuery(`${API_V1}/applications/users`, params),
68
+ movements: (params) => withQuery(`${API_V1}/applications/movements`, params),
69
+ balances: (params) => withQuery(`${API_V1}/applications/balances`, params),
70
+ stats: (params) => withQuery(`${API_V1}/applications/stats`, params),
71
+ },
72
+ subAccounts: {
73
+ list: () => `${API_V1}/accounts/sub-accounts`,
74
+ createLimit: () => `${API_V1}/accounts/sub-accounts/limits`,
75
+ getLimits: (subAccountId) => `${API_V1}/accounts/sub-accounts/${encodeSegment(subAccountId)}/limits`,
76
+ limit: (subAccountId, assetId) => `${API_V1}/accounts/sub-accounts/${encodeSegment(subAccountId)}/limits/${encodeSegment(assetId)}`,
77
+ },
78
+ faucet: {
79
+ mint: () => `${API_V1}/faucet/mint`,
80
+ },
81
+ whitelist: {
82
+ submit: () => `${API_V1}/whitelist`,
83
+ },
58
84
  positions: {
59
85
  list: (params) => withQuery(`${API_V1}/positions`, params),
60
86
  get: (positionId) => `${API_V1}/positions/${encodeSegment(positionId)}`,
@@ -67,7 +93,7 @@ export const perpRoutes = {
67
93
  },
68
94
  marginAccounts: {
69
95
  list: (params) => withQuery(`${API_V1}/margin/accounts`, params),
70
- create: () => `${API_V1}/margin/accounts`,
96
+ ensureParent: () => `${API_V1}/margin/accounts`,
71
97
  summary: (marginAccountId) => `${API_V1}/margin/accounts/${encodeSegment(marginAccountId)}`,
72
98
  availableCollateral: (params) => withQuery(`${API_V1}/margin/collateral/available`, params),
73
99
  transferIn: (marginAccountId) => `${API_V1}/margin/accounts/${encodeSegment(marginAccountId)}/collateral/transfer-in`,
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Sub-Accounts API Implementation
3
+ *
4
+ * Manage a master account's sub-accounts and their per-asset spending limits.
5
+ * All methods are session-authenticated. The limit mutations (`createLimit`,
6
+ * `updateLimit`, `deleteLimit`) additionally require the master account to hold
7
+ * the `ManageSubAccounts` permission — enforced server-side, so a non-master or
8
+ * unpermissioned caller receives a 403.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const { sub_accounts } = await sdk.subAccounts.list();
13
+ * await sdk.subAccounts.createLimit({ sub_account_id, asset_id, max_amount: "1000.00" });
14
+ * ```
15
+ */
16
+ import type { CreateSubAccountLimitRequest, CreateSubAccountLimitResponse, GetSubAccountLimitsResponse, ListSubAccountsResponse, SubAccountsAPI, UpdateSubAccountLimitBody, UpdateSubAccountLimitResponse } from "@0xmonaco/types";
17
+ import { BaseAPI } from "../base";
18
+ export declare class SubAccountsAPIImpl extends BaseAPI implements SubAccountsAPI {
19
+ /**
20
+ * Lists the authenticated master account's sub-accounts with balances.
21
+ *
22
+ * @returns Promise resolving to the sub-accounts and total count
23
+ */
24
+ list(): Promise<ListSubAccountsResponse>;
25
+ /**
26
+ * Creates a per-asset spending limit on a sub-account.
27
+ *
28
+ * Requires the `ManageSubAccounts` permission (enforced server-side).
29
+ *
30
+ * @param body - Sub-account, asset, max amount, and optional daily limit
31
+ * @returns Promise resolving to the created limit
32
+ */
33
+ createLimit(body: CreateSubAccountLimitRequest): Promise<CreateSubAccountLimitResponse>;
34
+ /**
35
+ * Gets the limits configured for a sub-account.
36
+ *
37
+ * @param subAccountId - Sub-account UUID
38
+ * @returns Promise resolving to the sub-account's limits
39
+ */
40
+ getLimits(subAccountId: string): Promise<GetSubAccountLimitsResponse>;
41
+ /**
42
+ * Updates a sub-account's per-asset limit (partial update).
43
+ *
44
+ * Requires the `ManageSubAccounts` permission (enforced server-side).
45
+ *
46
+ * @param subAccountId - Sub-account UUID
47
+ * @param assetId - Asset UUID
48
+ * @param body - Fields to update
49
+ * @returns Promise resolving to the updated limit
50
+ */
51
+ updateLimit(subAccountId: string, assetId: string, body: UpdateSubAccountLimitBody): Promise<UpdateSubAccountLimitResponse>;
52
+ /**
53
+ * Deletes a sub-account's per-asset limit.
54
+ *
55
+ * Requires the `ManageSubAccounts` permission (enforced server-side).
56
+ *
57
+ * @param subAccountId - Sub-account UUID
58
+ * @param assetId - Asset UUID
59
+ * @returns Promise resolving when the limit is deleted
60
+ */
61
+ deleteLimit(subAccountId: string, assetId: string): Promise<void>;
62
+ }
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Sub-Accounts API Implementation
3
+ *
4
+ * Manage a master account's sub-accounts and their per-asset spending limits.
5
+ * All methods are session-authenticated. The limit mutations (`createLimit`,
6
+ * `updateLimit`, `deleteLimit`) additionally require the master account to hold
7
+ * the `ManageSubAccounts` permission — enforced server-side, so a non-master or
8
+ * unpermissioned caller receives a 403.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const { sub_accounts } = await sdk.subAccounts.list();
13
+ * await sdk.subAccounts.createLimit({ sub_account_id, asset_id, max_amount: "1000.00" });
14
+ * ```
15
+ */
16
+ import { BaseAPI } from "../base";
17
+ import { perpRoutes } from "../perp/routes";
18
+ export class SubAccountsAPIImpl extends BaseAPI {
19
+ /**
20
+ * Lists the authenticated master account's sub-accounts with balances.
21
+ *
22
+ * @returns Promise resolving to the sub-accounts and total count
23
+ */
24
+ async list() {
25
+ return await this.makeAuthenticatedRequest(perpRoutes.subAccounts.list());
26
+ }
27
+ /**
28
+ * Creates a per-asset spending limit on a sub-account.
29
+ *
30
+ * Requires the `ManageSubAccounts` permission (enforced server-side).
31
+ *
32
+ * @param body - Sub-account, asset, max amount, and optional daily limit
33
+ * @returns Promise resolving to the created limit
34
+ */
35
+ async createLimit(body) {
36
+ return await this.makeAuthenticatedRequest(perpRoutes.subAccounts.createLimit(), {
37
+ method: "POST",
38
+ body: JSON.stringify(body),
39
+ });
40
+ }
41
+ /**
42
+ * Gets the limits configured for a sub-account.
43
+ *
44
+ * @param subAccountId - Sub-account UUID
45
+ * @returns Promise resolving to the sub-account's limits
46
+ */
47
+ async getLimits(subAccountId) {
48
+ return await this.makeAuthenticatedRequest(perpRoutes.subAccounts.getLimits(subAccountId));
49
+ }
50
+ /**
51
+ * Updates a sub-account's per-asset limit (partial update).
52
+ *
53
+ * Requires the `ManageSubAccounts` permission (enforced server-side).
54
+ *
55
+ * @param subAccountId - Sub-account UUID
56
+ * @param assetId - Asset UUID
57
+ * @param body - Fields to update
58
+ * @returns Promise resolving to the updated limit
59
+ */
60
+ async updateLimit(subAccountId, assetId, body) {
61
+ return await this.makeAuthenticatedRequest(perpRoutes.subAccounts.limit(subAccountId, assetId), {
62
+ method: "PUT",
63
+ body: JSON.stringify(body),
64
+ });
65
+ }
66
+ /**
67
+ * Deletes a sub-account's per-asset limit.
68
+ *
69
+ * Requires the `ManageSubAccounts` permission (enforced server-side).
70
+ *
71
+ * @param subAccountId - Sub-account UUID
72
+ * @param assetId - Asset UUID
73
+ * @returns Promise resolving when the limit is deleted
74
+ */
75
+ async deleteLimit(subAccountId, assetId) {
76
+ await this.makeAuthenticatedRequest(perpRoutes.subAccounts.limit(subAccountId, assetId), {
77
+ method: "DELETE",
78
+ });
79
+ }
80
+ }
@@ -0,0 +1 @@
1
+ export { SubAccountsAPIImpl } from "./api";
@@ -0,0 +1 @@
1
+ export { SubAccountsAPIImpl } from "./api";
@@ -11,8 +11,11 @@ interface RawTradeEvent {
11
11
  trade_id: string;
12
12
  price: string;
13
13
  quantity: string;
14
+ /** Raw (integer) quantity; present on single-trade lookups, ignored when mapping */
15
+ quantity_raw?: string;
14
16
  maker_side: string;
15
- executed_at: string;
17
+ /** Absent when the trade has no recorded execution time */
18
+ executed_at?: string;
16
19
  };
17
20
  }
18
21
  /**
@@ -40,5 +43,13 @@ export declare class TradesAPIImpl extends BaseAPI {
40
43
  * @returns Array of TradeEvent records sorted by executed_at descending (newest first)
41
44
  */
42
45
  getTrades(tradingPairId: string, options?: GetTradesOptions): Promise<TradeEvent[]>;
46
+ /**
47
+ * Get a single trade by its UUID.
48
+ *
49
+ * @param tradeId - The trade UUID
50
+ * @returns The matching TradeEvent
51
+ * @throws {APIError} If the trade is not found
52
+ */
53
+ getTradeById(tradeId: string): Promise<TradeEvent>;
43
54
  }
44
55
  export {};
@@ -1,4 +1,5 @@
1
1
  import { BaseAPI } from "../base";
2
+ import { perpRoutes } from "../perp";
2
3
  /**
3
4
  * Convert a raw trade event (snake_case) to a TradeEvent (camelCase)
4
5
  */
@@ -12,7 +13,7 @@ export function parseRawTradeEvent(raw) {
12
13
  price: raw.data.price,
13
14
  quantity: raw.data.quantity,
14
15
  makerSide: raw.data.maker_side.toUpperCase(),
15
- executedAt: raw.data.executed_at,
16
+ executedAt: raw.data.executed_at ?? "",
16
17
  },
17
18
  };
18
19
  }
@@ -39,4 +40,15 @@ export class TradesAPIImpl extends BaseAPI {
39
40
  const response = await this.makePublicRequest(`/api/v1/trades/${encodeURIComponent(tradingPairId)}?${params.toString()}`);
40
41
  return response.trades.map(parseRawTradeEvent);
41
42
  }
43
+ /**
44
+ * Get a single trade by its UUID.
45
+ *
46
+ * @param tradeId - The trade UUID
47
+ * @returns The matching TradeEvent
48
+ * @throws {APIError} If the trade is not found
49
+ */
50
+ async getTradeById(tradeId) {
51
+ const response = await this.makePublicRequest(perpRoutes.trades.byId(tradeId));
52
+ return parseRawTradeEvent(response);
53
+ }
42
54
  }
@@ -80,6 +80,8 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
80
80
  expirationDate?: string;
81
81
  timeInForce?: TimeInForce;
82
82
  marginAccountId?: string;
83
+ marginBucketId?: string;
84
+ marginBucketCollateral?: string;
83
85
  strategyKey?: string;
84
86
  positionSide?: PositionSide;
85
87
  leverage?: string;
@@ -132,6 +134,8 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
132
134
  tradingMode?: TradingMode;
133
135
  slippageTolerance?: number;
134
136
  marginAccountId?: string;
137
+ marginBucketId?: string;
138
+ marginBucketCollateral?: string;
135
139
  strategyKey?: string;
136
140
  positionSide?: PositionSide;
137
141
  leverage?: string;
@@ -107,6 +107,8 @@ export class TradingAPIImpl extends BaseAPI {
107
107
  expiration_date: options?.expirationDate,
108
108
  time_in_force: options?.timeInForce,
109
109
  margin_account_id: options?.marginAccountId,
110
+ margin_bucket_id: options?.marginBucketId,
111
+ margin_bucket_collateral: options?.marginBucketCollateral,
110
112
  strategy_key: options?.strategyKey,
111
113
  position_side: options?.positionSide,
112
114
  leverage: options?.leverage,
@@ -177,6 +179,8 @@ export class TradingAPIImpl extends BaseAPI {
177
179
  quantity,
178
180
  trading_mode: options?.tradingMode || "SPOT",
179
181
  margin_account_id: options?.marginAccountId,
182
+ margin_bucket_id: options?.marginBucketId,
183
+ margin_bucket_collateral: options?.marginBucketCollateral,
180
184
  strategy_key: options?.strategyKey,
181
185
  position_side: options?.positionSide,
182
186
  leverage: options?.leverage,
@@ -363,6 +367,8 @@ export class TradingAPIImpl extends BaseAPI {
363
367
  expiration_date: order.expirationDate,
364
368
  time_in_force: order.timeInForce,
365
369
  margin_account_id: order.marginAccountId,
370
+ margin_bucket_id: order.marginBucketId,
371
+ margin_bucket_collateral: order.marginBucketCollateral,
366
372
  strategy_key: order.strategyKey,
367
373
  position_side: order.positionSide,
368
374
  leverage: order.leverage,
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Whitelist API Implementation
3
+ *
4
+ * Public (unauthenticated) whitelist/waitlist application submission. The
5
+ * server validates and de-duplicates by wallet address and email, creating an
6
+ * inactive user pending manual approval. This is an onboarding endpoint, not a
7
+ * trading operation.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const { message, user_id } = await sdk.whitelist.submit({
12
+ * wallet_address: "0x...",
13
+ * email: "user@example.com",
14
+ * });
15
+ * ```
16
+ */
17
+ import type { SubmitWhitelistRequest, SubmitWhitelistResponse, WhitelistAPI } from "@0xmonaco/types";
18
+ import { BaseAPI } from "../base";
19
+ export declare class WhitelistAPIImpl extends BaseAPI implements WhitelistAPI {
20
+ /**
21
+ * Submits a whitelist (waitlist) application. Public — no auth required.
22
+ *
23
+ * @param body - Applicant details
24
+ * @returns Promise resolving to the status message and created user id
25
+ */
26
+ submit(body: SubmitWhitelistRequest): Promise<SubmitWhitelistResponse>;
27
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Whitelist API Implementation
3
+ *
4
+ * Public (unauthenticated) whitelist/waitlist application submission. The
5
+ * server validates and de-duplicates by wallet address and email, creating an
6
+ * inactive user pending manual approval. This is an onboarding endpoint, not a
7
+ * trading operation.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * const { message, user_id } = await sdk.whitelist.submit({
12
+ * wallet_address: "0x...",
13
+ * email: "user@example.com",
14
+ * });
15
+ * ```
16
+ */
17
+ import { BaseAPI } from "../base";
18
+ import { perpRoutes } from "../perp/routes";
19
+ export class WhitelistAPIImpl extends BaseAPI {
20
+ /**
21
+ * Submits a whitelist (waitlist) application. Public — no auth required.
22
+ *
23
+ * @param body - Applicant details
24
+ * @returns Promise resolving to the status message and created user id
25
+ */
26
+ async submit(body) {
27
+ return await this.makePublicRequest(perpRoutes.whitelist.submit(), {
28
+ method: "POST",
29
+ body: JSON.stringify(body),
30
+ });
31
+ }
32
+ }
@@ -0,0 +1 @@
1
+ export { WhitelistAPIImpl } from "./api";
@@ -0,0 +1 @@
1
+ export { WhitelistAPIImpl } from "./api";
@@ -0,0 +1,15 @@
1
+ import type { InitiateWithdrawalRequest, WithdrawalResponse, WithdrawalsAPI } from "@0xmonaco/types";
2
+ import { BaseAPI } from "../base";
3
+ /**
4
+ * Low-level withdrawals client.
5
+ *
6
+ * `initiateWithdrawal` debits the caller's balance via the matching engine and
7
+ * returns the target vault address plus pre-signed `executeSignedWithdrawal`
8
+ * calldata; `getWithdrawal` re-fetches that calldata for a previously-initiated
9
+ * index. Neither submits on-chain — use the high-level vault API for the flow
10
+ * that also broadcasts the transaction.
11
+ */
12
+ export declare class WithdrawalsAPIImpl extends BaseAPI implements WithdrawalsAPI {
13
+ initiateWithdrawal(request: InitiateWithdrawalRequest): Promise<WithdrawalResponse>;
14
+ getWithdrawal(withdrawalIndex: number): Promise<WithdrawalResponse>;
15
+ }
@@ -0,0 +1,27 @@
1
+ import { BaseAPI } from "../base";
2
+ import { perpRoutes } from "../perp";
3
+ /**
4
+ * Low-level withdrawals client.
5
+ *
6
+ * `initiateWithdrawal` debits the caller's balance via the matching engine and
7
+ * returns the target vault address plus pre-signed `executeSignedWithdrawal`
8
+ * calldata; `getWithdrawal` re-fetches that calldata for a previously-initiated
9
+ * index. Neither submits on-chain — use the high-level vault API for the flow
10
+ * that also broadcasts the transaction.
11
+ */
12
+ export class WithdrawalsAPIImpl extends BaseAPI {
13
+ async initiateWithdrawal(request) {
14
+ return this.makeAuthenticatedRequest(perpRoutes.withdrawals.initiate(), {
15
+ method: "POST",
16
+ body: JSON.stringify({
17
+ asset_id: request.assetId,
18
+ amount: request.amount,
19
+ destination: request.destination,
20
+ }),
21
+ });
22
+ }
23
+ async getWithdrawal(withdrawalIndex) {
24
+ // Public lookup — no auth required.
25
+ return this.makePublicRequest(perpRoutes.withdrawals.byIndex(withdrawalIndex));
26
+ }
27
+ }
@@ -0,0 +1 @@
1
+ export * from "./api";
@@ -0,0 +1 @@
1
+ export * from "./api";
@@ -0,0 +1,7 @@
1
+ /** operationId → reason it is intentionally not covered by @0xmonaco/core. */
2
+ export declare const INTENTIONALLY_EXCLUDED: {
3
+ authenticate_backend: string;
4
+ health_check: string;
5
+ list_funding_payments: string;
6
+ list_user_trades: string;
7
+ };
@@ -0,0 +1,7 @@
1
+ /** operationId → reason it is intentionally not covered by @0xmonaco/core. */
2
+ export const INTENTIONALLY_EXCLUDED = {
3
+ authenticate_backend: "Backend auth is header-based via setServerKey()/the x-server-key header, not an endpoint method (MON-1486).",
4
+ health_check: "Infrastructure liveness probe (GET /health); not part of the data SDK surface.",
5
+ list_funding_payments: "gRPC-only: accounts.proto declares the HTTP annotation but api-gateway-rust has no Actix route for GET /api/v1/accounts/funding-payments, so it is unreachable from a REST client.",
6
+ list_user_trades: "gRPC-only: trades.proto declares the HTTP annotation but there is no Actix route; GET /api/v1/trades/user is shadowed by GET /api/v1/trades/{id}. Equivalent data is exposed via get_user_trades (GET /api/v1/accounts/trades).",
7
+ };
package/dist/sdk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ApplicationsAPI, AuthAPI, AuthState, DelegatedAgentsAPI, FeesAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PositionsAPI, ProfileAPI, SDKConfig, TradingAPI, VaultAPI } from "@0xmonaco/types";
1
+ import type { ApplicationsAPI, AuthAPI, AuthState, DelegatedAgentsAPI, FaucetAPI, FeesAPI, MarginAccountsAPI, MarketAPI, MonacoSDK, Network, PositionsAPI, ProfileAPI, SDKConfig, SubAccountsAPI, TradingAPI, VaultAPI, WhitelistAPI, WithdrawalsAPI } from "@0xmonaco/types";
2
2
  import { type PublicClient, type TransactionReceipt, type WalletClient } from "viem";
3
3
  import { type MonacoWebSocket, OrderbookAPIImpl, TradesAPIImpl } from "./api";
4
4
  export declare class MonacoSDKImpl implements MonacoSDK {
@@ -7,10 +7,14 @@ export declare class MonacoSDKImpl implements MonacoSDK {
7
7
  applications: ApplicationsAPI;
8
8
  fees: FeesAPI;
9
9
  vault: VaultAPI;
10
+ withdrawals: WithdrawalsAPI;
10
11
  trading: TradingAPI;
11
12
  market: MarketAPI;
12
13
  marginAccounts: MarginAccountsAPI;
13
14
  positions: PositionsAPI;
15
+ subAccounts: SubAccountsAPI;
16
+ faucet: FaucetAPI;
17
+ whitelist: WhitelistAPI;
14
18
  profile: ProfileAPI;
15
19
  orderbook: OrderbookAPIImpl;
16
20
  trades: TradesAPIImpl;
@@ -25,6 +29,24 @@ export declare class MonacoSDKImpl implements MonacoSDK {
25
29
  * the WebSocket client.
26
30
  */
27
31
  private propagateSession;
32
+ /**
33
+ * Set (or clear) the application secret key used for backend-authenticated
34
+ * requests (those annotated `#[require_backend]` on the gateway, e.g. the
35
+ * `applications` reporting endpoints).
36
+ *
37
+ * The raw `sk_...` key is sent in the `x-server-key` header on each such
38
+ * request. This is independent of {@link login}/session auth — a client may
39
+ * hold both a session and a server key at once.
40
+ *
41
+ * @param serverKey - The application secret key (`sk_...`), or `undefined` to clear.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * sdk.setServerKey("sk_live_...");
46
+ * const orders = await sdk.applications.listApplicationOrders({ status: "FILLED" });
47
+ * ```
48
+ */
49
+ setServerKey(serverKey: string | undefined): void;
28
50
  /** Extract the session keypair from an auth state. */
29
51
  private sessionFromAuthState;
30
52
  constructor(cfg: SDKConfig);