@0xmonaco/core 0.0.0-develop-20260323152825 → 0.0.0-develop-20260415185155

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 (130) hide show
  1. package/README.md +4 -7
  2. package/dist/api/applications/api.d.ts +0 -1
  3. package/dist/api/applications/api.js +0 -1
  4. package/dist/api/applications/index.d.ts +0 -1
  5. package/dist/api/applications/index.js +0 -1
  6. package/dist/api/auth/api.d.ts +9 -9
  7. package/dist/api/auth/api.js +9 -12
  8. package/dist/api/auth/index.d.ts +0 -1
  9. package/dist/api/auth/index.js +0 -1
  10. package/dist/api/base.d.ts +0 -1
  11. package/dist/api/base.js +0 -1
  12. package/dist/api/fees/api.d.ts +2 -1
  13. package/dist/api/fees/api.js +8 -1
  14. package/dist/api/fees/index.d.ts +0 -1
  15. package/dist/api/fees/index.js +0 -1
  16. package/dist/api/index.d.ts +0 -1
  17. package/dist/api/index.js +0 -1
  18. package/dist/api/market/api.d.ts +0 -1
  19. package/dist/api/market/api.js +4 -5
  20. package/dist/api/market/index.d.ts +0 -1
  21. package/dist/api/market/index.js +0 -1
  22. package/dist/api/orderbook/api.d.ts +0 -1
  23. package/dist/api/orderbook/api.js +1 -2
  24. package/dist/api/orderbook/index.d.ts +0 -1
  25. package/dist/api/orderbook/index.js +0 -1
  26. package/dist/api/profile/api.d.ts +34 -10
  27. package/dist/api/profile/api.js +61 -18
  28. package/dist/api/profile/index.d.ts +0 -1
  29. package/dist/api/profile/index.js +0 -1
  30. package/dist/api/trades/api.d.ts +4 -5
  31. package/dist/api/trades/api.js +8 -9
  32. package/dist/api/trades/index.d.ts +0 -1
  33. package/dist/api/trades/index.js +0 -1
  34. package/dist/api/trading/api.d.ts +2 -3
  35. package/dist/api/trading/api.js +5 -6
  36. package/dist/api/trading/index.d.ts +0 -1
  37. package/dist/api/trading/index.js +0 -1
  38. package/dist/api/vault/api.d.ts +0 -1
  39. package/dist/api/vault/api.js +0 -1
  40. package/dist/api/vault/index.d.ts +0 -1
  41. package/dist/api/vault/index.js +0 -1
  42. package/dist/api/websocket/index.d.ts +0 -1
  43. package/dist/api/websocket/index.js +0 -1
  44. package/dist/api/websocket/types.d.ts +0 -1
  45. package/dist/api/websocket/types.js +0 -1
  46. package/dist/api/websocket/utils.d.ts +0 -1
  47. package/dist/api/websocket/utils.js +0 -1
  48. package/dist/api/websocket/websocket.d.ts +0 -1
  49. package/dist/api/websocket/websocket.js +4 -5
  50. package/dist/errors/errors.d.ts +0 -1
  51. package/dist/errors/errors.js +0 -1
  52. package/dist/errors/index.d.ts +0 -1
  53. package/dist/errors/index.js +0 -1
  54. package/dist/index.d.ts +0 -1
  55. package/dist/index.js +0 -1
  56. package/dist/networks/index.d.ts +0 -1
  57. package/dist/networks/index.js +0 -1
  58. package/dist/networks/networks.d.ts +0 -1
  59. package/dist/networks/networks.js +0 -1
  60. package/dist/sdk.d.ts +4 -5
  61. package/dist/sdk.js +5 -6
  62. package/dist/utils/index.d.ts +0 -1
  63. package/dist/utils/index.js +0 -1
  64. package/dist/utils/magnitude.d.ts +0 -1
  65. package/dist/utils/magnitude.js +0 -1
  66. package/package.json +3 -3
  67. package/dist/api/applications/api.d.ts.map +0 -1
  68. package/dist/api/applications/api.js.map +0 -1
  69. package/dist/api/applications/index.d.ts.map +0 -1
  70. package/dist/api/applications/index.js.map +0 -1
  71. package/dist/api/auth/api.d.ts.map +0 -1
  72. package/dist/api/auth/api.js.map +0 -1
  73. package/dist/api/auth/index.d.ts.map +0 -1
  74. package/dist/api/auth/index.js.map +0 -1
  75. package/dist/api/base.d.ts.map +0 -1
  76. package/dist/api/base.js.map +0 -1
  77. package/dist/api/fees/api.d.ts.map +0 -1
  78. package/dist/api/fees/api.js.map +0 -1
  79. package/dist/api/fees/index.d.ts.map +0 -1
  80. package/dist/api/fees/index.js.map +0 -1
  81. package/dist/api/index.d.ts.map +0 -1
  82. package/dist/api/index.js.map +0 -1
  83. package/dist/api/market/api.d.ts.map +0 -1
  84. package/dist/api/market/api.js.map +0 -1
  85. package/dist/api/market/index.d.ts.map +0 -1
  86. package/dist/api/market/index.js.map +0 -1
  87. package/dist/api/orderbook/api.d.ts.map +0 -1
  88. package/dist/api/orderbook/api.js.map +0 -1
  89. package/dist/api/orderbook/index.d.ts.map +0 -1
  90. package/dist/api/orderbook/index.js.map +0 -1
  91. package/dist/api/profile/api.d.ts.map +0 -1
  92. package/dist/api/profile/api.js.map +0 -1
  93. package/dist/api/profile/index.d.ts.map +0 -1
  94. package/dist/api/profile/index.js.map +0 -1
  95. package/dist/api/trades/api.d.ts.map +0 -1
  96. package/dist/api/trades/api.js.map +0 -1
  97. package/dist/api/trades/index.d.ts.map +0 -1
  98. package/dist/api/trades/index.js.map +0 -1
  99. package/dist/api/trading/api.d.ts.map +0 -1
  100. package/dist/api/trading/api.js.map +0 -1
  101. package/dist/api/trading/index.d.ts.map +0 -1
  102. package/dist/api/trading/index.js.map +0 -1
  103. package/dist/api/vault/api.d.ts.map +0 -1
  104. package/dist/api/vault/api.js.map +0 -1
  105. package/dist/api/vault/index.d.ts.map +0 -1
  106. package/dist/api/vault/index.js.map +0 -1
  107. package/dist/api/websocket/index.d.ts.map +0 -1
  108. package/dist/api/websocket/index.js.map +0 -1
  109. package/dist/api/websocket/types.d.ts.map +0 -1
  110. package/dist/api/websocket/types.js.map +0 -1
  111. package/dist/api/websocket/utils.d.ts.map +0 -1
  112. package/dist/api/websocket/utils.js.map +0 -1
  113. package/dist/api/websocket/websocket.d.ts.map +0 -1
  114. package/dist/api/websocket/websocket.js.map +0 -1
  115. package/dist/errors/errors.d.ts.map +0 -1
  116. package/dist/errors/errors.js.map +0 -1
  117. package/dist/errors/index.d.ts.map +0 -1
  118. package/dist/errors/index.js.map +0 -1
  119. package/dist/index.d.ts.map +0 -1
  120. package/dist/index.js.map +0 -1
  121. package/dist/networks/index.d.ts.map +0 -1
  122. package/dist/networks/index.js.map +0 -1
  123. package/dist/networks/networks.d.ts.map +0 -1
  124. package/dist/networks/networks.js.map +0 -1
  125. package/dist/sdk.d.ts.map +0 -1
  126. package/dist/sdk.js.map +0 -1
  127. package/dist/utils/index.d.ts.map +0 -1
  128. package/dist/utils/index.js.map +0 -1
  129. package/dist/utils/magnitude.d.ts.map +0 -1
  130. package/dist/utils/magnitude.js.map +0 -1
