@lightconexyz/lightcone-sdk 0.1.0 → 0.2.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 (373) hide show
  1. package/README.md +33 -206
  2. package/dist/auth/client.d.ts +25 -0
  3. package/dist/auth/client.d.ts.map +1 -0
  4. package/dist/auth/client.js +120 -0
  5. package/dist/auth/client.js.map +1 -0
  6. package/dist/auth/index.d.ts +73 -0
  7. package/dist/auth/index.d.ts.map +1 -0
  8. package/dist/auth/index.js +42 -0
  9. package/dist/auth/index.js.map +1 -0
  10. package/dist/auth/native.d.ts +8 -0
  11. package/dist/auth/native.d.ts.map +1 -0
  12. package/dist/auth/native.js +19 -0
  13. package/dist/auth/native.js.map +1 -0
  14. package/dist/auth.d.ts +1 -79
  15. package/dist/auth.d.ts.map +1 -1
  16. package/dist/auth.js +15 -145
  17. package/dist/auth.js.map +1 -1
  18. package/dist/client.d.ts +69 -0
  19. package/dist/client.d.ts.map +1 -0
  20. package/dist/client.js +158 -0
  21. package/dist/client.js.map +1 -0
  22. package/dist/domain/admin/client.d.ts +17 -0
  23. package/dist/domain/admin/client.d.ts.map +1 -0
  24. package/dist/domain/admin/client.js +32 -0
  25. package/dist/domain/admin/client.js.map +1 -0
  26. package/dist/domain/admin/index.d.ts +7 -0
  27. package/dist/domain/admin/index.d.ts.map +1 -0
  28. package/dist/domain/admin/index.js +19 -0
  29. package/dist/domain/admin/index.js.map +1 -0
  30. package/dist/domain/admin/wire.d.ts +117 -0
  31. package/dist/domain/admin/wire.d.ts.map +1 -0
  32. package/dist/domain/admin/wire.js +3 -0
  33. package/dist/domain/admin/wire.js.map +1 -0
  34. package/dist/domain/index.d.ts +9 -0
  35. package/dist/domain/index.d.ts.map +1 -0
  36. package/dist/domain/index.js +45 -0
  37. package/dist/domain/index.js.map +1 -0
  38. package/dist/domain/market/client.d.ts +21 -0
  39. package/dist/domain/market/client.d.ts.map +1 -0
  40. package/dist/domain/market/client.js +70 -0
  41. package/dist/domain/market/client.js.map +1 -0
  42. package/dist/domain/market/convert.d.ts +8 -0
  43. package/dist/domain/market/convert.d.ts.map +1 -0
  44. package/dist/domain/market/convert.js +96 -0
  45. package/dist/domain/market/convert.js.map +1 -0
  46. package/dist/domain/market/index.d.ts +47 -0
  47. package/dist/domain/market/index.d.ts.map +1 -0
  48. package/dist/domain/market/index.js +58 -0
  49. package/dist/domain/market/index.js.map +1 -0
  50. package/dist/domain/market/outcome.d.ts +12 -0
  51. package/dist/domain/market/outcome.d.ts.map +1 -0
  52. package/dist/domain/market/outcome.js +28 -0
  53. package/dist/domain/market/outcome.js.map +1 -0
  54. package/dist/domain/market/tokens.d.ts +42 -0
  55. package/dist/domain/market/tokens.d.ts.map +1 -0
  56. package/dist/domain/market/tokens.js +106 -0
  57. package/dist/domain/market/tokens.js.map +1 -0
  58. package/dist/domain/market/wire.d.ts +116 -0
  59. package/dist/domain/market/wire.d.ts.map +1 -0
  60. package/dist/domain/market/wire.js +3 -0
  61. package/dist/domain/market/wire.js.map +1 -0
  62. package/dist/domain/order/client.d.ts +187 -0
  63. package/dist/domain/order/client.d.ts.map +1 -0
  64. package/dist/domain/order/client.js +122 -0
  65. package/dist/domain/order/client.js.map +1 -0
  66. package/dist/domain/order/convert.d.ts +8 -0
  67. package/dist/domain/order/convert.d.ts.map +1 -0
  68. package/dist/domain/order/convert.js +80 -0
  69. package/dist/domain/order/convert.js.map +1 -0
  70. package/dist/domain/order/index.d.ts +48 -0
  71. package/dist/domain/order/index.d.ts.map +1 -0
  72. package/dist/domain/order/index.js +41 -0
  73. package/dist/domain/order/index.js.map +1 -0
  74. package/dist/domain/order/state.d.ts +26 -0
  75. package/dist/domain/order/state.d.ts.map +1 -0
  76. package/dist/domain/order/state.js +85 -0
  77. package/dist/domain/order/state.js.map +1 -0
  78. package/dist/domain/order/wire.d.ts +123 -0
  79. package/dist/domain/order/wire.d.ts.map +1 -0
  80. package/dist/domain/order/wire.js +3 -0
  81. package/dist/domain/order/wire.js.map +1 -0
  82. package/dist/domain/orderbook/client.d.ts +20 -0
  83. package/dist/domain/orderbook/client.d.ts.map +1 -0
  84. package/dist/domain/orderbook/client.js +30 -0
  85. package/dist/domain/orderbook/client.js.map +1 -0
  86. package/dist/domain/orderbook/convert.d.ts +5 -0
  87. package/dist/domain/orderbook/convert.d.ts.map +1 -0
  88. package/dist/domain/orderbook/convert.js +34 -0
  89. package/dist/domain/orderbook/convert.js.map +1 -0
  90. package/dist/domain/orderbook/index.d.ts +36 -0
  91. package/dist/domain/orderbook/index.d.ts.map +1 -0
  92. package/dist/domain/orderbook/index.js +63 -0
  93. package/dist/domain/orderbook/index.js.map +1 -0
  94. package/dist/domain/orderbook/state.d.ts +19 -0
  95. package/dist/domain/orderbook/state.d.ts.map +1 -0
  96. package/dist/domain/orderbook/state.js +86 -0
  97. package/dist/domain/orderbook/state.js.map +1 -0
  98. package/dist/domain/orderbook/ticker.d.ts +8 -0
  99. package/dist/domain/orderbook/ticker.d.ts.map +1 -0
  100. package/dist/domain/orderbook/ticker.js +3 -0
  101. package/dist/domain/orderbook/ticker.js.map +1 -0
  102. package/dist/domain/orderbook/wire.d.ts +61 -0
  103. package/dist/domain/orderbook/wire.d.ts.map +1 -0
  104. package/dist/domain/orderbook/wire.js +3 -0
  105. package/dist/domain/orderbook/wire.js.map +1 -0
  106. package/dist/domain/position/client.d.ts +13 -0
  107. package/dist/domain/position/client.d.ts.map +1 -0
  108. package/dist/domain/position/client.js +20 -0
  109. package/dist/domain/position/client.js.map +1 -0
  110. package/dist/domain/position/index.d.ts +66 -0
  111. package/dist/domain/position/index.d.ts.map +1 -0
  112. package/dist/domain/position/index.js +19 -0
  113. package/dist/domain/position/index.js.map +1 -0
  114. package/dist/domain/position/wire.d.ts +29 -0
  115. package/dist/domain/position/wire.d.ts.map +1 -0
  116. package/dist/domain/position/wire.js +3 -0
  117. package/dist/domain/position/wire.js.map +1 -0
  118. package/dist/domain/price_history/client.d.ts +12 -0
  119. package/dist/domain/price_history/client.d.ts.map +1 -0
  120. package/dist/domain/price_history/client.js +24 -0
  121. package/dist/domain/price_history/client.js.map +1 -0
  122. package/dist/domain/price_history/index.d.ts +14 -0
  123. package/dist/domain/price_history/index.d.ts.map +1 -0
  124. package/dist/domain/price_history/index.js +27 -0
  125. package/dist/domain/price_history/index.js.map +1 -0
  126. package/dist/domain/price_history/state.d.ts +11 -0
  127. package/dist/domain/price_history/state.d.ts.map +1 -0
  128. package/dist/domain/price_history/state.js +35 -0
  129. package/dist/domain/price_history/state.js.map +1 -0
  130. package/dist/domain/price_history/wire.d.ts +47 -0
  131. package/dist/domain/price_history/wire.d.ts.map +1 -0
  132. package/dist/domain/price_history/wire.js +3 -0
  133. package/dist/domain/price_history/wire.js.map +1 -0
  134. package/dist/domain/referral/client.d.ts +13 -0
  135. package/dist/domain/referral/client.d.ts.map +1 -0
  136. package/dist/domain/referral/client.js +34 -0
  137. package/dist/domain/referral/client.js.map +1 -0
  138. package/dist/domain/referral/index.d.ts +17 -0
  139. package/dist/domain/referral/index.d.ts.map +1 -0
  140. package/dist/domain/referral/index.js +19 -0
  141. package/dist/domain/referral/index.js.map +1 -0
  142. package/dist/domain/referral/wire.d.ts +22 -0
  143. package/dist/domain/referral/wire.d.ts.map +1 -0
  144. package/dist/domain/referral/wire.js +3 -0
  145. package/dist/domain/referral/wire.js.map +1 -0
  146. package/dist/domain/trade/client.d.ts +12 -0
  147. package/dist/domain/trade/client.d.ts.map +1 -0
  148. package/dist/domain/trade/client.js +27 -0
  149. package/dist/domain/trade/client.js.map +1 -0
  150. package/dist/domain/trade/convert.d.ts +5 -0
  151. package/dist/domain/trade/convert.d.ts.map +1 -0
  152. package/dist/domain/trade/convert.js +25 -0
  153. package/dist/domain/trade/convert.js.map +1 -0
  154. package/dist/domain/trade/index.d.ts +19 -0
  155. package/dist/domain/trade/index.d.ts.map +1 -0
  156. package/dist/domain/trade/index.js +24 -0
  157. package/dist/domain/trade/index.js.map +1 -0
  158. package/dist/domain/trade/state.d.ts +16 -0
  159. package/dist/domain/trade/state.d.ts.map +1 -0
  160. package/dist/domain/trade/state.js +40 -0
  161. package/dist/domain/trade/state.js.map +1 -0
  162. package/dist/domain/trade/wire.d.ts +34 -0
  163. package/dist/domain/trade/wire.d.ts.map +1 -0
  164. package/dist/domain/trade/wire.js +3 -0
  165. package/dist/domain/trade/wire.js.map +1 -0
  166. package/dist/error.d.ts +44 -0
  167. package/dist/error.d.ts.map +1 -0
  168. package/dist/error.js +126 -0
  169. package/dist/error.js.map +1 -0
  170. package/dist/http/client.d.ts +16 -0
  171. package/dist/http/client.d.ts.map +1 -0
  172. package/dist/http/client.js +146 -0
  173. package/dist/http/client.js.map +1 -0
  174. package/dist/http/index.d.ts +3 -0
  175. package/dist/http/index.d.ts.map +1 -0
  176. package/dist/http/index.js +12 -0
  177. package/dist/http/index.js.map +1 -0
  178. package/dist/http/retry.d.ts +30 -0
  179. package/dist/http/retry.d.ts.map +1 -0
  180. package/dist/http/retry.js +48 -0
  181. package/dist/http/retry.js.map +1 -0
  182. package/dist/index.d.ts +13 -51
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +22 -68
  185. package/dist/index.js.map +1 -1
  186. package/dist/network.d.ts +4 -4
  187. package/dist/network.d.ts.map +1 -1
  188. package/dist/network.js +4 -4
  189. package/dist/network.js.map +1 -1
  190. package/dist/prelude.d.ts +41 -0
  191. package/dist/prelude.d.ts.map +1 -0
  192. package/dist/prelude.js +55 -0
  193. package/dist/prelude.js.map +1 -0
  194. package/dist/privy/client.d.ts +17 -0
  195. package/dist/privy/client.d.ts.map +1 -0
  196. package/dist/privy/client.js +66 -0
  197. package/dist/privy/client.js.map +1 -0
  198. package/dist/privy/index.d.ts +57 -0
  199. package/dist/privy/index.d.ts.map +1 -0
  200. package/dist/privy/index.js +80 -0
  201. package/dist/privy/index.js.map +1 -0
  202. package/dist/program/accounts.d.ts +19 -2
  203. package/dist/program/accounts.d.ts.map +1 -1
  204. package/dist/program/accounts.js +52 -2
  205. package/dist/program/accounts.js.map +1 -1
  206. package/dist/program/builder.d.ts +15 -11
  207. package/dist/program/builder.d.ts.map +1 -1
  208. package/dist/program/builder.js +30 -22
  209. package/dist/program/builder.js.map +1 -1
  210. package/dist/program/client.d.ts +40 -1
  211. package/dist/program/client.d.ts.map +1 -1
  212. package/dist/program/client.js +87 -2
  213. package/dist/program/client.js.map +1 -1
  214. package/dist/program/constants.d.ts +10 -1
  215. package/dist/program/constants.d.ts.map +1 -1
  216. package/dist/program/constants.js +11 -2
  217. package/dist/program/constants.js.map +1 -1
  218. package/dist/program/envelope.d.ts +94 -0
  219. package/dist/program/envelope.d.ts.map +1 -0
  220. package/dist/program/envelope.js +258 -0
  221. package/dist/program/envelope.js.map +1 -0
  222. package/dist/program/error.d.ts +8 -0
  223. package/dist/program/error.d.ts.map +1 -0
  224. package/dist/program/error.js +20 -0
  225. package/dist/program/error.js.map +1 -0
  226. package/dist/program/index.d.ts +8 -5
  227. package/dist/program/index.d.ts.map +1 -1
  228. package/dist/program/index.js +29 -3
  229. package/dist/program/index.js.map +1 -1
  230. package/dist/program/instructions.d.ts +124 -1
  231. package/dist/program/instructions.d.ts.map +1 -1
  232. package/dist/program/instructions.js +439 -4
  233. package/dist/program/instructions.js.map +1 -1
  234. package/dist/program/orders.d.ts +26 -8
  235. package/dist/program/orders.d.ts.map +1 -1
  236. package/dist/program/orders.js +58 -31
  237. package/dist/program/orders.js.map +1 -1
  238. package/dist/program/pda.d.ts +19 -0
  239. package/dist/program/pda.d.ts.map +1 -1
  240. package/dist/program/pda.js +28 -0
  241. package/dist/program/pda.js.map +1 -1
  242. package/dist/program/types.d.ts +93 -9
  243. package/dist/program/types.d.ts.map +1 -1
  244. package/dist/program/types.js.map +1 -1
  245. package/dist/shared/fmt/decimal.d.ts +5 -0
  246. package/dist/shared/fmt/decimal.d.ts.map +1 -0
  247. package/dist/shared/fmt/decimal.js +54 -0
  248. package/dist/shared/fmt/decimal.js.map +1 -0
  249. package/dist/shared/fmt/index.d.ts +3 -0
  250. package/dist/shared/fmt/index.d.ts.map +1 -0
  251. package/dist/shared/fmt/index.js +39 -0
  252. package/dist/shared/fmt/index.js.map +1 -0
  253. package/dist/shared/fmt/num.d.ts +6 -0
  254. package/dist/shared/fmt/num.d.ts.map +1 -0
  255. package/dist/shared/fmt/num.js +44 -0
  256. package/dist/shared/fmt/num.js.map +1 -0
  257. package/dist/shared/index.d.ts +4 -7
  258. package/dist/shared/index.d.ts.map +1 -1
  259. package/dist/shared/index.js +19 -7
  260. package/dist/shared/index.js.map +1 -1
  261. package/dist/shared/price.d.ts +5 -33
  262. package/dist/shared/price.d.ts.map +1 -1
  263. package/dist/shared/price.js +11 -39
  264. package/dist/shared/price.js.map +1 -1
  265. package/dist/shared/scaling.d.ts +17 -30
  266. package/dist/shared/scaling.d.ts.map +1 -1
  267. package/dist/shared/scaling.js +88 -57
  268. package/dist/shared/scaling.js.map +1 -1
  269. package/dist/shared/types.d.ts +66 -16
  270. package/dist/shared/types.d.ts.map +1 -1
  271. package/dist/shared/types.js +81 -17
  272. package/dist/shared/types.js.map +1 -1
  273. package/dist/ws/client.d.ts +35 -0
  274. package/dist/ws/client.d.ts.map +1 -0
  275. package/dist/ws/client.js +226 -0
  276. package/dist/ws/client.js.map +1 -0
  277. package/dist/ws/index.d.ts +109 -0
  278. package/dist/ws/index.d.ts.map +1 -0
  279. package/dist/ws/index.js +181 -0
  280. package/dist/ws/index.js.map +1 -0
  281. package/dist/ws/subscriptions.d.ts +51 -0
  282. package/dist/ws/subscriptions.d.ts.map +1 -0
  283. package/dist/ws/subscriptions.js +44 -0
  284. package/dist/ws/subscriptions.js.map +1 -0
  285. package/package.json +3 -11
  286. package/dist/api/client.d.ts +0 -225
  287. package/dist/api/client.d.ts.map +0 -1
  288. package/dist/api/client.js +0 -452
  289. package/dist/api/client.js.map +0 -1
  290. package/dist/api/error.d.ts +0 -58
  291. package/dist/api/error.d.ts.map +0 -1
  292. package/dist/api/error.js +0 -98
  293. package/dist/api/error.js.map +0 -1
  294. package/dist/api/index.d.ts +0 -23
  295. package/dist/api/index.d.ts.map +0 -1
  296. package/dist/api/index.js +0 -51
  297. package/dist/api/index.js.map +0 -1
  298. package/dist/api/types/admin.d.ts +0 -49
  299. package/dist/api/types/admin.d.ts.map +0 -1
  300. package/dist/api/types/admin.js +0 -13
  301. package/dist/api/types/admin.js.map +0 -1
  302. package/dist/api/types/index.d.ts +0 -14
  303. package/dist/api/types/index.d.ts.map +0 -1
  304. package/dist/api/types/index.js +0 -13
  305. package/dist/api/types/index.js.map +0 -1
  306. package/dist/api/types/market.d.ts +0 -186
  307. package/dist/api/types/market.d.ts.map +0 -1
  308. package/dist/api/types/market.js +0 -6
  309. package/dist/api/types/market.js.map +0 -1
  310. package/dist/api/types/order.d.ts +0 -190
  311. package/dist/api/types/order.d.ts.map +0 -1
  312. package/dist/api/types/order.js +0 -6
  313. package/dist/api/types/order.js.map +0 -1
  314. package/dist/api/types/orderbook.d.ts +0 -36
  315. package/dist/api/types/orderbook.d.ts.map +0 -1
  316. package/dist/api/types/orderbook.js +0 -6
  317. package/dist/api/types/orderbook.js.map +0 -1
  318. package/dist/api/types/position.d.ts +0 -60
  319. package/dist/api/types/position.d.ts.map +0 -1
  320. package/dist/api/types/position.js +0 -6
  321. package/dist/api/types/position.js.map +0 -1
  322. package/dist/api/types/price_history.d.ts +0 -68
  323. package/dist/api/types/price_history.d.ts.map +0 -1
  324. package/dist/api/types/price_history.js +0 -13
  325. package/dist/api/types/price_history.js.map +0 -1
  326. package/dist/api/types/trade.d.ts +0 -67
  327. package/dist/api/types/trade.d.ts.map +0 -1
  328. package/dist/api/types/trade.js +0 -13
  329. package/dist/api/types/trade.js.map +0 -1
  330. package/dist/api/validation.d.ts +0 -24
  331. package/dist/api/validation.d.ts.map +0 -1
  332. package/dist/api/validation.js +0 -53
  333. package/dist/api/validation.js.map +0 -1
  334. package/dist/websocket/client.d.ts +0 -238
  335. package/dist/websocket/client.d.ts.map +0 -1
  336. package/dist/websocket/client.js +0 -580
  337. package/dist/websocket/client.js.map +0 -1
  338. package/dist/websocket/error.d.ts +0 -47
  339. package/dist/websocket/error.d.ts.map +0 -1
  340. package/dist/websocket/error.js +0 -83
  341. package/dist/websocket/error.js.map +0 -1
  342. package/dist/websocket/handlers.d.ts +0 -97
  343. package/dist/websocket/handlers.d.ts.map +0 -1
  344. package/dist/websocket/handlers.js +0 -277
  345. package/dist/websocket/handlers.js.map +0 -1
  346. package/dist/websocket/index.d.ts +0 -38
  347. package/dist/websocket/index.d.ts.map +0 -1
  348. package/dist/websocket/index.js +0 -75
  349. package/dist/websocket/index.js.map +0 -1
  350. package/dist/websocket/state/index.d.ts +0 -7
  351. package/dist/websocket/state/index.d.ts.map +0 -1
  352. package/dist/websocket/state/index.js +0 -14
  353. package/dist/websocket/state/index.js.map +0 -1
  354. package/dist/websocket/state/orderbook.d.ts +0 -107
  355. package/dist/websocket/state/orderbook.d.ts.map +0 -1
  356. package/dist/websocket/state/orderbook.js +0 -293
  357. package/dist/websocket/state/orderbook.js.map +0 -1
  358. package/dist/websocket/state/price.d.ts +0 -108
  359. package/dist/websocket/state/price.d.ts.map +0 -1
  360. package/dist/websocket/state/price.js +0 -243
  361. package/dist/websocket/state/price.js.map +0 -1
  362. package/dist/websocket/state/user.d.ts +0 -83
  363. package/dist/websocket/state/user.d.ts.map +0 -1
  364. package/dist/websocket/state/user.js +0 -228
  365. package/dist/websocket/state/user.js.map +0 -1
  366. package/dist/websocket/subscriptions.d.ts +0 -143
  367. package/dist/websocket/subscriptions.d.ts.map +0 -1
  368. package/dist/websocket/subscriptions.js +0 -244
  369. package/dist/websocket/subscriptions.js.map +0 -1
  370. package/dist/websocket/types.d.ts +0 -417
  371. package/dist/websocket/types.d.ts.map +0 -1
  372. package/dist/websocket/types.js +0 -195
  373. package/dist/websocket/types.js.map +0 -1
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E;;;GAGG;AACH,4CAA0B;AAE1B;;GAEG;AACH,qCAA4D;AAAnD,0GAAA,eAAe,OAAA;AAAE,yGAAA,cAAc,OAAA;AAExC;;;GAGG;AACH,2CAAyB;AAEzB;;;GAGG;AACH,6CAA6B;AAE7B;;;GAGG;AACH,yDAAyC;AAEzC;;;GAGG;AACH,+CAA+B;AAE/B,+EAA+E;AAC/E,+BAA+B;AAC/B,+EAA+E;AAC/E,2CAMyB;AALvB,oGAAA,SAAS,OAAA;AACT,qGAAA,UAAU,OAAA;AACV,kGAAA,OAAO,OAAA;AACP,sGAAA,WAAW,OAAA;AACX,iHAAA,sBAAsB,OAAA","sourcesContent":["/**\n * Lightcone SDK - TypeScript SDK for the Lightcone protocol on Solana.\n *\n * This SDK provides three main modules:\n * - `program`: On-chain program interaction (smart contract)\n * - `api`: REST API client for market data, orders, and positions\n * - `websocket`: Real-time data streaming for orderbooks, trades, and user events\n *\n * @example\n * ```typescript\n * import { LightconePinocchioClient, PROGRAM_ID, api, websocket } from \"@lightcone/sdk\";\n *\n * // On-chain program interaction\n * const programClient = new LightconePinocchioClient(connection, payer);\n *\n * // REST API client\n * const apiClient = new api.LightconeApiClient();\n * const markets = await apiClient.getMarkets();\n *\n * // WebSocket client for real-time data\n * const wsClient = await websocket.LightconeWebSocketClient.connectDefault();\n * await wsClient.subscribeBookUpdates([\"market1:ob1\"]);\n * ```\n */\n\n// ============================================================================\n// MODULE EXPORTS\n// ============================================================================\n\n/**\n * On-chain program interaction module.\n * Contains the client and utilities for interacting with the Lightcone smart contract.\n */\nexport * from \"./program\";\n\n/**\n * Network URL constants (API and WebSocket endpoints).\n */\nexport { DEFAULT_API_URL, DEFAULT_WS_URL } from \"./network\";\n\n/**\n * Shared utilities, types, and constants.\n * Used across all SDK modules.\n */\nexport * from \"./shared\";\n\n/**\n * REST API client module.\n * Provides HTTP client functionality for market data, orders, and positions.\n */\nexport * as api from \"./api\";\n\n/**\n * WebSocket client module.\n * Provides real-time data streaming for orderbooks, trades, and user events.\n */\nexport * as websocket from \"./websocket\";\n\n/**\n * Authentication module.\n * Provides authentication functionality shared by API and WebSocket clients.\n */\nexport * as auth from \"./auth\";\n\n// ============================================================================\n// RE-EXPORTS FROM DEPENDENCIES\n// ============================================================================\nexport {\n PublicKey,\n Connection,\n Keypair,\n Transaction,\n TransactionInstruction,\n} from \"@solana/web3.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gBAAgB;AAChB,mDAAmC;AACnC,mDAAmC;AACnC,qDAAqC;AACrC,0CAAwB;AACxB,4CAA0B;AAE1B,wBAAwB;AACxB,+CAA+B;AAC/B,iDAAiC;AAEjC,gBAAgB;AAChB,+CAA+B;AAE/B,qBAAqB;AACrB,2CAA2B;AAE3B,6BAA6B;AAC7B,mCAAmE;AAA1D,yGAAA,eAAe,OAAA;AAAE,gHAAA,sBAAsB,OAAA;AAwBhD,4CAA0B","sourcesContent":["/**\n * Lightcone SDK v2 - TypeScript implementation mirroring Rust SDK v2 layers.\n */\n\n// Layer 1: Core\nexport * as shared from \"./shared\";\nexport * as domain from \"./domain\";\nexport * as program from \"./program\";\nexport * from \"./error\";\nexport * from \"./network\";\n\n// Layer 2: Auth + Privy\nexport * as auth from \"./auth\";\nexport * as privy from \"./privy\";\n\n// Layer 3: HTTP\nexport * as http from \"./http\";\n\n// Layer 4: WebSocket\nexport * as ws from \"./ws\";\n\n// Layer 5: High-level client\nexport { LightconeClient, LightconeClientBuilder } from \"./client\";\n\n// Convenience top-level type exports\nexport type {\n AuthCredentials,\n ChainType,\n EmbeddedWallet,\n LinkedAccount,\n LinkedAccountType,\n User,\n} from \"./auth\";\n\nexport type {\n AdminClient,\n MarketsClient,\n MarketsResult,\n OrdersClient,\n OrderbooksClient,\n PositionsClient,\n PriceHistorySubClient,\n ReferralsClient,\n TradesClient,\n} from \"./prelude\";\n\nexport * from \"./prelude\";\n"]}
package/dist/network.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- /** Default REST API base URL for Lightcone. */
2
- export declare const DEFAULT_API_URL = "https://tapi.lightcone.xyz/api";
3
- /** Default WebSocket URL for Lightcone. */
4
- export declare const DEFAULT_WS_URL = "wss://ws.lightcone.xyz/ws";
1
+ /** Default REST API base URL. */
2
+ export declare const DEFAULT_API_URL = "https://tapi.lightcone.xyz";
3
+ /** Default WebSocket URL. */
4
+ export declare const DEFAULT_WS_URL = "wss://tws.lightcone.xyz/ws";
5
5
  //# sourceMappingURL=network.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,eAAO,MAAM,eAAe,mCAAmC,CAAC;AAEhE,2CAA2C;AAC3C,eAAO,MAAM,cAAc,8BAA8B,CAAC"}
