lighter-sdk-client 0.2.22

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 (366) hide show
  1. package/README.md +816 -0
  2. package/dist/api/exchange/change-account-tier.cjs +6 -0
  3. package/dist/api/exchange/change-account-tier.d.cts +14 -0
  4. package/dist/api/exchange/change-account-tier.d.ts +14 -0
  5. package/dist/api/exchange/change-account-tier.js +6 -0
  6. package/dist/api/exchange/fastwithdraw.cjs +6 -0
  7. package/dist/api/exchange/fastwithdraw.d.cts +14 -0
  8. package/dist/api/exchange/fastwithdraw.d.ts +14 -0
  9. package/dist/api/exchange/fastwithdraw.js +6 -0
  10. package/dist/api/exchange/index.cjs +37 -0
  11. package/dist/api/exchange/index.d.cts +8 -0
  12. package/dist/api/exchange/index.d.ts +8 -0
  13. package/dist/api/exchange/index.js +37 -0
  14. package/dist/api/exchange/notification-ack.cjs +6 -0
  15. package/dist/api/exchange/notification-ack.d.cts +13 -0
  16. package/dist/api/exchange/notification-ack.d.ts +13 -0
  17. package/dist/api/exchange/notification-ack.js +6 -0
  18. package/dist/api/exchange/send-tx-batch.cjs +6 -0
  19. package/dist/api/exchange/send-tx-batch.d.cts +22 -0
  20. package/dist/api/exchange/send-tx-batch.d.ts +22 -0
  21. package/dist/api/exchange/send-tx-batch.js +6 -0
  22. package/dist/api/exchange/send-tx.cjs +12 -0
  23. package/dist/api/exchange/send-tx.d.cts +33 -0
  24. package/dist/api/exchange/send-tx.d.ts +33 -0
  25. package/dist/api/exchange/send-tx.js +12 -0
  26. package/dist/api/exchange/tokens-create.cjs +6 -0
  27. package/dist/api/exchange/tokens-create.d.cts +24 -0
  28. package/dist/api/exchange/tokens-create.d.ts +24 -0
  29. package/dist/api/exchange/tokens-create.js +6 -0
  30. package/dist/api/exchange/tokens-revoke.cjs +6 -0
  31. package/dist/api/exchange/tokens-revoke.d.cts +15 -0
  32. package/dist/api/exchange/tokens-revoke.d.ts +15 -0
  33. package/dist/api/exchange/tokens-revoke.js +6 -0
  34. package/dist/api/info/account-by-l1-address.cjs +6 -0
  35. package/dist/api/info/account-by-l1-address.d.cts +28 -0
  36. package/dist/api/info/account-by-l1-address.d.ts +28 -0
  37. package/dist/api/info/account-by-l1-address.js +6 -0
  38. package/dist/api/info/account.cjs +6 -0
  39. package/dist/api/info/account.d.cts +67 -0
  40. package/dist/api/info/account.d.ts +67 -0
  41. package/dist/api/info/account.js +6 -0
  42. package/dist/api/info/announcement.cjs +6 -0
  43. package/dist/api/info/announcement.d.cts +15 -0
  44. package/dist/api/info/announcement.d.ts +15 -0
  45. package/dist/api/info/announcement.js +6 -0
  46. package/dist/api/info/api-keys.cjs +6 -0
  47. package/dist/api/info/api-keys.d.cts +19 -0
  48. package/dist/api/info/api-keys.d.ts +19 -0
  49. package/dist/api/info/api-keys.js +6 -0
  50. package/dist/api/info/asset-details.cjs +6 -0
  51. package/dist/api/info/asset-details.d.cts +26 -0
  52. package/dist/api/info/asset-details.d.ts +26 -0
  53. package/dist/api/info/asset-details.js +6 -0
  54. package/dist/api/info/candles.cjs +6 -0
  55. package/dist/api/info/candles.d.cts +23 -0
  56. package/dist/api/info/candles.d.ts +23 -0
  57. package/dist/api/info/candles.js +6 -0
  58. package/dist/api/info/exchange-stats.cjs +6 -0
  59. package/dist/api/info/exchange-stats.d.cts +11 -0
  60. package/dist/api/info/exchange-stats.d.ts +11 -0
  61. package/dist/api/info/exchange-stats.js +6 -0
  62. package/dist/api/info/fastbridge-info.cjs +6 -0
  63. package/dist/api/info/fastbridge-info.d.cts +10 -0
  64. package/dist/api/info/fastbridge-info.d.ts +10 -0
  65. package/dist/api/info/fastbridge-info.js +6 -0
  66. package/dist/api/info/funding-rates.cjs +6 -0
  67. package/dist/api/info/funding-rates.d.cts +16 -0
  68. package/dist/api/info/funding-rates.d.ts +16 -0
  69. package/dist/api/info/funding-rates.js +6 -0
  70. package/dist/api/info/fundings.cjs +6 -0
  71. package/dist/api/info/fundings.d.cts +21 -0
  72. package/dist/api/info/fundings.d.ts +21 -0
  73. package/dist/api/info/fundings.js +6 -0
  74. package/dist/api/info/index.cjs +85 -0
  75. package/dist/api/info/index.d.cts +22 -0
  76. package/dist/api/info/index.d.ts +22 -0
  77. package/dist/api/info/index.js +85 -0
  78. package/dist/api/info/next-nonce.cjs +6 -0
  79. package/dist/api/info/next-nonce.d.cts +14 -0
  80. package/dist/api/info/next-nonce.d.ts +14 -0
  81. package/dist/api/info/next-nonce.js +6 -0
  82. package/dist/api/info/order-book-details.cjs +8 -0
  83. package/dist/api/info/order-book-details.d.cts +95 -0
  84. package/dist/api/info/order-book-details.d.ts +95 -0
  85. package/dist/api/info/order-book-details.js +8 -0
  86. package/dist/api/info/order-books.cjs +6 -0
  87. package/dist/api/info/order-books.d.cts +16 -0
  88. package/dist/api/info/order-books.d.ts +16 -0
  89. package/dist/api/info/order-books.js +6 -0
  90. package/dist/api/info/recent-trades.cjs +6 -0
  91. package/dist/api/info/recent-trades.d.cts +11 -0
  92. package/dist/api/info/recent-trades.d.ts +11 -0
  93. package/dist/api/info/recent-trades.js +6 -0
  94. package/dist/api/info/root-info.cjs +6 -0
  95. package/dist/api/info/root-info.d.cts +8 -0
  96. package/dist/api/info/root-info.d.ts +8 -0
  97. package/dist/api/info/root-info.js +6 -0
  98. package/dist/api/info/root-status.cjs +6 -0
  99. package/dist/api/info/root-status.d.cts +10 -0
  100. package/dist/api/info/root-status.d.ts +10 -0
  101. package/dist/api/info/root-status.js +6 -0
  102. package/dist/api/info/tx-from-l1-hash.cjs +6 -0
  103. package/dist/api/info/tx-from-l1-hash.d.cts +9 -0
  104. package/dist/api/info/tx-from-l1-hash.d.ts +9 -0
  105. package/dist/api/info/tx-from-l1-hash.js +6 -0
  106. package/dist/api/info/tx.cjs +6 -0
  107. package/dist/api/info/tx.d.cts +33 -0
  108. package/dist/api/info/tx.d.ts +33 -0
  109. package/dist/api/info/tx.js +6 -0
  110. package/dist/api/info/txs.cjs +6 -0
  111. package/dist/api/info/txs.d.cts +11 -0
  112. package/dist/api/info/txs.d.ts +11 -0
  113. package/dist/api/info/txs.js +6 -0
  114. package/dist/api/info/withdrawal-delay.cjs +6 -0
  115. package/dist/api/info/withdrawal-delay.d.cts +8 -0
  116. package/dist/api/info/withdrawal-delay.d.ts +8 -0
  117. package/dist/api/info/withdrawal-delay.js +6 -0
  118. package/dist/api/info-private/account-active-orders.cjs +6 -0
  119. package/dist/api/info-private/account-active-orders.d.cts +11 -0
  120. package/dist/api/info-private/account-active-orders.d.ts +11 -0
  121. package/dist/api/info-private/account-active-orders.js +6 -0
  122. package/dist/api/info-private/account-inactive-orders.cjs +6 -0
  123. package/dist/api/info-private/account-inactive-orders.d.cts +52 -0
  124. package/dist/api/info-private/account-inactive-orders.d.ts +52 -0
  125. package/dist/api/info-private/account-inactive-orders.js +6 -0
  126. package/dist/api/info-private/account-limits.cjs +6 -0
  127. package/dist/api/info-private/account-limits.d.cts +16 -0
  128. package/dist/api/info-private/account-limits.d.ts +16 -0
  129. package/dist/api/info-private/account-limits.js +6 -0
  130. package/dist/api/info-private/account-metadata.cjs +6 -0
  131. package/dist/api/info-private/account-metadata.d.cts +22 -0
  132. package/dist/api/info-private/account-metadata.d.ts +22 -0
  133. package/dist/api/info-private/account-metadata.js +6 -0
  134. package/dist/api/info-private/deposit-history.cjs +6 -0
  135. package/dist/api/info-private/deposit-history.d.cts +27 -0
  136. package/dist/api/info-private/deposit-history.d.ts +27 -0
  137. package/dist/api/info-private/deposit-history.js +6 -0
  138. package/dist/api/info-private/export.cjs +6 -0
  139. package/dist/api/info-private/export.d.cts +16 -0
  140. package/dist/api/info-private/export.d.ts +16 -0
  141. package/dist/api/info-private/export.js +6 -0
  142. package/dist/api/info-private/fastwithdraw-info.cjs +6 -0
  143. package/dist/api/info-private/fastwithdraw-info.d.cts +16 -0
  144. package/dist/api/info-private/fastwithdraw-info.d.ts +16 -0
  145. package/dist/api/info-private/fastwithdraw-info.js +6 -0
  146. package/dist/api/info-private/index.cjs +75 -0
  147. package/dist/api/info-private/index.d.cts +19 -0
  148. package/dist/api/info-private/index.d.ts +19 -0
  149. package/dist/api/info-private/index.js +75 -0
  150. package/dist/api/info-private/l1-metadata.cjs +6 -0
  151. package/dist/api/info-private/l1-metadata.d.cts +16 -0
  152. package/dist/api/info-private/l1-metadata.d.ts +16 -0
  153. package/dist/api/info-private/l1-metadata.js +6 -0
  154. package/dist/api/info-private/liquidations.cjs +6 -0
  155. package/dist/api/info-private/liquidations.d.cts +66 -0
  156. package/dist/api/info-private/liquidations.d.ts +66 -0
  157. package/dist/api/info-private/liquidations.js +6 -0
  158. package/dist/api/info-private/pnl.cjs +6 -0
  159. package/dist/api/info-private/pnl.d.cts +24 -0
  160. package/dist/api/info-private/pnl.d.ts +24 -0
  161. package/dist/api/info-private/pnl.js +6 -0
  162. package/dist/api/info-private/position-funding.cjs +6 -0
  163. package/dist/api/info-private/position-funding.d.cts +28 -0
  164. package/dist/api/info-private/position-funding.d.ts +28 -0
  165. package/dist/api/info-private/position-funding.js +6 -0
  166. package/dist/api/info-private/public-pools-metadata.cjs +6 -0
  167. package/dist/api/info-private/public-pools-metadata.d.cts +24 -0
  168. package/dist/api/info-private/public-pools-metadata.d.ts +24 -0
  169. package/dist/api/info-private/public-pools-metadata.js +6 -0
  170. package/dist/api/info-private/referral-points.cjs +6 -0
  171. package/dist/api/info-private/referral-points.d.cts +24 -0
  172. package/dist/api/info-private/referral-points.d.ts +24 -0
  173. package/dist/api/info-private/referral-points.js +6 -0
  174. package/dist/api/info-private/tokens.cjs +6 -0
  175. package/dist/api/info-private/tokens.d.cts +24 -0
  176. package/dist/api/info-private/tokens.d.ts +24 -0
  177. package/dist/api/info-private/tokens.js +6 -0
  178. package/dist/api/info-private/trades.cjs +6 -0
  179. package/dist/api/info-private/trades.d.cts +49 -0
  180. package/dist/api/info-private/trades.d.ts +49 -0
  181. package/dist/api/info-private/trades.js +6 -0
  182. package/dist/api/info-private/transfer-fee-info.cjs +6 -0
  183. package/dist/api/info-private/transfer-fee-info.d.cts +15 -0
  184. package/dist/api/info-private/transfer-fee-info.d.ts +15 -0
  185. package/dist/api/info-private/transfer-fee-info.js +6 -0
  186. package/dist/api/info-private/transfer-history.cjs +6 -0
  187. package/dist/api/info-private/transfer-history.d.cts +27 -0
  188. package/dist/api/info-private/transfer-history.d.ts +27 -0
  189. package/dist/api/info-private/transfer-history.js +6 -0
  190. package/dist/api/info-private/withdraw-history.cjs +6 -0
  191. package/dist/api/info-private/withdraw-history.d.cts +27 -0
  192. package/dist/api/info-private/withdraw-history.d.ts +27 -0
  193. package/dist/api/info-private/withdraw-history.js +6 -0
  194. package/dist/chunk-24BJYHI5.cjs +166 -0
  195. package/dist/chunk-2R5COGAH.cjs +10 -0
  196. package/dist/chunk-3OSXAPI3.js +8 -0
  197. package/dist/chunk-3R4OL3TU.cjs +17 -0
  198. package/dist/chunk-3SKO62BC.js +0 -0
  199. package/dist/chunk-3Y76Q54G.js +18 -0
  200. package/dist/chunk-3ZIFHX7Q.cjs +1 -0
  201. package/dist/chunk-467IJZRE.js +14 -0
  202. package/dist/chunk-472ULOSN.js +10 -0
  203. package/dist/chunk-4LNJ2577.js +17 -0
  204. package/dist/chunk-4MZ3XQUJ.cjs +13 -0
  205. package/dist/chunk-4TIJW7PH.cjs +14 -0
  206. package/dist/chunk-4UDAN2FX.js +225 -0
  207. package/dist/chunk-4VAZ7ZA2.js +10 -0
  208. package/dist/chunk-5JDRAN7L.cjs +22 -0
  209. package/dist/chunk-5P5CPB5A.js +18 -0
  210. package/dist/chunk-5U6X6DI7.cjs +13 -0
  211. package/dist/chunk-5WEMEUUI.js +22 -0
  212. package/dist/chunk-6CD3YMMG.cjs +1 -0
  213. package/dist/chunk-6GCE6YQR.cjs +8 -0
  214. package/dist/chunk-6LUEPRL7.cjs +16 -0
  215. package/dist/chunk-6M6GRSDD.cjs +370 -0
  216. package/dist/chunk-6NEX2QS6.js +370 -0
  217. package/dist/chunk-76SPKVHT.js +48 -0
  218. package/dist/chunk-77QSYYAW.js +13 -0
  219. package/dist/chunk-7U2USLAM.cjs +8 -0
  220. package/dist/chunk-A2APDMN3.js +13 -0
  221. package/dist/chunk-AHCELOTZ.js +325 -0
  222. package/dist/chunk-AMNDQGYL.js +18 -0
  223. package/dist/chunk-BA2QFD27.cjs +19 -0
  224. package/dist/chunk-BES73YEF.js +8 -0
  225. package/dist/chunk-BKIL4UXV.cjs +22 -0
  226. package/dist/chunk-BKJGDTS3.js +8 -0
  227. package/dist/chunk-BVC2AA7Y.cjs +8 -0
  228. package/dist/chunk-BXMXWCMD.js +13 -0
  229. package/dist/chunk-C7OTZCGC.js +0 -0
  230. package/dist/chunk-DCKMNDS3.js +0 -0
  231. package/dist/chunk-DOZF64YC.cjs +17 -0
  232. package/dist/chunk-DW6W5SX2.cjs +18 -0
  233. package/dist/chunk-E3GJJZER.cjs +8 -0
  234. package/dist/chunk-EBSW5ZYW.js +19 -0
  235. package/dist/chunk-F24JA2OV.cjs +22 -0
  236. package/dist/chunk-FJJWUBKM.js +17 -0
  237. package/dist/chunk-FM4WWIRI.cjs +17 -0
  238. package/dist/chunk-FODEDUT4.js +8 -0
  239. package/dist/chunk-GEWTGUEG.cjs +1 -0
  240. package/dist/chunk-GI4WUHSL.cjs +1 -0
  241. package/dist/chunk-GYABNQWH.js +8 -0
  242. package/dist/chunk-GYQ6HJQY.cjs +21 -0
  243. package/dist/chunk-INCL3WRA.cjs +13 -0
  244. package/dist/chunk-IQQRFW4A.cjs +8 -0
  245. package/dist/chunk-IT6LK2G5.cjs +19 -0
  246. package/dist/chunk-IXF4QUC6.js +8 -0
  247. package/dist/chunk-J3UZK77O.cjs +18 -0
  248. package/dist/chunk-J7GXRK7R.cjs +19 -0
  249. package/dist/chunk-JLCOD3WH.cjs +325 -0
  250. package/dist/chunk-JNTYHWDJ.js +22 -0
  251. package/dist/chunk-JTE4UBAX.js +8 -0
  252. package/dist/chunk-JTP6DTDN.js +0 -0
  253. package/dist/chunk-K7ZQARON.js +8 -0
  254. package/dist/chunk-L5SDFTHR.cjs +242 -0
  255. package/dist/chunk-LBVNEQ5R.cjs +21 -0
  256. package/dist/chunk-LXNCAKJZ.js +0 -0
  257. package/dist/chunk-LYNZNSLV.js +18 -0
  258. package/dist/chunk-MAPH47LH.cjs +1 -0
  259. package/dist/chunk-MO4PMYTS.js +0 -0
  260. package/dist/chunk-MOOGM3DW.cjs +1 -0
  261. package/dist/chunk-MZCKU6FF.js +8 -0
  262. package/dist/chunk-NIT6TCVS.cjs +8 -0
  263. package/dist/chunk-NOFXPTLU.js +8 -0
  264. package/dist/chunk-NOREYPFC.js +612 -0
  265. package/dist/chunk-NRZGE42C.js +23 -0
  266. package/dist/chunk-NSFKW27X.js +0 -0
  267. package/dist/chunk-O3PA6HV2.js +18 -0
  268. package/dist/chunk-OBR3B6S7.cjs +367 -0
  269. package/dist/chunk-ON64OVOQ.cjs +20 -0
  270. package/dist/chunk-OPSCTD6W.js +17 -0
  271. package/dist/chunk-P32EPCEM.js +19 -0
  272. package/dist/chunk-PEALQBVN.js +19 -0
  273. package/dist/chunk-PP4Q2W66.cjs +10 -0
  274. package/dist/chunk-PPU2VWXX.js +12 -0
  275. package/dist/chunk-Q2MT7FZ7.js +242 -0
  276. package/dist/chunk-QCE5PEXE.cjs +8 -0
  277. package/dist/chunk-QILV2ZMV.js +166 -0
  278. package/dist/chunk-QMXZQNBK.cjs +8 -0
  279. package/dist/chunk-QNM3HYIV.cjs +8 -0
  280. package/dist/chunk-QXGO7TJ2.js +17 -0
  281. package/dist/chunk-R37XMGAI.cjs +612 -0
  282. package/dist/chunk-RGVFMOQI.js +20 -0
  283. package/dist/chunk-RYDJEI67.cjs +48 -0
  284. package/dist/chunk-S4OE3IME.js +13 -0
  285. package/dist/chunk-SA6CXVP6.js +22 -0
  286. package/dist/chunk-TELGVFFP.js +13 -0
  287. package/dist/chunk-TM3CNEVD.js +367 -0
  288. package/dist/chunk-TPGO4YD3.js +21 -0
  289. package/dist/chunk-TSHQJVUP.js +0 -0
  290. package/dist/chunk-TWGXKYO2.cjs +23 -0
  291. package/dist/chunk-U25GSCR7.cjs +17 -0
  292. package/dist/chunk-U2SM46CP.cjs +17 -0
  293. package/dist/chunk-UORSMHI2.js +21 -0
  294. package/dist/chunk-VDBWTSBC.cjs +1 -0
  295. package/dist/chunk-VNQKWIQG.cjs +13 -0
  296. package/dist/chunk-VW77SNCY.js +24 -0
  297. package/dist/chunk-VWX5CLM4.cjs +225 -0
  298. package/dist/chunk-W2BVNVOC.cjs +1 -0
  299. package/dist/chunk-W5VY4TWP.js +16 -0
  300. package/dist/chunk-WK6OQRMG.cjs +8 -0
  301. package/dist/chunk-WWLOQFSW.cjs +12 -0
  302. package/dist/chunk-X7E6XJVQ.cjs +18 -0
  303. package/dist/chunk-XOG6T533.cjs +18 -0
  304. package/dist/chunk-XQGOXCT4.js +22 -0
  305. package/dist/chunk-YVJVFJ24.cjs +19 -0
  306. package/dist/chunk-YWN57BJF.js +8 -0
  307. package/dist/chunk-Z5XTWR2A.cjs +8 -0
  308. package/dist/chunk-ZDNQFOED.js +17 -0
  309. package/dist/chunk-ZGWYI7Q2.cjs +24 -0
  310. package/dist/chunk-ZIMFMYT2.cjs +22 -0
  311. package/dist/chunk-ZJVQD6JD.cjs +18 -0
  312. package/dist/chunk-ZKFXRN6W.cjs +13 -0
  313. package/dist/chunk-ZWYNOAL3.js +19 -0
  314. package/dist/client/exchange-client.cjs +14 -0
  315. package/dist/client/exchange-client.d.cts +409 -0
  316. package/dist/client/exchange-client.d.ts +409 -0
  317. package/dist/client/exchange-client.js +14 -0
  318. package/dist/client/index.cjs +71 -0
  319. package/dist/client/index.d.cts +53 -0
  320. package/dist/client/index.d.ts +53 -0
  321. package/dist/client/index.js +71 -0
  322. package/dist/client/info-client.cjs +27 -0
  323. package/dist/client/info-client.d.cts +255 -0
  324. package/dist/client/info-client.d.ts +255 -0
  325. package/dist/client/info-client.js +27 -0
  326. package/dist/client/info-private-client.cjs +25 -0
  327. package/dist/client/info-private-client.d.cts +293 -0
  328. package/dist/client/info-private-client.d.ts +293 -0
  329. package/dist/client/info-private-client.js +25 -0
  330. package/dist/client/l1-bridge-client.cjs +6 -0
  331. package/dist/client/l1-bridge-client.d.cts +45 -0
  332. package/dist/client/l1-bridge-client.d.ts +45 -0
  333. package/dist/client/l1-bridge-client.js +6 -0
  334. package/dist/client/ws-client.cjs +6 -0
  335. package/dist/client/ws-client.d.cts +64 -0
  336. package/dist/client/ws-client.d.ts +64 -0
  337. package/dist/client/ws-client.js +6 -0
  338. package/dist/index.cjs +225 -0
  339. package/dist/index.d.cts +54 -0
  340. package/dist/index.d.ts +54 -0
  341. package/dist/index.js +225 -0
  342. package/dist/signing/index.cjs +7 -0
  343. package/dist/signing/index.d.cts +1 -0
  344. package/dist/signing/index.d.ts +1 -0
  345. package/dist/signing/index.js +7 -0
  346. package/dist/signing/wasm-signer.cjs +6 -0
  347. package/dist/signing/wasm-signer.d.cts +101 -0
  348. package/dist/signing/wasm-signer.d.ts +101 -0
  349. package/dist/signing/wasm-signer.js +6 -0
  350. package/dist/types/bridge.cjs +1 -0
  351. package/dist/types/bridge.d.cts +24 -0
  352. package/dist/types/bridge.d.ts +24 -0
  353. package/dist/types/bridge.js +1 -0
  354. package/dist/types/constant.cjs +148 -0
  355. package/dist/types/constant.d.cts +142 -0
  356. package/dist/types/constant.d.ts +142 -0
  357. package/dist/types/constant.js +148 -0
  358. package/dist/types/index.cjs +151 -0
  359. package/dist/types/index.d.cts +3 -0
  360. package/dist/types/index.d.ts +3 -0
  361. package/dist/types/index.js +151 -0
  362. package/dist/types/ws.cjs +1 -0
  363. package/dist/types/ws.d.cts +362 -0
  364. package/dist/types/ws.d.ts +362 -0
  365. package/dist/types/ws.js +1 -0
  366. package/package.json +53 -0
