@lightconexyz/lightcone-sdk 0.1.0 → 0.2.1

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 (381) 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 +63 -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 +45 -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 +16 -1
  203. package/dist/program/accounts.d.ts.map +1 -1
  204. package/dist/program/accounts.js +41 -0
  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 +37 -1
  211. package/dist/program/client.d.ts.map +1 -1
  212. package/dist/program/client.js +82 -2
  213. package/dist/program/client.js.map +1 -1
  214. package/dist/program/constants.d.ts +9 -1
  215. package/dist/program/constants.d.ts.map +1 -1
  216. package/dist/program/constants.js +9 -1
  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 +28 -3
  229. package/dist/program/index.js.map +1 -1
  230. package/dist/program/instructions.d.ts +78 -1
  231. package/dist/program/instructions.d.ts.map +1 -1
  232. package/dist/program/instructions.js +277 -3
  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 +72 -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.browser.d.ts +46 -0
  274. package/dist/ws/client.browser.d.ts.map +1 -0
  275. package/dist/ws/client.browser.js +245 -0
  276. package/dist/ws/client.browser.js.map +1 -0
  277. package/dist/ws/client.node.d.ts +36 -0
  278. package/dist/ws/client.node.d.ts.map +1 -0
  279. package/dist/ws/client.node.js +226 -0
  280. package/dist/ws/client.node.js.map +1 -0
  281. package/dist/ws/index.d.ts +110 -0
  282. package/dist/ws/index.d.ts.map +1 -0
  283. package/dist/ws/index.js +181 -0
  284. package/dist/ws/index.js.map +1 -0
  285. package/dist/ws/subscriptions.d.ts +51 -0
  286. package/dist/ws/subscriptions.d.ts.map +1 -0
  287. package/dist/ws/subscriptions.js +44 -0
  288. package/dist/ws/subscriptions.js.map +1 -0
  289. package/dist/ws/types.d.ts +23 -0
  290. package/dist/ws/types.d.ts.map +1 -0
  291. package/dist/ws/types.js +3 -0
  292. package/dist/ws/types.js.map +1 -0
  293. package/package.json +10 -13
  294. package/dist/api/client.d.ts +0 -225
  295. package/dist/api/client.d.ts.map +0 -1
  296. package/dist/api/client.js +0 -452
  297. package/dist/api/client.js.map +0 -1
  298. package/dist/api/error.d.ts +0 -58
  299. package/dist/api/error.d.ts.map +0 -1
  300. package/dist/api/error.js +0 -98
  301. package/dist/api/error.js.map +0 -1
  302. package/dist/api/index.d.ts +0 -23
  303. package/dist/api/index.d.ts.map +0 -1
  304. package/dist/api/index.js +0 -51
  305. package/dist/api/index.js.map +0 -1
  306. package/dist/api/types/admin.d.ts +0 -49
  307. package/dist/api/types/admin.d.ts.map +0 -1
  308. package/dist/api/types/admin.js +0 -13
  309. package/dist/api/types/admin.js.map +0 -1
  310. package/dist/api/types/index.d.ts +0 -14
  311. package/dist/api/types/index.d.ts.map +0 -1
  312. package/dist/api/types/index.js +0 -13
  313. package/dist/api/types/index.js.map +0 -1
  314. package/dist/api/types/market.d.ts +0 -186
  315. package/dist/api/types/market.d.ts.map +0 -1
  316. package/dist/api/types/market.js +0 -6
  317. package/dist/api/types/market.js.map +0 -1
  318. package/dist/api/types/order.d.ts +0 -190
  319. package/dist/api/types/order.d.ts.map +0 -1
  320. package/dist/api/types/order.js +0 -6
  321. package/dist/api/types/order.js.map +0 -1
  322. package/dist/api/types/orderbook.d.ts +0 -36
  323. package/dist/api/types/orderbook.d.ts.map +0 -1
  324. package/dist/api/types/orderbook.js +0 -6
  325. package/dist/api/types/orderbook.js.map +0 -1
  326. package/dist/api/types/position.d.ts +0 -60
  327. package/dist/api/types/position.d.ts.map +0 -1
  328. package/dist/api/types/position.js +0 -6
  329. package/dist/api/types/position.js.map +0 -1
  330. package/dist/api/types/price_history.d.ts +0 -68
  331. package/dist/api/types/price_history.d.ts.map +0 -1
  332. package/dist/api/types/price_history.js +0 -13
  333. package/dist/api/types/price_history.js.map +0 -1
  334. package/dist/api/types/trade.d.ts +0 -67
  335. package/dist/api/types/trade.d.ts.map +0 -1
  336. package/dist/api/types/trade.js +0 -13
  337. package/dist/api/types/trade.js.map +0 -1
  338. package/dist/api/validation.d.ts +0 -24
  339. package/dist/api/validation.d.ts.map +0 -1
  340. package/dist/api/validation.js +0 -53
  341. package/dist/api/validation.js.map +0 -1
  342. package/dist/websocket/client.d.ts +0 -238
  343. package/dist/websocket/client.d.ts.map +0 -1
  344. package/dist/websocket/client.js +0 -580
  345. package/dist/websocket/client.js.map +0 -1
  346. package/dist/websocket/error.d.ts +0 -47
  347. package/dist/websocket/error.d.ts.map +0 -1
  348. package/dist/websocket/error.js +0 -83
  349. package/dist/websocket/error.js.map +0 -1
  350. package/dist/websocket/handlers.d.ts +0 -97
  351. package/dist/websocket/handlers.d.ts.map +0 -1
  352. package/dist/websocket/handlers.js +0 -277
  353. package/dist/websocket/handlers.js.map +0 -1
  354. package/dist/websocket/index.d.ts +0 -38
  355. package/dist/websocket/index.d.ts.map +0 -1
  356. package/dist/websocket/index.js +0 -75
  357. package/dist/websocket/index.js.map +0 -1
  358. package/dist/websocket/state/index.d.ts +0 -7
  359. package/dist/websocket/state/index.d.ts.map +0 -1
  360. package/dist/websocket/state/index.js +0 -14
  361. package/dist/websocket/state/index.js.map +0 -1
  362. package/dist/websocket/state/orderbook.d.ts +0 -107
  363. package/dist/websocket/state/orderbook.d.ts.map +0 -1
  364. package/dist/websocket/state/orderbook.js +0 -293
  365. package/dist/websocket/state/orderbook.js.map +0 -1
  366. package/dist/websocket/state/price.d.ts +0 -108
  367. package/dist/websocket/state/price.d.ts.map +0 -1
  368. package/dist/websocket/state/price.js +0 -243
  369. package/dist/websocket/state/price.js.map +0 -1
  370. package/dist/websocket/state/user.d.ts +0 -83
  371. package/dist/websocket/state/user.d.ts.map +0 -1
  372. package/dist/websocket/state/user.js +0 -228
  373. package/dist/websocket/state/user.js.map +0 -1
  374. package/dist/websocket/subscriptions.d.ts +0 -143
  375. package/dist/websocket/subscriptions.d.ts.map +0 -1
  376. package/dist/websocket/subscriptions.js +0 -244
  377. package/dist/websocket/subscriptions.js.map +0 -1
  378. package/dist/websocket/types.d.ts +0 -417
  379. package/dist/websocket/types.d.ts.map +0 -1
  380. package/dist/websocket/types.js +0 -195
  381. package/dist/websocket/types.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/program/types.ts"],"names":[],"mappings":";;;AAEA,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,mDAAU,CAAA;IACV,uDAAY,CAAA;IACZ,yDAAa,CAAA;AACf,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;;;GAIG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAO,CAAA;IACP,uCAAO,CAAA;AACT,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB","sourcesContent":["import { PublicKey, Transaction } from \"@solana/web3.js\";\n\n// ============================================================================\n// ENUMS\n// ============================================================================\n\n/**\n * Market status enum matching on-chain representation\n */\nexport enum MarketStatus {\n Pending = 0,\n Active = 1,\n Resolved = 2,\n Cancelled = 3,\n}\n\n/**\n * Order side enum\n * BID = buyer wants base tokens (pays quote)\n * ASK = seller offers base tokens (receives quote)\n */\nexport enum OrderSide {\n BID = 0,\n ASK = 1,\n}\n\n// ============================================================================\n// ACCOUNT TYPES\n// ============================================================================\n\n/**\n * Exchange account - singleton central state\n * PDA: [\"central_state\"]\n * Size: 88 bytes\n */\nexport interface Exchange {\n discriminator: Buffer; // 8 bytes\n authority: PublicKey; // 32 bytes - initial admin\n operator: PublicKey; // 32 bytes - can perform operational tasks\n marketCount: bigint; // u64 - incremented for each market\n paused: boolean; // u8 - 0 = active, 1 = paused\n bump: number; // u8\n}\n\n/**\n * Market account\n * PDA: [\"market\", market_id (u64)]\n * Size: 120 bytes\n */\nexport interface Market {\n discriminator: Buffer; // 8 bytes\n marketId: bigint; // u64 - auto-assigned, sequential\n numOutcomes: number; // u8 - 2-6 outcomes supported\n status: MarketStatus; // u8\n winningOutcome: number; // u8\n hasWinningOutcome: boolean; // u8\n bump: number; // u8\n oracle: PublicKey; // 32 bytes - who can settle the market\n questionId: Buffer; // 32 bytes\n conditionId: Buffer; // 32 bytes - derived from oracle + questionId + numOutcomes\n}\n\n/**\n * Order status account - tracks partial fills and cancellations\n * PDA: [\"order_status\", order_hash (32 bytes)]\n * Size: 24 bytes\n */\nexport interface OrderStatus {\n discriminator: Buffer; // 8 bytes\n remaining: bigint; // u64 - maker_amount not yet filled\n isCancelled: boolean; // u8\n}\n\n/**\n * User nonce account - replay protection\n * PDA: [\"user_nonce\", user_pubkey (32 bytes)]\n * Size: 16 bytes\n */\nexport interface UserNonce {\n discriminator: Buffer; // 8 bytes\n nonce: bigint; // u64 - incremented per order\n}\n\n/**\n * Position account - user's state in a market\n * PDA: [\"position\", owner (32 bytes), market (32 bytes)]\n * Size: 80 bytes\n */\nexport interface Position {\n discriminator: Buffer; // 8 bytes\n owner: PublicKey; // 32 bytes\n market: PublicKey; // 32 bytes\n bump: number; // u8\n}\n\n/**\n * Orderbook account - links market to token pair and lookup table\n * PDA: [\"orderbook\", mint_a (32 bytes), mint_b (32 bytes)]\n * Size: 144 bytes\n */\nexport interface Orderbook {\n discriminator: Buffer; // 8 bytes\n market: PublicKey; // 32 bytes\n mintA: PublicKey; // 32 bytes\n mintB: PublicKey; // 32 bytes\n lookupTable: PublicKey; // 32 bytes\n bump: number; // u8\n}\n\n// ============================================================================\n// ORDER TYPES\n// ============================================================================\n\n/**\n * Signed order format (225 bytes)\n * Full order with all fields for submission, cancellation, and hashing\n */\nexport interface SignedOrder {\n nonce: number; // u32 - order ID + replay protection (serialized as u64 LE on wire)\n maker: PublicKey; // 32 bytes - signer\n market: PublicKey; // 32 bytes\n baseMint: PublicKey; // 32 bytes - token being bought/sold\n quoteMint: PublicKey; // 32 bytes - payment token\n side: OrderSide; // u8 - 0=BID, 1=ASK\n makerAmount: bigint; // u64 - what maker gives\n takerAmount: bigint; // u64 - what maker receives\n expiration: bigint; // i64 - unix timestamp, 0=no expiration\n signature: Buffer; // 64 bytes - Ed25519 signature\n}\n\n/**\n * Compact order format (29 bytes)\n * Transaction-optimized version: nonce is u32, no maker field (derived on-chain from Position PDA)\n */\nexport interface Order {\n nonce: number; // u32 (4 bytes) - truncated from SignedOrder's u64 nonce\n side: OrderSide; // u8\n makerAmount: bigint; // u64\n takerAmount: bigint; // u64\n expiration: bigint; // i64\n}\n\n// ============================================================================\n// PARAMETER TYPES\n// ============================================================================\n\n/**\n * Parameters for initialize instruction\n */\nexport interface InitializeParams {\n authority: PublicKey;\n}\n\n/**\n * Parameters for createMarket instruction\n */\nexport interface CreateMarketParams {\n authority: PublicKey;\n numOutcomes: number; // 2-6\n oracle: PublicKey;\n questionId: Buffer; // 32 bytes\n}\n\n/**\n * Metadata for a single outcome token\n */\nexport interface OutcomeMetadata {\n name: string;\n symbol: string;\n uri: string;\n}\n\n/**\n * Parameters for addDepositMint instruction\n */\nexport interface AddDepositMintParams {\n authority: PublicKey;\n marketId: bigint;\n depositMint: PublicKey;\n outcomeMetadata: OutcomeMetadata[];\n}\n\n/**\n * Parameters for mintCompleteSet instruction\n */\nexport interface MintCompleteSetParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for mergeCompleteSet instruction\n */\nexport interface MergeCompleteSetParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for cancelOrder instruction\n */\nexport interface CancelOrderParams {\n maker: PublicKey;\n order: SignedOrder;\n}\n\n/**\n * Parameters for incrementNonce instruction\n */\nexport interface IncrementNonceParams {\n user: PublicKey;\n}\n\n/**\n * Parameters for settleMarket instruction\n */\nexport interface SettleMarketParams {\n oracle: PublicKey;\n marketId: bigint;\n winningOutcome: number;\n}\n\n/**\n * Parameters for redeemWinnings instruction\n */\nexport interface RedeemWinningsParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for setPaused instruction\n */\nexport interface SetPausedParams {\n authority: PublicKey;\n paused: boolean;\n}\n\n/**\n * Parameters for setOperator instruction\n */\nexport interface SetOperatorParams {\n authority: PublicKey;\n newOperator: PublicKey;\n}\n\n/**\n * Parameters for withdrawFromPosition instruction\n */\nexport interface WithdrawFromPositionParams {\n user: PublicKey;\n market: PublicKey;\n mint: PublicKey; // Can be deposit mint or conditional mint\n amount: bigint;\n outcomeIndex: number; // u8 outcome index\n}\n\n/**\n * Parameters for activateMarket instruction\n */\nexport interface ActivateMarketParams {\n authority: PublicKey;\n marketId: bigint;\n}\n\n/**\n * Parameters for matchOrdersMulti instruction\n */\nexport interface MatchOrdersMultiParams {\n operator: PublicKey;\n market: PublicKey;\n baseMint: PublicKey;\n quoteMint: PublicKey;\n takerOrder: SignedOrder;\n makerOrders: SignedOrder[];\n makerFillAmounts: bigint[]; // Per maker - what each maker gives\n takerFillAmounts: bigint[]; // Per maker - what taker gives to each maker\n fullFillBitmask: number; // u8 bitmask: bit 7 = taker, bits 0..n = makers\n}\n\n/**\n * Parameters for setAuthority instruction\n */\nexport interface SetAuthorityParams {\n currentAuthority: PublicKey;\n newAuthority: PublicKey;\n}\n\n/**\n * Parameters for createOrderbook instruction\n */\nexport interface CreateOrderbookParams {\n payer: PublicKey;\n market: PublicKey;\n mintA: PublicKey;\n mintB: PublicKey;\n recentSlot: bigint;\n}\n\n// ============================================================================\n// BUILDER RESULT TYPES\n// ============================================================================\n\n/**\n * Result from transaction builders\n */\nexport interface BuildResult<T = Record<string, PublicKey>> {\n /** Unsigned transaction ready for signing */\n transaction: Transaction;\n /** Key accounts involved in the transaction */\n accounts: T;\n /** Serialize transaction to base64 */\n serialize: () => string;\n}\n\n/**\n * Accounts returned from initialize\n */\nexport interface InitializeAccounts {\n exchange: PublicKey;\n}\n\n/**\n * Accounts returned from createMarket\n */\nexport interface CreateMarketAccounts {\n exchange: PublicKey;\n market: PublicKey;\n}\n\n/**\n * Accounts returned from addDepositMint\n */\nexport interface AddDepositMintAccounts {\n market: PublicKey;\n vault: PublicKey;\n mintAuthority: PublicKey;\n conditionalMints: PublicKey[];\n}\n\n/**\n * Accounts returned from mintCompleteSet\n */\nexport interface MintCompleteSetAccounts {\n position: PublicKey;\n vault: PublicKey;\n conditionalMints: PublicKey[];\n}\n\n/**\n * Accounts returned from mergeCompleteSet\n */\nexport interface MergeCompleteSetAccounts {\n position: PublicKey;\n vault: PublicKey;\n conditionalMints: PublicKey[];\n}\n\n/**\n * Accounts returned from cancelOrder\n */\nexport interface CancelOrderAccounts {\n orderStatus: PublicKey;\n}\n\n/**\n * Accounts returned from incrementNonce\n */\nexport interface IncrementNonceAccounts {\n userNonce: PublicKey;\n}\n\n/**\n * Accounts returned from settleMarket\n */\nexport interface SettleMarketAccounts {\n exchange: PublicKey;\n market: PublicKey;\n}\n\n/**\n * Accounts returned from redeemWinnings\n */\nexport interface RedeemWinningsAccounts {\n position: PublicKey;\n vault: PublicKey;\n winningMint: PublicKey;\n}\n\n/**\n * Accounts returned from activateMarket\n */\nexport interface ActivateMarketAccounts {\n exchange: PublicKey;\n market: PublicKey;\n}\n\n/**\n * Accounts returned from matchOrdersMulti\n */\nexport interface MatchOrdersMultiAccounts {\n takerOrderStatus: PublicKey;\n takerPosition: PublicKey;\n makerOrderStatuses: PublicKey[];\n makerPositions: PublicKey[];\n}\n\n// ============================================================================\n// ORDER CREATION TYPES\n// ============================================================================\n\n/**\n * Parameters for creating a bid order\n */\nexport interface BidOrderParams {\n nonce: number;\n maker: PublicKey;\n market: PublicKey;\n baseMint: PublicKey; // Token to buy\n quoteMint: PublicKey; // Token to pay with\n makerAmount: bigint; // Quote tokens to give\n takerAmount: bigint; // Base tokens to receive\n expiration?: bigint; // 0 = no expiration\n}\n\n/**\n * Parameters for creating an ask order\n */\nexport interface AskOrderParams {\n nonce: number;\n maker: PublicKey;\n market: PublicKey;\n baseMint: PublicKey; // Token to sell\n quoteMint: PublicKey; // Token to receive\n makerAmount: bigint; // Base tokens to give\n takerAmount: bigint; // Quote tokens to receive\n expiration?: bigint; // 0 = no expiration\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/program/types.ts"],"names":[],"mappings":";;;AAEA,+EAA+E;AAC/E,QAAQ;AACR,+EAA+E;AAE/E;;GAEG;AACH,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,qDAAW,CAAA;IACX,mDAAU,CAAA;IACV,uDAAY,CAAA;IACZ,yDAAa,CAAA;AACf,CAAC,EALW,YAAY,4BAAZ,YAAY,QAKvB;AAED;;;;GAIG;AACH,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,uCAAO,CAAA;IACP,uCAAO,CAAA;AACT,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB","sourcesContent":["import { PublicKey, Transaction } from \"@solana/web3.js\";\n\n// ============================================================================\n// ENUMS\n// ============================================================================\n\n/**\n * Market status enum matching on-chain representation\n */\nexport enum MarketStatus {\n Pending = 0,\n Active = 1,\n Resolved = 2,\n Cancelled = 3,\n}\n\n/**\n * Order side enum\n * BID = buyer wants base tokens (pays quote)\n * ASK = seller offers base tokens (receives quote)\n */\nexport enum OrderSide {\n BID = 0,\n ASK = 1,\n}\n\n// ============================================================================\n// ACCOUNT TYPES\n// ============================================================================\n\n/**\n * Exchange account - singleton central state\n * PDA: [\"central_state\"]\n * Size: 88 bytes\n */\nexport interface Exchange {\n discriminator: Buffer; // 8 bytes\n authority: PublicKey; // 32 bytes - initial admin\n operator: PublicKey; // 32 bytes - can perform operational tasks\n marketCount: bigint; // u64 - incremented for each market\n paused: boolean; // u8 - 0 = active, 1 = paused\n bump: number; // u8\n}\n\n/**\n * Market account\n * PDA: [\"market\", market_id (u64)]\n * Size: 120 bytes\n */\nexport interface Market {\n discriminator: Buffer; // 8 bytes\n marketId: bigint; // u64 - auto-assigned, sequential\n numOutcomes: number; // u8 - 2-6 outcomes supported\n status: MarketStatus; // u8\n winningOutcome: number; // u8\n hasWinningOutcome: boolean; // u8\n bump: number; // u8\n oracle: PublicKey; // 32 bytes - who can settle the market\n questionId: Buffer; // 32 bytes\n conditionId: Buffer; // 32 bytes - derived from oracle + questionId + numOutcomes\n}\n\n/**\n * Order status account - tracks partial fills and cancellations\n * PDA: [\"order_status\", order_hash (32 bytes)]\n * Size: 24 bytes\n */\nexport interface OrderStatus {\n discriminator: Buffer; // 8 bytes\n remaining: bigint; // u64 - maker_amount not yet filled\n isCancelled: boolean; // u8\n}\n\n/**\n * User nonce account - replay protection\n * PDA: [\"user_nonce\", user_pubkey (32 bytes)]\n * Size: 16 bytes\n */\nexport interface UserNonce {\n discriminator: Buffer; // 8 bytes\n nonce: bigint; // u64 - incremented per order\n}\n\n/**\n * Position account - user's state in a market\n * PDA: [\"position\", owner (32 bytes), market (32 bytes)]\n * Size: 80 bytes\n */\nexport interface Position {\n discriminator: Buffer; // 8 bytes\n owner: PublicKey; // 32 bytes\n market: PublicKey; // 32 bytes\n bump: number; // u8\n}\n\n/**\n * Orderbook account - links market to token pair and lookup table\n * PDA: [\"orderbook\", mint_a (32 bytes), mint_b (32 bytes)]\n * Size: 144 bytes\n */\nexport interface Orderbook {\n discriminator: Buffer; // 8 bytes\n market: PublicKey; // 32 bytes\n mintA: PublicKey; // 32 bytes\n mintB: PublicKey; // 32 bytes\n lookupTable: PublicKey; // 32 bytes\n bump: number; // u8\n}\n\n/**\n * GlobalDepositToken whitelist account.\n * PDA: [\"global_deposit\", mint]\n * Size: 48 bytes\n */\nexport interface GlobalDepositToken {\n discriminator: Buffer; // 8 bytes\n mint: PublicKey; // 32 bytes\n active: boolean; // u8\n bump: number; // u8\n}\n\n// ============================================================================\n// ORDER TYPES\n// ============================================================================\n\n/**\n * Signed order format (225 bytes)\n * Full order with all fields for submission, cancellation, and hashing\n */\nexport interface SignedOrder {\n nonce: number; // u32 - order ID + replay protection (serialized as u64 LE on wire)\n maker: PublicKey; // 32 bytes - signer\n market: PublicKey; // 32 bytes\n baseMint: PublicKey; // 32 bytes - token being bought/sold\n quoteMint: PublicKey; // 32 bytes - payment token\n side: OrderSide; // u8 - 0=BID, 1=ASK\n amountIn: bigint; // u64 - what maker gives\n amountOut: bigint; // u64 - what maker receives\n expiration: bigint; // i64 - unix timestamp, 0=no expiration\n signature: Buffer; // 64 bytes - Ed25519 signature\n}\n\n/**\n * Alias matching Rust v2 naming.\n */\nexport type OrderPayload = SignedOrder;\n\n/**\n * Compact order format (29 bytes)\n * Transaction-optimized version: nonce is u32, no maker field (derived on-chain from Position PDA)\n */\nexport interface Order {\n nonce: number; // u32 (4 bytes) - truncated from SignedOrder's u64 nonce\n side: OrderSide; // u8\n amountIn: bigint; // u64\n amountOut: bigint; // u64\n expiration: bigint; // i64\n}\n\n// ============================================================================\n// PARAMETER TYPES\n// ============================================================================\n\n/**\n * Parameters for initialize instruction\n */\nexport interface InitializeParams {\n authority: PublicKey;\n}\n\n/**\n * Parameters for createMarket instruction\n */\nexport interface CreateMarketParams {\n authority: PublicKey;\n numOutcomes: number; // 2-6\n oracle: PublicKey;\n questionId: Buffer; // 32 bytes\n}\n\n/**\n * Metadata for a single outcome token\n */\nexport interface OutcomeMetadata {\n name: string;\n symbol: string;\n uri: string;\n}\n\n/**\n * Parameters for addDepositMint instruction\n */\nexport interface AddDepositMintParams {\n payer: PublicKey;\n marketId: bigint;\n depositMint: PublicKey;\n outcomeMetadata: OutcomeMetadata[];\n}\n\n/**\n * Parameters for mintCompleteSet instruction\n */\nexport interface MintCompleteSetParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for mergeCompleteSet instruction\n */\nexport interface MergeCompleteSetParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for cancelOrder instruction\n */\nexport interface CancelOrderParams {\n maker: PublicKey;\n order: SignedOrder;\n}\n\n/**\n * Parameters for incrementNonce instruction\n */\nexport interface IncrementNonceParams {\n user: PublicKey;\n}\n\n/**\n * Parameters for settleMarket instruction\n */\nexport interface SettleMarketParams {\n oracle: PublicKey;\n marketId: bigint;\n winningOutcome: number;\n}\n\n/**\n * Parameters for redeemWinnings instruction\n */\nexport interface RedeemWinningsParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for setPaused instruction\n */\nexport interface SetPausedParams {\n authority: PublicKey;\n paused: boolean;\n}\n\n/**\n * Parameters for setOperator instruction\n */\nexport interface SetOperatorParams {\n authority: PublicKey;\n newOperator: PublicKey;\n}\n\n/**\n * Parameters for withdrawFromPosition instruction\n */\nexport interface WithdrawFromPositionParams {\n user: PublicKey;\n market: PublicKey;\n mint: PublicKey; // Can be deposit mint or conditional mint\n amount: bigint;\n outcomeIndex: number; // u8 outcome index\n}\n\n/**\n * Parameters for activateMarket instruction\n */\nexport interface ActivateMarketParams {\n authority: PublicKey;\n marketId: bigint;\n}\n\n/**\n * Parameters for matchOrdersMulti instruction\n */\nexport interface MatchOrdersMultiParams {\n operator: PublicKey;\n market: PublicKey;\n baseMint: PublicKey;\n quoteMint: PublicKey;\n takerOrder: SignedOrder;\n makerOrders: SignedOrder[];\n makerFillAmounts: bigint[]; // Per maker - what each maker gives\n takerFillAmounts: bigint[]; // Per maker - what taker gives to each maker\n fullFillBitmask: number; // u8 bitmask: bit 7 = taker, bits 0..n = makers\n}\n\n/**\n * Parameters for setAuthority instruction\n */\nexport interface SetAuthorityParams {\n currentAuthority: PublicKey;\n newAuthority: PublicKey;\n}\n\n/**\n * Parameters for createOrderbook instruction\n */\nexport interface CreateOrderbookParams {\n payer: PublicKey;\n market: PublicKey;\n mintA: PublicKey;\n mintB: PublicKey;\n recentSlot: bigint;\n}\n\n/**\n * Parameters for whitelistDepositToken instruction\n */\nexport interface WhitelistDepositTokenParams {\n authority: PublicKey;\n mint: PublicKey;\n}\n\n/**\n * Parameters for depositToGlobal instruction\n */\nexport interface DepositToGlobalParams {\n user: PublicKey;\n mint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for globalToMarketDeposit instruction\n */\nexport interface GlobalToMarketDepositParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n amount: bigint;\n}\n\n/**\n * Parameters for initPositionTokens instruction\n */\nexport interface InitPositionTokensParams {\n user: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n recentSlot: bigint;\n}\n\n/**\n * Parameters for depositAndSwap instruction\n */\nexport interface DepositAndSwapParams {\n operator: PublicKey;\n market: PublicKey;\n depositMint: PublicKey;\n baseMint: PublicKey;\n quoteMint: PublicKey;\n takerOrder: SignedOrder;\n makerOrders: SignedOrder[];\n makerFillAmounts: bigint[];\n takerFillAmounts: bigint[];\n fullFillBitmask: number;\n}\n\n// ============================================================================\n// BUILDER RESULT TYPES\n// ============================================================================\n\n/**\n * Result from transaction builders\n */\nexport interface BuildResult<T = Record<string, PublicKey>> {\n /** Unsigned transaction ready for signing */\n transaction: Transaction;\n /** Key accounts involved in the transaction */\n accounts: T;\n /** Serialize transaction to base64 */\n serialize: () => string;\n}\n\n/**\n * Accounts returned from initialize\n */\nexport interface InitializeAccounts {\n exchange: PublicKey;\n}\n\n/**\n * Accounts returned from createMarket\n */\nexport interface CreateMarketAccounts {\n exchange: PublicKey;\n market: PublicKey;\n}\n\n/**\n * Accounts returned from addDepositMint\n */\nexport interface AddDepositMintAccounts {\n market: PublicKey;\n vault: PublicKey;\n mintAuthority: PublicKey;\n conditionalMints: PublicKey[];\n}\n\n/**\n * Accounts returned from mintCompleteSet\n */\nexport interface MintCompleteSetAccounts {\n position: PublicKey;\n vault: PublicKey;\n conditionalMints: PublicKey[];\n}\n\n/**\n * Accounts returned from mergeCompleteSet\n */\nexport interface MergeCompleteSetAccounts {\n position: PublicKey;\n vault: PublicKey;\n conditionalMints: PublicKey[];\n}\n\n/**\n * Accounts returned from cancelOrder\n */\nexport interface CancelOrderAccounts {\n orderStatus: PublicKey;\n}\n\n/**\n * Accounts returned from incrementNonce\n */\nexport interface IncrementNonceAccounts {\n userNonce: PublicKey;\n}\n\n/**\n * Accounts returned from settleMarket\n */\nexport interface SettleMarketAccounts {\n exchange: PublicKey;\n market: PublicKey;\n}\n\n/**\n * Accounts returned from redeemWinnings\n */\nexport interface RedeemWinningsAccounts {\n position: PublicKey;\n vault: PublicKey;\n winningMint: PublicKey;\n}\n\n/**\n * Accounts returned from activateMarket\n */\nexport interface ActivateMarketAccounts {\n exchange: PublicKey;\n market: PublicKey;\n}\n\n/**\n * Accounts returned from matchOrdersMulti\n */\nexport interface MatchOrdersMultiAccounts {\n takerOrderStatus: PublicKey;\n takerPosition: PublicKey;\n makerOrderStatuses: PublicKey[];\n makerPositions: PublicKey[];\n}\n\n// ============================================================================\n// ORDER CREATION TYPES\n// ============================================================================\n\n/**\n * Parameters for creating a bid order\n */\nexport interface BidOrderParams {\n nonce: number;\n maker: PublicKey;\n market: PublicKey;\n baseMint: PublicKey; // Token to buy\n quoteMint: PublicKey; // Token to pay with\n amountIn: bigint; // Quote tokens to give\n amountOut: bigint; // Base tokens to receive\n expiration?: bigint; // 0 = no expiration\n}\n\n/**\n * Parameters for creating an ask order\n */\nexport interface AskOrderParams {\n nonce: number;\n maker: PublicKey;\n market: PublicKey;\n baseMint: PublicKey; // Token to sell\n quoteMint: PublicKey; // Token to receive\n amountIn: bigint; // Base tokens to give\n amountOut: bigint; // Quote tokens to receive\n expiration?: bigint; // 0 = no expiration\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import Decimal from "decimal.js";
2
+ export declare function display(value: Decimal): string;
3
+ export declare function abbrNumber(value: Decimal, digits?: number): string;
4
+ export declare function toBaseUnits(value: Decimal, decimals: number): bigint | null;
5
+ //# sourceMappingURL=decimal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decimal.d.ts","sourceRoot":"","sources":["../../../src/shared/fmt/decimal.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AAGjC,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAsB9C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,SAAI,GAAG,MAAM,CAkB7D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM3E"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.display = display;
7
+ exports.abbrNumber = abbrNumber;
8
+ exports.toBaseUnits = toBaseUnits;
9
+ const decimal_js_1 = __importDefault(require("decimal.js"));
10
+ const num_1 = require("./num");
11
+ function display(value) {
12
+ if (value.isZero()) {
13
+ return "0";
14
+ }
15
+ const abs = value.abs();
16
+ if (abs.greaterThanOrEqualTo(100)) {
17
+ return (0, num_1.displayFormattedString)(value.toDecimalPlaces(0).toString());
18
+ }
19
+ if (abs.greaterThanOrEqualTo(1)) {
20
+ return (0, num_1.displayFormattedString)(value.toDecimalPlaces(2).toString());
21
+ }
22
+ const asString = abs.toFixed(20).replace(/0+$/, "");
23
+ const match = /^0\.(0+)(\d+)/.exec(asString);
24
+ if (match && match[1].length > 5) {
25
+ const sign = value.isNegative() ? "-" : "";
26
+ const significant = match[2].slice(0, 4).replace(/0+$/, "");
27
+ return `${sign}0.0(${match[1].length})${significant || "0"}`;
28
+ }
29
+ return (0, num_1.displayFormattedString)(value.toSignificantDigits(8).toString());
30
+ }
31
+ function abbrNumber(value, digits = 2) {
32
+ const sign = value.isNegative() ? "-" : "";
33
+ const abs = value.abs();
34
+ const units = [
35
+ [new decimal_js_1.default("1000000000000"), "T"],
36
+ [new decimal_js_1.default("1000000000"), "B"],
37
+ [new decimal_js_1.default("1000000"), "M"],
38
+ [new decimal_js_1.default("1000"), "K"],
39
+ ];
40
+ for (const [threshold, suffix] of units) {
41
+ if (abs.greaterThanOrEqualTo(threshold)) {
42
+ return `${sign}${abs.div(threshold).toDecimalPlaces(digits).toString()}${suffix}`;
43
+ }
44
+ }
45
+ return `${sign}${abs.toDecimalPlaces(digits).toString()}`;
46
+ }
47
+ function toBaseUnits(value, decimals) {
48
+ const scaled = value.mul(new decimal_js_1.default(10).pow(decimals));
49
+ if (!scaled.isInteger() || scaled.isNegative()) {
50
+ return null;
51
+ }
52
+ return BigInt(scaled.toFixed(0));
53
+ }
54
+ //# sourceMappingURL=decimal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decimal.js","sourceRoot":"","sources":["../../../src/shared/fmt/decimal.ts"],"names":[],"mappings":";;;;;AAGA,0BAsBC;AAED,gCAkBC;AAED,kCAMC;AArDD,4DAAiC;AACjC,+BAA+C;AAE/C,SAAgB,OAAO,CAAC,KAAc;IACpC,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;QACnB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IACxB,IAAI,GAAG,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,OAAO,IAAA,4BAAsB,EAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,OAAO,IAAA,4BAAsB,EAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3C,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC5D,OAAO,GAAG,IAAI,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,WAAW,IAAI,GAAG,EAAE,CAAC;IAC/D,CAAC;IAED,OAAO,IAAA,4BAAsB,EAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AACzE,CAAC;AAED,SAAgB,UAAU,CAAC,KAAc,EAAE,MAAM,GAAG,CAAC;IACnD,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC;IAExB,MAAM,KAAK,GAA6B;QACtC,CAAC,IAAI,oBAAO,CAAC,eAAe,CAAC,EAAE,GAAG,CAAC;QACnC,CAAC,IAAI,oBAAO,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC;QAChC,CAAC,IAAI,oBAAO,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC;QAC7B,CAAC,IAAI,oBAAO,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC;KAC3B,CAAC;IAEF,KAAK,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACxC,IAAI,GAAG,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC;YACxC,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,GAAG,MAAM,EAAE,CAAC;QACpF,CAAC;IACH,CAAC;IAED,OAAO,GAAG,IAAI,GAAG,GAAG,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC5D,CAAC;AAED,SAAgB,WAAW,CAAC,KAAc,EAAE,QAAgB;IAC1D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,oBAAO,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACxD,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import Decimal from \"decimal.js\";\nimport { displayFormattedString } from \"./num\";\n\nexport function display(value: Decimal): string {\n if (value.isZero()) {\n return \"0\";\n }\n\n const abs = value.abs();\n if (abs.greaterThanOrEqualTo(100)) {\n return displayFormattedString(value.toDecimalPlaces(0).toString());\n }\n if (abs.greaterThanOrEqualTo(1)) {\n return displayFormattedString(value.toDecimalPlaces(2).toString());\n }\n\n const asString = abs.toFixed(20).replace(/0+$/, \"\");\n const match = /^0\\.(0+)(\\d+)/.exec(asString);\n if (match && match[1].length > 5) {\n const sign = value.isNegative() ? \"-\" : \"\";\n const significant = match[2].slice(0, 4).replace(/0+$/, \"\");\n return `${sign}0.0(${match[1].length})${significant || \"0\"}`;\n }\n\n return displayFormattedString(value.toSignificantDigits(8).toString());\n}\n\nexport function abbrNumber(value: Decimal, digits = 2): string {\n const sign = value.isNegative() ? \"-\" : \"\";\n const abs = value.abs();\n\n const units: Array<[Decimal, string]> = [\n [new Decimal(\"1000000000000\"), \"T\"],\n [new Decimal(\"1000000000\"), \"B\"],\n [new Decimal(\"1000000\"), \"M\"],\n [new Decimal(\"1000\"), \"K\"],\n ];\n\n for (const [threshold, suffix] of units) {\n if (abs.greaterThanOrEqualTo(threshold)) {\n return `${sign}${abs.div(threshold).toDecimalPlaces(digits).toString()}${suffix}`;\n }\n }\n\n return `${sign}${abs.toDecimalPlaces(digits).toString()}`;\n}\n\nexport function toBaseUnits(value: Decimal, decimals: number): bigint | null {\n const scaled = value.mul(new Decimal(10).pow(decimals));\n if (!scaled.isInteger() || scaled.isNegative()) {\n return null;\n }\n return BigInt(scaled.toFixed(0));\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export * as decimal from "./decimal";
2
+ export * as num from "./num";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/fmt/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC"}
@@ -0,0 +1,39 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.num = exports.decimal = void 0;
37
+ exports.decimal = __importStar(require("./decimal"));
38
+ exports.num = __importStar(require("./num"));
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/fmt/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAqC;AACrC,6CAA6B","sourcesContent":["export * as decimal from \"./decimal\";\nexport * as num from \"./num\";\n"]}
@@ -0,0 +1,6 @@
1
+ export declare function displayFormattedString(input: string): string;
2
+ export declare function displayWithDecimals(value: number, decimals: number): string;
3
+ export declare function display(value: number): string;
4
+ export declare function toDecimalValue(value: bigint, decimals: number): number;
5
+ export declare function fromDecimalValue(value: number, decimals: number): bigint;
6
+ //# sourceMappingURL=num.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"num.d.ts","sourceRoot":"","sources":["../../../src/shared/fmt/num.ts"],"names":[],"mappings":"AAAA,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAa5D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAe7C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExE"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.displayFormattedString = displayFormattedString;
4
+ exports.displayWithDecimals = displayWithDecimals;
5
+ exports.display = display;
6
+ exports.toDecimalValue = toDecimalValue;
7
+ exports.fromDecimalValue = fromDecimalValue;
8
+ function displayFormattedString(input) {
9
+ const [rawInteger, rawFraction] = input.split(".");
10
+ const negative = rawInteger.startsWith("-");
11
+ const integer = negative ? rawInteger.slice(1) : rawInteger;
12
+ const withCommas = integer.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
13
+ const fraction = rawFraction?.replace(/0+$/, "");
14
+ const prefix = negative ? "-" : "";
15
+ if (!fraction) {
16
+ return `${prefix}${withCommas}`;
17
+ }
18
+ return `${prefix}${withCommas}.${fraction}`;
19
+ }
20
+ function displayWithDecimals(value, decimals) {
21
+ return displayFormattedString(value.toFixed(decimals));
22
+ }
23
+ function display(value) {
24
+ if (Math.abs(value) >= 100) {
25
+ return displayWithDecimals(value, 0);
26
+ }
27
+ if (Math.abs(value) >= 1) {
28
+ return displayWithDecimals(value, 2);
29
+ }
30
+ if (value === 0) {
31
+ return "0";
32
+ }
33
+ const abs = Math.abs(value);
34
+ const exponent = Math.floor(Math.log10(abs));
35
+ const decimals = Math.min(Math.max(Math.abs(exponent) + 2, 2), 8);
36
+ return displayWithDecimals(value, decimals);
37
+ }
38
+ function toDecimalValue(value, decimals) {
39
+ return Number(value) / 10 ** decimals;
40
+ }
41
+ function fromDecimalValue(value, decimals) {
42
+ return BigInt(Math.trunc(value * 10 ** decimals));
43
+ }
44
+ //# sourceMappingURL=num.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"num.js","sourceRoot":"","sources":["../../../src/shared/fmt/num.ts"],"names":[],"mappings":";;AAAA,wDAaC;AAED,kDAEC;AAED,0BAeC;AAED,wCAEC;AAED,4CAEC;AA1CD,SAAgB,sBAAsB,CAAC,KAAa;IAClD,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5D,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;IACjE,MAAM,QAAQ,GAAG,WAAW,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IAEnC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,MAAM,GAAG,UAAU,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,GAAG,MAAM,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;AAC9C,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAa,EAAE,QAAgB;IACjE,OAAO,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAgB,OAAO,CAAC,KAAa;IACnC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC;QAC3B,OAAO,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,mBAAmB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,IAAI,KAAK,KAAK,CAAC,EAAE,CAAC;QAChB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAClE,OAAO,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,SAAgB,cAAc,CAAC,KAAa,EAAE,QAAgB;IAC5D,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,QAAQ,CAAC;AACxC,CAAC;AAED,SAAgB,gBAAgB,CAAC,KAAa,EAAE,QAAgB;IAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,IAAI,QAAQ,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["export function displayFormattedString(input: string): string {\n const [rawInteger, rawFraction] = input.split(\".\");\n const negative = rawInteger.startsWith(\"-\");\n const integer = negative ? rawInteger.slice(1) : rawInteger;\n const withCommas = integer.replace(/\\B(?=(\\d{3})+(?!\\d))/g, \",\");\n const fraction = rawFraction?.replace(/0+$/, \"\");\n const prefix = negative ? \"-\" : \"\";\n\n if (!fraction) {\n return `${prefix}${withCommas}`;\n }\n\n return `${prefix}${withCommas}.${fraction}`;\n}\n\nexport function displayWithDecimals(value: number, decimals: number): string {\n return displayFormattedString(value.toFixed(decimals));\n}\n\nexport function display(value: number): string {\n if (Math.abs(value) >= 100) {\n return displayWithDecimals(value, 0);\n }\n if (Math.abs(value) >= 1) {\n return displayWithDecimals(value, 2);\n }\n if (value === 0) {\n return \"0\";\n }\n\n const abs = Math.abs(value);\n const exponent = Math.floor(Math.log10(abs));\n const decimals = Math.min(Math.max(Math.abs(exponent) + 2, 2), 8);\n return displayWithDecimals(value, decimals);\n}\n\nexport function toDecimalValue(value: bigint, decimals: number): number {\n return Number(value) / 10 ** decimals;\n}\n\nexport function fromDecimalValue(value: number, decimals: number): bigint {\n return BigInt(Math.trunc(value * 10 ** decimals));\n}\n"]}
@@ -1,8 +1,5 @@
1
- /**
2
- * Shared utilities used across API and WebSocket modules.
3
- */
4
- export { Resolution } from "./types";
5
- export { parseDecimal, formatDecimal, isZero } from "./price";
6
- export { scalePriceSize, ScalingError, } from "./scaling";
7
- export type { OrderbookDecimals, ScaledAmounts } from "./scaling";
1
+ export { asOrderBookId, asPubkeyStr, deriveOrderbookId, resolutionSeconds, sideLabel, OrderUpdateType, Resolution, Side, TimeInForce, TriggerResultStatus, TriggerStatus, TriggerType, TriggerUpdateType, type Branded, type OrderBookId, type PubkeyStr, type SubmitOrderRequest, } from "./types";
2
+ export { formatDecimal, isZero, parseDecimal } from "./price";
3
+ export { alignPriceToTick, scalePriceSize, scalePriceSizeLegacy, ScalingError, type LegacyScaledAmounts, type OrderbookDecimals, type ScaledAmounts, } from "./scaling";
4
+ export { scalePriceSizeLegacy as scalePriceSizeV1 } from "./scaling";
8
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,cAAc,EACd,YAAY,GACb,MAAM,WAAW,CAAC;AACnB,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,UAAU,EACV,IAAI,EACJ,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,kBAAkB,GACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,aAAa,GACnB,MAAM,WAAW,CAAC;AAGnB,OAAO,EAAE,oBAAoB,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
@@ -1,18 +1,30 @@
1
1
  "use strict";