1
+ {"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,eAAO,MAAM,eAAe,+BAA+B,CAAC;AAE5D,6BAA6B;AAC7B,eAAO,MAAM,cAAc,+BAA+B,CAAC"}
package/dist/network.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_WS_URL = exports.DEFAULT_API_URL = void 0;
4
- /** Default REST API base URL for Lightcone. */
5
- exports.DEFAULT_API_URL = "https://tapi.lightcone.xyz/api";
6
- /** Default WebSocket URL for Lightcone. */
7
- exports.DEFAULT_WS_URL = "wss://ws.lightcone.xyz/ws";
4
+ /** Default REST API base URL. */
5
+ exports.DEFAULT_API_URL = "https://tapi.lightcone.xyz";
6
+ /** Default WebSocket URL. */
7
+ exports.DEFAULT_WS_URL = "wss://tws.lightcone.xyz/ws";
8
8
  //# sourceMappingURL=network.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAClC,QAAA,eAAe,GAAG,gCAAgC,CAAC;AAEhE,2CAA2C;AAC9B,QAAA,cAAc,GAAG,2BAA2B,CAAC","sourcesContent":["/** Default REST API base URL for Lightcone. */\nexport const DEFAULT_API_URL = \"https://tapi.lightcone.xyz/api\";\n\n/** Default WebSocket URL for Lightcone. */\nexport const DEFAULT_WS_URL = \"wss://ws.lightcone.xyz/ws\";\n"]}