package/README.md ADDED
@@ -0,0 +1,816 @@
1
+ # Lighter SDK Client
2
+
3
+ Unofficial TypeScript/JavaScript SDK client for the Lighter protocol - a high-performance decentralized exchange built on zkSync.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/lighter-sdk-client.svg)](https://www.npmjs.com/package/lighter-sdk-client)
6
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
7
+
8
+ ## Features
9
+
10
+ - 🔄 **Full API Coverage** - Complete access to public, private, and exchange endpoints
11
+ - 🔐 **WASM Signing** - Built-in transaction signing with WebAssembly support
12
+ - 🌉 **L1 Bridge Integration** - Direct integration with L1 bridging functionality
13
+ - 📡 **WebSocket Support** - Real-time market data and account updates
14
+ - 🎯 **TypeScript First** - Full type safety and IntelliSense support
15
+ - 📋 **Protocol Constants** - Comprehensive enums and constants for type-safe interactions
16
+ - ⚡ **High Performance** - Optimized for speed with minimal dependencies
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pnpm add lighter-sdk-client
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ### Public API (InfoClient)
27
+
28
+ Access public market data without authentication:
29
+
30
+ ```typescript
31
+ import { InfoClient } from 'lighter-sdk-client';
32
+
33
+ const client = new InfoClient({
34
+ baseURL: 'https://mainnet.zklighter.elliot.ai'
35
+ });
36
+
37
+ // Get account information
38
+ const account = await client.getAccountInfo({
39
+ by: 'index',
40
+ value: '0'
41
+ });
42
+
43
+ // Get order books
44
+ const orderBooks = await client.getOrderBooks();
45
+
46
+ // Get asset details
47
+ const allAssets = await client.getAssetDetails();
48
+ const specificAsset = await client.getAssetDetails({ asset_index: 0 });
49
+
50
+ // Get recent trades
51
+ const trades = await client.getRecentTrades({
52
+ market_id: 1,
53
+ limit: 50
54
+ });
55
+
56
+ // Get candlestick data
57
+ const candles = await client.getCandlesticks({
58
+ market_id: 1,
59
+ resolution: '1h',
60
+ start_timestamp: Math.floor(Date.now() / 1000) - 86400,
61
+ end_timestamp: Math.floor(Date.now() / 1000)
62
+ });
63
+
64
+ // Get withdrawal delay
65
+ const withdrawalDelay = await client.getWithdrawalDelay();
66
+
67
+ // Get root status
68
+ const rootStatus = await client.getRootStatus();
69
+ ```
70
+
71
+ ### Exchange Operations (ExchangeClient)
72
+
73
+ Send transactions and manage orders:
74
+
75
+ ```typescript
76
+ import { ExchangeClient } from 'lighter-sdk-client';
77
+
78
+ const client = new ExchangeClient({
79
+ baseURL: 'https://mainnet.zklighter.elliot.ai'
80
+ });
81
+
82
+ // Send a transaction
83
+ const result = await client.sendTransaction({
84
+ account_index: 0,
85
+ api_key_index: 0,
86
+ transaction: '0x...'
87
+ });
88
+
89
+ // Send a batch of transactions
90
+ const batchResult = await client.sendTransactionBatch({
91
+ account_index: 0,
92
+ api_key_index: 0,
93
+ transactions: ['0x...', '0x...']
94
+ });
95
+
96
+ // Change account tier
97
+ const tierResult = await client.changeAccountTier({
98
+ account_index: 0,
99
+ new_tier: 'premium'
100
+ }, 'auth-token');
101
+
102
+ // Fast withdraw
103
+ const withdrawResult = await client.fastWithdraw({
104
+ tx_info: '0x...',
105
+ to_address: '0x...'
106
+ }, 'auth-token');
107
+
108
+ // Create API token
109
+ const newToken = await client.createToken({
110
+ name: 'My API Token',
111
+ account_index: 0,
112
+ expiry: Math.floor(Date.now() / 1000) + 86400 * 30, // 30 days
113
+ sub_account_access: true,
114
+ scopes: 'read.*'
115
+ }, 'auth-token');
116
+
117
+ // Revoke API token
118
+ const revokeResult = await client.revokeToken({
119
+ token_id: 123,
120
+ account_index: 0
121
+ }, 'auth-token');
122
+
123
+ // Generate L1 sign message for changing public key
124
+ const signMessage = await client.generateChangePubKeyL1SignMessage(
125
+ '0xabcdef...', // pubKeyHex
126
+ 1, // nonce
127
+ 0, // accountIndex
128
+ 0 // newApiKeyIndex
129
+ );
130
+ console.log('Sign this message:', signMessage);
131
+ ```
132
+
133
+ ### Private API (InfoPrivateClient)
134
+
135
+ Access authenticated account data with automatic WASM signing:
136
+
137
+ ```typescript
138
+ import { InfoPrivateClient, WasmSigner } from 'lighter-sdk-client';
139
+
140
+ // Initialize WASM signer
141
+ const wasmSigner = new WasmSigner({
142
+ wasmPath: './public/wasm/lighter-signer.wasm',
143
+ wasmExecPath: './public/wasm/lighter-wasm-exec.js'
144
+ });
145
+
146
+ // Create private client - authentication is handled automatically
147
+ const client = new InfoPrivateClient({
148
+ baseURL: 'https://mainnet.zklighter.elliot.ai',
149
+ wasmSigning: wasmSigner
150
+ });
151
+
152
+ // Get active orders
153
+ const activeOrders = await client.getAccountActiveOrders({
154
+ account_index: 0,
155
+ market_id: 1
156
+ });
157
+
158
+ // Get inactive orders with pagination
159
+ const inactiveOrders = await client.getAccountInactiveOrders({
160
+ account_index: 0,
161
+ limit: 50,
162
+ market_id: 1
163
+ });
164
+
165
+ // Get account limits and tier info
166
+ const limits = await client.getAccountLimits({
167
+ account_index: 0
168
+ });
169
+
170
+ // Get L1 metadata
171
+ const l1Metadata = await client.getL1Metadata({
172
+ l1_address: '0x...'
173
+ });
174
+
175
+ // Get API tokens for account
176
+ const tokens = await client.getTokens({
177
+ account_index: 0
178
+ });
179
+
180
+ // Get deposit history
181
+ const deposits = await client.getDepositHistory({
182
+ account_index: 0,
183
+ l1_address: '0x...',
184
+ filter: 'pending'
185
+ });
186
+
187
+ // Get withdrawal history
188
+ const withdrawals = await client.getWithdrawHistory({
189
+ account_index: 0,
190
+ l1_address: '0x...',
191
+ filter: 'completed'
192
+ });
193
+
194
+ // Get fast withdraw information
195
+ const fastWithdrawInfo = await client.getFastWithdrawInfo({
196
+ account_index: 0
197
+ });
198
+
199
+ // Get transfer fee information
200
+ const transferFeeInfo = await client.getTransferFeeInfo({
201
+ account_index: 0,
202
+ to_account_index: 1
203
+ });
204
+
205
+ // Get transfer history
206
+ const transfers = await client.getTransferHistory({
207
+ account_index: 0,
208
+ cursor: 'optional-cursor-for-pagination'
209
+ });
210
+
211
+ // Get liquidation history
212
+ const liquidations = await client.getLiquidations({
213
+ account_index: 0,
214
+ limit: 50,
215
+ market_id: 1
216
+ });
217
+
218
+ // Get profit and loss data
219
+ const pnl = await client.getPnL({
220
+ by: 'account_index',
221
+ value: '0',
222
+ resolution: '1d',
223
+ start_timestamp: Math.floor(Date.now() / 1000) - 86400 * 30,
224
+ end_timestamp: Math.floor(Date.now() / 1000),
225
+ count_back: 30
226
+ });
227
+
228
+ // Get position funding history
229
+ const funding = await client.getPositionFunding({
230
+ account_index: 0,
231
+ limit: 50,
232
+ market_id: 1,
233
+ side: 'long'
234
+ });
235
+
236
+ // Get public pools metadata
237
+ const pools = await client.getPublicPools({
238
+ filter: 'all',
239
+ limit: 10,
240
+ index: 0
241
+ });
242
+
243
+ // Get referral points
244
+ const referralPoints = await client.getReferralPoints({
245
+ account_index: 0
246
+ });
247
+
248
+ // Get trades for account or market
249
+ const trades = await client.getTrades({
250
+ sort_by: 'timestamp',
251
+ limit: 50,
252
+ account_index: 0,
253
+ market_id: 1,
254
+ sort_dir: 'desc'
255
+ });
256
+
257
+ // Export data
258
+ const exportData = await client.getExport({
259
+ type: 'trade',
260
+ account_index: 0,
261
+ market_id: 1
262
+ });
263
+ console.log('Download URL:', exportData.data_url);
264
+ ```
265
+
266
+ ### L1 Bridge Operations
267
+
268
+ Deposit and withdraw assets:
269
+
270
+ ```typescript
271
+ import { L1BridgeClient } from 'lighter-sdk-client';
272
+ import { arbitrum } from 'viem/chains';
273
+
274
+ const bridgeClient = new L1BridgeClient({
275
+ chain: arbitrum,
276
+ l1RpcUrl: 'https://arb1.arbitrum.io/rpc',
277
+ privateKey: '0x...',
278
+ bridgeContractAddress: '0x...',
279
+ usdcAddress: '0x...'
280
+ });
281
+
282
+ // Deposit USDC from L1 to L2
283
+ const result = await bridgeClient.depositUSDC({
284
+ amount: '100.00',
285
+ lighterAccountIndex: 0
286
+ });
287
+
288
+ console.log('Transaction hash:', result.transactionHash);
289
+ console.log('Amount deposited:', result.amountDeposited);
290
+ ```
291
+
292
+ ### WebSocket Client
293
+
294
+ Subscribe to real-time market data and account updates with automatic reconnection:
295
+
296
+ ```typescript
297
+ import { WsClient } from 'lighter-sdk-client';
298
+
299
+ const wsClient = new WsClient({
300
+ url: 'wss://mainnet.zklighter.elliot.ai/stream',
301
+ reconnectInterval: 5000, // Initial reconnect delay (ms)
302
+ maxReconnectAttempts: Infinity, // Unlimited reconnection attempts
303
+ onOpen: () => console.log('WebSocket connected'),
304
+ onClose: () => console.log('WebSocket disconnected'),
305
+ onError: (error) => console.error('WebSocket error:', error),
306
+ onMessage: (data) => console.log('Raw message:', data)
307
+ });
308
+
309
+ // Connect to WebSocket server
310
+ await wsClient.connect();
311
+
312
+ // Subscribe to order book updates
313
+ wsClient.subscribeOrderBook(1, (update) => {
314
+ console.log('Order book:', update.order_book);
315
+ console.log('Bids:', update.order_book.bids);
316
+ console.log('Asks:', update.order_book.asks);
317
+ });
318
+
319
+ // Subscribe to market statistics
320
+ wsClient.subscribeMarketStats('all', (update) => {
321
+ console.log('Market stats:', update.market_stats);
322
+ });
323
+
324
+ // Subscribe to trade updates for a specific market
325
+ wsClient.subscribeTrades(1, (update) => {
326
+ update.trades.forEach(trade => {
327
+ console.log('Trade:', {
328
+ price: trade.price,
329
+ size: trade.size,
330
+ side: trade.is_maker_ask ? 'sell' : 'buy'
331
+ });
332
+ });
333
+ });
334
+
335
+ // Subscribe to block height updates
336
+ wsClient.subscribeHeight((update) => {
337
+ console.log('Current block height:', update.height);
338
+ });
339
+
340
+ // Subscribe to account updates (requires authentication)
341
+ const authToken = 'your-auth-token';
342
+
343
+ // Subscribe to all account data
344
+ wsClient.subscribeAccountAll(0, (update) => {
345
+ console.log('Positions:', update.positions);
346
+ console.log('Orders:', update.trades);
347
+ console.log('Pool shares:', update.shares);
348
+ });
349
+
350
+ // Subscribe to specific market for an account
351
+ wsClient.subscribeAccountMarket(1, 0, authToken, (update) => {
352
+ console.log('Account orders:', update.orders);
353
+ console.log('Account position:', update.position);
354
+ console.log('Account trades:', update.trades);
355
+ });
356
+
357
+ // Subscribe to user statistics
358
+ wsClient.subscribeUserStats(0, (update) => {
359
+ console.log('Portfolio value:', update.stats.portfolio_value);
360
+ console.log('Available balance:', update.stats.available_balance);
361
+ console.log('Leverage:', update.stats.leverage);
362
+ });
363
+
364
+ // Subscribe to notifications
365
+ wsClient.subscribeNotifications(0, authToken, (update) => {
366
+ update.notifs.forEach(notif => {
367
+ console.log('Notification:', notif.kind, notif.content);
368
+ });
369
+ });
370
+
371
+ // Unsubscribe from specific channels
372
+ wsClient.unsubscribeOrderBook(1);
373
+ wsClient.unsubscribeMarketStats('all');
374
+
375
+ // Check connection status
376
+ const isConnected = wsClient.isConnectedToWebSocket();
377
+ console.log('Connected:', isConnected);
378
+
379
+ // Get all active subscriptions
380
+ const subscriptions = wsClient.getSubscriptions();
381
+ console.log('Active subscriptions:', subscriptions);
382
+
383
+ // Disconnect when done (stops automatic reconnection)
384
+ wsClient.disconnect();
385
+ ```
386
+
387
+ **Features:**
388
+ - ✅ **Automatic Reconnection** - Uses `reconnecting-websocket` library for reliable connections
389
+ - ✅ **Exponential Backoff** - Gradually increases reconnection delay (up to 30 seconds)
390
+ - ✅ **Auto-Resubscription** - Automatically resubscribes to all channels after reconnection
391
+ - ✅ **Type-Safe** - Full TypeScript support with typed update handlers
392
+ - ✅ **Connection Management** - Built-in connection state tracking and lifecycle hooks
393
+
394
+ ## API Reference
395
+
396
+ ### InfoClient
397
+
398
+ Public API client for market data and account information. No authentication required.
399
+
400
+ #### Methods
401
+
402
+ **Account Methods**
403
+ - `getAccountInfo(params)` - Get account information by index or L2 address
404
+ - `getAccountByL1Address(params)` - Get account information associated with an L1 address
405
+
406
+ **API Keys & Announcements**
407
+ - `getApiKeys(params)` - Get API keys for an account
408
+ - `getAnnouncements()` - Get system announcements
409
+
410
+ **Market Data**
411
+ - `getAssetDetails(params?)` - Get asset details for a specific asset or all assets (symbol, decimals, limits, pricing)
412
+ - `getCandlesticks(params)` - Get candlestick data with specified resolution and time range
413
+ - `getFundings(params)` - Get funding history for a market
414
+ - `getExchangeStats()` - Get exchange-wide statistics including volume and fees
415
+ - `getFundingRates()` - Get current funding rates for all markets
416
+
417
+ **Order Books**
418
+ - `getOrderBooks()` - Get list of all order books with configurations
419
+ - `getOrderBookDetails(params)` - Get detailed information about a specific order book
420
+ - `getOrderBookOrders(params)` - Get bids and asks in an order book
421
+
422
+ **Trades**
423
+ - `getRecentTrades(params)` - Get recent trades for a market
424
+ - `getTrades(params, authorization?)` - Get trades with optional filtering and authentication
425
+
426
+ **Transactions**
427
+ - `getTransaction(params)` - Get a specific transaction by hash
428
+ - `getTransactions(params?)` - Get transactions with optional filtering
429
+ - `getTransactionFromL1TxHash(params)` - Get L2 transaction from L1 transaction hash
430
+
431
+ **Utilities**
432
+ - `getNextNonce(params)` - Get the next nonce for an account
433
+ - `getFastBridgeInfo()` - Get fast bridge configuration and status
434
+ - `getWithdrawalDelay()` - Get withdrawal delay in seconds
435
+ - `getRootStatus()` - Get root status information including network status and timestamp
436
+
437
+ ### ExchangeClient
438
+
439
+ Client for sending transactions and managing exchange operations.
440
+
441
+ #### Methods
442
+
443
+ **Transaction Submission**
444
+ - `sendTransaction(params)` - Send a signed transaction to the exchange
445
+ - `sendTx(params)` - Send transaction with form data format
446
+ - `sendTxWithIndices(params)` - Send transaction with account and API key indices
447
+ - `sendTxJson(params)` - Send transaction with JSON payload format
448
+ - `sendTransactionBatch(params)` - Send multiple transactions in a single batch for better efficiency
449
+
450
+ **Account Management**
451
+ - `changeAccountTier(params, authorization?)` - Change account tier (requires authorization)
452
+ - `fastWithdraw(params, authorization?)` - Fast withdraw funds (requires authorization)
453
+
454
+ **API Tokens**
455
+ - `createToken(params, authorization?)` - Create API token with specified permissions and expiry
456
+ - `revokeToken(params, authorization?)` - Revoke an existing API token
457
+ - `generateChangePubKeyL1SignMessage(pubKeyHex, nonce, accountIndex, newApiKeyIndex)` - Generate L1 sign message for changing public key
458
+
459
+ **Notifications**
460
+ - `acknowledgeNotification(params)` - Acknowledge receipt of a notification
461
+
462
+ ### InfoPrivateClient
463
+
464
+ Client for authenticated/private endpoints. Authentication is handled automatically via WasmSigner.
465
+
466
+ #### Methods
467
+
468
+ **Account Orders**
469
+ - `getAccountActiveOrders(params)` - Get active orders for an account in a specific market
470
+ - `getAccountInactiveOrders(params)` - Get inactive orders with pagination support
471
+
472
+ **Account Information**
473
+ - `getAccountLimits(params)` - Get account limits including max LLP percentage, user tier, and pool creation permissions
474
+ - `getAccountMetadata(params)` - Get account metadata by index or L1 address
475
+ - `getL1Metadata(params)` - Get L1 metadata for an address including referral information
476
+ - `getTokens(params)` - Get API tokens for an account with details including name, expiry, scopes, and status
477
+
478
+ **Transaction History**
479
+ - `getDepositHistory(params)` - Get deposit history with status and timestamps
480
+ - `getWithdrawHistory(params)` - Get withdrawal history with status and timestamps
481
+ - `getFastWithdrawInfo(params)` - Get fast withdraw limits and account information
482
+ - `getTransferFeeInfo(params)` - Get transfer fee information between accounts
483
+ - `getTransferHistory(params)` - Get transfer history with pagination support
484
+ - `getLiquidations(params)` - Get liquidation history with pagination support
485
+
486
+ **Analytics**
487
+ - `getPnL(params)` - Get profit and loss data with customizable resolution and time range
488
+ - `getPositionFunding(params)` - Get position funding history with pagination support
489
+
490
+ **Liquidity Pools**
491
+ - `getPublicPools(params?)` - Get public pool information including TVL, APY, and share details
492
+
493
+ **Referral System**
494
+ - `getReferralPoints(params)` - Get referral points data including user points and referral list
495
+
496
+ **Trading**
497
+ - `getTrades(params)` - Get trades for an account or market with sorting and filtering options
498
+
499
+ **Data Export**
500
+ - `getExport(params)` - Export data (funding or trade data) for downloading
501
+
502
+ ### L1BridgeClient
503
+
504
+ Client for L1 bridge operations to move assets between Layer 1 and Layer 2.
505
+
506
+ #### Methods
507
+
508
+ **Bridge Operations**
509
+ - `depositUSDC(params)` - Deposit USDC from L1 to L2 Lighter account
510
+
511
+ **Balance & Allowance**
512
+ - `checkUSDCBalance()` - Check USDC balance on L1
513
+ - `checkAllowance()` - Check current USDC allowance for bridge contract
514
+ - `approveUSDC(amount)` - Approve USDC spending for bridge contract
515
+
516
+ ### WsClient
517
+
518
+ WebSocket client for real-time market data and account updates with automatic reconnection and resubscription.
519
+
520
+ #### Configuration Options
521
+
522
+ ```typescript
523
+ interface WebSocketConfig {
524
+ url?: string; // WebSocket server URL (default: wss://mainnet.zklighter.elliot.ai/stream)
525
+ reconnectInterval?: number; // Initial reconnect delay in ms (default: 5000)
526
+ maxReconnectAttempts?: number; // Max reconnection attempts (default: Infinity)
527
+ onMessage?: (data: any) => void; // Raw message handler
528
+ onError?: (error: Error) => void; // Error handler
529
+ onClose?: () => void; // Close event handler
530
+ onOpen?: () => void; // Open event handler
531
+ }
532
+ ```
533
+
534
+ #### Methods
535
+
536
+ **Connection Management**
537
+ - `connect()` - Establish WebSocket connection with automatic reconnection support
538
+ - `disconnect()` - Close WebSocket connection and stop automatic reconnection
539
+ - `isConnectedToWebSocket()` - Check if currently connected to WebSocket server
540
+ - `getSubscriptions()` - Get list of all active subscriptions
541
+
542
+ **Market Data Subscriptions**
543
+ - `subscribeOrderBook(marketIndex, handler)` - Subscribe to order book updates (bids/asks)
544
+ - `unsubscribeOrderBook(marketIndex)` - Unsubscribe from order book updates
545
+ - `subscribeTrades(marketIndex, handler)` - Subscribe to trade updates for a market
546
+ - `unsubscribeTrades(marketIndex)` - Unsubscribe from trade updates
547
+ - `subscribeMarketStats(market, handler)` - Subscribe to market statistics (market can be number or 'all')
548
+ - `unsubscribeMarketStats(market)` - Unsubscribe from market statistics
549
+ - `subscribeSpotMarketStats(market, handler)` - Subscribe to spot market statistics
550
+ - `unsubscribeSpotMarketStats(market)` - Unsubscribe from spot market statistics
551
+
552
+ **Account Subscriptions** (requires authentication)
553
+ - `subscribeAccountAll(accountId, handler)` - Subscribe to all account data (positions, trades, shares)
554
+ - `unsubscribeAccountAll(accountId)` - Unsubscribe from all account data
555
+ - `subscribeAccountMarket(marketId, accountId, auth, handler)` - Subscribe to account updates for specific market
556
+ - `unsubscribeAccountMarket(marketId, accountId)` - Unsubscribe from account market updates
557
+ - `subscribeAccountOrders(marketIndex, accountId, auth, handler)` - Subscribe to order updates for specific market
558
+ - `unsubscribeAccountOrders(marketIndex, accountId)` - Unsubscribe from order updates
559
+ - `subscribeAccountAllOrders(accountId, auth, handler)` - Subscribe to all order updates across markets
560
+ - `unsubscribeAccountAllOrders(accountId)` - Unsubscribe from all order updates
561
+ - `subscribeAccountAllPositions(accountId, auth, handler)` - Subscribe to all position updates
562
+ - `unsubscribeAccountAllPositions(accountId)` - Unsubscribe from position updates
563
+ - `subscribeAccountAllTrades(accountId, auth, handler)` - Subscribe to all trade updates
564
+ - `unsubscribeAccountAllTrades(accountId)` - Unsubscribe from trade updates
565
+ - `subscribeUserStats(accountId, handler)` - Subscribe to user statistics (portfolio, balance, leverage)
566
+ - `unsubscribeUserStats(accountId)` - Unsubscribe from user statistics
567
+
568
+ **Pool Subscriptions** (requires authentication)
569
+ - `subscribePoolData(accountId, auth, handler)` - Subscribe to pool data updates
570
+ - `unsubscribePoolData(accountId)` - Unsubscribe from pool data
571
+ - `subscribePoolInfo(accountId, auth, handler)` - Subscribe to pool information updates
572
+ - `unsubscribePoolInfo(accountId)` - Unsubscribe from pool information
573
+
574
+ **System Subscriptions**
575
+ - `subscribeNotifications(accountId, auth, handler)` - Subscribe to system notifications
576
+ - `unsubscribeNotifications(accountId)` - Unsubscribe from notifications
577
+ - `subscribeTransactions(handler)` - Subscribe to all transaction updates
578
+ - `unsubscribeTransactions()` - Unsubscribe from transaction updates
579
+ - `subscribeExecutedTransactions(handler)` - Subscribe to executed transaction updates
580
+ - `unsubscribeExecutedTransactions()` - Unsubscribe from executed transactions
581
+ - `subscribeAccountTransactions(accountId, auth, handler)` - Subscribe to account-specific transactions
582
+ - `unsubscribeAccountTransactions(accountId)` - Unsubscribe from account transactions
583
+ - `subscribeHeight(handler)` - Subscribe to block height updates
584
+ - `unsubscribeHeight()` - Unsubscribe from height updates
585
+
586
+ **Advanced**
587
+ - `subscribe<TPayload>(subscription)` - Generic subscribe method with custom subscription options
588
+ - `unsubscribe(channel)` - Generic unsubscribe method for any channel
589
+ - `send(message)` - Send raw message through WebSocket connection
590
+
591
+ ## Constants and Enums
592
+
593
+ The SDK provides comprehensive constants and enums for type-safe interaction with the Lighter protocol:
594
+
595
+ ### Transaction Types
596
+
597
+ ```typescript
598
+ import { TxType } from 'lighter-sdk-client';
599
+
600
+ // L1 Transaction Types
601
+ TxType.L1Deposit
602
+ TxType.L1ChangePubKey
603
+ TxType.L1CreateMarket
604
+ TxType.L1UpdateMarket
605
+ TxType.L1CancelAllOrders
606
+ TxType.L1Withdraw
607
+ TxType.L1CreateOrder
608
+ TxType.L1BurnShares
609
+
610
+ // L2 Transaction Types
611
+ TxType.L2ChangePubKey
612
+ TxType.L2CreateSubAccount
613
+ TxType.L2CreatePublicPool
614
+ TxType.L2UpdatePublicPool
615
+ TxType.L2Transfer
616
+ TxType.L2Withdraw
617
+ TxType.L2CreateOrder
618
+ TxType.L2CancelOrder
619
+ TxType.L2CancelAllOrders
620
+ TxType.L2ModifyOrder
621
+ TxType.L2MintShares
622
+ TxType.L2BurnShares
623
+ TxType.L2UpdateLeverage
624
+ TxType.L2CreateGroupedOrders
625
+ TxType.L2UpdateMargin
626
+
627
+ // Internal Transaction Types
628
+ TxType.InternalClaimOrder
629
+ TxType.InternalCancelOrder
630
+ TxType.InternalDeleverage
631
+ TxType.InternalExitPosition
632
+ TxType.InternalCancelAllOrders
633
+ TxType.InternalLiquidatePosition
634
+ TxType.InternalCreateOrder
635
+ ```
636
+
637
+ ### Order Types
638
+
639
+ ```typescript
640
+ import { OrderType } from 'lighter-sdk-client';
641
+
642
+ OrderType.Limit // Standard limit order
643
+ OrderType.Market // Market order
644
+ OrderType.StopLoss // Stop loss order
645
+ OrderType.StopLossLimit // Stop loss limit order
646
+ OrderType.TakeProfit // Take profit order
647
+ OrderType.TakeProfitLimit // Take profit limit order
648
+ OrderType.TWAP // Time-weighted average price order
649
+ OrderType.TWAPSub // TWAP sub-order (internal)
650
+ OrderType.Liquidation // Liquidation order (internal)
651
+ ```
652
+
653
+ ### Order Time-In-Force
654
+
655
+ ```typescript
656
+ import { OrderTimeInForce } from 'lighter-sdk-client';
657
+
658
+ OrderTimeInForce.ImmediateOrCancel // Execute immediately or cancel
659
+ OrderTimeInForce.GoodTillTime // Active until specified time
660
+ OrderTimeInForce.PostOnly // Only add to order book (maker only)
661
+ ```
662
+
663
+ ### Grouping Types
664
+
665
+ ```typescript
666
+ import { GroupingType } from 'lighter-sdk-client';
667
+
668
+ GroupingType.Default // No grouping
669
+ GroupingType.OneTriggersTheOther // OCO: One triggers the other
670
+ GroupingType.OneCancelsTheOther // OCO: One cancels the other
671
+ GroupingType.OneTriggersAOneCancelsTheOther // OTOCO: Combined behavior
672
+ ```
673
+
674
+ ### Margin Modes
675
+
676
+ ```typescript
677
+ import {
678
+ PositionMarginMode,
679
+ AssetMarginMode,
680
+ MarginUpdateDirection
681
+ } from 'lighter-sdk-client';
682
+
683
+ // Position Margin Mode
684
+ PositionMarginMode.Cross // Cross margin
685
+ PositionMarginMode.Isolated // Isolated margin
686
+
687
+ // Asset Margin Mode
688
+ AssetMarginMode.Disabled
689
+ AssetMarginMode.Enabled
690
+
691
+ // Margin Update Direction
692
+ MarginUpdateDirection.RemoveFromIsolated
693
+ MarginUpdateDirection.AddToIsolated
694
+ ```
695
+
696
+ ### Asset Route Types
697
+
698
+ ```typescript
699
+ import { AssetRouteType } from 'lighter-sdk-client';
700
+
701
+ AssetRouteType.Perps // Perpetual futures
702
+ AssetRouteType.Spot // Spot trading
703
+ ```
704
+
705
+ ### Numeric Constants
706
+
707
+ The SDK includes various numeric constants for limits and validations:
708
+
709
+ ```typescript
710
+ import {
711
+ OneUSDC,
712
+ MinOrderPrice,
713
+ MaxOrderPrice,
714
+ MinOrderBaseAmount,
715
+ MaxOrderBaseAmount,
716
+ MinAccountIndex,
717
+ MaxAccountIndex,
718
+ NativeAssetIndex,
719
+ USDCAssetIndex,
720
+ // ... and many more
721
+ } from 'lighter-sdk-client';
722
+
723
+ // Example usage
724
+ const minAmount = MinOrderBaseAmount; // 1
725
+ const maxAmount = MaxOrderBaseAmount; // 281474976710655
726
+ const usdcDecimals = OneUSDC; // 1000000
727
+ ```
728
+
729
+ Available numeric constants include:
730
+ - **Account Indices**: `MinAccountIndex`, `MaxAccountIndex`, `MaxMasterAccountIndex`, `MinSubAccountIndex`
731
+ - **Market Indices**: `MinMarketIndex`, `MaxPerpsMarketIndex`, `MinSpotMarketIndex`, `MaxSpotMarketIndex`
732
+ - **Asset Indices**: `NativeAssetIndex`, `USDCAssetIndex`, `MinAssetIndex`, `MaxAssetIndex`
733
+ - **Order Limits**: `MinOrderPrice`, `MaxOrderPrice`, `MinOrderBaseAmount`, `MaxOrderBaseAmount`
734
+ - **Order Timing**: `MinOrderExpiryPeriod`, `MaxOrderExpiryPeriod`, `MinOrderCancelAllPeriod`, `MaxOrderCancelAllPeriod`
735
+ - **Pool Limits**: `MaxInvestedPublicPoolCount`, `MinInitialTotalShares`, `MaxInitialTotalShares`
736
+ - **Exchange Limits**: `MaxExchangeUSDC`, `MinTransferAmount`, `MaxTransferAmount`, `MinWithdrawalAmount`, `MaxWithdrawalAmount`
737
+
738
+ ## Configuration
739
+
740
+ ### Base URLs
741
+
742
+ - **Mainnet**: `https://mainnet.zklighter.elliot.ai`
743
+ - **WebSocket**: `wss://mainnet.zklighter.elliot.ai/stream`
744
+
745
+ ### WASM Signing Setup
746
+
747
+ For transaction signing, you need to include the WASM files (please copy them from the `lighter-sdk-client` package to your `./public` directory):
748
+
749
+ ```typescript
750
+ import { WasmSigner } from 'lighter-sdk-client';
751
+
752
+ const wasmSigning = new WasmSigner({
753
+ wasmPath: './public/wasm/lighter-signer.wasm',
754
+ wasmExecPath: './public/wasm/lighter-wasm-exec.js'
755
+ });
756
+ ```
757
+
758
+ The WASM files should be placed in your public directory and served statically.
759
+
760
+ ## Dependencies
761
+
762
+ - `axios` - HTTP client for API requests
763
+ - `viem` - Ethereum library for L1 bridge operations
764
+ - `wagmi` - React hooks for Ethereum (peer dependency)
765
+ - `@tanstack/react-query` - Data fetching library (peer dependency)
766
+
767
+ ## Development
768
+
769
+ ### Build
770
+
771
+ ```bash
772
+ pnpm build
773
+ ```
774
+
775
+ ### Project Structure
776
+
777
+ ```
778
+ src/
779
+ ├── api/ # API endpoint implementations
780
+ │ ├── exchange/ # Exchange/transaction endpoints
781
+ │ ├── info/ # Public info endpoints
782
+ │ └── info-private/ # Private/authenticated endpoints
783
+ ├── client/ # Client classes
784
+ │ ├── exchange-client.ts
785
+ │ ├── info-client.ts
786
+ │ ├── info-private-client.ts
787
+ │ ├── l1-bridge-client.ts
788
+ │ └── ws-client.ts
789
+ ├── signing/ # Transaction signing utilities
790
+ │ └── wasm-signer.ts
791
+ └── types/ # TypeScript type definitions
792
+ ├── bridge.ts
793
+ ├── constant.ts # Protocol constants and enums
794
+ ├── ws.ts
795
+ └── index.ts
796
+ ```
797
+
798
+ ## License
799
+
800
+ ISC
801
+
802
+ ## Disclaimer
803
+
804
+ This is an unofficial SDK client for the Lighter protocol. Use at your own risk. Always verify transactions before signing.
805
+
806
+ ## Links
807
+
808
+ - [Lighter Protocol](https://lighter.xyz)
809
+ - [Documentation](https://docs.lighter.xyz)
810
+
811
+ ## Support
812
+
813
+ For issues and questions:
814
+ - Create an issue on GitHub
815
+ - Join the Lighter community Discord
816
+ - Check the official documentation