2
- /**
3
- * Shared utilities used across API and WebSocket modules.
4
- */
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.ScalingError = exports.scalePriceSize = exports.isZero = exports.formatDecimal = exports.parseDecimal = exports.Resolution = void 0;
3
+ exports.scalePriceSizeV1 = exports.ScalingError = exports.scalePriceSizeLegacy = exports.scalePriceSize = exports.alignPriceToTick = exports.parseDecimal = exports.isZero = exports.formatDecimal = exports.TriggerUpdateType = exports.TriggerType = exports.TriggerStatus = exports.TriggerResultStatus = exports.TimeInForce = exports.Side = exports.Resolution = exports.OrderUpdateType = exports.sideLabel = exports.resolutionSeconds = exports.deriveOrderbookId = exports.asPubkeyStr = exports.asOrderBookId = void 0;
7
4
  var types_1 = require("./types");
5
+ Object.defineProperty(exports, "asOrderBookId", { enumerable: true, get: function () { return types_1.asOrderBookId; } });
6
+ Object.defineProperty(exports, "asPubkeyStr", { enumerable: true, get: function () { return types_1.asPubkeyStr; } });
7
+ Object.defineProperty(exports, "deriveOrderbookId", { enumerable: true, get: function () { return types_1.deriveOrderbookId; } });
8
+ Object.defineProperty(exports, "resolutionSeconds", { enumerable: true, get: function () { return types_1.resolutionSeconds; } });
9
+ Object.defineProperty(exports, "sideLabel", { enumerable: true, get: function () { return types_1.sideLabel; } });
10
+ Object.defineProperty(exports, "OrderUpdateType", { enumerable: true, get: function () { return types_1.OrderUpdateType; } });
8
11
  Object.defineProperty(exports, "Resolution", { enumerable: true, get: function () { return types_1.Resolution; } });