1
+ {"version":3,"file":"network.js","sourceRoot":"","sources":["../src/network.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACpB,QAAA,eAAe,GAAG,4BAA4B,CAAC;AAE5D,6BAA6B;AAChB,QAAA,cAAc,GAAG,4BAA4B,CAAC","sourcesContent":["/** Default REST API base URL. */\nexport const DEFAULT_API_URL = \"https://tapi.lightcone.xyz\";\n\n/** Default WebSocket URL. */\nexport const DEFAULT_WS_URL = \"wss://tws.lightcone.xyz/ws\";\n"]}
@@ -0,0 +1,41 @@
1
+ export { asOrderBookId, asPubkeyStr, deriveOrderbookId, OrderUpdateType, Resolution, Side, TimeInForce, TriggerResultStatus, TriggerStatus, TriggerType, TriggerUpdateType, type OrderBookId, type PubkeyStr, type SubmitOrderRequest, } from "./shared";
2
+ export { SdkError } from "./error";
3
+ export { DEFAULT_API_URL, DEFAULT_WS_URL } from "./network";
4
+ export { LightconeClient, LightconeClientBuilder, } from "./client";
5
+ export { Auth } from "./auth";
6
+ export { Admin } from "./domain/admin";
7
+ export { Markets } from "./domain/market";
8
+ export { Orderbooks } from "./domain/orderbook";
9
+ export { Orders } from "./domain/order";
10
+ export { Positions } from "./domain/position";
11
+ export { Trades } from "./domain/trade";
12
+ export { PriceHistoryClient } from "./domain/price_history";
13
+ export { Referrals } from "./domain/referral";
14
+ export type { Market, Status, Outcome, ConditionalToken, DepositAsset, Token, TokenMetadata, ValidatedTokens, } from "./domain/market";
15
+ export type { OrderBookPair, OutcomeImpact, TickerData, } from "./domain/orderbook";
16
+ export { OrderBookValidationError } from "./domain/orderbook";
17
+ export { OrderbookSnapshot } from "./domain/orderbook/state";
18
+ export type { CancelAllBody, CancelAllSuccess, CancelBody, CancelSuccess, CancelTriggerBody, CancelTriggerSuccess, ConditionalBalance, FillInfo, Order, OrderEvent, OrderStatus, OrderType, SubmitOrderResponse, TriggerOrder, TriggerOrderResponse, TriggerOrderUpdate, UserSnapshotBalance, UserSnapshotOrder, UserOrdersResponse, } from "./domain/order";
19
+ export type { UserOpenOrders, UserTriggerOrders } from "./domain/order/state";
20
+ export type { Portfolio, Position, PositionOutcome, WalletHolding, TokenBalance, TokenBalanceComputedBase, TokenBalanceTokenType, DepositAssetMetadata, DepositTokenBalance, } from "./domain/position";
21
+ export type { Trade } from "./domain/trade";
22
+ export { TradeHistory } from "./domain/trade/state";
23
+ export type { LineData } from "./domain/price_history";
24
+ export { PriceHistoryState } from "./domain/price_history";
25
+ export type { AuthCredentials, ChainType, EmbeddedWallet, LinkedAccount, LinkedAccountType, User, } from "./auth";
26
+ export { LimitOrderEnvelope, TriggerOrderEnvelope, type OrderEnvelope, type OrderPayload, } from "./program";
27
+ export type { ExportWalletRequest, ExportWalletResponse, PrivyOrderEnvelope, SignAndSendOrderRequest, SignAndSendTxRequest, SignAndSendTxResponse, } from "./privy";
28
+ export type { RedeemResult, ReferralCodeInfo, ReferralStatus, } from "./domain/referral";
29
+ export { RetryPolicy, type RetryConfig, } from "./http";
30
+ export type { Kind, MessageIn, MessageOut, SubscribeParams, UnsubscribeParams, WsEvent, } from "./ws";
31
+ export type AuthClient = import("./auth").Auth;
32
+ export type AdminClient = import("./domain/admin").Admin;
33
+ export type MarketsClient = import("./domain/market").Markets;
34
+ export type MarketsResult = import("./domain/market").MarketsResult;
35
+ export type OrderbooksClient = import("./domain/orderbook").Orderbooks;
36
+ export type OrdersClient = import("./domain/order").Orders;
37
+ export type PositionsClient = import("./domain/position").Positions;
38
+ export type TradesClient = import("./domain/trade").Trades;
39
+ export type PriceHistorySubClient = import("./domain/price_history").PriceHistoryClient;
40
+ export type ReferralsClient = import("./domain/referral").Referrals;
41
+ //# sourceMappingURL=prelude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prelude.d.ts","sourceRoot":"","sources":["../src/prelude.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,kBAAkB,GACxB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EACL,eAAe,EACf,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,YAAY,EACV,MAAM,EACN,MAAM,EACN,O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kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,WAAW,EACX,KAAK,WAAW,GACjB,MAAM,QAAQ,CAAC;AAEhB,YAAY,EACV,IAAI,EACJ,SAAS,EACT,UAAU,EACV,eAAe,EACf,iBAAiB,EACjB,OAAO,GACR,MAAM,MAAM,CAAC;AAEd,MAAM,MAAM,UAAU,GAAG,OAAO,QAAQ,EAAE,IAAI,CAAC;AAC/C,MAAM,MAAM,WAAW,GAAG,OAAO,gBAAgB,EAAE,KAAK,CAAC;AACzD,MAAM,MAAM,aAAa,GAAG,OAAO,iBAAiB,EAAE,OAAO,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,OAAO,iBAAiB,EAAE,aAAa,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,OAAO,oBAAoB,EAAE,UAAU,CAAC;AACvE,MAAM,MAAM,YAAY,GAAG,OAAO,gBAAgB,EAAE,MAAM,CAAC;AAC3D,MAAM,MAAM,eAAe,GAAG,OAAO,mBAAmB,EAAE,SAAS,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG,OAAO,gBAAgB,EAAE,MAAM,CAAC;AAC3D,MAAM,MAAM,qBAAqB,GAAG,OAAO,wBAAwB,EAAE,kBAAkB,CAAC;AACxF,MAAM,MAAM,eAAe,GAAG,OAAO,mBAAmB,EAAE,SAAS,CAAC"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RetryPolicy = exports.TriggerOrderEnvelope = exports.LimitOrderEnvelope = exports.PriceHistoryState = exports.TradeHistory = exports.OrderbookSnapshot = exports.OrderBookValidationError = exports.Referrals = exports.PriceHistoryClient = exports.Trades = exports.Positions = exports.Orders = exports.Orderbooks = exports.Markets = exports.Admin = exports.Auth = exports.LightconeClientBuilder = exports.LightconeClient = exports.DEFAULT_WS_URL = exports.DEFAULT_API_URL = exports.SdkError = exports.TriggerUpdateType = exports.TriggerType = exports.TriggerStatus = exports.TriggerResultStatus = exports.TimeInForce = exports.Side = exports.Resolution = exports.OrderUpdateType = exports.deriveOrderbookId = exports.asPubkeyStr = exports.asOrderBookId = void 0;
4
+ var shared_1 = require("./shared");
5
+ Object.defineProperty(exports, "asOrderBookId", { enumerable: true, get: function () { return shared_1.asOrderBookId; } });
6
+ Object.defineProperty(exports, "asPubkeyStr", { enumerable: true, get: function () { return shared_1.asPubkeyStr; } });
7
+ Object.defineProperty(exports, "deriveOrderbookId", { enumerable: true, get: function () { return shared_1.deriveOrderbookId; } });
8
+ Object.defineProperty(exports, "OrderUpdateType", { enumerable: true, get: function () { return shared_1.OrderUpdateType; } });
9
+ Object.defineProperty(exports, "Resolution", { enumerable: true, get: function () { return shared_1.Resolution; } });
10
+ Object.defineProperty(exports, "Side", { enumerable: true, get: function () { return shared_1.Side; } });
11
+ Object.defineProperty(exports, "TimeInForce", { enumerable: true, get: function () { return shared_1.TimeInForce; } });
12
+ Object.defineProperty(exports, "TriggerResultStatus", { enumerable: true, get: function () { return shared_1.TriggerResultStatus; } });
13
+ Object.defineProperty(exports, "TriggerStatus", { enumerable: true, get: function () { return shared_1.TriggerStatus; } });
14
+ Object.defineProperty(exports, "TriggerType", { enumerable: true, get: function () { return shared_1.TriggerType; } });
15
+ Object.defineProperty(exports, "TriggerUpdateType", { enumerable: true, get: function () { return shared_1.TriggerUpdateType; } });
16
+ var error_1 = require("./error");
17
+ Object.defineProperty(exports, "SdkError", { enumerable: true, get: function () { return error_1.SdkError; } });
18
+ var network_1 = require("./network");
19
+ Object.defineProperty(exports, "DEFAULT_API_URL", { enumerable: true, get: function () { return network_1.DEFAULT_API_URL; } });
20
+ Object.defineProperty(exports, "DEFAULT_WS_URL", { enumerable: true, get: function () { return network_1.DEFAULT_WS_URL; } });
21
+ var client_1 = require("./client");
22
+ Object.defineProperty(exports, "LightconeClient", { enumerable: true, get: function () { return client_1.LightconeClient; } });
23
+ Object.defineProperty(exports, "LightconeClientBuilder", { enumerable: true, get: function () { return client_1.LightconeClientBuilder; } });
24
+ var auth_1 = require("./auth");
25
+ Object.defineProperty(exports, "Auth", { enumerable: true, get: function () { return auth_1.Auth; } });
26
+ var admin_1 = require("./domain/admin");
27
+ Object.defineProperty(exports, "Admin", { enumerable: true, get: function () { return admin_1.Admin; } });
28
+ var market_1 = require("./domain/market");
29
+ Object.defineProperty(exports, "Markets", { enumerable: true, get: function () { return market_1.Markets; } });
30
+ var orderbook_1 = require("./domain/orderbook");
31
+ Object.defineProperty(exports, "Orderbooks", { enumerable: true, get: function () { return orderbook_1.Orderbooks; } });
32
+ var order_1 = require("./domain/order");
33
+ Object.defineProperty(exports, "Orders", { enumerable: true, get: function () { return order_1.Orders; } });
34
+ var position_1 = require("./domain/position");
35
+ Object.defineProperty(exports, "Positions", { enumerable: true, get: function () { return position_1.Positions; } });
36
+ var trade_1 = require("./domain/trade");
37
+ Object.defineProperty(exports, "Trades", { enumerable: true, get: function () { return trade_1.Trades; } });
38
+ var price_history_1 = require("./domain/price_history");
39
+ Object.defineProperty(exports, "PriceHistoryClient", { enumerable: true, get: function () { return price_history_1.PriceHistoryClient; } });
40
+ var referral_1 = require("./domain/referral");
41
+ Object.defineProperty(exports, "Referrals", { enumerable: true, get: function () { return referral_1.Referrals; } });
42
+ var orderbook_2 = require("./domain/orderbook");
43
+ Object.defineProperty(exports, "OrderBookValidationError", { enumerable: true, get: function () { return orderbook_2.OrderBookValidationError; } });
44
+ var state_1 = require("./domain/orderbook/state");
45
+ Object.defineProperty(exports, "OrderbookSnapshot", { enumerable: true, get: function () { return state_1.OrderbookSnapshot; } });
46
+ var state_2 = require("./domain/trade/state");
47
+ Object.defineProperty(exports, "TradeHistory", { enumerable: true, get: function () { return state_2.TradeHistory; } });
48
+ var price_history_2 = require("./domain/price_history");
49
+ Object.defineProperty(exports, "PriceHistoryState", { enumerable: true, get: function () { return price_history_2.PriceHistoryState; } });
50
+ var program_1 = require("./program");
51
+ Object.defineProperty(exports, "LimitOrderEnvelope", { enumerable: true, get: function () { return program_1.LimitOrderEnvelope; } });
52
+ Object.defineProperty(exports, "TriggerOrderEnvelope", { enumerable: true, get: function () { return program_1.TriggerOrderEnvelope; } });
53
+ var http_1 = require("./http");
54
+ Object.defineProperty(exports, "RetryPolicy", { enumerable: true, get: function () { return http_1.RetryPolicy; } });
55
+ //# sourceMappingURL=prelude.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prelude.js","sourceRoot":"","sources":["../src/prelude.ts"],"names":[],"mappings":";;;AAAA,mCAekB;AAdhB,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AACjB,yGAAA,eAAe,OAAA;AACf,oGAAA,UAAU,OAAA;AACV,8FAAA,IAAI,OAAA;AACJ,qGAAA,WAAW,OAAA;AACX,6GAAA,mBAAmB,OAAA;AACnB,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA;AAMnB,iCAAmC;AAA1B,iGAAA,QAAQ,OAAA;AACjB,qCAA4D;AAAnD,0GAAA,eAAe,OAAA;AAAE,yGAAA,cAAc,OAAA;AAExC,mCAGkB;AAFhB,yGAAA,eAAe,OAAA;AACf,gHAAA,sBAAsB,OAAA;AAGxB,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,wCAAuC;AAA9B,8FAAA,KAAK,OAAA;AACd,0CAA0C;AAAjC,iGAAA,OAAO,OAAA;AAChB,gDAAgD;AAAvC,uGAAA,UAAU,OAAA;AACnB,wCAAwC;AAA/B,+FAAA,MAAM,OAAA;AACf,8CAA8C;AAArC,qGAAA,SAAS,OAAA;AAClB,wCAAwC;AAA/B,+FAAA,MAAM,OAAA;AACf,wDAA4D;AAAnD,mHAAA,kBAAkB,OAAA;AAC3B,8CAA8C;AAArC,qGAAA,SAAS,OAAA;AAkBlB,gDAA8D;AAArD,qHAAA,wBAAwB,OAAA;AACjC,kDAA6D;AAApD,0GAAA,iBAAiB,OAAA;AAsC1B,8CAAoD;AAA3C,qGAAA,YAAY,OAAA;AAErB,wDAA2D;AAAlD,kHAAA,iBAAiB,OAAA;AAW1B,qCAKmB;AAJjB,6GAAA,kBAAkB,OAAA;AAClB,+GAAA,oBAAoB,OAAA;AAoBtB,+BAGgB;AAFd,mGAAA,WAAW,OAAA","sourcesContent":["export {\n asOrderBookId,\n asPubkeyStr,\n deriveOrderbookId,\n OrderUpdateType,\n Resolution,\n Side,\n TimeInForce,\n TriggerResultStatus,\n TriggerStatus,\n TriggerType,\n TriggerUpdateType,\n type OrderBookId,\n type PubkeyStr,\n type SubmitOrderRequest,\n} from \"./shared\";\n\nexport { SdkError } from \"./error\";\nexport { DEFAULT_API_URL, DEFAULT_WS_URL } from \"./network\";\n\nexport {\n LightconeClient,\n LightconeClientBuilder,\n} from \"./client\";\n\nexport { Auth } from \"./auth\";\nexport { Admin } from \"./domain/admin\";\nexport { Markets } from \"./domain/market\";\nexport { Orderbooks } from \"./domain/orderbook\";\nexport { Orders } from \"./domain/order\";\nexport { Positions } from \"./domain/position\";\nexport { Trades } from \"./domain/trade\";\nexport { PriceHistoryClient } from \"./domain/price_history\";\nexport { Referrals } from \"./domain/referral\";\n\nexport type {\n Market,\n Status,\n Outcome,\n ConditionalToken,\n DepositAsset,\n Token,\n TokenMetadata,\n ValidatedTokens,\n} from \"./domain/market\";\n\nexport type {\n OrderBookPair,\n OutcomeImpact,\n TickerData,\n} from \"./domain/orderbook\";\nexport { OrderBookValidationError } from \"./domain/orderbook\";\nexport { OrderbookSnapshot } from \"./domain/orderbook/state\";\n\nexport type {\n CancelAllBody,\n CancelAllSuccess,\n CancelBody,\n CancelSuccess,\n CancelTriggerBody,\n CancelTriggerSuccess,\n ConditionalBalance,\n FillInfo,\n Order,\n OrderEvent,\n OrderStatus,\n OrderType,\n SubmitOrderResponse,\n TriggerOrder,\n TriggerOrderResponse,\n TriggerOrderUpdate,\n UserSnapshotBalance,\n UserSnapshotOrder,\n UserOrdersResponse,\n} from \"./domain/order\";\nexport type { UserOpenOrders, UserTriggerOrders } from \"./domain/order/state\";\n\nexport type {\n Portfolio,\n Position,\n PositionOutcome,\n WalletHolding,\n TokenBalance,\n TokenBalanceComputedBase,\n TokenBalanceTokenType,\n DepositAssetMetadata,\n DepositTokenBalance,\n} from \"./domain/position\";\n\nexport type { Trade } from \"./domain/trade\";\nexport { TradeHistory } from \"./domain/trade/state\";\nexport type { LineData } from \"./domain/price_history\";\nexport { PriceHistoryState } from \"./domain/price_history\";\n\nexport type {\n AuthCredentials,\n ChainType,\n EmbeddedWallet,\n LinkedAccount,\n LinkedAccountType,\n User,\n} from \"./auth\";\n\nexport {\n LimitOrderEnvelope,\n TriggerOrderEnvelope,\n type OrderEnvelope,\n type OrderPayload,\n} from \"./program\";\n\nexport type {\n ExportWalletRequest,\n ExportWalletResponse,\n PrivyOrderEnvelope,\n SignAndSendOrderRequest,\n SignAndSendTxRequest,\n SignAndSendTxResponse,\n} from \"./privy\";\n\nexport type {\n RedeemResult,\n ReferralCodeInfo,\n ReferralStatus,\n} from \"./domain/referral\";\n\nexport {\n RetryPolicy,\n type RetryConfig,\n} from \"./http\";\n\nexport type {\n Kind,\n MessageIn,\n MessageOut,\n SubscribeParams,\n UnsubscribeParams,\n WsEvent,\n} from \"./ws\";\n\nexport type AuthClient = import(\"./auth\").Auth;\nexport type AdminClient = import(\"./domain/admin\").Admin;\nexport type MarketsClient = import(\"./domain/market\").Markets;\nexport type MarketsResult = import(\"./domain/market\").MarketsResult;\nexport type OrderbooksClient = import(\"./domain/orderbook\").Orderbooks;\nexport type OrdersClient = import(\"./domain/order\").Orders;\nexport type PositionsClient = import(\"./domain/position\").Positions;\nexport type TradesClient = import(\"./domain/trade\").Trades;\nexport type PriceHistorySubClient = import(\"./domain/price_history\").PriceHistoryClient;\nexport type ReferralsClient = import(\"./domain/referral\").Referrals;\n"]}
@@ -0,0 +1,17 @@
1
+ import { type LightconeHttp } from "../http";
2
+ import type { ExportWalletResponse, PrivyOrderEnvelope, SignAndSendTxResponse } from "./index";
3
+ interface ClientContext {
4
+ http: LightconeHttp;
5
+ }
6
+ export declare class Privy {
7
+ private readonly client;
8
+ constructor(client: ClientContext);
9
+ signAndSendTx(walletId: string, base64Tx: string): Promise<SignAndSendTxResponse>;
10
+ signAndSendOrder(walletId: string, order: PrivyOrderEnvelope): Promise<unknown>;
11
+ signAndCancelOrder(walletId: string, orderHash: string, maker: string): Promise<unknown>;
12
+ signAndCancelTriggerOrder(walletId: string, triggerOrderId: string, maker: string): Promise<unknown>;
13
+ signAndCancelAllOrders(walletId: string, userPubkey: string, orderbookId: string | undefined, timestamp: number): Promise<unknown>;
14
+ exportWallet(walletId: string, decodePubkeyBase64: string): Promise<ExportWalletResponse>;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/privy/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,KAAK,EAEV,oBAAoB,EACpB,kBAAkB,EAKlB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAEjB,UAAU,aAAa;IACrB,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,qBAAa,KAAK;IACJ,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAE5C,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAajF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAS/E,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAWxF,yBAAyB,CAC7B,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,OAAO,CAAC;IAWb,sBAAsB,CAC1B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,YAAK,EACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IAWb,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAYhG"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Privy = void 0;
4
+ const http_1 = require("../http");
5
+ class Privy {
6
+ client;
7
+ constructor(client) {
8
+ this.client = client;
9
+ }
10
+ async signAndSendTx(walletId, base64Tx) {
11
+ const url = `${this.client.http.baseUrl()}/api/privy/sign_and_send_tx`;
12
+ const body = {
13
+ wallet_id: walletId,
14
+ base64_tx: base64Tx,
15
+ };
16
+ return this.client.http.post(url, body, http_1.RetryPolicy.None);
17
+ }
18
+ async signAndSendOrder(walletId, order) {
19
+ const url = `${this.client.http.baseUrl()}/api/privy/sign_and_send_order`;
20
+ const body = {
21
+ wallet_id: walletId,
22
+ order,
23
+ };
24
+ return this.client.http.post(url, body, http_1.RetryPolicy.None);
25
+ }
26
+ async signAndCancelOrder(walletId, orderHash, maker) {
27
+ const url = `${this.client.http.baseUrl()}/api/privy/sign_and_cancel_order`;
28
+ const body = {
29
+ wallet_id: walletId,
30
+ maker,
31
+ cancel_type: "limit",
32
+ order_hash: orderHash,
33
+ };
34
+ return this.client.http.post(url, body, http_1.RetryPolicy.None);
35
+ }
36
+ async signAndCancelTriggerOrder(walletId, triggerOrderId, maker) {
37
+ const url = `${this.client.http.baseUrl()}/api/privy/sign_and_cancel_order`;
38
+ const body = {
39
+ wallet_id: walletId,
40
+ maker,
41
+ cancel_type: "trigger",
42
+ trigger_order_id: triggerOrderId,
43
+ };
44
+ return this.client.http.post(url, body, http_1.RetryPolicy.None);
45
+ }
46
+ async signAndCancelAllOrders(walletId, userPubkey, orderbookId = "", timestamp) {
47
+ const url = `${this.client.http.baseUrl()}/api/privy/sign_and_cancel_all_orders`;
48
+ const body = {
49
+ wallet_id: walletId,
50
+ user_pubkey: userPubkey,
51
+ orderbook_id: orderbookId,
52
+ timestamp,
53
+ };
54
+ return this.client.http.post(url, body, http_1.RetryPolicy.None);
55
+ }
56
+ async exportWallet(walletId, decodePubkeyBase64) {
57
+ const url = `${this.client.http.baseUrl()}/api/privy/wallet/export`;
58
+ const body = {
59
+ wallet_id: walletId,
60
+ decode_pubkey_base64: decodePubkeyBase64,
61
+ };
62
+ return this.client.http.post(url, body, http_1.RetryPolicy.None);
63
+ }
64
+ }
65
+ exports.Privy = Privy;
66
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/privy/client.ts"],"names":[],"mappings":";;;AAAA,kCAA0D;AAgB1D,MAAa,KAAK;IACa;IAA7B,YAA6B,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAEtD,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,QAAgB;QACpD,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,6BAA6B,CAAC;QACvE,MAAM,IAAI,GAAyB;YACjC,SAAS,EAAE,QAAQ;YACnB,SAAS,EAAE,QAAQ;SACpB,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAC1B,GAAG,EACH,IAAI,EACJ,kBAAW,CAAC,IAAI,CACjB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAgB,EAAE,KAAyB;QAChE,MAA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MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,uCAAuC,CAAC;QACjF,MAAM,IAAI,GAA4B;YACpC,SAAS,EAAE,QAAQ;YACnB,WAAW,EAAE,UAAU;YACvB,YAAY,EAAE,WAAW;YACzB,SAAS;SACV,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAmC,GAAG,EAAE,IAAI,EAAE,kBAAW,CAAC,IAAI,CAAC,CAAC;IAC9F,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,QAAgB,EAAE,kBAA0B;QAC7D,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,0BAA0B,CAAC;QACpE,MAAM,IAAI,GAAwB;YAChC,SAAS,EAAE,QAAQ;YACnB,oBAAoB,EAAE,kBAAkB;SACzC,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAC1B,GAAG,EACH,IAAI,EACJ,kBAAW,CAAC,IAAI,CACjB,CAAC;IACJ,CAAC;CACF;AA/ED,sBA+EC","sourcesContent":["import { RetryPolicy, type LightconeHttp } from \"../http\";\nimport type {\n ExportWalletRequest,\n ExportWalletResponse,\n PrivyOrderEnvelope,\n SignAndCancelAllRequest,\n SignAndCancelOrderRequest,\n SignAndSendOrderRequest,\n SignAndSendTxRequest,\n SignAndSendTxResponse,\n} from \"./index\";\n\ninterface ClientContext {\n http: LightconeHttp;\n}\n\nexport class Privy {\n constructor(private readonly client: ClientContext) {}\n\n async signAndSendTx(walletId: string, base64Tx: string): Promise<SignAndSendTxResponse> {\n const url = `${this.client.http.baseUrl()}/api/privy/sign_and_send_tx`;\n const body: SignAndSendTxRequest = {\n wallet_id: walletId,\n base64_tx: base64Tx,\n };\n return this.client.http.post<SignAndSendTxResponse, SignAndSendTxRequest>(\n url,\n body,\n RetryPolicy.None\n );\n }\n\n async signAndSendOrder(walletId: string, order: PrivyOrderEnvelope): Promise<unknown> {\n const url = `${this.client.http.baseUrl()}/api/privy/sign_and_send_order`;\n const body: SignAndSendOrderRequest = {\n wallet_id: walletId,\n order,\n };\n return this.client.http.post<unknown, SignAndSendOrderRequest>(url, body, RetryPolicy.None);\n }\n\n async signAndCancelOrder(walletId: string, orderHash: string, maker: string): Promise<unknown> {\n const url = `${this.client.http.baseUrl()}/api/privy/sign_and_cancel_order`;\n const body: SignAndCancelOrderRequest = {\n wallet_id: walletId,\n maker,\n cancel_type: \"limit\",\n order_hash: orderHash,\n };\n return this.client.http.post<unknown, SignAndCancelOrderRequest>(url, body, RetryPolicy.None);\n }\n\n async signAndCancelTriggerOrder(\n walletId: string,\n triggerOrderId: string,\n maker: string\n ): Promise<unknown> {\n const url = `${this.client.http.baseUrl()}/api/privy/sign_and_cancel_order`;\n const body: SignAndCancelOrderRequest = {\n wallet_id: walletId,\n maker,\n cancel_type: \"trigger\",\n trigger_order_id: triggerOrderId,\n };\n return this.client.http.post<unknown, SignAndCancelOrderRequest>(url, body, RetryPolicy.None);\n }\n\n async signAndCancelAllOrders(\n walletId: string,\n userPubkey: string,\n orderbookId: string = \"\",\n timestamp: number\n ): Promise<unknown> {\n const url = `${this.client.http.baseUrl()}/api/privy/sign_and_cancel_all_orders`;\n const body: SignAndCancelAllRequest = {\n wallet_id: walletId,\n user_pubkey: userPubkey,\n orderbook_id: orderbookId,\n timestamp,\n };\n return this.client.http.post<unknown, SignAndCancelAllRequest>(url, body, RetryPolicy.None);\n }\n\n async exportWallet(walletId: string, decodePubkeyBase64: string): Promise<ExportWalletResponse> {\n const url = `${this.client.http.baseUrl()}/api/privy/wallet/export`;\n const body: ExportWalletRequest = {\n wallet_id: walletId,\n decode_pubkey_base64: decodePubkeyBase64,\n };\n return this.client.http.post<ExportWalletResponse, ExportWalletRequest>(\n url,\n body,\n RetryPolicy.None\n );\n }\n}\n"]}
@@ -0,0 +1,57 @@
1
+ export * from "./client";
2
+ import type { LimitOrderEnvelope, TriggerOrderEnvelope } from "../program/envelope";
3
+ export interface SignAndSendTxRequest {
4
+ wallet_id: string;
5
+ base64_tx: string;
6
+ }
7
+ export interface SignAndSendTxResponse {
8
+ hash: string;
9
+ }
10
+ export interface PrivyOrderEnvelope {
11
+ maker: string;
12
+ nonce: number;
13
+ market_pubkey: string;
14
+ base_token: string;
15
+ quote_token: string;
16
+ side: number;
17
+ amount_in: number;
18
+ amount_out: number;
19
+ expiration?: number;
20
+ orderbook_id: string;
21
+ tif?: import("../shared").TimeInForce;
22
+ trigger_price?: number;
23
+ trigger_type?: import("../shared").TriggerType;
24
+ }
25
+ export interface SignAndSendOrderRequest {
26
+ wallet_id: string;
27
+ order: PrivyOrderEnvelope;
28
+ }
29
+ export type CancelTarget = {
30
+ cancel_type: "limit";
31
+ order_hash: string;
32
+ } | {
33
+ cancel_type: "trigger";
34
+ trigger_order_id: string;
35
+ };
36
+ export type SignAndCancelOrderRequest = {
37
+ wallet_id: string;
38
+ maker: string;
39
+ } & CancelTarget;
40
+ export interface SignAndCancelAllRequest {
41
+ wallet_id: string;
42
+ user_pubkey: string;
43
+ orderbook_id?: string;
44
+ timestamp: number;
45
+ }
46
+ export interface ExportWalletRequest {
47
+ wallet_id: string;
48
+ decode_pubkey_base64: string;
49
+ }
50
+ export interface ExportWalletResponse {
51
+ encryption_type: string;
52
+ ciphertext: string;
53
+ encapsulated_key: string;
54
+ }
55
+ export declare function privyOrderFromLimitEnvelope(envelope: LimitOrderEnvelope, orderbookId: string): PrivyOrderEnvelope;
56
+ export declare function privyOrderFromTriggerEnvelope(envelope: TriggerOrderEnvelope, orderbookId: string): PrivyOrderEnvelope;
57
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/privy/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEpF,MAAM,WAAW,oBAAo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MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAoBD,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,kBAAkB,EAC5B,WAAW,EAAE,MAAM,GAClB,kBAAkB,CAsBpB;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,oBAAoB,EAC9B,WAAW,EAAE,MAAM,GAClB,kBAAkB,CAyBpB"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.privyOrderFromLimitEnvelope = privyOrderFromLimitEnvelope;
18
+ exports.privyOrderFromTriggerEnvelope = privyOrderFromTriggerEnvelope;
19
+ __exportStar(require("./client"), exports);
20
+ function requireDefined(value, field) {
21
+ if (value === undefined) {
22
+ throw new Error(`Missing required field: ${field}`);
23
+ }
24
+ return value;
25
+ }
26
+ function bigintToSafeNumber(value, field) {
27
+ const max = BigInt(Number.MAX_SAFE_INTEGER);
28
+ if (value > max || value < -max) {
29
+ throw new Error(`${field} exceeds Number.MAX_SAFE_INTEGER`);
30
+ }
31
+ return Number(value);
32
+ }
33
+ function privyOrderFromLimitEnvelope(envelope, orderbookId) {
34
+ const maker = requireDefined(envelope.fieldsMaker(), "maker");
35
+ const nonce = requireDefined(envelope.fieldsNonce(), "nonce");
36
+ const market = requireDefined(envelope.fieldsMarket(), "market");
37
+ const baseMint = requireDefined(envelope.fieldsBaseMint(), "base_mint");
38
+ const quoteMint = requireDefined(envelope.fieldsQuoteMint(), "quote_mint");
39
+ const side = requireDefined(envelope.fieldsSide(), "side");
40
+ const amountIn = requireDefined(envelope.fieldsAmountIn(), "amount_in");
41
+ const amountOut = requireDefined(envelope.fieldsAmountOut(), "amount_out");
42
+ return {
43
+ maker: maker.toBase58(),
44
+ nonce,
45
+ market_pubkey: market.toBase58(),
46
+ base_token: baseMint.toBase58(),
47
+ quote_token: quoteMint.toBase58(),
48
+ side,
49
+ amount_in: bigintToSafeNumber(amountIn, "amount_in"),
50
+ amount_out: bigintToSafeNumber(amountOut, "amount_out"),
51
+ expiration: bigintToSafeNumber(envelope.fieldsExpiration(), "expiration"),
52
+ orderbook_id: orderbookId,
53
+ };
54
+ }
55
+ function privyOrderFromTriggerEnvelope(envelope, orderbookId) {
56
+ const maker = requireDefined(envelope.fieldsMaker(), "maker");
57
+ const nonce = requireDefined(envelope.fieldsNonce(), "nonce");
58
+ const market = requireDefined(envelope.fieldsMarket(), "market");
59
+ const baseMint = requireDefined(envelope.fieldsBaseMint(), "base_mint");
60
+ const quoteMint = requireDefined(envelope.fieldsQuoteMint(), "quote_mint");
61
+ const side = requireDefined(envelope.fieldsSide(), "side");
62
+ const amountIn = requireDefined(envelope.fieldsAmountIn(), "amount_in");
63
+ const amountOut = requireDefined(envelope.fieldsAmountOut(), "amount_out");
64
+ return {
65
+ maker: maker.toBase58(),
66
+ nonce,
67
+ market_pubkey: market.toBase58(),
68
+ base_token: baseMint.toBase58(),
69
+ quote_token: quoteMint.toBase58(),
70
+ side,
71
+ amount_in: bigintToSafeNumber(amountIn, "amount_in"),
72
+ amount_out: bigintToSafeNumber(amountOut, "amount_out"),
73
+ expiration: bigintToSafeNumber(envelope.fieldsExpiration(), "expiration"),
74
+ orderbook_id: orderbookId,
75
+ tif: envelope.fieldsTimeInForce(),
76
+ trigger_price: envelope.fieldsTriggerPrice(),
77
+ trigger_type: envelope.fieldsTriggerType(),
78
+ };
79
+ }
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/privy/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA8EA,kEAyBC;AAED,sEA4BC;AArID,2CAAyB;AA4DzB,SAAS,cAAc,CACrB,KAAoB,EACpB,KAAa;IAEb,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa,EAAE,KAAa;IACtD,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAC5C,IAAI,KAAK,GAAG,GAAG,IAAI,KAAK,GAAG,CAAC,GAAG,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,kCAAkC,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,SAAgB,2BAA2B,CACzC,QAA4B,EAC5B,WAAmB;IAEnB,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,cAAc,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,cAAc,CAAC,QAAQ,CAAC,YAAY,EAAE,EAAE,QAAQ,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,WAAW,CAA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,CAAC,QAAQ,CAAC,eAAe,EAAE,EAAE,YAAY,CAAC,CAAC;IAC3E,MAAM,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,CAAC,cAAc,EAAE,EAAE,WAAW,CAAC,CAAC;IACxE,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAC,eAAe,EAAE,EAAE,YAAY,CAAC,CAAC;IAE3E,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE;QACvB,KAAK;QACL,aAAa,EAAE,MAAM,CAAC,QAAQ,EAAE;QAChC,UAAU,EAAE,QAAQ,CAAC,QAAQ,EAAE;QAC/B,WAAW,EAAE,SAAS,CAAC,QAAQ,EAAE;QACjC,IAAI;QACJ,SAAS,EAAE,kBAAkB,CAAC,QAAQ,EAAE,WAAW,CAAC;QACpD,UAAU,EAAE,kBAAkB,CAAC,SAAS,EAAE,YAAY,CAAC;QACvD,UAAU,EAAE,kBAAkB,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,YAAY,CAAC;QACzE,YAAY,EAAE,WAAW;QACzB,GAAG,EAAE,QAAQ,CAAC,iBAAiB,EAAE;QACjC,aAAa,EAAE,QAAQ,CAAC,kBAAkB,EAAE;QAC5C,YAAY,EAAE,QAAQ,CAAC,iBAAiB,EAAE;KAC3C,CAAC;AACJ,CAAC","sourcesContent":["export * from \"./client\";\nimport type { LimitOrderEnvelope, TriggerOrderEnvelope } from \"../program/envelope\";\n\nexport interface SignAndSendTxRequest {\n wallet_id: string;\n base64_tx: string;\n}\n\nexport interface SignAndSendTxResponse {\n hash: string;\n}\n\nexport interface PrivyOrderEnvelope {\n maker: string;\n nonce: number;\n market_pubkey: string;\n base_token: string;\n quote_token: string;\n side: number;\n amount_in: number;\n amount_out: number;\n expiration?: number;\n orderbook_id: string;\n tif?: import(\"../shared\").TimeInForce;\n trigger_price?: number;\n trigger_type?: import(\"../shared\").TriggerType;\n}\n\nexport interface SignAndSendOrderRequest {\n wallet_id: string;\n order: PrivyOrderEnvelope;\n}\n\nexport type CancelTarget =\n | { cancel_type: \"limit\"; order_hash: string }\n | { cancel_type: \"trigger\"; trigger_order_id: string };\n\nexport type SignAndCancelOrderRequest = {\n wallet_id: string;\n maker: string;\n} & CancelTarget;\n\nexport interface SignAndCancelAllRequest {\n wallet_id: string;\n user_pubkey: string;\n orderbook_id?: string;\n timestamp: number;\n}\n\nexport interface ExportWalletRequest {\n wallet_id: string;\n decode_pubkey_base64: string;\n}\n\nexport interface ExportWalletResponse {\n encryption_type: string;\n ciphertext: string;\n encapsulated_key: string;\n}\n\nfunction requireDefined<T>(\n value: T | undefined,\n field: string\n): T {\n if (value === undefined) {\n throw new Error(`Missing required field: ${field}`);\n }\n return value;\n}\n\nfunction bigintToSafeNumber(value: bigint, field: string): number {\n const max = BigInt(Number.MAX_SAFE_INTEGER);\n if (value > max || value < -max) {\n throw new Error(`${field} exceeds Number.MAX_SAFE_INTEGER`);\n }\n return Number(value);\n}\n\nexport function privyOrderFromLimitEnvelope(\n envelope: LimitOrderEnvelope,\n orderbookId: string\n): PrivyOrderEnvelope {\n const maker = requireDefined(envelope.fieldsMaker(), \"maker\");\n const nonce = requireDefined(envelope.fieldsNonce(), \"nonce\");\n const market = requireDefined(envelope.fieldsMarket(), \"market\");\n const baseMint = requireDefined(envelope.fieldsBaseMint(), \"base_mint\");\n const quoteMint = requireDefined(envelope.fieldsQuoteMint(), \"quote_mint\");\n const side = requireDefined(envelope.fieldsSide(), \"side\");\n const amountIn = requireDefined(envelope.fieldsAmountIn(), \"amount_in\");\n const amountOut = requireDefined(envelope.fieldsAmountOut(), \"amount_out\");\n\n return {\n maker: maker.toBase58(),\n nonce,\n market_pubkey: market.toBase58(),\n base_token: baseMint.toBase58(),\n quote_token: quoteMint.toBase58(),\n side,\n amount_in: bigintToSafeNumber(amountIn, \"amount_in\"),\n amount_out: bigintToSafeNumber(amountOut, \"amount_out\"),\n expiration: bigintToSafeNumber(envelope.fieldsExpiration(), \"expiration\"),\n orderbook_id: orderbookId,\n };\n}\n\nexport function privyOrderFromTriggerEnvelope(\n envelope: TriggerOrderEnvelope,\n orderbookId: string\n): PrivyOrderEnvelope {\n const maker = requireDefined(envelope.fieldsMaker(), \"maker\");\n const nonce = requireDefined(envelope.fieldsNonce(), \"nonce\");\n const market = requireDefined(envelope.fieldsMarket(), \"market\");\n const baseMint = requireDefined(envelope.fieldsBaseMint(), \"base_mint\");\n const quoteMint = requireDefined(envelope.fieldsQuoteMint(), \"quote_mint\");\n const side = requireDefined(envelope.fieldsSide(), \"side\");\n const amountIn = requireDefined(envelope.fieldsAmountIn(), \"amount_in\");\n const amountOut = requireDefined(envelope.fieldsAmountOut(), \"amount_out\");\n\n return {\n maker: maker.toBase58(),\n nonce,\n market_pubkey: market.toBase58(),\n base_token: baseMint.toBase58(),\n quote_token: quoteMint.toBase58(),\n side,\n amount_in: bigintToSafeNumber(amountIn, \"amount_in\"),\n amount_out: bigintToSafeNumber(amountOut, \"amount_out\"),\n expiration: bigintToSafeNumber(envelope.fieldsExpiration(), \"expiration\"),\n orderbook_id: orderbookId,\n tif: envelope.fieldsTimeInForce(),\n trigger_price: envelope.fieldsTriggerPrice(),\n trigger_type: envelope.fieldsTriggerType(),\n };\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Exchange, Market, OrderStatus, UserNonce, Position, Orderbook } from "./types";
1
+ import { Exchange, GlobalDepositToken, Market, OrderStatus, UserNonce, Position, Orderbook } from "./types";
2
2
  /**
3
3
  * Check if a buffer has a valid Exchange discriminator
4
4
  */