package/README.md CHANGED
@@ -125,7 +125,7 @@ async function authExample() {
125
125
  console.log("Authenticated:", authState.user);
126
126
  console.log("Tokens:", {
127
127
  accessToken: authState.accessToken,
128
- refreshToken: authState.refreshToken, // Use this for revokeToken()
128
+ refreshToken: authState.refreshToken,
129
129
  });
130
130
 
131
131
  // Authenticated WebSocket channels are now connected - start receiving real-time updates
@@ -141,8 +141,7 @@ async function authExample() {
141
141
  await monaco.logout();
142
142
 
143
143
  // Or manually revoke the token
144
- // ✅ CORRECT: Use authState.refreshToken
145
- await monaco.auth.revokeToken(authState.refreshToken);
144
+ await monaco.auth.revokeToken();
146
145
  }
147
146
 
148
147
  // Market Data
@@ -277,11 +276,9 @@ interface AuthState {
277
276
  }
278
277
  ```
279
278
 
280
- **⚠️ Important:** The authentication response contains `refreshToken`, NOT `revokeToken`.
281
-
282
279
  ```typescript
283
- // CORRECT: Revoke using refreshToken
284
- await sdk.auth.revokeToken(authState.refreshToken);
280
+ // Revoke the current session's token
281
+ await sdk.auth.revokeToken();
285
282
 
286
283
  // 💡 TIP: Use the built-in logout method
287
284
  await sdk.logout(); // Automatically calls revokeToken internally
@@ -41,4 +41,3 @@ export declare class ApplicationsAPIImpl extends BaseAPI implements Applications
41
41
  */
42
42
  getApplicationConfig(): Promise<ApplicationConfigResponse>;
43
43
  }