12
+ Object.defineProperty(exports, "Side", { enumerable: true, get: function () { return types_1.Side; } });
13
+ Object.defineProperty(exports, "TimeInForce", { enumerable: true, get: function () { return types_1.TimeInForce; } });
14
+ Object.defineProperty(exports, "TriggerResultStatus", { enumerable: true, get: function () { return types_1.TriggerResultStatus; } });
15
+ Object.defineProperty(exports, "TriggerStatus", { enumerable: true, get: function () { return types_1.TriggerStatus; } });
16
+ Object.defineProperty(exports, "TriggerType", { enumerable: true, get: function () { return types_1.TriggerType; } });
17
+ Object.defineProperty(exports, "TriggerUpdateType", { enumerable: true, get: function () { return types_1.TriggerUpdateType; } });
9
18
  var price_1 = require("./price");
10
- Object.defineProperty(exports, "parseDecimal", { enumerable: true, get: function () { return price_1.parseDecimal; } });
11
19
  Object.defineProperty(exports, "formatDecimal", { enumerable: true, get: function () { return price_1.formatDecimal; } });
12
20
  Object.defineProperty(exports, "isZero", { enumerable: true, get: function () { return price_1.isZero; } });
21
+ Object.defineProperty(exports, "parseDecimal", { enumerable: true, get: function () { return price_1.parseDecimal; } });
13
22
  var scaling_1 = require("./scaling");