@@ -23,6 +23,10 @@ export declare function isPositionAccount(data: Buffer): boolean;
23
23
  * Check if a buffer has a valid Orderbook discriminator
24
24
  */
25
25
  export declare function isOrderbookAccount(data: Buffer): boolean;
26
+ /**
27
+ * Check if a buffer has a valid GlobalDepositToken discriminator
28
+ */
29
+ export declare function isGlobalDepositTokenAccount(data: Buffer): boolean;
26
30
  /**
27
31
  * Deserialize Exchange account data
28
32
  *
@@ -33,7 +37,8 @@ export declare function isOrderbookAccount(data: Buffer): boolean;
33
37
  * - market_count: u64 (8 bytes)
34
38
  * - paused: u8 (1 byte)
35
39
  * - bump: u8 (1 byte)
36
- * - _padding: [u8; 6]
40
+ * - deposit_token_count: u16 (2 bytes)
41
+ * - _padding: [u8; 4]
37
42
  */
38
43
  export declare function deserializeExchange(data: Buffer): Exchange;
39
44
  /**
@@ -95,4 +100,16 @@ export declare function deserializePosition(data: Buffer): Position;
95
100
  * - _padding: [u8; 7]
96
101
  */
97
102
  export declare function deserializeOrderbook(data: Buffer): Orderbook;
