@0xmonaco/core 0.0.0-develop-20260120180031

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 +693 -0
  2. package/dist/api/applications/api.d.ts +44 -0
  3. package/dist/api/applications/api.d.ts.map +1 -0
  4. package/dist/api/applications/api.js +54 -0
  5. package/dist/api/applications/api.js.map +1 -0
  6. package/dist/api/applications/index.d.ts +5 -0
  7. package/dist/api/applications/index.d.ts.map +1 -0
  8. package/dist/api/applications/index.js +5 -0
  9. package/dist/api/applications/index.js.map +1 -0
  10. package/dist/api/auth/api.d.ts +201 -0
  11. package/dist/api/auth/api.d.ts.map +1 -0
  12. package/dist/api/auth/api.js +293 -0
  13. package/dist/api/auth/api.js.map +1 -0
  14. package/dist/api/auth/index.d.ts +5 -0
  15. package/dist/api/auth/index.d.ts.map +1 -0
  16. package/dist/api/auth/index.js +5 -0
  17. package/dist/api/auth/index.js.map +1 -0
  18. package/dist/api/base.d.ts +124 -0
  19. package/dist/api/base.d.ts.map +1 -0
  20. package/dist/api/base.js +284 -0
  21. package/dist/api/base.js.map +1 -0
  22. package/dist/api/fees/api.d.ts +71 -0
  23. package/dist/api/fees/api.d.ts.map +1 -0
  24. package/dist/api/fees/api.js +83 -0
  25. package/dist/api/fees/api.js.map +1 -0
  26. package/dist/api/fees/index.d.ts +7 -0
  27. package/dist/api/fees/index.d.ts.map +1 -0
  28. package/dist/api/fees/index.js +7 -0
  29. package/dist/api/fees/index.js.map +1 -0
  30. package/dist/api/index.d.ts +16 -0
  31. package/dist/api/index.d.ts.map +1 -0
  32. package/dist/api/index.js +16 -0
  33. package/dist/api/index.js.map +1 -0
  34. package/dist/api/market/api.d.ts +14 -0
  35. package/dist/api/market/api.d.ts.map +1 -0
  36. package/dist/api/market/api.js +70 -0
  37. package/dist/api/market/api.js.map +1 -0
  38. package/dist/api/market/index.d.ts +2 -0
  39. package/dist/api/market/index.d.ts.map +1 -0
  40. package/dist/api/market/index.js +2 -0
  41. package/dist/api/market/index.js.map +1 -0
  42. package/dist/api/orderbook/api.d.ts +16 -0
  43. package/dist/api/orderbook/api.d.ts.map +1 -0
  44. package/dist/api/orderbook/api.js +38 -0
  45. package/dist/api/orderbook/api.js.map +1 -0
  46. package/dist/api/orderbook/index.d.ts +2 -0
  47. package/dist/api/orderbook/index.d.ts.map +1 -0
  48. package/dist/api/orderbook/index.js +2 -0
  49. package/dist/api/orderbook/index.js.map +1 -0
  50. package/dist/api/profile/api.d.ts +119 -0
  51. package/dist/api/profile/api.d.ts.map +1 -0
  52. package/dist/api/profile/api.js +162 -0
  53. package/dist/api/profile/api.js.map +1 -0
  54. package/dist/api/profile/index.d.ts +7 -0
  55. package/dist/api/profile/index.d.ts.map +1 -0
  56. package/dist/api/profile/index.js +7 -0
  57. package/dist/api/profile/index.js.map +1 -0
  58. package/dist/api/trades/api.d.ts +45 -0
  59. package/dist/api/trades/api.d.ts.map +1 -0
  60. package/dist/api/trades/api.js +43 -0
  61. package/dist/api/trades/api.js.map +1 -0
  62. package/dist/api/trades/index.d.ts +2 -0
  63. package/dist/api/trades/index.d.ts.map +1 -0
  64. package/dist/api/trades/index.js +2 -0
  65. package/dist/api/trades/index.js.map +1 -0
  66. package/dist/api/trading/api.d.ts +213 -0
  67. package/dist/api/trading/api.d.ts.map +1 -0
  68. package/dist/api/trading/api.js +285 -0
  69. package/dist/api/trading/api.js.map +1 -0
  70. package/dist/api/trading/index.d.ts +5 -0
  71. package/dist/api/trading/index.d.ts.map +1 -0
  72. package/dist/api/trading/index.js +5 -0
  73. package/dist/api/trading/index.js.map +1 -0
  74. package/dist/api/vault/api.d.ts +257 -0
  75. package/dist/api/vault/api.d.ts.map +1 -0
  76. package/dist/api/vault/api.js +526 -0
  77. package/dist/api/vault/api.js.map +1 -0
  78. package/dist/api/vault/index.d.ts +5 -0
  79. package/dist/api/vault/index.d.ts.map +1 -0
  80. package/dist/api/vault/index.js +5 -0
  81. package/dist/api/vault/index.js.map +1 -0
  82. package/dist/api/websocket/index.d.ts +4 -0
  83. package/dist/api/websocket/index.d.ts.map +1 -0
  84. package/dist/api/websocket/index.js +4 -0
  85. package/dist/api/websocket/index.js.map +1 -0
  86. package/dist/api/websocket/types.d.ts +36 -0
  87. package/dist/api/websocket/types.d.ts.map +1 -0
  88. package/dist/api/websocket/types.js +2 -0
  89. package/dist/api/websocket/types.js.map +1 -0
  90. package/dist/api/websocket/utils.d.ts +9 -0
  91. package/dist/api/websocket/utils.d.ts.map +1 -0
  92. package/dist/api/websocket/utils.js +23 -0
  93. package/dist/api/websocket/utils.js.map +1 -0
  94. package/dist/api/websocket/websocket.d.ts +6 -0
  95. package/dist/api/websocket/websocket.d.ts.map +1 -0
  96. package/dist/api/websocket/websocket.js +345 -0
  97. package/dist/api/websocket/websocket.js.map +1 -0
  98. package/dist/errors/errors.d.ts +382 -0
  99. package/dist/errors/errors.d.ts.map +1 -0
  100. package/dist/errors/errors.js +801 -0
  101. package/dist/errors/errors.js.map +1 -0
  102. package/dist/errors/index.d.ts +2 -0
  103. package/dist/errors/index.d.ts.map +1 -0
  104. package/dist/errors/index.js +2 -0
  105. package/dist/errors/index.js.map +1 -0
  106. package/dist/index.d.ts +6 -0
  107. package/dist/index.d.ts.map +1 -0
  108. package/dist/index.js +6 -0
  109. package/dist/index.js.map +1 -0
  110. package/dist/networks/index.d.ts +2 -0
  111. package/dist/networks/index.d.ts.map +1 -0
  112. package/dist/networks/index.js +2 -0
  113. package/dist/networks/index.js.map +1 -0
  114. package/dist/networks/networks.d.ts +15 -0
  115. package/dist/networks/networks.d.ts.map +1 -0
  116. package/dist/networks/networks.js +34 -0
  117. package/dist/networks/networks.js.map +1 -0
  118. package/dist/sdk.d.ts +128 -0
  119. package/dist/sdk.d.ts.map +1 -0
  120. package/dist/sdk.js +272 -0
  121. package/dist/sdk.js.map +1 -0
  122. package/dist/utils/index.d.ts +2 -0
  123. package/dist/utils/index.d.ts.map +1 -0
  124. package/dist/utils/index.js +2 -0
  125. package/dist/utils/index.js.map +1 -0
  126. package/dist/utils/magnitude.d.ts +27 -0
  127. package/dist/utils/magnitude.d.ts.map +1 -0
  128. package/dist/utils/magnitude.js +32 -0
  129. package/dist/utils/magnitude.js.map +1 -0
  130. package/package.json +49 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/market/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EAEX,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,QAAQ,EACR,SAAS,EACT,cAAc,EACd,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,OAAQ,YAAW,SAAS;IACvD,wBAAwB,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IA4B1F,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAMxE,eAAe,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAgClH,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAMxE"}
