@lifi/perps-sdk-provider-lighter 0.2.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +176 -0
  3. package/dist/cjs/LighterProvider.d.ts +20 -0
  4. package/dist/cjs/LighterProvider.d.ts.map +1 -0
  5. package/dist/cjs/LighterProvider.js +592 -0
  6. package/dist/cjs/LighterProvider.js.map +1 -0
  7. package/dist/cjs/accountConfig.d.ts +3 -0
  8. package/dist/cjs/accountConfig.d.ts.map +1 -0
  9. package/dist/cjs/accountConfig.js +69 -0
  10. package/dist/cjs/accountConfig.js.map +1 -0
  11. package/dist/cjs/accountSummary.d.ts +3 -0
  12. package/dist/cjs/accountSummary.d.ts.map +1 -0
  13. package/dist/cjs/accountSummary.js +8 -0
  14. package/dist/cjs/accountSummary.js.map +1 -0
  15. package/dist/cjs/constants.d.ts +14 -0
  16. package/dist/cjs/constants.d.ts.map +1 -0
  17. package/dist/cjs/constants.js +18 -0
  18. package/dist/cjs/constants.js.map +1 -0
  19. package/dist/cjs/index.d.ts +11 -0
  20. package/dist/cjs/index.d.ts.map +1 -0
  21. package/dist/cjs/index.js +35 -0
  22. package/dist/cjs/index.js.map +1 -0
  23. package/dist/cjs/package.json +1 -0
  24. package/dist/cjs/signers/LighterKeyStore.d.ts +18 -0
  25. package/dist/cjs/signers/LighterKeyStore.d.ts.map +1 -0
  26. package/dist/cjs/signers/LighterKeyStore.js +54 -0
  27. package/dist/cjs/signers/LighterKeyStore.js.map +1 -0
  28. package/dist/cjs/signers/LighterReadOnlyTokenManager.d.ts +56 -0
  29. package/dist/cjs/signers/LighterReadOnlyTokenManager.d.ts.map +1 -0
  30. package/dist/cjs/signers/LighterReadOnlyTokenManager.js +127 -0
  31. package/dist/cjs/signers/LighterReadOnlyTokenManager.js.map +1 -0
  32. package/dist/cjs/signers/LighterSigner.d.ts +41 -0
  33. package/dist/cjs/signers/LighterSigner.d.ts.map +1 -0
  34. package/dist/cjs/signers/LighterSigner.js +175 -0
  35. package/dist/cjs/signers/LighterSigner.js.map +1 -0
  36. package/dist/cjs/signers/createAuthToken.d.ts +12 -0
  37. package/dist/cjs/signers/createAuthToken.d.ts.map +1 -0
  38. package/dist/cjs/signers/createAuthToken.js +28 -0
  39. package/dist/cjs/signers/createAuthToken.js.map +1 -0
  40. package/dist/cjs/signers/index.d.ts +11 -0
  41. package/dist/cjs/signers/index.d.ts.map +1 -0
  42. package/dist/cjs/signers/index.js +19 -0
  43. package/dist/cjs/signers/index.js.map +1 -0
  44. package/dist/cjs/signers/signActions.d.ts +15 -0
  45. package/dist/cjs/signers/signActions.d.ts.map +1 -0
  46. package/dist/cjs/signers/signActions.js +142 -0
  47. package/dist/cjs/signers/signActions.js.map +1 -0
  48. package/dist/cjs/signers/wasmLoader.d.ts +42 -0
  49. package/dist/cjs/signers/wasmLoader.d.ts.map +1 -0
  50. package/dist/cjs/signers/wasmLoader.js +166 -0
  51. package/dist/cjs/signers/wasmLoader.js.map +1 -0
  52. package/dist/cjs/types/account.d.ts +97 -0
  53. package/dist/cjs/types/account.d.ts.map +1 -0
  54. package/dist/cjs/types/account.js +3 -0
  55. package/dist/cjs/types/account.js.map +1 -0
  56. package/dist/cjs/types/action.d.ts +72 -0
  57. package/dist/cjs/types/action.d.ts.map +1 -0
  58. package/dist/cjs/types/action.js +23 -0
  59. package/dist/cjs/types/action.js.map +1 -0
  60. package/dist/cjs/types/activity.d.ts +73 -0
  61. package/dist/cjs/types/activity.d.ts.map +1 -0
  62. package/dist/cjs/types/activity.js +3 -0
  63. package/dist/cjs/types/activity.js.map +1 -0
  64. package/dist/cjs/types/asset.d.ts +122 -0
  65. package/dist/cjs/types/asset.d.ts.map +1 -0
  66. package/dist/cjs/types/asset.js +3 -0
  67. package/dist/cjs/types/asset.js.map +1 -0
  68. package/dist/cjs/types/fill.d.ts +29 -0
  69. package/dist/cjs/types/fill.d.ts.map +1 -0
  70. package/dist/cjs/types/fill.js +3 -0
  71. package/dist/cjs/types/fill.js.map +1 -0
  72. package/dist/cjs/types/index.d.ts +9 -0
  73. package/dist/cjs/types/index.d.ts.map +1 -0
  74. package/dist/cjs/types/index.js +25 -0
  75. package/dist/cjs/types/index.js.map +1 -0
  76. package/dist/cjs/types/order.d.ts +57 -0
  77. package/dist/cjs/types/order.d.ts.map +1 -0
  78. package/dist/cjs/types/order.js +3 -0
  79. package/dist/cjs/types/order.js.map +1 -0
  80. package/dist/cjs/types/submit.d.ts +39 -0
  81. package/dist/cjs/types/submit.d.ts.map +1 -0
  82. package/dist/cjs/types/submit.js +3 -0
  83. package/dist/cjs/types/submit.js.map +1 -0
  84. package/dist/cjs/types/ws.d.ts +84 -0
  85. package/dist/cjs/types/ws.d.ts.map +1 -0
  86. package/dist/cjs/types/ws.js +3 -0
  87. package/dist/cjs/types/ws.js.map +1 -0
  88. package/dist/cjs/utils/activityCursor.d.ts +12 -0
  89. package/dist/cjs/utils/activityCursor.d.ts.map +1 -0
  90. package/dist/cjs/utils/activityCursor.js +85 -0
  91. package/dist/cjs/utils/activityCursor.js.map +1 -0
  92. package/dist/cjs/utils/apiClient.d.ts +26 -0
  93. package/dist/cjs/utils/apiClient.d.ts.map +1 -0
  94. package/dist/cjs/utils/apiClient.js +94 -0
  95. package/dist/cjs/utils/apiClient.js.map +1 -0
  96. package/dist/cjs/utils/fetchDetailedAccount.d.ts +5 -0
  97. package/dist/cjs/utils/fetchDetailedAccount.d.ts.map +1 -0
  98. package/dist/cjs/utils/fetchDetailedAccount.js +22 -0
  99. package/dist/cjs/utils/fetchDetailedAccount.js.map +1 -0
  100. package/dist/cjs/utils/index.d.ts +16 -0
  101. package/dist/cjs/utils/index.d.ts.map +1 -0
  102. package/dist/cjs/utils/index.js +45 -0
  103. package/dist/cjs/utils/index.js.map +1 -0
  104. package/dist/cjs/utils/lighterAsset.d.ts +3 -0
  105. package/dist/cjs/utils/lighterAsset.d.ts.map +1 -0
  106. package/dist/cjs/utils/lighterAsset.js +12 -0
  107. package/dist/cjs/utils/lighterAsset.js.map +1 -0
  108. package/dist/cjs/utils/liquidation.d.ts +4 -0
  109. package/dist/cjs/utils/liquidation.d.ts.map +1 -0
  110. package/dist/cjs/utils/liquidation.js +16 -0
  111. package/dist/cjs/utils/liquidation.js.map +1 -0
  112. package/dist/cjs/utils/mapFill.d.ts +4 -0
  113. package/dist/cjs/utils/mapFill.d.ts.map +1 -0
  114. package/dist/cjs/utils/mapFill.js +61 -0
  115. package/dist/cjs/utils/mapFill.js.map +1 -0
  116. package/dist/cjs/utils/mapOpenPositions.d.ts +4 -0
  117. package/dist/cjs/utils/mapOpenPositions.d.ts.map +1 -0
  118. package/dist/cjs/utils/mapOpenPositions.js +9 -0
  119. package/dist/cjs/utils/mapOpenPositions.js.map +1 -0
  120. package/dist/cjs/utils/mapOrder.d.ts +15 -0
  121. package/dist/cjs/utils/mapOrder.d.ts.map +1 -0
  122. package/dist/cjs/utils/mapOrder.js +164 -0
  123. package/dist/cjs/utils/mapOrder.js.map +1 -0
  124. package/dist/cjs/utils/mapPosition.d.ts +4 -0
  125. package/dist/cjs/utils/mapPosition.d.ts.map +1 -0
  126. package/dist/cjs/utils/mapPosition.js +30 -0
  127. package/dist/cjs/utils/mapPosition.js.map +1 -0
  128. package/dist/cjs/utils/ohlcvInterval.d.ts +2 -0
  129. package/dist/cjs/utils/ohlcvInterval.d.ts.map +1 -0
  130. package/dist/cjs/utils/ohlcvInterval.js +26 -0
  131. package/dist/cjs/utils/ohlcvInterval.js.map +1 -0
  132. package/dist/cjs/utils/orderFormatting.d.ts +4 -0
  133. package/dist/cjs/utils/orderFormatting.d.ts.map +1 -0
  134. package/dist/cjs/utils/orderFormatting.js +23 -0
  135. package/dist/cjs/utils/orderFormatting.js.map +1 -0
  136. package/dist/cjs/utils/time.d.ts +3 -0
  137. package/dist/cjs/utils/time.d.ts.map +1 -0
  138. package/dist/cjs/utils/time.js +8 -0
  139. package/dist/cjs/utils/time.js.map +1 -0
  140. package/dist/cjs/utils/wireEncoding.d.ts +9 -0
  141. package/dist/cjs/utils/wireEncoding.d.ts.map +1 -0
  142. package/dist/cjs/utils/wireEncoding.js +87 -0
  143. package/dist/cjs/utils/wireEncoding.js.map +1 -0
  144. package/dist/cjs/websocket/LighterWsProvider.d.ts +45 -0
  145. package/dist/cjs/websocket/LighterWsProvider.d.ts.map +1 -0
  146. package/dist/cjs/websocket/LighterWsProvider.js +396 -0
  147. package/dist/cjs/websocket/LighterWsProvider.js.map +1 -0
  148. package/dist/esm/LighterProvider.d.ts +105 -0
  149. package/dist/esm/LighterProvider.d.ts.map +1 -0
  150. package/dist/esm/LighterProvider.js +684 -0
  151. package/dist/esm/LighterProvider.js.map +1 -0
  152. package/dist/esm/accountConfig.d.ts +14 -0
  153. package/dist/esm/accountConfig.d.ts.map +1 -0
  154. package/dist/esm/accountConfig.js +135 -0
  155. package/dist/esm/accountConfig.js.map +1 -0
  156. package/dist/esm/accountSummary.d.ts +12 -0
  157. package/dist/esm/accountSummary.d.ts.map +1 -0
  158. package/dist/esm/accountSummary.js +14 -0
  159. package/dist/esm/accountSummary.js.map +1 -0
  160. package/dist/esm/constants.d.ts +74 -0
  161. package/dist/esm/constants.d.ts.map +1 -0
  162. package/dist/esm/constants.js +73 -0
  163. package/dist/esm/constants.js.map +1 -0
  164. package/dist/esm/index.d.ts +22 -0
  165. package/dist/esm/index.d.ts.map +1 -0
  166. package/dist/esm/index.js +22 -0
  167. package/dist/esm/index.js.map +1 -0
  168. package/dist/esm/package.json +1 -0
  169. package/dist/esm/signers/LighterKeyStore.d.ts +24 -0
  170. package/dist/esm/signers/LighterKeyStore.d.ts.map +1 -0
  171. package/dist/esm/signers/LighterKeyStore.js +55 -0
  172. package/dist/esm/signers/LighterKeyStore.js.map +1 -0
  173. package/dist/esm/signers/LighterReadOnlyTokenManager.d.ts +157 -0
  174. package/dist/esm/signers/LighterReadOnlyTokenManager.d.ts.map +1 -0
  175. package/dist/esm/signers/LighterReadOnlyTokenManager.js +194 -0
  176. package/dist/esm/signers/LighterReadOnlyTokenManager.js.map +1 -0
  177. package/dist/esm/signers/LighterSigner.d.ts +94 -0
  178. package/dist/esm/signers/LighterSigner.d.ts.map +1 -0
  179. package/dist/esm/signers/LighterSigner.js +228 -0
  180. package/dist/esm/signers/LighterSigner.js.map +1 -0
  181. package/dist/esm/signers/createAuthToken.d.ts +36 -0
  182. package/dist/esm/signers/createAuthToken.d.ts.map +1 -0
  183. package/dist/esm/signers/createAuthToken.js +42 -0
  184. package/dist/esm/signers/createAuthToken.js.map +1 -0
  185. package/dist/esm/signers/index.d.ts +11 -0
  186. package/dist/esm/signers/index.d.ts.map +1 -0
  187. package/dist/esm/signers/index.js +7 -0
  188. package/dist/esm/signers/index.js.map +1 -0
  189. package/dist/esm/signers/signActions.d.ts +54 -0
  190. package/dist/esm/signers/signActions.d.ts.map +1 -0
  191. package/dist/esm/signers/signActions.js +193 -0
  192. package/dist/esm/signers/signActions.js.map +1 -0
  193. package/dist/esm/signers/wasmLoader.d.ts +79 -0
  194. package/dist/esm/signers/wasmLoader.d.ts.map +1 -0
  195. package/dist/esm/signers/wasmLoader.js +180 -0
  196. package/dist/esm/signers/wasmLoader.js.map +1 -0
  197. package/dist/esm/types/account.d.ts +113 -0
  198. package/dist/esm/types/account.d.ts.map +1 -0
  199. package/dist/esm/types/account.js +4 -0
  200. package/dist/esm/types/account.js.map +1 -0
  201. package/dist/esm/types/action.d.ts +146 -0
  202. package/dist/esm/types/action.d.ts.map +1 -0
  203. package/dist/esm/types/action.js +50 -0
  204. package/dist/esm/types/action.js.map +1 -0
  205. package/dist/esm/types/activity.d.ts +83 -0
  206. package/dist/esm/types/activity.d.ts.map +1 -0
  207. package/dist/esm/types/activity.js +4 -0
  208. package/dist/esm/types/activity.js.map +1 -0
  209. package/dist/esm/types/asset.d.ts +134 -0
  210. package/dist/esm/types/asset.d.ts.map +1 -0
  211. package/dist/esm/types/asset.js +3 -0
  212. package/dist/esm/types/asset.js.map +1 -0
  213. package/dist/esm/types/fill.d.ts +31 -0
  214. package/dist/esm/types/fill.d.ts.map +1 -0
  215. package/dist/esm/types/fill.js +3 -0
  216. package/dist/esm/types/fill.js.map +1 -0
  217. package/dist/esm/types/index.d.ts +9 -0
  218. package/dist/esm/types/index.d.ts.map +1 -0
  219. package/dist/esm/types/index.js +12 -0
  220. package/dist/esm/types/index.js.map +1 -0
  221. package/dist/esm/types/order.d.ts +61 -0
  222. package/dist/esm/types/order.d.ts.map +1 -0
  223. package/dist/esm/types/order.js +3 -0
  224. package/dist/esm/types/order.js.map +1 -0
  225. package/dist/esm/types/submit.d.ts +76 -0
  226. package/dist/esm/types/submit.d.ts.map +1 -0
  227. package/dist/esm/types/submit.js +3 -0
  228. package/dist/esm/types/submit.js.map +1 -0
  229. package/dist/esm/types/ws.d.ts +124 -0
  230. package/dist/esm/types/ws.d.ts.map +1 -0
  231. package/dist/esm/types/ws.js +11 -0
  232. package/dist/esm/types/ws.js.map +1 -0
  233. package/dist/esm/utils/activityCursor.d.ts +51 -0
  234. package/dist/esm/utils/activityCursor.d.ts.map +1 -0
  235. package/dist/esm/utils/activityCursor.js +99 -0
  236. package/dist/esm/utils/activityCursor.js.map +1 -0
  237. package/dist/esm/utils/apiClient.d.ts +65 -0
  238. package/dist/esm/utils/apiClient.d.ts.map +1 -0
  239. package/dist/esm/utils/apiClient.js +131 -0
  240. package/dist/esm/utils/apiClient.js.map +1 -0
  241. package/dist/esm/utils/fetchDetailedAccount.d.ts +11 -0
  242. package/dist/esm/utils/fetchDetailedAccount.d.ts.map +1 -0
  243. package/dist/esm/utils/fetchDetailedAccount.js +24 -0
  244. package/dist/esm/utils/fetchDetailedAccount.js.map +1 -0
  245. package/dist/esm/utils/index.d.ts +16 -0
  246. package/dist/esm/utils/index.d.ts.map +1 -0
  247. package/dist/esm/utils/index.js +17 -0
  248. package/dist/esm/utils/index.js.map +1 -0
  249. package/dist/esm/utils/lighterAsset.d.ts +4 -0
  250. package/dist/esm/utils/lighterAsset.d.ts.map +1 -0
  251. package/dist/esm/utils/lighterAsset.js +9 -0
  252. package/dist/esm/utils/lighterAsset.js.map +1 -0
  253. package/dist/esm/utils/liquidation.d.ts +22 -0
  254. package/dist/esm/utils/liquidation.d.ts.map +1 -0
  255. package/dist/esm/utils/liquidation.js +31 -0
  256. package/dist/esm/utils/liquidation.js.map +1 -0
  257. package/dist/esm/utils/mapFill.d.ts +10 -0
  258. package/dist/esm/utils/mapFill.d.ts.map +1 -0
  259. package/dist/esm/utils/mapFill.js +72 -0
  260. package/dist/esm/utils/mapFill.js.map +1 -0
  261. package/dist/esm/utils/mapOpenPositions.d.ts +11 -0
  262. package/dist/esm/utils/mapOpenPositions.d.ts.map +1 -0
  263. package/dist/esm/utils/mapOpenPositions.js +12 -0
  264. package/dist/esm/utils/mapOpenPositions.js.map +1 -0
  265. package/dist/esm/utils/mapOrder.d.ts +72 -0
  266. package/dist/esm/utils/mapOrder.d.ts.map +1 -0
  267. package/dist/esm/utils/mapOrder.js +219 -0
  268. package/dist/esm/utils/mapOrder.js.map +1 -0
  269. package/dist/esm/utils/mapPosition.d.ts +9 -0
  270. package/dist/esm/utils/mapPosition.d.ts.map +1 -0
  271. package/dist/esm/utils/mapPosition.js +34 -0
  272. package/dist/esm/utils/mapPosition.js.map +1 -0
  273. package/dist/esm/utils/ohlcvInterval.d.ts +3 -0
  274. package/dist/esm/utils/ohlcvInterval.d.ts.map +1 -0
  275. package/dist/esm/utils/ohlcvInterval.js +30 -0
  276. package/dist/esm/utils/ohlcvInterval.js.map +1 -0
  277. package/dist/esm/utils/orderFormatting.d.ts +29 -0
  278. package/dist/esm/utils/orderFormatting.d.ts.map +1 -0
  279. package/dist/esm/utils/orderFormatting.js +41 -0
  280. package/dist/esm/utils/orderFormatting.js.map +1 -0
  281. package/dist/esm/utils/time.d.ts +5 -0
  282. package/dist/esm/utils/time.d.ts.map +1 -0
  283. package/dist/esm/utils/time.js +5 -0
  284. package/dist/esm/utils/time.js.map +1 -0
  285. package/dist/esm/utils/wireEncoding.d.ts +72 -0
  286. package/dist/esm/utils/wireEncoding.d.ts.map +1 -0
  287. package/dist/esm/utils/wireEncoding.js +129 -0
  288. package/dist/esm/utils/wireEncoding.js.map +1 -0
  289. package/dist/esm/websocket/LighterWsProvider.d.ts +97 -0
  290. package/dist/esm/websocket/LighterWsProvider.d.ts.map +1 -0
  291. package/dist/esm/websocket/LighterWsProvider.js +489 -0
  292. package/dist/esm/websocket/LighterWsProvider.js.map +1 -0
  293. package/dist/types/LighterProvider.d.ts +105 -0
  294. package/dist/types/LighterProvider.d.ts.map +1 -0
  295. package/dist/types/accountConfig.d.ts +14 -0
  296. package/dist/types/accountConfig.d.ts.map +1 -0
  297. package/dist/types/accountSummary.d.ts +12 -0
  298. package/dist/types/accountSummary.d.ts.map +1 -0
  299. package/dist/types/constants.d.ts +74 -0
  300. package/dist/types/constants.d.ts.map +1 -0
  301. package/dist/types/index.d.ts +22 -0
  302. package/dist/types/index.d.ts.map +1 -0
  303. package/dist/types/signers/LighterKeyStore.d.ts +24 -0
  304. package/dist/types/signers/LighterKeyStore.d.ts.map +1 -0
  305. package/dist/types/signers/LighterReadOnlyTokenManager.d.ts +157 -0
  306. package/dist/types/signers/LighterReadOnlyTokenManager.d.ts.map +1 -0
  307. package/dist/types/signers/LighterSigner.d.ts +94 -0
  308. package/dist/types/signers/LighterSigner.d.ts.map +1 -0
  309. package/dist/types/signers/createAuthToken.d.ts +36 -0
  310. package/dist/types/signers/createAuthToken.d.ts.map +1 -0
  311. package/dist/types/signers/index.d.ts +11 -0
  312. package/dist/types/signers/index.d.ts.map +1 -0
  313. package/dist/types/signers/signActions.d.ts +54 -0
  314. package/dist/types/signers/signActions.d.ts.map +1 -0
  315. package/dist/types/signers/wasmLoader.d.ts +79 -0
  316. package/dist/types/signers/wasmLoader.d.ts.map +1 -0
  317. package/dist/types/types/account.d.ts +113 -0
  318. package/dist/types/types/account.d.ts.map +1 -0
  319. package/dist/types/types/action.d.ts +146 -0
  320. package/dist/types/types/action.d.ts.map +1 -0
  321. package/dist/types/types/activity.d.ts +83 -0
  322. package/dist/types/types/activity.d.ts.map +1 -0
  323. package/dist/types/types/asset.d.ts +134 -0
  324. package/dist/types/types/asset.d.ts.map +1 -0
  325. package/dist/types/types/fill.d.ts +31 -0
  326. package/dist/types/types/fill.d.ts.map +1 -0
  327. package/dist/types/types/index.d.ts +9 -0
  328. package/dist/types/types/index.d.ts.map +1 -0
  329. package/dist/types/types/order.d.ts +61 -0
  330. package/dist/types/types/order.d.ts.map +1 -0
  331. package/dist/types/types/submit.d.ts +76 -0
  332. package/dist/types/types/submit.d.ts.map +1 -0
  333. package/dist/types/types/ws.d.ts +124 -0
  334. package/dist/types/types/ws.d.ts.map +1 -0
  335. package/dist/types/utils/activityCursor.d.ts +51 -0
  336. package/dist/types/utils/activityCursor.d.ts.map +1 -0
  337. package/dist/types/utils/apiClient.d.ts +65 -0
  338. package/dist/types/utils/apiClient.d.ts.map +1 -0
  339. package/dist/types/utils/fetchDetailedAccount.d.ts +11 -0
  340. package/dist/types/utils/fetchDetailedAccount.d.ts.map +1 -0
  341. package/dist/types/utils/index.d.ts +16 -0
  342. package/dist/types/utils/index.d.ts.map +1 -0
  343. package/dist/types/utils/lighterAsset.d.ts +4 -0
  344. package/dist/types/utils/lighterAsset.d.ts.map +1 -0
  345. package/dist/types/utils/liquidation.d.ts +22 -0
  346. package/dist/types/utils/liquidation.d.ts.map +1 -0
  347. package/dist/types/utils/mapFill.d.ts +10 -0
  348. package/dist/types/utils/mapFill.d.ts.map +1 -0
  349. package/dist/types/utils/mapOpenPositions.d.ts +11 -0
  350. package/dist/types/utils/mapOpenPositions.d.ts.map +1 -0
  351. package/dist/types/utils/mapOrder.d.ts +72 -0
  352. package/dist/types/utils/mapOrder.d.ts.map +1 -0
  353. package/dist/types/utils/mapPosition.d.ts +9 -0
  354. package/dist/types/utils/mapPosition.d.ts.map +1 -0
  355. package/dist/types/utils/ohlcvInterval.d.ts +3 -0
  356. package/dist/types/utils/ohlcvInterval.d.ts.map +1 -0
  357. package/dist/types/utils/orderFormatting.d.ts +29 -0
  358. package/dist/types/utils/orderFormatting.d.ts.map +1 -0
  359. package/dist/types/utils/time.d.ts +5 -0
  360. package/dist/types/utils/time.d.ts.map +1 -0
  361. package/dist/types/utils/wireEncoding.d.ts +72 -0
  362. package/dist/types/utils/wireEncoding.d.ts.map +1 -0
  363. package/dist/types/websocket/LighterWsProvider.d.ts +97 -0
  364. package/dist/types/websocket/LighterWsProvider.d.ts.map +1 -0
  365. package/dist/wasm/lighter-signer.wasm +0 -0
  366. package/dist/wasm/wasm_exec.js +575 -0
  367. package/package.json +67 -0
  368. package/src/LighterProvider.ts +1167 -0
  369. package/src/accountConfig.ts +162 -0
  370. package/src/accountSummary.ts +22 -0
  371. package/src/constants.ts +89 -0
  372. package/src/index.ts +37 -0
  373. package/src/signers/LighterKeyStore.ts +79 -0
  374. package/src/signers/LighterReadOnlyTokenManager.ts +340 -0
  375. package/src/signers/LighterSigner.ts +400 -0
  376. package/src/signers/createAuthToken.ts +69 -0
  377. package/src/signers/index.ts +36 -0
  378. package/src/signers/signActions.ts +311 -0
  379. package/src/signers/wasmLoader.ts +293 -0
  380. package/src/types/account.ts +123 -0
  381. package/src/types/action.ts +163 -0
  382. package/src/types/activity.ts +94 -0
  383. package/src/types/asset.ts +146 -0
  384. package/src/types/fill.ts +42 -0
  385. package/src/types/index.ts +12 -0
  386. package/src/types/order.ts +65 -0
  387. package/src/types/submit.ts +83 -0
  388. package/src/types/ws.ts +136 -0
  389. package/src/utils/activityCursor.ts +150 -0
  390. package/src/utils/apiClient.ts +185 -0
  391. package/src/utils/fetchDetailedAccount.ts +46 -0
  392. package/src/utils/index.ts +38 -0
  393. package/src/utils/lighterAsset.ts +10 -0
  394. package/src/utils/liquidation.ts +39 -0
  395. package/src/utils/mapFill.ts +108 -0
  396. package/src/utils/mapOpenPositions.ts +18 -0
  397. package/src/utils/mapOrder.ts +258 -0
  398. package/src/utils/mapPosition.ts +42 -0
  399. package/src/utils/ohlcvInterval.ts +34 -0
  400. package/src/utils/orderFormatting.ts +46 -0
  401. package/src/utils/time.ts +6 -0
  402. package/src/utils/wireEncoding.ts +179 -0
  403. package/src/websocket/LighterWsProvider.ts +725 -0
  404. package/wasm/lighter-signer.wasm +0 -0
  405. package/wasm/wasm_exec.js +575 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright LI.FI
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,176 @@
1
+ # `@lifi/perps-sdk-provider-lighter`
2
+
3
+ Lighter provider plugin for [`@lifi/perps-sdk`](../../README.md). Registers a `PerpsProviderPlugin` that routes Lighter reads directly to the Lighter REST API (no LI.FI backend hop per read), and handles all Lighter signing via a bundled Go WASM signer.
4
+
5
+ > **`marketId` is numeric.** Lighter's `Market.id` is a numeric string (`"0"`, `"1"`, …). Never pass a display string such as `"LIT/USDC"` where a `marketId` is expected — it will silently produce `NaN` and requests will fail.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add @lifi/perps-sdk @lifi/perps-sdk-provider-lighter
11
+ # or
12
+ npm install @lifi/perps-sdk @lifi/perps-sdk-provider-lighter
13
+ ```
14
+
15
+ ## Registration
16
+
17
+ ```ts
18
+ import { createPerpsClient, localStorageAdapter } from '@lifi/perps-sdk'
19
+ import {
20
+ LighterKeyStore,
21
+ LighterSigner,
22
+ lighterProvider,
23
+ } from '@lifi/perps-sdk-provider-lighter'
24
+
25
+ const client = createPerpsClient({
26
+ integrator: 'my-app',
27
+ apiKey: 'your-lifi-api-key',
28
+ providers: [
29
+ lighterProvider({
30
+ signer: new LighterSigner(),
31
+ keyStore: new LighterKeyStore(localStorageAdapter),
32
+ readOnlyTokenOptions: { storage: localStorageAdapter },
33
+ }),
34
+ ],
35
+ })
36
+ ```
37
+
38
+ ### Loading WASM in a Vite/browser project
39
+
40
+ The `LighterSigner` bundles `lighter-signer.wasm` and `wasm_exec.js` alongside its `dist/`. In a Vite project you must import these assets so Vite serves them correctly — otherwise the IIFE that installs `globalThis.Go` may be transformed and break:
41
+
42
+ ```ts
43
+ import lighterWasmUrl from '@lifi/perps-sdk-provider-lighter/wasm/lighter-signer.wasm?url'
44
+ import lighterWasmExecSource from '@lifi/perps-sdk-provider-lighter/wasm/wasm_exec.js?raw'
45
+
46
+ const signer = new LighterSigner({
47
+ wasmBinaryUrl: lighterWasmUrl,
48
+ wasmExecJsSource: lighterWasmExecSource,
49
+ })
50
+ ```
51
+
52
+ In Node.js the default asset paths resolve correctly from `dist/` without any overrides.
53
+
54
+ ## Token model
55
+
56
+ Lighter uses two distinct bearer tokens for different purposes. Both flow through `LighterProviderOptions` and are managed automatically once `signer` and `keyStore` are configured.
57
+
58
+ ### Standard auth token
59
+
60
+ - **Created by:** the WASM signer (`LighterSigner.createAuthToken`), signed with the user's registered Lighter API key — no wallet popup.
61
+ - **Lifetime:** up to 8 hours (Lighter's hard cap). The SDK defaults to 1-hour tokens and re-creates one when the remaining life falls below 60 seconds.
62
+ - **Used for:** authenticated writes (via `signActions`) and as the credential that authorises read-only token creation on first use.
63
+
64
+ ### Read-only token
65
+
66
+ - **Created at:** first authenticated read after setup, via Lighter's `POST /api/v1/tokens/create`, authorised by a standard auth token.
67
+ - **Lifetime:** up to 10 years (Lighter's maximum). The SDK requests this maximum so the token covers the account's lifetime. One warning: `LighterReadOnlyTokenManager.isReadOnlyTokenExpiringSoon` can alert the consumer when fewer than 30 days remain.
68
+ - **Used for:** all authenticated reads (`getOrders`, `getOrder`, `getActivity`, `getAccount` fee tier, etc.) that go directly to the Lighter API — no LI.FI backend hop.
69
+ - **Scope:** `all` (reads across all sub-accounts of the owner).
70
+ - **Stored by:** `LighterReadOnlyTokenManager`, keyed on `(l1Address, accountIndex)`, using the `StorageAdapter` passed in `readOnlyTokenOptions.storage`.
71
+
72
+ Per-user reads go **direct to the Lighter API** (not through the LI.FI backend). The backend is involved only in the create/execute action pipeline for writes.
73
+
74
+ ### Token resolution order for authenticated reads
75
+
76
+ When a read requires authentication the provider tries these sources in order and uses the first that produces a token:
77
+
78
+ 1. Per-call `options.lighterAuthToken`
79
+ 2. Constructor `authToken` string or factory
80
+ 3. Stored read-only token (from `LighterReadOnlyTokenManager`)
81
+ 4. Freshly created read-only token (authorised by a standard token created from the registered API key)
82
+ 5. Standard auth token (fallback if read-only token creation fails)
83
+
84
+ When no source produces a token, `getOrders` and `getActivity` return empty results, `getOrder` throws `Unauthorized`, and `getAccount` returns a zero fee tier.
85
+
86
+ ## One-time setup flow
87
+
88
+ Before trading, the user's Ethereum address must be registered on Lighter's L2 with a Lighter-native API keypair. The `PerpsClient.checkSetup` / `PerpsClient.executeSetup` flow handles this. The Lighter-specific steps are:
89
+
90
+ 1. **`REGISTER_API_KEY`** — the WASM signer generates a fresh Lighter keypair (`GenerateAPIKey`), produces a `ChangePubKey` transaction blob, and requests an EIP-191 `signMessage` from the user's L1 wallet (one wallet popup, first time only). The L1 signature is embedded into the blob and submitted. The keypair is then persisted in `LighterKeyStore`.
91
+
92
+ 2. Subsequent write operations (place order, cancel, modify, withdraw, etc.) are signed with the stored API key via the WASM signer — no further wallet popups.
93
+
94
+ For the generic `checkSetup → executeSetup` lifecycle, see the [root README](../../README.md).
95
+
96
+ ```mermaid
97
+ sequenceDiagram
98
+ participant App
99
+ participant PC as PerpsClient
100
+ participant KS as LighterKeyStore
101
+ participant WS as WASM signer
102
+ participant BE as LI.FI backend
103
+ participant LX as Lighter API
104
+
105
+ Note over App,LX: one-time setup
106
+ App->>PC: executeSetup (REGISTER_API_KEY)
107
+ PC->>WS: generateAPIKey → keypair
108
+ PC->>WS: signChangePubKey → blob + EIP-191 message
109
+ PC->>App: wallet.signMessage (one popup)
110
+ PC->>BE: executeAction (blob + L1 sig)
111
+ BE->>LX: sendTx (ChangePubKey)
112
+ PC->>KS: persist API keypair
113
+
114
+ Note over App,LX: steady state — place order
115
+ App->>PC: placeOrder(...)
116
+ PC->>BE: createAction
117
+ BE-->>PC: WasmBlobActionStep
118
+ PC->>WS: sign with API key (no popup)
119
+ PC->>BE: executeAction (signed blob)
120
+
121
+ Note over App,LX: steady state — read positions
122
+ App->>PC: getPositions(...)
123
+ PC->>LX: GET /api/v1/account (read-only token)
124
+ LX-->>PC: positions data
125
+ ```
126
+
127
+ ## WASM signer
128
+
129
+ The package bundles two assets under `wasm/`:
130
+
131
+ - `lighter-signer.wasm` — the Go WASM binary that signs Lighter transactions and creates auth tokens.
132
+ - `wasm_exec.js` — Go's runtime shim that installs the `globalThis.Go` class and registers polyfills.
133
+
134
+ The WASM provides: key generation (`GenerateAPIKey`), API-key client registration (`CreateClient`), auth-token creation (`CreateAuthToken`), and all transaction signing operations (`SignCreateOrder`, `SignCancelOrder`, `SignModifyOrder`, `SignWithdraw`, `SignTransfer`, `SignUpdateLeverage`, `SignUpdateMargin`, `SignChangePubKey`).
135
+
136
+ `loadLighterWasm` is memoized per process — the Go runtime starts a long-running goroutine on first load and is never stopped.
137
+
138
+ `LighterSigner` calls `loadLighterWasm` automatically on first use; you do not need to call `initialize()` explicitly.
139
+
140
+ ## Storage
141
+
142
+ `LighterKeyStore` persists the user's Lighter API keypair (private key, public key, `accountIndex`, `apiKeyIndex`) under the key `lifi-perps-lighter-key:<address>`.
143
+
144
+ `LighterReadOnlyTokenManager` persists the read-only token under `lifi:perps:lighter:rotoken:<address>:<accountIndex>`.
145
+
146
+ Both accept any `StorageAdapter` — an interface from `@lifi/perps-sdk` with `get`, `set`, and `remove` methods. The SDK ships `localStorageAdapter` for browsers. Pass a custom adapter for server-side or React Native environments.
147
+
148
+ **Recovery when storage is lost:** re-run `executeSetup`. For `REGISTER_API_KEY` specifically — the backend checks whether the public key you hold matches the one registered on-chain. If storage was wiped but the on-chain slot matches a freshly generated key, setup re-completes transparently. No funds are at risk; the API keypair authorises signing only, not asset custody.
149
+
150
+ ## Multi-account
151
+
152
+ Lighter uses a numeric `accountIndex` (looked up once from the user's L1 Ethereum address via Lighter's REST) and an `apiKeyIndex` for the API key slot. The SDK uses `accountIndex` 0-based (the primary account) and defaults to `apiKeyIndex` 42 (`DEFAULT_API_KEY_INDEX`), chosen to avoid colliding with Lighter's reserved desktop/mobile slots (0–3).
153
+
154
+ The SDK exposes `accountIndex` and `apiKeyIndex` as fields on `LighterApiKey` (what `LighterKeyStore` stores) and on `LighterAccountConfig` (what `getAccount` returns under `AccountResponse.config`). Sub-account switching is not directly supported beyond this — the SDK operates on the primary account for a given L1 address.
155
+
156
+ ## Exported surface
157
+
158
+ The main exports from `@lifi/perps-sdk-provider-lighter`:
159
+
160
+ | Export | Kind | Purpose |
161
+ |---|---|---|
162
+ | `lighterProvider` / `Lighter` | factory | Creates the `LighterPerpsProvider` plugin for `createPerpsClient` |
163
+ | `LighterSigner` | class | WASM-backed signer for key generation, signing, and auth-token creation |
164
+ | `LighterKeyStore` | class | Persists the user's Lighter API keypair |
165
+ | `LighterReadOnlyTokenManager` | class | Creates and persists the long-lived read-only bearer token |
166
+ | `createAuthToken` | function | Creates a fresh standard auth token from an API key + signer |
167
+ | `isReadOnlyTokenExpiringSoon` | function | Returns `true` when the stored read-only token expires within a threshold |
168
+ | `loadLighterWasm` | function | Loads the WASM binary (memoized) |
169
+ | `LighterWsProvider` / `lighterWsProvider` | class / factory | Realtime WebSocket provider (orderbook, prices, orders, fills, positions) |
170
+ | `LighterPerpsProvider` | interface | Extended `PerpsProviderPlugin` with `resolveAuthToken` — used by the WS layer |
171
+ | `LighterProviderOptions` | interface | Constructor options for `lighterProvider(...)` |
172
+ | `LighterApiKey` | interface | Shape stored by `LighterKeyStore` |
173
+ | `LighterReadOnlyToken` | interface | Shape stored by `LighterReadOnlyTokenManager` |
174
+ | `DEFAULT_API_KEY_INDEX` | constant | `42` — the LI.FI-assigned API key slot |
175
+ | `DEFAULT_LIGHTER_REST_URL` | constant | Lighter mainnet REST base URL |
176
+ | `LIGHTER_PROVIDER_KEY` | constant | `"lighter"` — the provider key used on `Market.categoryId` |
@@ -0,0 +1,20 @@
1
+ import { type PerpsProviderPlugin } from '@lifi/perps-sdk';
2
+ import type { Address } from 'viem';
3
+ import type { LighterKeyStore } from './signers/LighterKeyStore.js';
4
+ import type { LighterReadOnlyTokenManagerOptions } from './signers/LighterReadOnlyTokenManager.js';
5
+ import type { LighterSigner } from './signers/LighterSigner.js';
6
+ export interface LighterProviderOptions {
7
+ restUrl?: string;
8
+ authToken?: string | (() => string | Promise<string>);
9
+ signer?: LighterSigner;
10
+ keyStore?: LighterKeyStore;
11
+ readOnlyTokenOptions?: LighterReadOnlyTokenManagerOptions;
12
+ tokenLifetimeSeconds?: number;
13
+ tokenRenewBufferSeconds?: number;
14
+ }
15
+ export interface LighterPerpsProvider extends PerpsProviderPlugin {
16
+ resolveAuthToken(address: Address): Promise<string | undefined>;
17
+ }
18
+ export declare const lighterProvider: (options?: LighterProviderOptions) => LighterPerpsProvider;
19
+ export declare const Lighter: (options?: LighterProviderOptions) => LighterPerpsProvider;
20
+ //# sourceMappingURL=LighterProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LighterProvider.d.ts","sourceRoot":"","sources":["../../src/LighterProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,mBAAmB,EAazB,MAAM,iBAAiB,CAAA;AAsBxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAcnC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,0CAA0C,CAAA;AAElG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAoG/D,MAAM,WAAW,sBAAsB;IAErC,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB,SAAS,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAMrD,MAAM,CAAC,EAAE,aAAa,CAAA;IAKtB,QAAQ,CAAC,EAAE,eAAe,CAAA;IAQ1B,oBAAoB,CAAC,EAAE,kCAAkC,CAAA;IAEzD,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAE7B,uBAAuB,CAAC,EAAE,MAAM,CAAA;CACjC;AAiBD,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAO/D,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;CAChE;AAuBD,eAAO,MAAM,eAAe,GAC1B,UAAS,sBAA2B,KACnC,oBA25BF,CAAA;AAOD,eAAO,MAAM,OAAO,aAn6BT,sBAAsB,KAC9B,oBAk6BmC,CAAA"}