103
+ /**
104
+ * Deserialize GlobalDepositToken account data
105
+ *
106
+ * Layout (48 bytes):
107
+ * - discriminator: [u8; 8]
108
+ * - mint: Pubkey (32 bytes)
109
+ * - active: u8 (1 byte)
110
+ * - bump: u8 (1 byte)
111
+ * - index: u16 (2 bytes) - deterministic ALT ordering
112
+ * - _padding: [u8; 4]
113
+ */
114
+ export declare function deserializeGlobalDepositToken(data: Buffer): GlobalDepositToken;
98
115
  //# sourceMappingURL=accounts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/program/accounts.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,QAAQ,EACR,MAAM,EAEN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,SAAS,EACV,MAAM,SAAS,CAAC;AAuBjB;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGrD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG1D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED;;G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AAM,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGxD;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGjE;AAMD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CA2C1D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2EtD;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CA2BhE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAqB5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CA+B1D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAuC5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,CAkC9E"}
@@ -6,12 +6,14 @@ exports.isOrderStatusAccount = isOrderStatusAccount;
6
6
  exports.isUserNonceAccount = isUserNonceAccount;
7
7
  exports.isPositionAccount = isPositionAccount;
8
8
  exports.isOrderbookAccount = isOrderbookAccount;
9
+ exports.isGlobalDepositTokenAccount = isGlobalDepositTokenAccount;
9
10
  exports.deserializeExchange = deserializeExchange;