23
+ Object.defineProperty(exports, "alignPriceToTick", { enumerable: true, get: function () { return scaling_1.alignPriceToTick; } });
14
24
  Object.defineProperty(exports, "scalePriceSize", { enumerable: true, get: function () { return scaling_1.scalePriceSize; } });
25
+ Object.defineProperty(exports, "scalePriceSizeLegacy", { enumerable: true, get: function () { return scaling_1.scalePriceSizeLegacy; } });
15
26
  Object.defineProperty(exports, "ScalingError", { enumerable: true, get: function () { return scaling_1.ScalingError; } });
16
- // deriveOrderbookId is exported from the program module (orders.ts)
17
- // Re-exported here for convenience via the shared module path
27
+ // Backward-compatible name from v1.
28
+ var scaling_2 = require("./scaling");
29
+ Object.defineProperty(exports, "scalePriceSizeV1", { enumerable: true, get: function () { return scaling_2.scalePriceSizeLegacy; } });
18
30
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,iCAAqC;AAA5B,mGAAA,UAAU,OAAA;AACnB,iCAA8D;AAArD,qGAAA,YAAY,OAAA;AAAE,sGAAA,aAAa,OAAA;AAAE,+FAAA,MAAM,OAAA;AAC5C,qCAGmB;AAFjB,yGAAA,cAAc,OAAA;AACd,uGAAA,YAAY,OAAA;AAId,oEAAoE;AACpE,8DAA8D","sourcesContent":["/**\n * Shared utilities used across API and WebSocket modules.\n */\n\nexport { Resolution } from \"./types\";\nexport { parseDecimal, formatDecimal, isZero } from \"./price\";\nexport {\n scalePriceSize,\n ScalingError,\n} from \"./scaling\";\nexport type { OrderbookDecimals, ScaledAmounts } from \"./scaling\";\n\n// deriveOrderbookId is exported from the program module (orders.ts)\n// Re-exported here for convenience via the shared module path\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":";;;AAAA,iCAkBiB;AAjBf,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,0GAAA,iBAAiB,OAAA;AACjB,kGAAA,SAAS,OAAA;AACT,wGAAA,eAAe,OAAA;AACf,mGAAA,UAAU,OAAA;AACV,6FAAA,IAAI,OAAA;AACJ,oGAAA,WAAW,OAAA;AACX,4GAAA,mBAAmB,OAAA;AACnB,sGAAA,aAAa,OAAA;AACb,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AAOnB,iCAA8D;AAArD,sGAAA,aAAa,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,qGAAA,YAAY,OAAA;AAE5C,qCAQmB;AAPjB,2GAAA,gBAAgB,OAAA;AAChB,yGAAA,cAAc,OAAA;AACd,+GAAA,oBAAoB,OAAA;AACpB,uGAAA,YAAY,OAAA;AAMd,oCAAoC;AACpC,qCAAqE;AAA5D,2GAAA,oBAAoB,OAAoB","sourcesContent":["export {\n asOrderBookId,\n asPubkeyStr,\n deriveOrderbookId,\n resolutionSeconds,\n sideLabel,\n OrderUpdateType,\n Resolution,\n Side,\n TimeInForce,\n TriggerResultStatus,\n TriggerStatus,\n TriggerType,\n TriggerUpdateType,\n type Branded,\n type OrderBookId,\n type PubkeyStr,\n type SubmitOrderRequest,\n} from \"./types\";\n\nexport { formatDecimal, isZero, parseDecimal } from \"./price\";\n\nexport {\n alignPriceToTick,\n scalePriceSize,\n scalePriceSizeLegacy,\n ScalingError,\n type LegacyScaledAmounts,\n type OrderbookDecimals,\n type ScaledAmounts,\n} from \"./scaling\";\n\n// Backward-compatible name from v1.\nexport { scalePriceSizeLegacy as scalePriceSizeV1 } from \"./scaling\";\n"]}
@@ -1,41 +1,13 @@
1
1
  /**
2
- * Price utilities for the Lightcone SDK.
3
- *
4
- * This module provides helper functions for working with decimal string prices.
5
- * The SDK uses String types for price/size/balance fields to preserve
6
- * the exact decimal representation from the server, as different tokens
7
- * have different decimal places (USDC=6, SOL=9, BTC=8, etc.).
2
+ * Parse a decimal string to a number.
8
3
  */