44
- //# sourceMappingURL=api.d.ts.map
@@ -51,4 +51,3 @@ export class ApplicationsAPIImpl extends BaseAPI {
51
51
  };
52
52
  }
53
53
  }
54
- //# sourceMappingURL=api.js.map
@@ -2,4 +2,3 @@
2
2
  * Applications API Module
3
3
  */
4
4
  export { ApplicationsAPIImpl } from "./api";
5
- //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * Applications API Module
3
3
  */
4
4
  export { ApplicationsAPIImpl } from "./api";
5
- //# sourceMappingURL=index.js.map
@@ -182,14 +182,15 @@ export declare class AuthAPIImpl extends BaseAPI implements AuthAPI {
182
182
  */
183
183
  refreshToken(refreshToken: string): Promise<TokenRefreshResponse>;
184
184
  /**
185
- * Revokes a refresh token.
185
+ * Revokes the current session's refresh token.
186
186
  *
187
- * Invalidates a refresh token, preventing it from being used to obtain
188
- * new access tokens. This is useful for logout functionality or when
189
- * a token has been compromised.
187
+ * Invalidates the refresh token associated with the current access token,
188
+ * preventing it from being used to obtain new access tokens. This is useful
189
+ * for logout functionality or when a token has been compromised.
190
+ *
191
+ * The server identifies the token to revoke from the access token in the
192
+ * Authorization header — no request body is needed.
190
193
  *
191
- * **Important:** Pass the `refreshToken` from the authentication response.
192
- * @param refreshToken - The refresh token to revoke (from authResult.refreshToken)
193
194
  * @returns Promise resolving when the token is revoked
194
195
  * @throws {APIError} When token revocation fails
195
196
  *
@@ -197,10 +198,9 @@ export declare class AuthAPIImpl extends BaseAPI implements AuthAPI {
197
198
  * ```typescript
198
199
  * // After authentication
199
200
  * const authResult = await authAPI.authenticate(clientId);
200
- * await authAPI.revokeToken(authResult.refreshToken);
201
+ * await authAPI.revokeToken();
201
202
  * console.log("Token revoked successfully");
202
203
  * ```
203
204
  */
204
- revokeToken(refreshToken: string): Promise<void>;
205
+ revokeToken(): Promise<void>;
205
206
  }
206
- //# sourceMappingURL=api.d.ts.map
@@ -277,14 +277,15 @@ export class AuthAPIImpl extends BaseAPI {
277
277
  };
278
278
  }
279
279
  /**
280
- * Revokes a refresh token.
280
+ * Revokes the current session's refresh token.
281
281
  *
282
- * Invalidates a refresh token, preventing it from being used to obtain
283
- * new access tokens. This is useful for logout functionality or when
284
- * a token has been compromised.
282
+ * Invalidates the refresh token associated with the current access token,
283
+ * preventing it from being used to obtain new access tokens. This is useful
284
+ * for logout functionality or when a token has been compromised.
285
+ *
286
+ * The server identifies the token to revoke from the access token in the
287
+ * Authorization header — no request body is needed.
285
288
  *
286
- * **Important:** Pass the `refreshToken` from the authentication response.
287
- * @param refreshToken - The refresh token to revoke (from authResult.refreshToken)
288
289
  * @returns Promise resolving when the token is revoked
289
290
  * @throws {APIError} When token revocation fails
290
291
  *
@@ -292,17 +293,13 @@ export class AuthAPIImpl extends BaseAPI {
292
293
  * ```typescript
293
294
  * // After authentication
294
295
  * const authResult = await authAPI.authenticate(clientId);
295
- * await authAPI.revokeToken(authResult.refreshToken);
296
+ * await authAPI.revokeToken();
296
297
  * console.log("Token revoked successfully");
297
298
  * ```
298
299
  */
299
- async revokeToken(refreshToken) {
300
+ async revokeToken() {
300
301
  await this.makeAuthenticatedRequest("/api/v1/auth/revoke", {
301
302
  method: "POST",
302
- body: JSON.stringify({
303
- refresh_token: refreshToken,
304
- }),
305
303
  });
306
304
  }
307
305
  }
308
- //# sourceMappingURL=api.js.map
@@ -2,4 +2,3 @@
2
2
  * Auth API Module
3
3
  */
4
4
  export { AuthAPIImpl } from "./api";
5
- //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,3 @@
2
2
  * Auth API Module
3
3
  */
4
4
  export { AuthAPIImpl } from "./api";