@@ -0,0 +1,70 @@
1
+ import { GetCandlesticksByPairIdSchema, GetMarketMetadataSchema, validate } from "@0xmonaco/types";
2
+ import { BaseAPI } from "../base";
3
+ /**
4
+ * Market API Implementation
5
+ *
6
+ * Provides read-only market metadata endpoints such as trading pair listings.
7
+ */
8
+ export class MarketAPIImpl extends BaseAPI {
9
+ async getPaginatedTradingPairs(params) {
10
+ const searchParams = new URLSearchParams();
11
+ if (params?.page !== undefined) {
12
+ searchParams.append("page", params.page.toString());
13
+ }
14
+ if (params?.limit !== undefined) {
15
+ searchParams.append("limit", params.limit.toString());
16
+ }
17
+ if (params?.market_type) {
18
+ searchParams.append("market_type", params.market_type);
19
+ }
20
+ if (params?.base_token) {
21
+ searchParams.append("base_token", params.base_token);
22
+ }
23
+ if (params?.quote_token) {
24
+ searchParams.append("quote_token", params.quote_token);
25
+ }
26
+ if (params?.is_active !== undefined) {
27
+ searchParams.append("is_active", params.is_active.toString());
28
+ }
29
+ const queryString = searchParams.toString();
30
+ const url = queryString ? `/api/v1/market/pairs?${queryString}` : "/api/v1/market/pairs";
31
+ return await this.makePublicRequest(url);
32
+ }
33
+ async getTradingPairBySymbol(symbol) {
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);
37
+ }
38
+ async getCandlesticks(tradingPairId, interval, params) {
39
+ // Validate inputs using the trading pair ID schema
40
+ validate(GetCandlesticksByPairIdSchema, {
41
+ tradingPairId,
42
+ interval,
43
+ startTime: params?.startTime,
44
+ endTime: params?.endTime,
45
+ limit: params?.limit,
46
+ });
47
+ const searchParams = new URLSearchParams();
48
+ if (params?.startTime !== undefined) {
49
+ searchParams.append("start_time", params.startTime.toString());
50
+ }
51
+ if (params?.endTime !== undefined) {
52
+ searchParams.append("end_time", params.endTime.toString());
53
+ }
54
+ if (params?.limit !== undefined) {
55
+ searchParams.append("limit", params.limit.toString());
56
+ }
57
+ const queryString = searchParams.toString();
58
+ const url = queryString
59
+ ? `/api/v1/market/pairs/charts/candlestick/${encodeURIComponent(tradingPairId)}/${interval}?${queryString}`
60
+ : `/api/v1/market/pairs/charts/candlestick/${encodeURIComponent(tradingPairId)}/${interval}`;
61
+ const response = await this.makePublicRequest(url);
62
+ return response.data || [];
63
+ }
64
+ async getMarketMetadata(tradingPairId) {
65
+ validate(GetMarketMetadataSchema, { tradingPairId });
66
+ const url = `/api/v1/market/pairs/${tradingPairId}/metadata`;
67
+ return await this.makePublicRequest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,YAAY,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,WAAW,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC5C,MAAM,GAAG,GAAG,WAAW;YACrB,CAAC,CAAC,2CAA2C,kBAAkB,CAAC,aAAa,CAAC,IAAI,QAAQ,IAAI,WAAW,EAAE;YAC3G,CAAC,CAAC,2CAA2C,kBAAkB,CAAC,aAAa,CAAC,IAAI,QAAQ,EAAE,CAAC;QAE/F,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAyB,GAAG,CAAC,CAAC;QAE3E,OAAO,QAAQ,CAAC,IAAI,IAAI,EAAE,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,aAAqB;QAC3C,QAAQ,CAAC,uBAAuB,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC;QAErD,MAAM,GAAG,GAAG,wBAAwB,aAAa,WAAW,CAAC;QAC7D,OAAO,MAAM,IAAI,CAAC,iBAAiB,CAAiB,GAAG,CAAC,CAAC;IAC3D,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export { MarketAPIImpl } from "./api";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/market/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { MarketAPIImpl } from "./api";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/market/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { OrderbookEvent, OrderbookQuotationMode, TradingMode } from "@0xmonaco/types";
2
+ import { BaseAPI } from "../base";
3
+ export interface GetOrderbookOptions {
4
+ /** Number of price levels to return (max 100). Defaults to 10. */
5
+ depth?: number;
6
+ /** Trading mode: 'Spot' or 'Margin'. Defaults to 'Spot'. */
7
+ tradingMode?: TradingMode;
8
+ /** Price grouping magnitude. Valid values: 0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000. */
9
+ magnitude?: number;
10
+ /** Quantity denomination: 'BASE' or 'QUOTE'. When 'QUOTE', quantities are multiplied by price. */
11
+ denomination?: OrderbookQuotationMode;
12
+ }
13
+ export declare class OrderbookAPIImpl extends BaseAPI {
14
+ getOrderbook(tradingPairId: string, options?: GetOrderbookOptions): Promise<OrderbookEvent>;
15
+ }
16
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/orderbook/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAmBlC,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4DAA4D;IAC5D,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iGAAiG;IACjG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC;AAED,qBAAa,gBAAiB,SAAQ,OAAO;IACrC,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,cAAc,CAAC;CAkCtG"}
@@ -0,0 +1,38 @@
1
+ import { BaseAPI } from "../base";
2
+ export class OrderbookAPIImpl extends BaseAPI {
3
+ async getOrderbook(tradingPairId, options = {}) {
4
+ const { depth = 10, tradingMode, magnitude, denomination } = options;
5
+ const params = new URLSearchParams();
6
+ params.set("levels", String(depth));
7
+ if (tradingMode)
8
+ params.set("trading_mode", tradingMode);
9
+ if (magnitude !== undefined)
10
+ params.set("magnitude", String(magnitude));
11
+ if (denomination)
12
+ params.set("denomination", denomination.toLowerCase());
13
+ const response = await this.makePublicRequest(`/api/v1/orderbook/${encodeURIComponent(tradingPairId)}?${params.toString()}`);
14
+ return {
15
+ tradingPairId: response.pair,
16
+ tradingMode: response.trading_mode,
17
+ bids: response.data.bids.map((level) => ({
18
+ price: level.price,
19
+ quantity: level.quantity,
20
+ orderCount: level.order_count,
21
+ })),
22
+ asks: response.data.asks.map((level) => ({
23
+ price: level.price,
24
+ quantity: level.quantity,
25
+ orderCount: level.order_count,
26
+ })),
27
+ bestBid: response.data.best_bid,
28
+ bestAsk: response.data.best_ask,
29
+ bidVolume: response.data.bid_volume,
30
+ askVolume: response.data.ask_volume,
31
+ baseDecimals: response.base_decimals,
32
+ quoteDecimals: response.quote_decimals,
33
+ timestamp: response.timestamp,
34
+ sequence: response.sequence_number,
35
+ };
36
+ }
37
+ }
38
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/api/orderbook/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA8BlC,MAAM,OAAO,gBAAiB,SAAQ,OAAO;IAC3C,KAAK,CAAC,YAAY,CAAC,aAAqB,EAAE,UAA+B,EAAE;QACzE,MAAM,EAAE,KAAK,GAAG,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;QAErE,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACpC,IAAI,WAAW;YAAE,MAAM,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;QACzD,IAA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AE,QAAQ,CAAC,eAAe;SACnC,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export { type GetOrderbookOptions, OrderbookAPIImpl } from "./api";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/orderbook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { OrderbookAPIImpl } from "./api";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/orderbook/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,gBAAgB,EAAE,MAAM,OAAO,CAAC"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Profile API Implementation
3
+ *
4
+ * Handles user profile operations including fetching profile information.
5
+ * All operations use JWT authentication and go through the API Gateway.
6
+ *
7
+ * This class provides a complete interface for profile operations on the Monaco protocol,
8
+ * including fetching user profile data from the /api/v1/accounts/me endpoint.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const profileAPI = new ProfileAPIImpl(apiUrl);
13
+ * profileAPI.setAccessToken(jwtToken);
14
+ *
15
+ * // Get user profile
16
+ * const profile = await profileAPI.getProfile();
17
+ * console.log(`User: ${profile.username} (${profile.address})`);
18
+ * ```
19
+ */
20
+ import type { AccountBalance, GetPaginatedUserMovementsResponse, GetUserBalancesParams, GetUserBalancesResponse, GetUserMovementsParams, ProfileAPI, UserProfile } from "@0xmonaco/types";
21
+ import { BaseAPI } from "../base";
22
+ export declare class ProfileAPIImpl extends BaseAPI implements ProfileAPI {
23
+ /**
24
+ * Get the current user's profile information.
25
+ *
26
+ * Fetches the profile data for the authenticated user using the /api/v1/accounts/me endpoint.
27
+ * Requires a valid access token to be set.
28
+ *
29
+ * @returns Promise resolving to the user's profile information
30
+ * @throws {APIError} When the request fails or user is not authenticated
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Set access token first
35
+ * profileAPI.setAccessToken(authResult.accessToken);
36
+ *
37
+ * // Get profile
38
+ * const profile = await profileAPI.getProfile();
39
+ * console.log(`User ID: ${profile.id}`);
40
+ * console.log(`Address: ${profile.address}`);
41
+ * console.log(`Username: ${profile.username}`);
42
+ * console.log(`Account type: ${profile.account_type}`);
43
+ * console.log(`Can withdraw: ${profile.can_withdraw}`);
44
+ * ```
45
+ */
46
+ getProfile(): Promise<UserProfile>;
47
+ /**
48
+ * Get the current user's ledger movements (transaction history) with pagination.
49
+ *
50
+ * Fetches the user's transaction history from the /api/v1/accounts/movements endpoint.
51
+ * Requires a valid access token to be set.
52
+ *
53
+ * @param params - Optional query parameters for pagination
54
+ * @param params.page - Page number (starts from 1, default: 1)
55
+ * @param params.limit - Number of items per page (default: 20, max: 100)
56
+ * @returns Promise resolving to paginated movements response
57
+ * @throws {APIError} When the request fails or user is not authenticated
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * // Get first page with default limit (20)
62
+ * const movements = await profileAPI.getUserMovements();
63
+ * console.log(`Total movements: ${movements.total_count}`);
64
+ *
65
+ * // Get second page with custom limit
66
+ * const page2 = await profileAPI.getUserMovements({ page: 2, limit: 50 });
67
+ * console.log(`Page ${page2.page} of ${page2.total_pages}`);
68
+ * ```
69
+ */
70
+ getPaginatedUserMovements(params?: GetUserMovementsParams): Promise<GetPaginatedUserMovementsResponse>;
71
+ /**
72
+ * Get the current user's token balances with pagination.
73
+ *
74
+ * Fetches the user's token balances from the /api/v1/accounts/balances endpoint.
75
+ * Requires a valid access token to be set.
76
+ *
77
+ * @param params - Optional query parameters for pagination
78
+ * @param params.limit - Number of items to return (default: 20)
79
+ * @param params.offset - Number of items to skip (default: 0)
80
+ * @returns Promise resolving to paginated balances response
81
+ * @throws {APIError} When the request fails or user is not authenticated
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * // Get first 20 balances (default limit)
86
+ * const balances = await profileAPI.getUserBalances();
87
+ * console.log(`Total balances: ${balances.total}`);
88
+ * balances.balances.forEach(balance => {
89
+ * console.log(`${balance.symbol}: ${balance.available_balance}`);
90
+ * });
91
+ *
92
+ * // Get next 50 balances with offset
93
+ * const nextBalances = await profileAPI.getUserBalances({ limit: 50, offset: 20 });
94
+ * console.log(`Returned ${nextBalances.balances.length} balances`);
95
+ * ```
96
+ */
97
+ getUserBalances(params?: GetUserBalancesParams): Promise<GetUserBalancesResponse>;
98
+ /**
99
+ * Get the current user's balance for a specific asset.
100
+ *
101
+ * Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{asset_id} endpoint.
102
+ * Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
103
+ *
104
+ * @param assetId - The asset identifier (UUID)
105
+ * @returns Promise resolving to the account balance for the asset
106
+ * @throws {APIError} When the request fails, user is not authenticated, or asset not found (404)
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * // Get balance for a specific asset
111
+ * const balance = await profileAPI.getUserBalanceByAssetId('123e4567-e89b-12d3-a456-426614174000');
112
+ * console.log(`${balance.symbol}: ${balance.available_balance}`);
113
+ * console.log(`Locked: ${balance.locked_balance}`);
114
+ * console.log(`Total: ${balance.total_balance}`);
115
+ * ```
116
+ */
117
+ getUserBalanceByAssetId(assetId: string): Promise<AccountBalance>;
118
+ }
119
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/profile/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,iCAAiC,EACjC,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,UAAU,EACV,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,qBAAa,cAAe,SAAQ,OAAQ,YAAW,UAAU;IAC/D;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC;IAgBxC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,yBAAyB,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,iCAAiC,CAAC;IAgB5G;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,eAAe,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAgBvF;;;;;;;;;;;;;;;;;;OAkBG;IACG,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CASxE"}
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Profile API Implementation
3
+ *
4
+ * Handles user profile operations including fetching profile information.
5
+ * All operations use JWT authentication and go through the API Gateway.
6
+ *
7
+ * This class provides a complete interface for profile operations on the Monaco protocol,
8
+ * including fetching user profile data from the /api/v1/accounts/me endpoint.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const profileAPI = new ProfileAPIImpl(apiUrl);
13
+ * profileAPI.setAccessToken(jwtToken);
14
+ *
15
+ * // Get user profile
16
+ * const profile = await profileAPI.getProfile();
17
+ * console.log(`User: ${profile.username} (${profile.address})`);
18
+ * ```
19
+ */
20
+ import { APIError } from "../../errors";
21
+ import { BaseAPI } from "../base";
22
+ export class ProfileAPIImpl extends BaseAPI {
23
+ /**
24
+ * Get the current user's profile information.
25
+ *
26
+ * Fetches the profile data for the authenticated user using the /api/v1/accounts/me endpoint.
27
+ * Requires a valid access token to be set.
28
+ *
29
+ * @returns Promise resolving to the user's profile information
30
+ * @throws {APIError} When the request fails or user is not authenticated
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * // Set access token first
35
+ * profileAPI.setAccessToken(authResult.accessToken);
36
+ *
37
+ * // Get profile
38
+ * const profile = await profileAPI.getProfile();
39
+ * console.log(`User ID: ${profile.id}`);
40
+ * console.log(`Address: ${profile.address}`);
41
+ * console.log(`Username: ${profile.username}`);
42
+ * console.log(`Account type: ${profile.account_type}`);
43
+ * console.log(`Can withdraw: ${profile.can_withdraw}`);
44
+ * ```
45
+ */
46
+ async getProfile() {
47
+ const data = await this.makeAuthenticatedRequest("/api/v1/accounts/me");
48
+ return {
49
+ id: data.id,
50
+ address: data.address,
51
+ username: data.username,
52
+ account_type: data.account_type,
53
+ can_withdraw: data.can_withdraw,
54
+ created_at: data.created_at,
55
+ balances: data.balances || [],
56
+ recent_movements: data.recent_movements || [],
57
+ recent_orders: data.recent_orders || [],
58
+ };
59
+ }
60
+ /**
61
+ * Get the current user's ledger movements (transaction history) with pagination.
62
+ *
63
+ * Fetches the user's transaction history from the /api/v1/accounts/movements endpoint.
64
+ * Requires a valid access token to be set.
65
+ *
66
+ * @param params - Optional query parameters for pagination
67
+ * @param params.page - Page number (starts from 1, default: 1)
68
+ * @param params.limit - Number of items per page (default: 20, max: 100)
69
+ * @returns Promise resolving to paginated movements response
70
+ * @throws {APIError} When the request fails or user is not authenticated
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * // Get first page with default limit (20)
75
+ * const movements = await profileAPI.getUserMovements();
76
+ * console.log(`Total movements: ${movements.total_count}`);
77
+ *
78
+ * // Get second page with custom limit
79
+ * const page2 = await profileAPI.getUserMovements({ page: 2, limit: 50 });
80
+ * console.log(`Page ${page2.page} of ${page2.total_pages}`);
81
+ * ```
82
+ */
83
+ async getPaginatedUserMovements(params) {
84
+ const searchParams = new URLSearchParams();
85
+ if (params?.page !== undefined) {
86
+ searchParams.append("page", params.page.toString());
87
+ }
88
+ if (params?.limit !== undefined) {
89
+ searchParams.append("limit", params.limit.toString());
90
+ }
91
+ const queryString = searchParams.toString();
92
+ const url = queryString ? `/api/v1/accounts/movements?${queryString}` : "/api/v1/accounts/movements";
93
+ return await this.makeAuthenticatedRequest(url);
94
+ }
95
+ /**
96
+ * Get the current user's token balances with pagination.
97
+ *
98
+ * Fetches the user's token balances from the /api/v1/accounts/balances endpoint.
99
+ * Requires a valid access token to be set.
100
+ *
101
+ * @param params - Optional query parameters for pagination
102
+ * @param params.limit - Number of items to return (default: 20)
103
+ * @param params.offset - Number of items to skip (default: 0)
104
+ * @returns Promise resolving to paginated balances response
105
+ * @throws {APIError} When the request fails or user is not authenticated
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * // Get first 20 balances (default limit)
110
+ * const balances = await profileAPI.getUserBalances();
111
+ * console.log(`Total balances: ${balances.total}`);
112
+ * balances.balances.forEach(balance => {
113
+ * console.log(`${balance.symbol}: ${balance.available_balance}`);
114
+ * });
115
+ *
116
+ * // Get next 50 balances with offset
117
+ * const nextBalances = await profileAPI.getUserBalances({ limit: 50, offset: 20 });
118
+ * console.log(`Returned ${nextBalances.balances.length} balances`);
119
+ * ```
120
+ */
121
+ async getUserBalances(params) {
122
+ const searchParams = new URLSearchParams();
123
+ if (params?.limit !== undefined) {
124
+ searchParams.append("limit", params.limit.toString());
125
+ }
126
+ if (params?.offset !== undefined) {
127
+ searchParams.append("offset", params.offset.toString());
128
+ }
129
+ const queryString = searchParams.toString();
130
+ const url = queryString ? `/api/v1/accounts/balances?${queryString}` : "/api/v1/accounts/balances";
131
+ return await this.makeAuthenticatedRequest(url);
132
+ }
133
+ /**
134
+ * Get the current user's balance for a specific asset.
135
+ *
136
+ * Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{asset_id} endpoint.
137
+ * Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
138
+ *
139
+ * @param assetId - The asset identifier (UUID)
140
+ * @returns Promise resolving to the account balance for the asset
141
+ * @throws {APIError} When the request fails, user is not authenticated, or asset not found (404)
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * // Get balance for a specific asset
146
+ * const balance = await profileAPI.getUserBalanceByAssetId('123e4567-e89b-12d3-a456-426614174000');
147
+ * console.log(`${balance.symbol}: ${balance.available_balance}`);
148
+ * console.log(`Locked: ${balance.locked_balance}`);
149
+ * console.log(`Total: ${balance.total_balance}`);
150
+ * ```
151
+ */
152
+ async getUserBalanceByAssetId(assetId) {
153
+ if (!assetId || assetId.trim() === "") {
154
+ throw new APIError("assetId is required and cannot be empty", {
155
+ endpoint: "/api/v1/accounts/balances/{asset_id}",
156
+ });
157
+ }
158
+ const url = `/api/v1/accounts/balances/${assetId}`;
159
+ return await this.makeAuthenticatedRequest(url);
160
+ }
161
+ }
162
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/api/profile/api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,OAAO,cAAe,SAAQ,OAAO;IACzC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAc,qBAAqB,CAAC,CAAC;QAErF,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,EAAE;YAC7B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,EAAE;YAC7C,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,EAAE;SACxC,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,yBAAyB,CAAC,MAA+B;QAC7D,MAAM,YAAY,GAAG,IAAI,eAAe,EAAE,CAAC;QAE3C,IAAI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;;;;;;OAkBG;IACH,KAAK,CAAC,uBAAuB,CAAC,OAAe;QAC3C,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;YACtC,MAAM,IAAI,QAAQ,CAAC,yCAAyC,EAAE;gBAC5D,QAAQ,EAAE,sCAAsC;aACjD,CAAC,CAAC;QACL,CAAC;QACD,MAAM,GAAG,GAAG,6BAA6B,OAAO,EAAE,CAAC;QACnD,OAAO,MAAM,IAAI,CAAC,wBAAwB,CAAiB,GAAG,CAAC,CAAC;IAClE,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Profile API Module
3
+ *
4
+ * Exports the ProfileAPI implementation for user profile operations.
5
+ */
6
+ export * from "./api";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/profile/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,OAAO,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Profile API Module
3
+ *
4
+ * Exports the ProfileAPI implementation for user profile operations.
5
+ */
6
+ export * from "./api";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/profile/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,OAAO,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { TradeEvent } from "@0xmonaco/types";
2
+ import { BaseAPI } from "../base";
3
+ /**
4
+ * Raw trade event from the API (snake_case) - matches websocket structure
5
+ */
6
+ interface RawTradeEvent {
7
+ event_type: string;
8
+ pair_id: string;
9
+ trading_mode: string;
10
+ data: {
11
+ trade_id: string;
12
+ price: string;
13
+ quantity: string;
14
+ maker_side: string;
15
+ executed_at: string;
16
+ };
17
+ }
18
+ /**
19
+ * Convert a raw trade event (snake_case) to a TradeEvent (camelCase)
20
+ */
21
+ export declare function parseRawTradeEvent(raw: RawTradeEvent): TradeEvent;
22
+ /**
23
+ * Options for fetching trades
24
+ */
25
+ export interface GetTradesOptions {
26
+ /** Number of records to skip (default: 0) */
27
+ skip?: number;
28
+ /** Maximum number of records to return (default: 25, max: 100) */
29
+ limit?: number;
30
+ }
31
+ /**
32
+ * Trades API for fetching historical trade data
33
+ */
34
+ export declare class TradesAPIImpl extends BaseAPI {
35
+ /**
36
+ * Get historical trades for a trading pair
37
+ *
38
+ * @param tradingPairId - The trading pair UUID
39
+ * @param options - Pagination options
40
+ * @returns Array of TradeEvent records sorted by executed_at descending (newest first)
41
+ */
42
+ getTrades(tradingPairId: string, options?: GetTradesOptions): Promise<TradeEvent[]>;
43
+ }
44
+ export {};
45
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/api/trades/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;GAEG;AACH,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAcD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,aAAa,GAAG,UAAU,CAajE;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,OAAO;IACxC;;;;;;OAMG;IACG,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CAe9F"}
@@ -0,0 +1,43 @@
1
+ import { BaseAPI } from "../base";
2
+ /**
3
+ * Convert a raw trade event (snake_case) to a TradeEvent (camelCase)
4
+ */
5
+ export function parseRawTradeEvent(raw) {
6
+ return {
7
+ eventType: "trade",
8
+ tradingPairId: raw.pair_id,
9
+ tradingMode: raw.trading_mode.toUpperCase(),
10
+ data: {
11
+ tradeId: raw.data.trade_id,
12
+ price: raw.data.price,
13
+ quantity: raw.data.quantity,
14
+ makerSide: raw.data.maker_side.toUpperCase(),
15
+ executedAt: raw.data.executed_at,
16
+ },
17
+ };
18
+ }
19
+ /**
20
+ * Trades API for fetching historical trade data
21
+ */
22
+ export class TradesAPIImpl extends BaseAPI {
23
+ /**
24
+ * Get historical trades for a trading pair
25
+ *
26
+ * @param tradingPairId - The trading pair UUID
27
+ * @param options - Pagination options
28
+ * @returns Array of TradeEvent records sorted by executed_at descending (newest first)
29
+ */
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;
34
+ const params = new URLSearchParams();
35
+ if (skip > 0) {
36
+ params.set("skip", String(skip));
37
+ }
38
+ params.set("limit", String(limit));
39
+ const response = await this.makePublicRequest(`/api/v1/trades/${encodeURIComponent(tradingPairId)}?${params.toString()}`);
40
+ return response.data.trades.map(parseRawTradeEvent);
41
+ }
42
+ }
43
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/api/trades/api.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AA8BlC;;GAEG;AACH,MAA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,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAE7I,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACtD,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/trades/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/trades/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}