@lightconexyz/lightcone-sdk 0.1.0

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 (158) hide show
  1. package/README.md +232 -0
  2. package/dist/api/client.d.ts +225 -0
  3. package/dist/api/client.d.ts.map +1 -0
  4. package/dist/api/client.js +452 -0
  5. package/dist/api/client.js.map +1 -0
  6. package/dist/api/error.d.ts +58 -0
  7. package/dist/api/error.d.ts.map +1 -0
  8. package/dist/api/error.js +98 -0
  9. package/dist/api/error.js.map +1 -0
  10. package/dist/api/index.d.ts +23 -0
  11. package/dist/api/index.d.ts.map +1 -0
  12. package/dist/api/index.js +51 -0
  13. package/dist/api/index.js.map +1 -0
  14. package/dist/api/types/admin.d.ts +49 -0
  15. package/dist/api/types/admin.d.ts.map +1 -0
  16. package/dist/api/types/admin.js +13 -0
  17. package/dist/api/types/admin.js.map +1 -0
  18. package/dist/api/types/index.d.ts +14 -0
  19. package/dist/api/types/index.d.ts.map +1 -0
  20. package/dist/api/types/index.js +13 -0
  21. package/dist/api/types/index.js.map +1 -0
  22. package/dist/api/types/market.d.ts +186 -0
  23. package/dist/api/types/market.d.ts.map +1 -0
  24. package/dist/api/types/market.js +6 -0
  25. package/dist/api/types/market.js.map +1 -0
  26. package/dist/api/types/order.d.ts +190 -0
  27. package/dist/api/types/order.d.ts.map +1 -0
  28. package/dist/api/types/order.js +6 -0
  29. package/dist/api/types/order.js.map +1 -0
  30. package/dist/api/types/orderbook.d.ts +36 -0
  31. package/dist/api/types/orderbook.d.ts.map +1 -0
  32. package/dist/api/types/orderbook.js +6 -0
  33. package/dist/api/types/orderbook.js.map +1 -0
  34. package/dist/api/types/position.d.ts +60 -0
  35. package/dist/api/types/position.d.ts.map +1 -0
  36. package/dist/api/types/position.js +6 -0
  37. package/dist/api/types/position.js.map +1 -0
  38. package/dist/api/types/price_history.d.ts +68 -0
  39. package/dist/api/types/price_history.d.ts.map +1 -0
  40. package/dist/api/types/price_history.js +13 -0
  41. package/dist/api/types/price_history.js.map +1 -0
  42. package/dist/api/types/trade.d.ts +67 -0
  43. package/dist/api/types/trade.d.ts.map +1 -0
  44. package/dist/api/types/trade.js +13 -0
  45. package/dist/api/types/trade.js.map +1 -0
  46. package/dist/api/validation.d.ts +24 -0
  47. package/dist/api/validation.d.ts.map +1 -0
  48. package/dist/api/validation.js +53 -0
  49. package/dist/api/validation.js.map +1 -0
  50. package/dist/auth.d.ts +80 -0
  51. package/dist/auth.d.ts.map +1 -0
  52. package/dist/auth.js +149 -0
  53. package/dist/auth.js.map +1 -0
  54. package/dist/index.d.ts +55 -0
  55. package/dist/index.d.ts.map +1 -0
  56. package/dist/index.js +107 -0
  57. package/dist/index.js.map +1 -0
  58. package/dist/network.d.ts +5 -0
  59. package/dist/network.d.ts.map +1 -0
  60. package/dist/network.js +8 -0
  61. package/dist/network.js.map +1 -0
  62. package/dist/program/accounts.d.ts +98 -0
  63. package/dist/program/accounts.d.ts.map +1 -0
  64. package/dist/program/accounts.js +319 -0
  65. package/dist/program/accounts.js.map +1 -0
  66. package/dist/program/builder.d.ts +94 -0
  67. package/dist/program/builder.d.ts.map +1 -0
  68. package/dist/program/builder.js +175 -0
  69. package/dist/program/builder.js.map +1 -0
  70. package/dist/program/client.d.ts +56 -0
  71. package/dist/program/client.d.ts.map +1 -0
  72. package/dist/program/client.js +288 -0
  73. package/dist/program/client.js.map +1 -0
  74. package/dist/program/constants.d.ts +108 -0
  75. package/dist/program/constants.d.ts.map +1 -0
  76. package/dist/program/constants.js +112 -0
  77. package/dist/program/constants.js.map +1 -0
  78. package/dist/program/index.d.ts +14 -0
  79. package/dist/program/index.d.ts.map +1 -0
  80. package/dist/program/index.js +149 -0
  81. package/dist/program/index.js.map +1 -0
  82. package/dist/program/instructions.d.ts +248 -0
  83. package/dist/program/instructions.d.ts.map +1 -0
  84. package/dist/program/instructions.js +692 -0
  85. package/dist/program/instructions.js.map +1 -0
  86. package/dist/program/orders.d.ts +151 -0
  87. package/dist/program/orders.d.ts.map +1 -0
  88. package/dist/program/orders.js +417 -0
  89. package/dist/program/orders.js.map +1 -0
  90. package/dist/program/pda.d.ts +73 -0
  91. package/dist/program/pda.d.ts.map +1 -0
  92. package/dist/program/pda.js +131 -0
  93. package/dist/program/pda.js.map +1 -0
  94. package/dist/program/types.d.ts +380 -0
  95. package/dist/program/types.d.ts.map +1 -0
  96. package/dist/program/types.js +27 -0
  97. package/dist/program/types.js.map +1 -0
  98. package/dist/program/utils.d.ts +91 -0
  99. package/dist/program/utils.d.ts.map +1 -0
  100. package/dist/program/utils.js +219 -0
  101. package/dist/program/utils.js.map +1 -0
  102. package/dist/shared/index.d.ts +8 -0
  103. package/dist/shared/index.d.ts.map +1 -0
  104. package/dist/shared/index.js +18 -0
  105. package/dist/shared/index.js.map +1 -0
  106. package/dist/shared/price.d.ts +41 -0
  107. package/dist/shared/price.d.ts.map +1 -0
  108. package/dist/shared/price.js +57 -0
  109. package/dist/shared/price.js.map +1 -0
  110. package/dist/shared/scaling.d.ts +45 -0
  111. package/dist/shared/scaling.d.ts.map +1 -0
  112. package/dist/shared/scaling.js +84 -0
  113. package/dist/shared/scaling.js.map +1 -0
  114. package/dist/shared/types.d.ts +19 -0
  115. package/dist/shared/types.d.ts.map +1 -0
  116. package/dist/shared/types.js +23 -0
  117. package/dist/shared/types.js.map +1 -0
  118. package/dist/websocket/client.d.ts +238 -0
  119. package/dist/websocket/client.d.ts.map +1 -0
  120. package/dist/websocket/client.js +580 -0
  121. package/dist/websocket/client.js.map +1 -0
  122. package/dist/websocket/error.d.ts +47 -0
  123. package/dist/websocket/error.d.ts.map +1 -0
  124. package/dist/websocket/error.js +83 -0
  125. package/dist/websocket/error.js.map +1 -0
  126. package/dist/websocket/handlers.d.ts +97 -0
  127. package/dist/websocket/handlers.d.ts.map +1 -0
  128. package/dist/websocket/handlers.js +277 -0
  129. package/dist/websocket/handlers.js.map +1 -0
  130. package/dist/websocket/index.d.ts +38 -0
  131. package/dist/websocket/index.d.ts.map +1 -0
  132. package/dist/websocket/index.js +75 -0
  133. package/dist/websocket/index.js.map +1 -0
  134. package/dist/websocket/state/index.d.ts +7 -0
  135. package/dist/websocket/state/index.d.ts.map +1 -0
  136. package/dist/websocket/state/index.js +14 -0
  137. package/dist/websocket/state/index.js.map +1 -0
  138. package/dist/websocket/state/orderbook.d.ts +107 -0
  139. package/dist/websocket/state/orderbook.d.ts.map +1 -0
  140. package/dist/websocket/state/orderbook.js +293 -0
  141. package/dist/websocket/state/orderbook.js.map +1 -0
  142. package/dist/websocket/state/price.d.ts +108 -0
  143. package/dist/websocket/state/price.d.ts.map +1 -0
  144. package/dist/websocket/state/price.js +243 -0
  145. package/dist/websocket/state/price.js.map +1 -0
  146. package/dist/websocket/state/user.d.ts +83 -0
  147. package/dist/websocket/state/user.d.ts.map +1 -0
  148. package/dist/websocket/state/user.js +228 -0
  149. package/dist/websocket/state/user.js.map +1 -0
  150. package/dist/websocket/subscriptions.d.ts +143 -0
  151. package/dist/websocket/subscriptions.d.ts.map +1 -0
  152. package/dist/websocket/subscriptions.js +244 -0
  153. package/dist/websocket/subscriptions.js.map +1 -0
  154. package/dist/websocket/types.d.ts +417 -0
  155. package/dist/websocket/types.d.ts.map +1 -0
  156. package/dist/websocket/types.js +195 -0
  157. package/dist/websocket/types.js.map +1 -0
  158. package/package.json +75 -0
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Order-related types for the Lightcone REST API.
3
+ */
4
+ /**
5
+ * Order side enum.
6
+ */
7
+ export type ApiOrderSide = 0 | 1;
8
+ /**
9
+ * Order status values.
10
+ */
11
+ export type OrderStatusValue = "accepted" | "partial_fill" | "filled" | "rejected";
12
+ /**
13
+ * Fill information from order matching.
14
+ */
15
+ export interface Fill {
16
+ /** Counterparty address */
17
+ counterparty: string;
18
+ /** Counterparty's order hash */
19
+ counterparty_order_hash: string;
20
+ /** Amount filled as decimal string */
21
+ fill_amount: string;
22
+ /** Fill price as decimal string */
23
+ price: string;
24
+ /** Whether this order was the maker */
25
+ is_maker: boolean;
26
+ }
27
+ /**
28
+ * Request for POST /api/orders/submit.
29
+ */
30
+ export interface SubmitOrderRequest {
31
+ /** Order creator's pubkey (Base58) */
32
+ maker: string;
33
+ /** User's nonce for uniqueness (u32 as string) */
34
+ nonce: string;
35
+ /** Market address (Base58) */
36
+ market_pubkey: string;
37
+ /** Token being bought/sold (Base58) */
38
+ base_token: string;
39
+ /** Token used for payment (Base58) */
40
+ quote_token: string;
41
+ /** Order side (0=BID, 1=ASK) */
42
+ side: number;
43
+ /** Amount maker gives (u64 as string) */
44
+ maker_amount: string;
45
+ /** Amount maker wants to receive (u64 as string) */
46
+ taker_amount: string;
47
+ /** Unix timestamp, 0=no expiration */
48
+ expiration?: number;
49
+ /** Ed25519 signature (hex, 128 chars) */
50
+ signature: string;
51
+ /** Target orderbook */
52
+ orderbook_id: string;
53
+ }
54
+ /**
55
+ * Response for POST /api/orders/submit.
56
+ */
57
+ export interface OrderResponse {
58
+ /** Order hash (hex) */
59
+ order_hash: string;
60
+ /** Order status */
61
+ status: OrderStatusValue;
62
+ /** Remaining amount as decimal string */
63
+ remaining: string;
64
+ /** Filled amount as decimal string */
65
+ filled: string;
66
+ /** Fill details */
67
+ fills: Fill[];
68
+ }
69
+ /**
70
+ * Request for POST /api/orders/cancel.
71
+ */
72
+ export interface CancelOrderRequest {
73
+ /** Hash of order to cancel (hex) */
74
+ order_hash: string;
75
+ /** Must match order creator (Base58) */
76
+ maker: string;
77
+ /** Ed25519 signature over the order hash (hex, 128 chars) */
78
+ signature: string;
79
+ }
80
+ /**
81
+ * Response for POST /api/orders/cancel.
82
+ */
83
+ export interface CancelResponse {
84
+ /** Cancellation status */
85
+ status: string;
86
+ /** Order hash */
87
+ order_hash: string;
88
+ /** Remaining amount that was cancelled as decimal string */
89
+ remaining: string;
90
+ }
91
+ /**
92
+ * Request for POST /api/orders/cancel-all.
93
+ */
94
+ export interface CancelAllOrdersRequest {
95
+ /** User's public key (Base58) */
96
+ user_pubkey: string;
97
+ /** Limit to specific orderbook (empty = all) */
98
+ orderbook_id?: string;
99
+ /** Ed25519 signature over "cancel_all:{pubkey}:{timestamp}" (hex, 128 chars) */
100
+ signature: string;
101
+ /** Unix timestamp used in the signed message */
102
+ timestamp: number;
103
+ }
104
+ /**
105
+ * Response for POST /api/orders/cancel-all.
106
+ */
107
+ export interface CancelAllResponse {
108
+ /** Status (success) */
109
+ status: string;
110
+ /** User pubkey */
111
+ user_pubkey: string;
112
+ /** Orderbook ID if specified */
113
+ orderbook_id?: string;
114
+ /** List of cancelled order hashes */
115
+ cancelled_order_hashes: string[];
116
+ /** Count of cancelled orders */
117
+ count: number;
118
+ /** Human-readable message */
119
+ message: string;
120
+ }
121
+ /**
122
+ * User order from GET /api/users/orders.
123
+ */
124
+ export interface UserOrder {
125
+ /** Order hash */
126
+ order_hash: string;
127
+ /** Market pubkey */
128
+ market_pubkey: string;
129
+ /** Orderbook ID */
130
+ orderbook_id: string;
131
+ /** Order side (0=BID, 1=ASK) */
132
+ side: ApiOrderSide;
133
+ /** Maker amount as decimal string */
134
+ maker_amount: string;
135
+ /** Taker amount as decimal string */
136
+ taker_amount: string;
137
+ /** Remaining amount as decimal string */
138
+ remaining: string;
139
+ /** Filled amount as decimal string */
140
+ filled: string;
141
+ /** Order price as decimal string */
142
+ price: string;
143
+ /** Creation timestamp */
144
+ created_at: string;
145
+ /** Expiration timestamp */
146
+ expiration: number;
147
+ }
148
+ /**
149
+ * Request for POST /api/users/orders.
150
+ */
151
+ export interface GetUserOrdersRequest {
152
+ /** User's public key (Base58) */
153
+ user_pubkey: string;
154
+ }
155
+ /**
156
+ * Outcome balance in user orders response.
157
+ */
158
+ export interface UserOrderOutcomeBalance {
159
+ /** Outcome index */
160
+ outcome_index: number;
161
+ /** Conditional token address */
162
+ conditional_token: string;
163
+ /** Idle balance as decimal string */
164
+ idle: string;
165
+ /** Balance on order book as decimal string */
166
+ on_book: string;
167
+ }
168
+ /**
169
+ * User balance from GET /api/users/orders.
170
+ */
171
+ export interface UserBalance {
172
+ /** Market pubkey */
173
+ market_pubkey: string;
174
+ /** Deposit asset */
175
+ deposit_asset: string;
176
+ /** Outcome balances */
177
+ outcomes: UserOrderOutcomeBalance[];
178
+ }
179
+ /**
180
+ * Response for POST /api/users/orders.
181
+ */
182
+ export interface UserOrdersResponse {
183
+ /** User pubkey */
184
+ user_pubkey: string;
185
+ /** Open orders */
186
+ orders: UserOrder[];
187
+ /** User balances */
188
+ balances: UserBalance[];
189
+ }
190
+ //# sourceMappingURL=order.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.d.ts","sourceRoot":"","sources":["../../../src/api/types/order.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,CAAC;AAEjC;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnF;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,gCAAgC;IAChC,uBAAuB,EAAE,MAAM,CAAC;IAChC,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAC;IACrB,o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AC;IACpB,kBAAkB;IAClB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,oBAAoB;IACpB,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Order-related types for the Lightcone REST API.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=order.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order.js","sourceRoot":"","sources":["../../../src/api/types/order.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Order-related types for the Lightcone REST API.\n */\n\n/**\n * Order side enum.\n */\nexport type ApiOrderSide = 0 | 1;\n\n/**\n * Order status values.\n */\nexport type OrderStatusValue = \"accepted\" | \"partial_fill\" | \"filled\" | \"rejected\";\n\n/**\n * Fill information from order matching.\n */\nexport interface Fill {\n /** Counterparty address */\n counterparty: string;\n /** Counterparty's order hash */\n counterparty_order_hash: string;\n /** Amount filled as decimal string */\n fill_amount: string;\n /** Fill price as decimal string */\n price: string;\n /** Whether this order was the maker */\n is_maker: boolean;\n}\n\n/**\n * Request for POST /api/orders/submit.\n */\nexport interface SubmitOrderRequest {\n /** Order creator's pubkey (Base58) */\n maker: string;\n /** User's nonce for uniqueness (u32 as string) */\n nonce: string;\n /** Market address (Base58) */\n market_pubkey: string;\n /** Token being bought/sold (Base58) */\n base_token: string;\n /** Token used for payment (Base58) */\n quote_token: string;\n /** Order side (0=BID, 1=ASK) */\n side: number;\n /** Amount maker gives (u64 as string) */\n maker_amount: string;\n /** Amount maker wants to receive (u64 as string) */\n taker_amount: string;\n /** Unix timestamp, 0=no expiration */\n expiration?: number;\n /** Ed25519 signature (hex, 128 chars) */\n signature: string;\n /** Target orderbook */\n orderbook_id: string;\n}\n\n/**\n * Response for POST /api/orders/submit.\n */\nexport interface OrderResponse {\n /** Order hash (hex) */\n order_hash: string;\n /** Order status */\n status: OrderStatusValue;\n /** Remaining amount as decimal string */\n remaining: string;\n /** Filled amount as decimal string */\n filled: string;\n /** Fill details */\n fills: Fill[];\n}\n\n/**\n * Request for POST /api/orders/cancel.\n */\nexport interface CancelOrderRequest {\n /** Hash of order to cancel (hex) */\n order_hash: string;\n /** Must match order creator (Base58) */\n maker: string;\n /** Ed25519 signature over the order hash (hex, 128 chars) */\n signature: string;\n}\n\n/**\n * Response for POST /api/orders/cancel.\n */\nexport interface CancelResponse {\n /** Cancellation status */\n status: string;\n /** Order hash */\n order_hash: string;\n /** Remaining amount that was cancelled as decimal string */\n remaining: string;\n}\n\n/**\n * Request for POST /api/orders/cancel-all.\n */\nexport interface CancelAllOrdersRequest {\n /** User's public key (Base58) */\n user_pubkey: string;\n /** Limit to specific orderbook (empty = all) */\n orderbook_id?: string;\n /** Ed25519 signature over \"cancel_all:{pubkey}:{timestamp}\" (hex, 128 chars) */\n signature: string;\n /** Unix timestamp used in the signed message */\n timestamp: number;\n}\n\n/**\n * Response for POST /api/orders/cancel-all.\n */\nexport interface CancelAllResponse {\n /** Status (success) */\n status: string;\n /** User pubkey */\n user_pubkey: string;\n /** Orderbook ID if specified */\n orderbook_id?: string;\n /** List of cancelled order hashes */\n cancelled_order_hashes: string[];\n /** Count of cancelled orders */\n count: number;\n /** Human-readable message */\n message: string;\n}\n\n/**\n * User order from GET /api/users/orders.\n */\nexport interface UserOrder {\n /** Order hash */\n order_hash: string;\n /** Market pubkey */\n market_pubkey: string;\n /** Orderbook ID */\n orderbook_id: string;\n /** Order side (0=BID, 1=ASK) */\n side: ApiOrderSide;\n /** Maker amount as decimal string */\n maker_amount: string;\n /** Taker amount as decimal string */\n taker_amount: string;\n /** Remaining amount as decimal string */\n remaining: string;\n /** Filled amount as decimal string */\n filled: string;\n /** Order price as decimal string */\n price: string;\n /** Creation timestamp */\n created_at: string;\n /** Expiration timestamp */\n expiration: number;\n}\n\n/**\n * Request for POST /api/users/orders.\n */\nexport interface GetUserOrdersRequest {\n /** User's public key (Base58) */\n user_pubkey: string;\n}\n\n/**\n * Outcome balance in user orders response.\n */\nexport interface UserOrderOutcomeBalance {\n /** Outcome index */\n outcome_index: number;\n /** Conditional token address */\n conditional_token: string;\n /** Idle balance as decimal string */\n idle: string;\n /** Balance on order book as decimal string */\n on_book: string;\n}\n\n/**\n * User balance from GET /api/users/orders.\n */\nexport interface UserBalance {\n /** Market pubkey */\n market_pubkey: string;\n /** Deposit asset */\n deposit_asset: string;\n /** Outcome balances */\n outcomes: UserOrderOutcomeBalance[];\n}\n\n/**\n * Response for POST /api/users/orders.\n */\nexport interface UserOrdersResponse {\n /** User pubkey */\n user_pubkey: string;\n /** Open orders */\n orders: UserOrder[];\n /** User balances */\n balances: UserBalance[];\n}\n"]}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Orderbook-related types for the Lightcone REST API.
3
+ */
4
+ /**
5
+ * Price level in the orderbook.
6
+ */
7
+ export interface PriceLevel {
8
+ /** Price as decimal string (e.g., "0.500000") */
9
+ price: string;
10
+ /** Total size at this price level as decimal string */
11
+ size: string;
12
+ /** Number of orders at this level */
13
+ orders: number;
14
+ }
15
+ /**
16
+ * Response for GET /api/orderbook/{orderbook_id}.
17
+ */
18
+ export interface OrderbookResponse {
19
+ /** Market pubkey */
20
+ market_pubkey: string;
21
+ /** Orderbook identifier */
22
+ orderbook_id: string;
23
+ /** Bid levels (buy orders), sorted by price descending */
24
+ bids: PriceLevel[];
25
+ /** Ask levels (sell orders), sorted by price ascending */
26
+ asks: PriceLevel[];
27
+ /** Best bid price as decimal string */
28
+ best_bid?: string;
29
+ /** Best ask price as decimal string */
30
+ best_ask?: string;
31
+ /** Spread (best_ask - best_bid) as decimal string */
32
+ spread?: string;
33
+ /** Tick size for this orderbook as decimal string */
34
+ tick_size: string;
35
+ }
36
+ //# sourceMappingURL=orderbook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderbook.d.ts","sourceRoot":"","sources":["../../../src/api/types/orderbook.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,2BAA2B;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,0DAA0D;IAC1D,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAC;CACnB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Orderbook-related types for the Lightcone REST API.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=orderbook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderbook.js","sourceRoot":"","sources":["../../../src/api/types/orderbook.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Orderbook-related types for the Lightcone REST API.\n */\n\n/**\n * Price level in the orderbook.\n */\nexport interface PriceLevel {\n /** Price as decimal string (e.g., \"0.500000\") */\n price: string;\n /** Total size at this price level as decimal string */\n size: string;\n /** Number of orders at this level */\n orders: number;\n}\n\n/**\n * Response for GET /api/orderbook/{orderbook_id}.\n */\nexport interface OrderbookResponse {\n /** Market pubkey */\n market_pubkey: string;\n /** Orderbook identifier */\n orderbook_id: string;\n /** Bid levels (buy orders), sorted by price descending */\n bids: PriceLevel[];\n /** Ask levels (sell orders), sorted by price ascending */\n asks: PriceLevel[];\n /** Best bid price as decimal string */\n best_bid?: string;\n /** Best ask price as decimal string */\n best_ask?: string;\n /** Spread (best_ask - best_bid) as decimal string */\n spread?: string;\n /** Tick size for this orderbook as decimal string */\n tick_size: string;\n}\n"]}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Position-related types for the Lightcone REST API.
3
+ */
4
+ /**
5
+ * Outcome balance in a position.
6
+ */
7
+ export interface OutcomeBalance {
8
+ /** Outcome index */
9
+ outcome_index: number;
10
+ /** Conditional token address */
11
+ conditional_token: string;
12
+ /** Total balance as decimal string */
13
+ balance: string;
14
+ /** Idle balance (not on book) as decimal string */
15
+ balance_idle: string;
16
+ /** Balance on order book as decimal string */
17
+ balance_on_book: string;
18
+ }
19
+ /**
20
+ * User position in a market.
21
+ */
22
+ export interface Position {
23
+ /** Database ID */
24
+ id: number;
25
+ /** Position PDA address */
26
+ position_pubkey: string;
27
+ /** Position owner */
28
+ owner: string;
29
+ /** Market pubkey */
30
+ market_pubkey: string;
31
+ /** Outcome balances */
32
+ outcomes: OutcomeBalance[];
33
+ /** Creation timestamp */
34
+ created_at: string;
35
+ /** Last update timestamp */
36
+ updated_at: string;
37
+ }
38
+ /**
39
+ * Response for GET /api/users/{user_pubkey}/positions.
40
+ */
41
+ export interface PositionsResponse {
42
+ /** Position owner */
43
+ owner: string;
44
+ /** Total markets with positions */
45
+ total_markets: number;
46
+ /** User positions */
47
+ positions: Position[];
48
+ }
49
+ /**
50
+ * Response for GET /api/users/{user_pubkey}/markets/{market_pubkey}/positions.
51
+ */
52
+ export interface MarketPositionsResponse {
53
+ /** Position owner */
54
+ owner: string;
55
+ /** Market pubkey */
56
+ market_pubkey: string;
57
+ /** Positions in this market */
58
+ positions: Position[];
59
+ }
60
+ //# sourceMappingURL=position.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/api/types/position.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,gCAAgC;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,kBAAkB;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,2BAA2B;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB;IACvB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB;IACrB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,oBAAoB;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * Position-related types for the Lightcone REST API.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=position.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"position.js","sourceRoot":"","sources":["../../../src/api/types/position.ts"],"names":[],"mappings":";AAAA;;GAEG","sourcesContent":["/**\n * Position-related types for the Lightcone REST API.\n */\n\n/**\n * Outcome balance in a position.\n */\nexport interface OutcomeBalance {\n /** Outcome index */\n outcome_index: number;\n /** Conditional token address */\n conditional_token: string;\n /** Total balance as decimal string */\n balance: string;\n /** Idle balance (not on book) as decimal string */\n balance_idle: string;\n /** Balance on order book as decimal string */\n balance_on_book: string;\n}\n\n/**\n * User position in a market.\n */\nexport interface Position {\n /** Database ID */\n id: number;\n /** Position PDA address */\n position_pubkey: string;\n /** Position owner */\n owner: string;\n /** Market pubkey */\n market_pubkey: string;\n /** Outcome balances */\n outcomes: OutcomeBalance[];\n /** Creation timestamp */\n created_at: string;\n /** Last update timestamp */\n updated_at: string;\n}\n\n/**\n * Response for GET /api/users/{user_pubkey}/positions.\n */\nexport interface PositionsResponse {\n /** Position owner */\n owner: string;\n /** Total markets with positions */\n total_markets: number;\n /** User positions */\n positions: Position[];\n}\n\n/**\n * Response for GET /api/users/{user_pubkey}/markets/{market_pubkey}/positions.\n */\nexport interface MarketPositionsResponse {\n /** Position owner */\n owner: string;\n /** Market pubkey */\n market_pubkey: string;\n /** Positions in this market */\n positions: Position[];\n}\n"]}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Price history types for the Lightcone REST API.
3
+ */
4
+ import { Resolution } from "../../shared";
5
+ /**
6
+ * Price point data.
7
+ */
8
+ export interface PricePoint {
9
+ /** Timestamp (milliseconds) */
10
+ t: number;
11
+ /** Midpoint price as decimal string */
12
+ m: string;
13
+ /** Open price (only with include_ohlcv) as decimal string */
14
+ o?: string;
15
+ /** High price (only with include_ohlcv) as decimal string */
16
+ h?: string;
17
+ /** Low price (only with include_ohlcv) as decimal string */
18
+ l?: string;
19
+ /** Close price (only with include_ohlcv) as decimal string */
20
+ c?: string;
21
+ /** Volume (only with include_ohlcv) as decimal string */
22
+ v?: string;
23
+ /** Best bid (only with include_ohlcv) as decimal string */
24
+ bb?: string;
25
+ /** Best ask (only with include_ohlcv) as decimal string */
26
+ ba?: string;
27
+ }
28
+ /**
29
+ * Query parameters for GET /api/price-history.
30
+ */
31
+ export interface PriceHistoryParams {
32
+ /** Orderbook identifier (required) */
33
+ orderbook_id: string;
34
+ /** Candle resolution */
35
+ resolution?: Resolution;
36
+ /** Start timestamp (milliseconds) */
37
+ from?: number;
38
+ /** End timestamp (milliseconds) */
39
+ to?: number;
40
+ /** Pagination cursor */
41
+ cursor?: number;
42
+ /** Max results (1-1000) */
43
+ limit?: number;
44
+ /** Include full OHLCV data */
45
+ include_ohlcv?: boolean;
46
+ }
47
+ /**
48
+ * Create new PriceHistoryParams with required orderbook_id.
49
+ */
50
+ export declare function createPriceHistoryParams(orderbook_id: string): PriceHistoryParams;
51
+ /**
52
+ * Response for GET /api/price-history.
53
+ */
54
+ export interface PriceHistoryResponse {
55
+ /** Orderbook ID */
56
+ orderbook_id: string;
57
+ /** Resolution used */
58
+ resolution: string;
59
+ /** Whether OHLCV data is included */
60
+ include_ohlcv: boolean;
61
+ /** Price points */
62
+ prices: PricePoint[];
63
+ /** Next pagination cursor */
64
+ next_cursor?: number;
65
+ /** Whether more results exist */
66
+ has_more: boolean;
67
+ }
68
+ //# sourceMappingURL=price_history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price_history.d.ts","sourceRoot":"","sources":["../../../src/api/types/price_history.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,uCAAuC;IACvC,CAAC,EAAE,MAAM,CAAC;IACV,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,6DAA6D;IAC7D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,4DAA4D;IAC5D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,yDAAyD;IACzD,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,2DAA2D;IAC3D,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,sCAAsC;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,MAAM,GAAG,kBAAkB,CAEjF;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,mBAAmB;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB;IACnB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,QAAQ,EAAE,OAAO,CAAC;CACnB"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Price history types for the Lightcone REST API.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createPriceHistoryParams = createPriceHistoryParams;
7
+ /**
8
+ * Create new PriceHistoryParams with required orderbook_id.
9
+ */
10
+ function createPriceHistoryParams(orderbook_id) {
11
+ return { orderbook_id };
12
+ }
13
+ //# sourceMappingURL=price_history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price_history.js","sourceRoot":"","sources":["../../../src/api/types/price_history.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAmDH,4DAEC;AALD;;GAEG;AACH,SAAgB,wBAAwB,CAAC,YAAoB;IAC3D,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * Price history types for the Lightcone REST API.\n */\n\nimport { Resolution } from \"../../shared\";\n\n/**\n * Price point data.\n */\nexport interface PricePoint {\n /** Timestamp (milliseconds) */\n t: number;\n /** Midpoint price as decimal string */\n m: string;\n /** Open price (only with include_ohlcv) as decimal string */\n o?: string;\n /** High price (only with include_ohlcv) as decimal string */\n h?: string;\n /** Low price (only with include_ohlcv) as decimal string */\n l?: string;\n /** Close price (only with include_ohlcv) as decimal string */\n c?: string;\n /** Volume (only with include_ohlcv) as decimal string */\n v?: string;\n /** Best bid (only with include_ohlcv) as decimal string */\n bb?: string;\n /** Best ask (only with include_ohlcv) as decimal string */\n ba?: string;\n}\n\n/**\n * Query parameters for GET /api/price-history.\n */\nexport interface PriceHistoryParams {\n /** Orderbook identifier (required) */\n orderbook_id: string;\n /** Candle resolution */\n resolution?: Resolution;\n /** Start timestamp (milliseconds) */\n from?: number;\n /** End timestamp (milliseconds) */\n to?: number;\n /** Pagination cursor */\n cursor?: number;\n /** Max results (1-1000) */\n limit?: number;\n /** Include full OHLCV data */\n include_ohlcv?: boolean;\n}\n\n/**\n * Create new PriceHistoryParams with required orderbook_id.\n */\nexport function createPriceHistoryParams(orderbook_id: string): PriceHistoryParams {\n return { orderbook_id };\n}\n\n/**\n * Response for GET /api/price-history.\n */\nexport interface PriceHistoryResponse {\n /** Orderbook ID */\n orderbook_id: string;\n /** Resolution used */\n resolution: string;\n /** Whether OHLCV data is included */\n include_ohlcv: boolean;\n /** Price points */\n prices: PricePoint[];\n /** Next pagination cursor */\n next_cursor?: number;\n /** Whether more results exist */\n has_more: boolean;\n}\n"]}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Trade-related types for the Lightcone REST API.
3
+ */
4
+ /**
5
+ * Trade side (API returns uppercase strings).
6
+ */
7
+ export type TradeSide = "BID" | "ASK";
8
+ /**
9
+ * Executed trade information.
10
+ */
11
+ export interface Trade {
12
+ /** Trade ID */
13
+ id: number;
14
+ /** Orderbook ID */
15
+ orderbook_id: string;
16
+ /** Taker's pubkey */
17
+ taker_pubkey: string;
18
+ /** Maker's pubkey */
19
+ maker_pubkey: string;
20
+ /** Trade side ("BID" or "ASK") */
21
+ side: TradeSide;
22
+ /** Trade size as decimal string */
23
+ size: string;
24
+ /** Trade price as decimal string */
25
+ price: string;
26
+ /** Taker fee as decimal string */
27
+ taker_fee: string;
28
+ /** Maker fee as decimal string */
29
+ maker_fee: string;
30
+ /** Execution timestamp (milliseconds since epoch) */
31
+ executed_at: number;
32
+ }
33
+ /**
34
+ * Query parameters for GET /api/trades.
35
+ */
36
+ export interface TradesParams {
37
+ /** Orderbook identifier (required) */
38
+ orderbook_id: string;
39
+ /** Filter by user pubkey */
40
+ user_pubkey?: string;
41
+ /** Start timestamp (milliseconds) */
42
+ from?: number;
43
+ /** End timestamp (milliseconds) */
44
+ to?: number;
45
+ /** Pagination cursor (trade ID) */
46
+ cursor?: number;
47
+ /** Max results (1-500) */
48
+ limit?: number;
49
+ }
50
+ /**
51
+ * Create new TradesParams with required orderbook_id.
52
+ */
53
+ export declare function createTradesParams(orderbook_id: string): TradesParams;
54
+ /**
55
+ * Response for GET /api/trades.
56
+ */
57
+ export interface TradesResponse {
58
+ /** Orderbook ID */
59
+ orderbook_id: string;
60
+ /** Trade list */
61
+ trades: Trade[];
62
+ /** Next pagination cursor */
63
+ next_cursor?: number;
64
+ /** Whether more results exist */
65
+ has_more: boolean;
66
+ }
67
+ //# sourceMappingURL=trade.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trade.d.ts","sourceRoot":"","sources":["../../../src/api/types/trade.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KA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ty(exports, "__esModule", { value: true });
6
+ exports.createTradesParams = createTradesParams;
7
+ /**
8
+ * Create new TradesParams with required orderbook_id.
9
+ */
10
+ function createTradesParams(orderbook_id) {
11
+ return { orderbook_id };
12
+ }
13
+ //# sourceMappingURL=trade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trade.js","sourceRoot":"","sources":["../../../src/api/types/trade.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAsDH,gDAEC;AALD;;GAEG;AACH,SAAgB,kBAAkB,CAAC,YAAoB;IACrD,OAAO,EAAE,YAAY,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["/**\n * Trade-related types for the Lightcone REST API.\n */\n\n/**\n * Trade side (API returns uppercase strings).\n */\nexport type TradeSide = \"BID\" | \"ASK\";\n\n/**\n * Executed trade information.\n */\nexport interface Trade {\n /** Trade ID */\n id: number;\n /** Orderbook ID */\n orderbook_id: string;\n /** Taker's pubkey */\n taker_pubkey: string;\n /** Maker's pubkey */\n maker_pubkey: string;\n /** Trade side (\"BID\" or \"ASK\") */\n side: TradeSide;\n /** Trade size as decimal string */\n size: string;\n /** Trade price as decimal string */\n price: string;\n /** Taker fee as decimal string */\n taker_fee: string;\n /** Maker fee as decimal string */\n maker_fee: string;\n /** Execution timestamp (milliseconds since epoch) */\n executed_at: number;\n}\n\n/**\n * Query parameters for GET /api/trades.\n */\nexport interface TradesParams {\n /** Orderbook identifier (required) */\n orderbook_id: string;\n /** Filter by user pubkey */\n user_pubkey?: string;\n /** Start timestamp (milliseconds) */\n from?: number;\n /** End timestamp (milliseconds) */\n to?: number;\n /** Pagination cursor (trade ID) */\n cursor?: number;\n /** Max results (1-500) */\n limit?: number;\n}\n\n/**\n * Create new TradesParams with required orderbook_id.\n */\nexport function createTradesParams(orderbook_id: string): TradesParams {\n return { orderbook_id };\n}\n\n/**\n * Response for GET /api/trades.\n */\nexport interface TradesResponse {\n /** Orderbook ID */\n orderbook_id: string;\n /** Trade list */\n trades: Trade[];\n /** Next pagination cursor */\n next_cursor?: number;\n /** Whether more results exist */\n has_more: boolean;\n}\n"]}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Input validation utilities for the Lightcone REST API.
3
+ */
4
+ /** Maximum allowed pagination limit */
5
+ export declare const MAX_PAGINATION_LIMIT = 500;
6
+ /** Default request timeout in milliseconds */
7
+ export declare const DEFAULT_TIMEOUT_MS = 30000;
8
+ /**
9
+ * Validate a Solana public key (Base58-encoded).
10
+ * Uses @solana/web3.js PublicKey for proper validation.
11
+ * @throws {ApiError} If the value is not a valid Solana pubkey
12
+ */
13
+ export declare function validatePubkey(value: string, fieldName: string): void;
14
+ /**
15
+ * Validate an Ed25519 signature (128 hex characters).
16
+ * @throws {ApiError} If the signature is invalid
17
+ */
18
+ export declare function validateSignature(signature: string): void;
19
+ /**
20
+ * Validate pagination limit (1-500).
21
+ * @throws {ApiError} If the limit is out of bounds
22
+ */
23
+ export declare function validateLimit(limit: number | undefined): void;
24
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/api/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,uCAAuC;AACvC,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAExC,8CAA8C;AAC9C,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CASrE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CASzD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAI7D"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /**
3
+ * Input validation utilities for the Lightcone REST API.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DEFAULT_TIMEOUT_MS = exports.MAX_PAGINATION_LIMIT = void 0;
7
+ exports.validatePubkey = validatePubkey;
8
+ exports.validateSignature = validateSignature;
9
+ exports.validateLimit = validateLimit;
10
+ const web3_js_1 = require("@solana/web3.js");
11
+ const error_1 = require("./error");
12
+ /** Maximum allowed pagination limit */
13
+ exports.MAX_PAGINATION_LIMIT = 500;
14
+ /** Default request timeout in milliseconds */
15
+ exports.DEFAULT_TIMEOUT_MS = 30000;
16
+ /**
17
+ * Validate a Solana public key (Base58-encoded).
18
+ * Uses @solana/web3.js PublicKey for proper validation.
19
+ * @throws {ApiError} If the value is not a valid Solana pubkey
20
+ */
21
+ function validatePubkey(value, fieldName) {
22
+ if (!value || value.length === 0) {
23
+ throw error_1.ApiError.invalidParameter(`${fieldName} cannot be empty`);
24
+ }
25
+ try {
26
+ new web3_js_1.PublicKey(value);
27
+ }
28
+ catch {
29
+ throw error_1.ApiError.invalidParameter(`${fieldName} is not a valid Solana public key`);
30
+ }
31
+ }
32
+ /**
33
+ * Validate an Ed25519 signature (128 hex characters).
34
+ * @throws {ApiError} If the signature is invalid
35
+ */
36
+ function validateSignature(signature) {
37
+ if (signature.length !== 128) {
38
+ throw error_1.ApiError.invalidParameter(`Signature must be 128 hex characters, got ${signature.length}`);
39
+ }
40
+ if (!/^[0-9a-fA-F]+$/.test(signature)) {
41
+ throw error_1.ApiError.invalidParameter("Signature must contain only hex characters");
42
+ }
43
+ }
44
+ /**
45
+ * Validate pagination limit (1-500).
46
+ * @throws {ApiError} If the limit is out of bounds
47
+ */
48
+ function validateLimit(limit) {
49
+ if (limit !== undefined && (limit < 1 || limit > exports.MAX_PAGINATION_LIMIT)) {
50
+ throw error_1.ApiError.invalidParameter(`Limit must be 1-${exports.MAX_PAGINATION_LIMIT}`);
51
+ }
52
+ }
53
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/api/validation.ts"],"names":[],"mappings":";AAAA;;GAEG;;;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ublicKey } from \"@solana/web3.js\";\nimport { ApiError } from \"./error\";\n\n/** Maximum allowed pagination limit */\nexport const MAX_PAGINATION_LIMIT = 500;\n\n/** Default request timeout in milliseconds */\nexport const DEFAULT_TIMEOUT_MS = 30000;\n\n/**\n * Validate a Solana public key (Base58-encoded).\n * Uses @solana/web3.js PublicKey for proper validation.\n * @throws {ApiError} If the value is not a valid Solana pubkey\n */\nexport function validatePubkey(value: string, fieldName: string): void {\n if (!value || value.length === 0) {\n throw ApiError.invalidParameter(`${fieldName} cannot be empty`);\n }\n try {\n new PublicKey(value);\n } catch {\n throw ApiError.invalidParameter(`${fieldName} is not a valid Solana public key`);\n }\n}\n\n/**\n * Validate an Ed25519 signature (128 hex characters).\n * @throws {ApiError} If the signature is invalid\n */\nexport function validateSignature(signature: string): void {\n if (signature.length !== 128) {\n throw ApiError.invalidParameter(\n `Signature must be 128 hex characters, got ${signature.length}`\n );\n }\n if (!/^[0-9a-fA-F]+$/.test(signature)) {\n throw ApiError.invalidParameter(\"Signature must contain only hex characters\");\n }\n}\n\n/**\n * Validate pagination limit (1-500).\n * @throws {ApiError} If the limit is out of bounds\n */\nexport function validateLimit(limit: number | undefined): void {\n if (limit !== undefined && (limit < 1 || limit > MAX_PAGINATION_LIMIT)) {\n throw ApiError.invalidParameter(`Limit must be 1-${MAX_PAGINATION_LIMIT}`);\n }\n}\n"]}