10
11
  exports.deserializeMarket = deserializeMarket;
11
12
  exports.deserializeOrderStatus = deserializeOrderStatus;
12
13
  exports.deserializeUserNonce = deserializeUserNonce;
13
14
  exports.deserializePosition = deserializePosition;
14
15
  exports.deserializeOrderbook = deserializeOrderbook;
16
+ exports.deserializeGlobalDepositToken = deserializeGlobalDepositToken;
15
17
  const web3_js_1 = require("@solana/web3.js");
16
18
  const constants_1 = require("./constants");
17
19
  const types_1 = require("./types");
@@ -76,6 +78,14 @@ function isOrderbookAccount(data) {
76
78
  return false;
77
79
  return data.subarray(0, 8).equals(constants_1.DISCRIMINATOR.ORDERBOOK);
78
80
  }
81
+ /**
82
+ * Check if a buffer has a valid GlobalDepositToken discriminator
83
+ */
84
+ function isGlobalDepositTokenAccount(data) {
85
+ if (data.length < 8)
86
+ return false;
87
+ return data.subarray(0, 8).equals(constants_1.DISCRIMINATOR.GLOBAL_DEPOSIT_TOKEN);
88
+ }
79
89
  // ============================================================================
80
90
  // ACCOUNT DESERIALIZATION