4
+ export declare function parseDecimal(value: string): number;
9
5
  /**
10
- * Parse a decimal string to number for calculations.
11
- *
12
- * @example
13
- * ```typescript
14
- * parseDecimal("0.500000"); // returns 0.5
15
- * parseDecimal("1.000000"); // returns 1.0
16
- * ```
17
- */
18
- export declare function parseDecimal(s: string): number;
19
- /**
20
- * Format a number as a decimal string with specified precision.
21
- *
22
- * @example
23
- * ```typescript
24
- * formatDecimal(0.5, 6); // returns "0.500000"
25
- * formatDecimal(1.0, 6); // returns "1.000000"
26
- * ```
6
+ * Format a number to a fixed decimal string.
27
7
  */
28
8
  export declare function formatDecimal(value: number, precision: number): string;
29
9
  /**
30
- * Check if a decimal string represents zero.
31
- *
32
- * @example
33
- * ```typescript
34
- * isZero("0"); // true
35
- * isZero("0.0"); // true
36
- * isZero("0.000000"); // true
37
- * isZero("0.001"); // false
38
- * ```
10
+ * Whether a decimal string represents numeric zero.
39
11
  */
40
- export declare function isZero(s: string): boolean;
12
+ export declare function isZero(value: string): boolean;
41
13
  //# sourceMappingURL=price.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/shared/price.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAM9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAGzC"}