5
- //# sourceMappingURL=index.js.map
@@ -121,4 +121,3 @@ export declare abstract class BaseAPI {
121
121
  */
122
122
  protected makePublicRequest<T>(endpoint: string, options?: RequestInit): Promise<T>;
123
123
  }
124
- //# sourceMappingURL=base.d.ts.map
package/dist/api/base.js CHANGED
@@ -284,4 +284,3 @@ export class BaseAPI {
284
284
  }, requestBody);
285
285
  }
286
286
  }
287
- //# sourceMappingURL=base.js.map
@@ -35,6 +35,8 @@ export declare class FeesAPIImpl extends BaseAPI implements FeesAPI {
35
35
  * @param params.side - The order side ("BUY" or "SELL")
36
36
  * @param params.price - The price per unit as string
37
37
  * @param params.quantity - The quantity to trade as string
38
+ * @param params.order_type - Order type: "LIMIT" (default) or "MARKET"
39
+ * @param params.slippage_tolerance_bps - Slippage tolerance in bps (0–1000, MARKET only, default 500)
38
40
  * @returns Promise resolving to SimulateFeeResponse with fee breakdown
39
41
  *
40
42
  * @example
@@ -68,4 +70,3 @@ export declare class FeesAPIImpl extends BaseAPI implements FeesAPI {
68
70
  */
69
71
  simulateFees(params: SimulateFeeParams): Promise<SimulateFeeResponse>;
70
72
  }
71
- //# sourceMappingURL=api.d.ts.map
@@ -35,6 +35,8 @@ export class FeesAPIImpl extends BaseAPI {
35
35
  * @param params.side - The order side ("BUY" or "SELL")
36
36
  * @param params.price - The price per unit as string
37
37
  * @param params.quantity - The quantity to trade as string
38
+ * @param params.order_type - Order type: "LIMIT" (default) or "MARKET"
39
+ * @param params.slippage_tolerance_bps - Slippage tolerance in bps (0–1000, MARKET only, default 500)
38
40
  * @returns Promise resolving to SimulateFeeResponse with fee breakdown
39
41
  *
40
42
  * @example
@@ -74,10 +76,15 @@ export class FeesAPIImpl extends BaseAPI {
74
76
  searchParams.append("side", validatedParams.side);
75
77
  searchParams.append("price", validatedParams.price);
76
78
  searchParams.append("quantity", validatedParams.quantity);
79
+ if (validatedParams.order_type !== undefined) {
80
+ searchParams.append("order_type", validatedParams.order_type);
81
+ }
82
+ if (validatedParams.slippage_tolerance_bps !== undefined) {
83
+ searchParams.append("slippage_tolerance_bps", String(validatedParams.slippage_tolerance_bps));
84
+ }
77
85
  const endpoint = `/api/v1/fees/simulate?${searchParams.toString()}`;
78
86
  return await this.makeAuthenticatedRequest(endpoint, {
79
87
  method: "GET",
80
88
  });
81
89
  }
82
90
  }
83
- //# sourceMappingURL=api.js.map
@@ -4,4 +4,3 @@
4
4
  * Exports fees API implementation.
5
5
  */
6
6
  export { FeesAPIImpl } from "./api";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Exports fees API implementation.
5
5
  */
6
6
  export { FeesAPIImpl } from "./api";
7
- //# sourceMappingURL=index.js.map
@@ -13,4 +13,3 @@ export * from "./trades";
13
13
  export * from "./trading";
14
14
  export * from "./vault";
15
15
  export * from "./websocket";
16
- //# sourceMappingURL=index.d.ts.map
package/dist/api/index.js CHANGED
@@ -13,4 +13,3 @@ export * from "./trades";
13
13
  export * from "./trading";
14
14
  export * from "./vault";
15
15
  export * from "./websocket";
16
- //# sourceMappingURL=index.js.map
@@ -11,4 +11,3 @@ export declare class MarketAPIImpl extends BaseAPI implements MarketAPI {
11
11
  getCandlesticks(tradingPairId: string, interval: Interval, params?: GetCandlesticksParams): Promise<Candlestick[]>;
12
12
  getMarketMetadata(tradingPairId: string): Promise<MarketMetadata>;
13
13
  }
14
- //# sourceMappingURL=api.d.ts.map
@@ -11,8 +11,8 @@ export class MarketAPIImpl extends BaseAPI {
11
11
  if (params?.page !== undefined) {
12
12
  searchParams.append("page", params.page.toString());
13
13
  }
14
- if (params?.limit !== undefined) {
15
- searchParams.append("limit", params.limit.toString());
14
+ if (params?.page_size !== undefined) {
15
+ searchParams.append("page_size", params.page_size.toString());
16
16
  }
17
17
  if (params?.market_type) {
18
18
  searchParams.append("market_type", params.market_type);
@@ -32,8 +32,8 @@ export class MarketAPIImpl extends BaseAPI {
32
32
  }
33
33
  async getTradingPairBySymbol(symbol) {
34
34
  // Backend endpoint expects UUID, not symbol, so we fetch all pairs and filter
35
- const response = await this.getPaginatedTradingPairs({ limit: 100 });
36
- return response.data.data.find((pair) => pair.symbol === symbol);
35
+ const response = await this.getPaginatedTradingPairs({ page_size: 100 });
36
+ return response.trading_pairs.find((pair) => pair.symbol === symbol);
37
37
  }
38
38
  async getCandlesticks(tradingPairId, interval, params) {
39
39
  // Validate inputs using the trading pair ID schema
@@ -67,4 +67,3 @@ export class MarketAPIImpl extends BaseAPI {
67
67
  return await this.makePublicRequest(url);
68
68
  }
69
69
  }
70
- //# sourceMappingURL=api.js.map
@@ -1,2 +1 @@
1
1
  export { MarketAPIImpl } from "./api";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export { MarketAPIImpl } from "./api";
2
- //# sourceMappingURL=index.js.map
@@ -13,4 +13,3 @@ export interface GetOrderbookOptions {
13
13
  export declare class OrderbookAPIImpl extends BaseAPI {
14
14
  getOrderbook(tradingPairId: string, options?: GetOrderbookOptions): Promise<OrderbookEvent>;
15
15
  }
16
- //# sourceMappingURL=api.d.ts.map
@@ -12,7 +12,7 @@ export class OrderbookAPIImpl extends BaseAPI {
12
12
  params.set("denomination", denomination.toLowerCase());
13
13
  const response = await this.makePublicRequest(`/api/v1/orderbook/${encodeURIComponent(tradingPairId)}?${params.toString()}`);
14
14
  return {
15
- tradingPairId: response.pair,
15
+ tradingPairId: response.symbol,
16
16
  tradingMode: response.trading_mode,
17
17
  bids: response.data.bids.map((level) => ({
18
18
  price: level.price,
@@ -35,4 +35,3 @@ export class OrderbookAPIImpl extends BaseAPI {
35
35
  };
36
36
  }
37
37
  }
38
- //# sourceMappingURL=api.js.map
@@ -1,2 +1 @@
1
1
  export { type GetOrderbookOptions, OrderbookAPIImpl } from "./api";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export { OrderbookAPIImpl } from "./api";
2
- //# sourceMappingURL=index.js.map
@@ -17,7 +17,7 @@
17
17
  * console.log(`User: ${profile.username} (${profile.address})`);
18
18
  * ```
19
19
  */
20
- import type { AccountBalance, GetPaginatedUserMovementsResponse, GetUserBalancesParams, GetUserBalancesResponse, GetUserMovementsParams, PortfolioChartResponse, PortfolioMetric, PortfolioPeriod, PortfolioStats, ProfileAPI, UserProfile } from "@0xmonaco/types";
20
+ import type { AccountBalance, GetPaginatedUserMovementsResponse, GetUserBalancesParams, GetUserBalancesResponse, GetUserMovementsParams, GetUserTradesParams, GetUserTradesResponse, PortfolioChartResponse, PortfolioMetric, PortfolioPeriod, PortfolioStats, ProfileAPI, UserProfile } from "@0xmonaco/types";
21
21
  import { BaseAPI } from "../base";
22
22
  export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
23
23
  /**
@@ -61,12 +61,12 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
61
61
  *
62
62
  * @example
63
63
  * ```typescript
64
- * // Get first page with default limit (20)
64
+ * // Get first page with default page_size (20)
65
65
  * const movements = await profileAPI.getPaginatedUserMovements();
66
- * console.log(`Total movements: ${movements.total_count}`);
66
+ * console.log(`Total movements: ${movements.total}`);
67
67
  *
68
- * // Get second page with custom limit
69
- * const page2 = await profileAPI.getPaginatedUserMovements({ page: 2, limit: 50 });
68
+ * // Get second page with custom page_size
69
+ * const page2 = await profileAPI.getPaginatedUserMovements({ page: 2, page_size: 50 });
70
70
  * console.log(`Page ${page2.page} of ${page2.total_pages}`);
71
71
  *
72
72
  * // Filter by entry type and transaction type
@@ -84,8 +84,8 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
84
84
  * Requires a valid access token to be set.
85
85
  *
86
86
  * @param params - Optional query parameters for pagination
87
- * @param params.limit - Number of items to return (default: 20)
88
- * @param params.offset - Number of items to skip (default: 0)
87
+ * @param params.page - Page number (starts from 1, default: 1)
88
+ * @param params.page_size - Number of items per page (default: 20, max: 100)
89
89
  * @returns Promise resolving to paginated balances response
90
90
  * @throws {APIError} When the request fails or user is not authenticated
91
91
  *
@@ -98,8 +98,8 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
98
98
  * console.log(`${balance.symbol}: ${balance.available_balance}`);
99
99
  * });
100
100
  *
101
- * // Get next 50 balances with offset
102
- * const nextBalances = await profileAPI.getUserBalances({ limit: 50, offset: 20 });
101
+ * // Get page 2 with 50 items per page
102
+ * const nextBalances = await profileAPI.getUserBalances({ page: 2, page_size: 50 });
103
103
  * console.log(`Returned ${nextBalances.balances.length} balances`);
104
104
  * ```
105
105
  */
@@ -163,5 +163,29 @@ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
163
163
  * ```
164
164
  */
165
165
  getPortfolioChart(period: PortfolioPeriod, metric: PortfolioMetric): Promise<PortfolioChartResponse>;
166
+ /**
167
+ * Get the current user's trade history with pagination.
168
+ *
169
+ * Fetches the user's executed trades from the /api/v1/accounts/trades endpoint.
170
+ * Requires a valid access token to be set.
171
+ *
172
+ * @param params - Optional query parameters for pagination and filtering
173
+ * @param params.page - Page number (starts from 1, default: 1)
174
+ * @param params.page_size - Number of items per page (default: 20, max: 100)
175
+ * @param params.trading_pair_id - Filter by trading pair ID (UUID)
176
+ * @returns Promise resolving to paginated trades response
177
+ * @throws {ValidationError} When the provided params fail client-side validation
178
+ * @throws {APIError} When the request fails or user is not authenticated
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * // Get first page of trades
183
+ * const trades = await profileAPI.getUserTrades();
184
+ * console.log(`Total trades: ${trades.total}`);
185
+ *
186
+ * // Filter by trading pair
187
+ * const pairTrades = await profileAPI.getUserTrades({ trading_pair_id: "550e8400-e29b-41d4-a716-446655440000" });
188
+ * ```
189
+ */
190
+ getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
166
191
  }
167
- //# sourceMappingURL=api.d.ts.map
@@ -17,7 +17,7 @@
17
17
  * console.log(`User: ${profile.username} (${profile.address})`);
18
18
  * ```
19
19
  */
20
- import { GetUserMovementsSchema, validate } from "@0xmonaco/types";
20
+ import { GetUserMovementsSchema, GetUserTradesSchema, validate } from "@0xmonaco/types";
21
21
  import { APIError } from "../../errors";
22
22
  import { BaseAPI } from "../base";
23
23
  export class ProfileAPIImpl extends BaseAPI {
@@ -64,12 +64,12 @@ export class ProfileAPIImpl extends BaseAPI {
64
64
  *
65
65
  * @example
66
66
  * ```typescript
67
- * // Get first page with default limit (20)
67
+ * // Get first page with default page_size (20)
68
68
  * const movements = await profileAPI.getPaginatedUserMovements();
69
- * console.log(`Total movements: ${movements.total_count}`);
69
+ * console.log(`Total movements: ${movements.total}`);
70
70
  *
71
- * // Get second page with custom limit
72
- * const page2 = await profileAPI.getPaginatedUserMovements({ page: 2, limit: 50 });
71
+ * // Get second page with custom page_size
72
+ * const page2 = await profileAPI.getPaginatedUserMovements({ page: 2, page_size: 50 });
73
73
  * console.log(`Page ${page2.page} of ${page2.total_pages}`);
74
74
  *
75
75
  * // Filter by entry type and transaction type
@@ -87,8 +87,8 @@ export class ProfileAPIImpl extends BaseAPI {
87
87
  if (params?.page !== undefined) {
88
88
  searchParams.append("page", params.page.toString());
89
89
  }
90
- if (params?.limit !== undefined) {
91
- searchParams.append("limit", params.limit.toString());
90
+ if (params?.page_size !== undefined) {
91
+ searchParams.append("page_size", params.page_size.toString());
92
92
  }
93
93
  if (params?.entry_type !== undefined) {
94
94
  searchParams.append("entry_type", params.entry_type);
@@ -110,8 +110,8 @@ export class ProfileAPIImpl extends BaseAPI {
110
110
  * Requires a valid access token to be set.
111
111
  *
112
112
  * @param params - Optional query parameters for pagination
113
- * @param params.limit - Number of items to return (default: 20)
114
- * @param params.offset - Number of items to skip (default: 0)
113
+ * @param params.page - Page number (starts from 1, default: 1)
114
+ * @param params.page_size - Number of items per page (default: 20, max: 100)
115
115
  * @returns Promise resolving to paginated balances response
116
116
  * @throws {APIError} When the request fails or user is not authenticated
117
117
  *
@@ -124,18 +124,18 @@ export class ProfileAPIImpl extends BaseAPI {
124
124
  * console.log(`${balance.symbol}: ${balance.available_balance}`);
125
125
  * });
126
126
  *
127
- * // Get next 50 balances with offset
128
- * const nextBalances = await profileAPI.getUserBalances({ limit: 50, offset: 20 });
127
+ * // Get page 2 with 50 items per page
128
+ * const nextBalances = await profileAPI.getUserBalances({ page: 2, page_size: 50 });
129
129
  * console.log(`Returned ${nextBalances.balances.length} balances`);
130
130
  * ```
131
131
  */
132
132
  async getUserBalances(params) {
133
133
  const searchParams = new URLSearchParams();
134
- if (params?.limit !== undefined) {
135
- searchParams.append("limit", params.limit.toString());
134
+ if (params?.page !== undefined) {
135
+ searchParams.append("page", params.page.toString());
136
136
  }
137
- if (params?.offset !== undefined) {
138
- searchParams.append("offset", params.offset.toString());
137
+ if (params?.page_size !== undefined) {
138
+ searchParams.append("page_size", params.page_size.toString());
139
139
  }
140
140
  const queryString = searchParams.toString();
141
141
  const url = queryString ? `/api/v1/accounts/balances?${queryString}` : "/api/v1/accounts/balances";
@@ -188,7 +188,8 @@ export class ProfileAPIImpl extends BaseAPI {
188
188
  * ```
189
189
  */
190
190
  async getPortfolioStats(period) {
191
- return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio?period=${period}`);
191
+ const searchParams = new URLSearchParams({ period });
192
+ return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio?${searchParams}`);
192
193
  }
193
194
  /**
194
195
  * Get the current user's portfolio chart time series for a given period and metric.
@@ -210,7 +211,49 @@ export class ProfileAPIImpl extends BaseAPI {
210
211
  * ```
211
212
  */
212
213
  async getPortfolioChart(period, metric) {
213
- return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio/chart?period=${period}&metric=${metric}`);
214
+ const searchParams = new URLSearchParams({ period, metric });
215
+ return await this.makeAuthenticatedRequest(`/api/v1/accounts/me/portfolio/chart?${searchParams}`);
216
+ }
217
+ /**
218
+ * Get the current user's trade history with pagination.
219
+ *
220
+ * Fetches the user's executed trades from the /api/v1/accounts/trades endpoint.
221
+ * Requires a valid access token to be set.
222
+ *
223
+ * @param params - Optional query parameters for pagination and filtering
224
+ * @param params.page - Page number (starts from 1, default: 1)
225
+ * @param params.page_size - Number of items per page (default: 20, max: 100)
226
+ * @param params.trading_pair_id - Filter by trading pair ID (UUID)
227
+ * @returns Promise resolving to paginated trades response
228
+ * @throws {ValidationError} When the provided params fail client-side validation
229
+ * @throws {APIError} When the request fails or user is not authenticated
230
+ *
231
+ * @example
232
+ * ```typescript
233
+ * // Get first page of trades
234
+ * const trades = await profileAPI.getUserTrades();
235
+ * console.log(`Total trades: ${trades.total}`);
236
+ *
237
+ * // Filter by trading pair
238
+ * const pairTrades = await profileAPI.getUserTrades({ trading_pair_id: "550e8400-e29b-41d4-a716-446655440000" });
239
+ * ```
240
+ */
241
+ async getUserTrades(params) {
242
+ if (params) {
243
+ validate(GetUserTradesSchema, params);
244
+ }
245
+ const searchParams = new URLSearchParams();
246
+ if (params?.page !== undefined) {
247
+ searchParams.append("page", params.page.toString());
248
+ }
249
+ if (params?.page_size !== undefined) {
250
+ searchParams.append("page_size", params.page_size.toString());
251
+ }
252
+ if (params?.trading_pair_id !== undefined) {
253
+ searchParams.append("trading_pair_id", params.trading_pair_id);
254
+ }
255
+ const queryString = searchParams.toString();
256
+ const url = queryString ? `/api/v1/accounts/trades?${queryString}` : "/api/v1/accounts/trades";
257
+ return await this.makeAuthenticatedRequest(url);
214
258
  }
215
259
  }
216
- //# sourceMappingURL=api.js.map
@@ -4,4 +4,3 @@
4
4
  * Exports the ProfileAPI implementation for user profile operations.
5
5
  */
6
6
  export * from "./api";
7
- //# sourceMappingURL=index.d.ts.map
@@ -4,4 +4,3 @@
4
4
  * Exports the ProfileAPI implementation for user profile operations.
5
5
  */
6
6
  export * from "./api";
7
- //# sourceMappingURL=index.js.map
@@ -5,7 +5,7 @@ import { BaseAPI } from "../base";
5
5
  */
6
6
  interface RawTradeEvent {
7
7
  event_type: string;
8
- pair_id: string;
8
+ trading_pair_id: string;
9
9
  trading_mode: string;
10
10
  data: {
11
11
  trade_id: string;
@@ -23,10 +23,10 @@ export declare function parseRawTradeEvent(raw: RawTradeEvent): TradeEvent;
23
23
  * Options for fetching trades
24
24
  */
25
25
  export interface GetTradesOptions {
26
- /** Number of records to skip (default: 0) */
27
- skip?: number;
26
+ /** Page number (starts from 1, default: 1) */
27
+ page?: number;
28
28
  /** Maximum number of records to return (default: 25, max: 100) */
29
- limit?: number;
29
+ page_size?: number;
30
30
  }
31
31
  /**
32
32
  * Trades API for fetching historical trade data
@@ -42,4 +42,3 @@ export declare class TradesAPIImpl extends BaseAPI {
42
42
  getTrades(tradingPairId: string, options?: GetTradesOptions): Promise<TradeEvent[]>;
43
43
  }
44
44
  export {};
45
- //# sourceMappingURL=api.d.ts.map
@@ -5,7 +5,7 @@ import { BaseAPI } from "../base";
5
5
  export function parseRawTradeEvent(raw) {
6
6
  return {
7
7
  eventType: "trade",
8
- tradingPairId: raw.pair_id,
8
+ tradingPairId: raw.trading_pair_id,
9
9
  tradingMode: raw.trading_mode.toUpperCase(),
10
10
  data: {
11
11
  tradeId: raw.data.trade_id,
@@ -28,16 +28,15 @@ export class TradesAPIImpl extends BaseAPI {
28
28
  * @returns Array of TradeEvent records sorted by executed_at descending (newest first)
29
29
  */
30
30
  async getTrades(tradingPairId, options = {}) {
31
- const { skip = 0 } = options;
32
- // Ensure limit is a positive number between 1 and 100, defaulting to 25
33
- const limit = options.limit != null && options.limit > 0 ? Math.min(options.limit, 100) : 25;
31
+ const { page = 1 } = options;
32
+ // Ensure page_size is a positive number between 1 and 100, defaulting to 25
33
+ const page_size = options.page_size != null && options.page_size > 0 ? Math.min(options.page_size, 100) : 25;
34
34
  const params = new URLSearchParams();
35
- if (skip > 0) {
36
- params.set("skip", String(skip));
35
+ if (page > 1) {
36
+ params.set("page", String(page));
37
37
  }
38
- params.set("limit", String(limit));
38
+ params.set("page_size", String(page_size));
39
39
  const response = await this.makePublicRequest(`/api/v1/trades/${encodeURIComponent(tradingPairId)}?${params.toString()}`);
40
- return response.data.trades.map(parseRawTradeEvent);
40
+ return response.trades.map(parseRawTradeEvent);
41
41
  }
42
42
  }
43
- //# sourceMappingURL=api.js.map
@@ -1,2 +1 @@
1
1
  export * from "./api";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export * from "./api";
2
- //# sourceMappingURL=index.js.map
@@ -242,7 +242,7 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
242
242
  *
243
243
  * @param params - Query parameters for filtering orders
244
244
  * @param params.status - Filter by order status (e.g., "SUBMITTED", "FILLED") (optional)
245
- * @param params.trading_pair - Filter by trading pair (e.g., "USDCo/MTK") (optional)
245
+ * @param params.trading_pair_id - Filter by trading pair UUID (optional)
246
246
  * @param params.page - Page number for pagination (defaults to 1, must be > 0)
247
247
  * @param params.page_size - Number of orders per page (defaults to 10, max 100, must be > 0)
248
248
  * @returns Promise resolving to GetPaginatedOrdersResponse with orders and pagination info
@@ -253,7 +253,7 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
253
253
  * // Get submitted orders for a specific trading pair with custom pagination
254
254
  * const orders = await tradingAPI.getPaginatedOrders({
255
255
  * status: "SUBMITTED",
256
- * trading_pair: "USDCo/MTK",
256
+ * trading_pair_id: "456e7890-e12b-12d3-a456-426614174000",
257
257
  * page: 1,
258
258
  * page_size: 20
259
259
  * });
@@ -284,4 +284,3 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
284
284
  */
285
285
  getOrder(orderId: string): Promise<GetOrderResponse>;
286
286
  }
287
- //# sourceMappingURL=api.d.ts.map