81
91
  // ============================================================================
@@ -89,7 +99,8 @@ function isOrderbookAccount(data) {
89
99
  * - market_count: u64 (8 bytes)
90
100
  * - paused: u8 (1 byte)
91
101
  * - bump: u8 (1 byte)
92
- * - _padding: [u8; 6]
102
+ * - deposit_token_count: u16 (2 bytes)
103
+ * - _padding: [u8; 4]
93
104
  */
94
105
  function deserializeExchange(data) {
95
106
  if (data.length < constants_1.ACCOUNT_SIZE.EXCHANGE) {
@@ -109,7 +120,9 @@ function deserializeExchange(data) {
109
120
  offset += 1;
110
121
  const bump = data[offset];
111
122
  offset += 1;
112
- // Skip padding: 6 bytes
123
+ const depositTokenCount = data.readUInt16LE(offset);
124
+ offset += 2;
125
+ // Skip padding: 4 bytes
113
126
  return {
114
127
  discriminator,
115
128
  authority,
@@ -117,6 +130,7 @@ function deserializeExchange(data) {
117
130
  marketCount,
118
131
  paused,
119
132
  bump,
133
+ depositTokenCount,
120
134
  };
121
135
  }
122
136
  /**
@@ -316,4 +330,40 @@ function deserializeOrderbook(data) {
316
330
  bump,
317
331
  };
318
332
  }
333
+ /**
334
+ * Deserialize GlobalDepositToken account data
335
+ *
336
+ * Layout (48 bytes):
337
+ * - discriminator: [u8; 8]
338
+ * - mint: Pubkey (32 bytes)
339
+ * - active: u8 (1 byte)
340
+ * - bump: u8 (1 byte)
341
+ * - index: u16 (2 bytes) - deterministic ALT ordering
342
+ * - _padding: [u8; 4]
343
+ */
344
+ function deserializeGlobalDepositToken(data) {
345
+ if (data.length < constants_1.ACCOUNT_SIZE.GLOBAL_DEPOSIT_TOKEN) {
346
+ throw new Error(`Invalid GlobalDepositToken data length: ${data.length}, expected ${constants_1.ACCOUNT_SIZE.GLOBAL_DEPOSIT_TOKEN}`);
347
+ }
348
+ validateDiscriminator(data, constants_1.DISCRIMINATOR.GLOBAL_DEPOSIT_TOKEN, "GlobalDepositToken");
349
+ let offset = 0;
350
+ const discriminator = data.subarray(offset, offset + 8);
351
+ offset += 8;
352
+ const mint = new web3_js_1.PublicKey(data.subarray(offset, offset + 32));
353
+ offset += 32;
354
+ const active = data[offset] !== 0;
355
+ offset += 1;
356
+ const bump = data[offset];
357
+ offset += 1;
358
+ const index = data.readUInt16LE(offset);
359
+ offset += 2;
360
+ // Skip padding: 4 bytes
361
+ return {
362
+ discriminator,
363
+ mint,
364
+ active,
365
+ bump,
366
+ index,
367
+ };
368
+ }
319
369
  //# sourceMappingURL=accounts.js.map