1
+ {"version":3,"file":"price.d.ts","sourceRoot":"","sources":["../../src/shared/price.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMlD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAG7C"}
@@ -1,57 +1,29 @@
1
1
  "use strict";
2
- /**
3
- * Price utilities for the Lightcone SDK.
4
- *
5
- * This module provides helper functions for working with decimal string prices.
6
- * The SDK uses String types for price/size/balance fields to preserve
7
- * the exact decimal representation from the server, as different tokens
8
- * have different decimal places (USDC=6, SOL=9, BTC=8, etc.).
9
- */
10
2
  Object.defineProperty(exports, "__esModule", { value: true });
11
3
  exports.parseDecimal = parseDecimal;
12
4
  exports.formatDecimal = formatDecimal;
13
5
  exports.isZero = isZero;
14
6
  /**
15
- * Parse a decimal string to number for calculations.
16
- *
17
- * @example
18
- * ```typescript
19
- * parseDecimal("0.500000"); // returns 0.5
20
- * parseDecimal("1.000000"); // returns 1.0
21
- * ```
7
+ * Parse a decimal string to a number.
22
8
  */
23
- function parseDecimal(s) {
24
- const result = parseFloat(s);
25
- if (isNaN(result)) {
26
- throw new Error(`Invalid decimal string: ${s}`);
9
+ function parseDecimal(value) {
10
+ const parsed = Number.parseFloat(value);
11
+ if (Number.isNaN(parsed)) {
12
+ throw new Error(`Invalid decimal string: ${value}`);
27
13
  }
28
- return result;
14
+ return parsed;
29
15
  }
30
16
  /**
31
- * Format a number as a decimal string with specified precision.
32
- *
33
- * @example
34
- * ```typescript
35
- * formatDecimal(0.5, 6); // returns "0.500000"
36
- * formatDecimal(1.0, 6); // returns "1.000000"
37
- * ```
17
+ * Format a number to a fixed decimal string.
38
18
  */
39
19
  function formatDecimal(value, precision) {
40
20
  return value.toFixed(precision);
41
21
  }
42
22
  /**
43
- * Check if a decimal string represents zero.
44
- *
45
- * @example
46
- * ```typescript
47
- * isZero("0"); // true
48
- * isZero("0.0"); // true
49
- * isZero("0.000000"); // true
50
- * isZero("0.001"); // false
51
- * ```
23
+ * Whether a decimal string represents numeric zero.
52
24
  */
53
- function isZero(s) {
54
- const parsed = parseFloat(s);
55
- return !isNaN(parsed) && parsed === 0;
25
+ function isZero(value) {
26
+ const parsed = Number.parseFloat(value);
27
+ return !Number.isNaN(parsed) && parsed === 0;
56
28
  }
57
29
  //# sourceMappingURL=price.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/shared/price.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAWH,oCAMC;AAWD,sCAEC;AAaD,wBAGC;AA5CD;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAAC,CAAS;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7B,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,EAAE,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAAC,KAAa,EAAE,SAAiB;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,MAAM,CAAC,CAAS;IAC9B,MAAM,MAAM,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IAC7B,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Price utilities for the Lightcone SDK.\n *\n * This module provides helper functions for working with decimal string prices.\n * The SDK uses String types for price/size/balance fields to preserve\n * the exact decimal representation from the server, as different tokens\n * have different decimal places (USDC=6, SOL=9, BTC=8, etc.).\n */\n\n/**\n * Parse a decimal string to number for calculations.\n *\n * @example\n * ```typescript\n * parseDecimal(\"0.500000\"); // returns 0.5\n * parseDecimal(\"1.000000\"); // returns 1.0\n * ```\n */\nexport function parseDecimal(s: string): number {\n const result = parseFloat(s);\n if (isNaN(result)) {\n throw new Error(`Invalid decimal string: ${s}`);\n }\n return result;\n}\n\n/**\n * Format a number as a decimal string with specified precision.\n *\n * @example\n * ```typescript\n * formatDecimal(0.5, 6); // returns \"0.500000\"\n * formatDecimal(1.0, 6); // returns \"1.000000\"\n * ```\n */\nexport function formatDecimal(value: number, precision: number): string {\n return value.toFixed(precision);\n}\n\n/**\n * Check if a decimal string represents zero.\n *\n * @example\n * ```typescript\n * isZero(\"0\"); // true\n * isZero(\"0.0\"); // true\n * isZero(\"0.000000\"); // true\n * isZero(\"0.001\"); // false\n * ```\n */\nexport function isZero(s: string): boolean {\n const parsed = parseFloat(s);\n return !isNaN(parsed) && parsed === 0;\n}\n\n"]}
1
+ {"version":3,"file":"price.js","sourceRoot":"","sources":["../../src/shared/price.ts"],"names":[],"mappings":";;AAGA,oCAMC;AAKD,sCAEC;AAKD,wBAGC;AAxBD;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAa,EAAE,SAAiB;IAC5D,OAAO,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,SAAgB,MAAM,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["/**\n * Parse a decimal string to a number.\n */\nexport function parseDecimal(value: string): number {\n const parsed = Number.parseFloat(value);\n if (Number.isNaN(parsed)) {\n throw new Error(`Invalid decimal string: ${value}`);\n }\n return parsed;\n}\n\n/**\n * Format a number to a fixed decimal string.\n */\nexport function formatDecimal(value: number, precision: number): string {\n return value.toFixed(precision);\n}\n\n/**\n * Whether a decimal string represents numeric zero.\n */\nexport function isZero(value: string): boolean {\n const parsed = Number.parseFloat(value);\n return !Number.isNaN(parsed) && parsed === 0;\n}\n"]}
@@ -1,45 +1,32 @@
1
+ import Decimal from "decimal.js";
1
2
  import { OrderSide } from "../program/types";
2
- /**
3
- * Orderbook decimal configuration
4
- */
5
3
  export interface OrderbookDecimals {
6
4
  orderbookId: string;
7
5
  baseDecimals: number;
8
6
  quoteDecimals: number;
9
7
  priceDecimals: number;
8
+ tickSize?: bigint;
10
9
  }
11
- /**
12
- * Scaled amounts result
13
- */
14
10
  export interface ScaledAmounts {
11
+ amountIn: bigint;
12
+ amountOut: bigint;
15
13
  makerAmount: bigint;
16
14
  takerAmount: bigint;
17
15
  }
18
- /**
19
- * Error thrown during price/size scaling
20
- */
21
16
  export declare class ScalingError extends Error {
22
17
  constructor(message: string);
23
- static zeroPriceOrSize(): ScalingError;
24
- static negativeValue(field: string): ScalingError;
25
- static overflow(field: string): ScalingError;
18
+ static nonPositivePrice(value: string): ScalingError;
19
+ static nonPositiveSize(value: string): ScalingError;
20
+ static overflow(context: string): ScalingError;
21
+ static zeroAmount(): ScalingError;
22
+ static fractionalAmount(value: string): ScalingError;
23
+ static invalidDecimal(input: string, reason: string): ScalingError;
26
24
  }
27
- /**
28
- * Scale price and size to maker_amount and taker_amount using exact decimal arithmetic.
29
- *
30
- * For BID orders (buying base with quote):
31
- * - maker_amount = price * size * 10^quoteDecimals (what maker gives in quote tokens)
32
- * - taker_amount = size * 10^baseDecimals (what maker receives in base tokens)
33
- *
34
- * For ASK orders (selling base for quote):
35
- * - maker_amount = size * 10^baseDecimals (what maker gives in base tokens)
36
- * - taker_amount = price * size * 10^quoteDecimals (what maker receives in quote tokens)
37
- *
38
- * @param priceStr - Price as a decimal string (e.g., "0.75")
39
- * @param sizeStr - Size as a decimal string (e.g., "100")
40
- * @param side - Order side (BID or ASK)
41
- * @param decimals - Orderbook decimal configuration
42
- * @returns Scaled maker_amount and taker_amount as bigints
43
- */
44
- export declare function scalePriceSize(priceStr: string, sizeStr: string, side: OrderSide, decimals: OrderbookDecimals): ScaledAmounts;
25
+ export declare function alignPriceToTick(price: Decimal, decimals: OrderbookDecimals): Decimal;
26
+ export declare function scalePriceSize(priceInput: string | Decimal, sizeInput: string | Decimal, side: OrderSide, decimals: OrderbookDecimals): ScaledAmounts;
27
+ export interface LegacyScaledAmounts {
28
+ makerAmount: bigint;
29
+ takerAmount: bigint;
30
+ }
31
+ export declare function scalePriceSizeLegacy(price: string, size: string, side: OrderSide, decimals: OrderbookDecimals): LegacyScaledAmounts;
45
32
  //# sourceMappingURL=scaling.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scaling.d.ts","sourceRoot":"","sources":["../../src/shared/scaling.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,eAAe,IAAI,YAAY;IAItC,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAIjD,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;CAG7C;AAID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,iBAAiB,GAC1B,aAAa,CAyCf"}
1
+ {"version":3,"file":"scaling.d.ts","sourceRoot":"","sources":["../../src/shared/scaling.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAElB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAID,qBAAa,YAAa,SAAQ,KAAK;gBACzB,OAAO,EAAE,MAAM;IAK3B,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAIpD,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAInD,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY;IAI9C,MAAM,CAAC,UAAU,IAAI,YAAY;IAIjC,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;IAIpD,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;CAGnE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAWrF;AAED,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,GAAG,OAAO,EAC5B,SAAS,EAAE,MAAM,GAAG,OAAO,EAC3B,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,iBAAiB,GAC1B,aAAa,CA0Cf;AA8BD,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,SAAS,EACf,QAAQ,EAAE,iBAAiB,GAC1B,mBAAmB,CAMrB"}