lynx-client 0.0.1-beta.9 → 0.0.2

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 (326) hide show
  1. package/README.md +392 -3
  2. package/dist/cjs/index.js +8 -0
  3. package/dist/cjs/lib/chains/chainMappings.js +17 -0
  4. package/dist/cjs/lib/constants/contractEnums.js +1 -0
  5. package/dist/cjs/lib/contractsIntegration/IntentsVerifierLensService/IIntentsVerifierLensService.js +15 -0
  6. package/dist/cjs/lib/contractsIntegration/IntentsVerifierLensService/IntentsVerifierLensService.js +42 -0
  7. package/dist/cjs/lib/contractsIntegration/IntentsVerifierLensService/index.js +18 -0
  8. package/dist/cjs/lib/contractsIntegration/LexLensService/ILexLensService.js +137 -0
  9. package/dist/cjs/lib/contractsIntegration/LexLensService/LexLensService.js +250 -0
  10. package/dist/cjs/lib/contractsIntegration/LexLensService/index.js +18 -0
  11. package/dist/cjs/lib/contractsIntegration/OrderBookService/IOrderBookService.js +2 -0
  12. package/dist/cjs/lib/contractsIntegration/OrderBookService/OrderBookService.js +92 -0
  13. package/dist/cjs/lib/contractsIntegration/TradersPortalService/ITradersPortalService.js +2 -0
  14. package/dist/cjs/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.js +157 -0
  15. package/dist/cjs/lib/contractsIntegration/TradersPortalService/TradersPortalUtils.js +64 -0
  16. package/dist/cjs/lib/contractsIntegration/TradersPortalService/index.js +19 -0
  17. package/dist/cjs/lib/contractsIntegration/TradingFloorLensService/ITradingFloorLensService.js +61 -0
  18. package/dist/cjs/lib/contractsIntegration/TradingFloorLensService/TradingFloorLensService.js +147 -0
  19. package/dist/cjs/lib/contractsIntegration/TradingFloorLensService/index.js +18 -0
  20. package/dist/cjs/lib/contractsIntegration/TradingFloorService/ITradingFloorService.js +2 -0
  21. package/dist/cjs/lib/contractsIntegration/TradingFloorService/TradingFloorService.js +158 -0
  22. package/dist/cjs/lib/contractsIntegration/TriggersAndPortalLensService/ITriggersAndPortalLensService.js +30 -0
  23. package/dist/cjs/lib/contractsIntegration/TriggersAndPortalLensService/TriggersAndPortalLensService.js +58 -0
  24. package/dist/cjs/lib/contractsIntegration/TriggersAndPortalLensService/index.js +18 -0
  25. package/dist/cjs/lib/contractsIntegration/TriggersService/ITriggersService.js +2 -0
  26. package/dist/cjs/lib/contractsIntegration/TriggersService/TriggersService.js +188 -0
  27. package/dist/cjs/lib/contractsIntegration/deployedContractsConnector.js +119 -8
  28. package/dist/cjs/lib/devex/getChainAddresses.js +65 -0
  29. package/dist/cjs/lib/devex/getSupportedEngineChains.js +45 -0
  30. package/dist/cjs/lib/devex/index.js +9 -0
  31. package/dist/cjs/lib/devex/types.js +2 -0
  32. package/dist/cjs/lib/lynxSystem/hashes.js +9 -0
  33. package/dist/cjs/lib/lynxSystem/lynxScalesUtils.js +8 -0
  34. package/dist/cjs/lib/lynxSystem/registry/registryReading.js +38 -0
  35. package/dist/cjs/lib/priceFeeds/pyth/pythFeedConstants.js +1 -2
  36. package/dist/cjs/lib/typechain/contracts/Lynx/OrderBook/OrderBookProxy.js +2 -0
  37. package/dist/cjs/lib/typechain/contracts/Lynx/OrderBook/OrderBookV1.js +2 -0
  38. package/dist/cjs/lib/typechain/contracts/Lynx/Registry/RegistryProxy.js +2 -0
  39. package/dist/cjs/lib/typechain/contracts/Lynx/Registry/RegistryV1.js +2 -0
  40. package/dist/cjs/lib/typechain/contracts/Lynx/TradersPortal/TradersPortalV1.js +2 -0
  41. package/dist/cjs/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorProxy.js +2 -0
  42. package/dist/cjs/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorV1.js +2 -0
  43. package/dist/cjs/lib/typechain/contracts/Lynx/Triggers/TriggersV1.js +2 -0
  44. package/dist/cjs/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookProxy__factory.js +258 -0
  45. package/dist/cjs/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.js +539 -0
  46. package/dist/cjs/lib/typechain/factories/contracts/Lynx/Registry/RegistryProxy__factory.js +226 -0
  47. package/dist/cjs/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.js +1108 -0
  48. package/dist/cjs/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.js +966 -0
  49. package/dist/cjs/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorProxy__factory.js +258 -0
  50. package/dist/cjs/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.js +1774 -0
  51. package/dist/cjs/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.js +1459 -0
  52. package/dist/cjs/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.js +1 -1
  53. package/dist/cjs/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.js +1 -1
  54. package/dist/cjs/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.js +1 -1
  55. package/dist/cjs/lib/utils/ethersTypes.js +29 -6
  56. package/dist/esm/index.d.ts +7 -0
  57. package/dist/esm/index.d.ts.map +1 -1
  58. package/dist/esm/index.js +8 -0
  59. package/dist/esm/lib/chains/chainMappings.d.ts +13 -0
  60. package/dist/esm/lib/chains/chainMappings.d.ts.map +1 -0
  61. package/dist/esm/lib/chains/chainMappings.js +17 -0
  62. package/dist/esm/lib/chains/chainTypes.d.ts +3 -0
  63. package/dist/esm/lib/chains/chainTypes.d.ts.map +1 -1
  64. package/dist/esm/lib/constants/contractEnums.d.ts.map +1 -1
  65. package/dist/esm/lib/constants/contractEnums.js +1 -0
  66. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/IIntentsVerifierLensService.d.ts +20 -0
  67. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/IIntentsVerifierLensService.d.ts.map +1 -0
  68. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/IIntentsVerifierLensService.js +15 -0
  69. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/IntentsVerifierLensService.d.ts +11 -0
  70. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/IntentsVerifierLensService.d.ts.map +1 -0
  71. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/IntentsVerifierLensService.js +42 -0
  72. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/index.d.ts +3 -0
  73. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/index.d.ts.map +1 -0
  74. package/dist/esm/lib/contractsIntegration/IntentsVerifierLensService/index.js +18 -0
  75. package/dist/esm/lib/contractsIntegration/LexLensService/ILexLensService.d.ts +85 -0
  76. package/dist/esm/lib/contractsIntegration/LexLensService/ILexLensService.d.ts.map +1 -0
  77. package/dist/esm/lib/contractsIntegration/LexLensService/ILexLensService.js +137 -0
  78. package/dist/esm/lib/contractsIntegration/LexLensService/LexLensService.d.ts +34 -0
  79. package/dist/esm/lib/contractsIntegration/LexLensService/LexLensService.d.ts.map +1 -0
  80. package/dist/esm/lib/contractsIntegration/LexLensService/LexLensService.js +250 -0
  81. package/dist/esm/lib/contractsIntegration/LexLensService/index.d.ts +3 -0
  82. package/dist/esm/lib/contractsIntegration/LexLensService/index.d.ts.map +1 -0
  83. package/dist/esm/lib/contractsIntegration/LexLensService/index.js +18 -0
  84. package/dist/esm/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts +40 -0
  85. package/dist/esm/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts.map +1 -0
  86. package/dist/esm/lib/contractsIntegration/OrderBookService/IOrderBookService.js +2 -0
  87. package/dist/esm/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts +12 -0
  88. package/dist/esm/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts.map +1 -0
  89. package/dist/esm/lib/contractsIntegration/OrderBookService/OrderBookService.js +92 -0
  90. package/dist/esm/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts +61 -0
  91. package/dist/esm/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts.map +1 -0
  92. package/dist/esm/lib/contractsIntegration/TradersPortalService/ITradersPortalService.js +2 -0
  93. package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts +14 -0
  94. package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts.map +1 -0
  95. package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.js +157 -0
  96. package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalUtils.d.ts +32 -0
  97. package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalUtils.d.ts.map +1 -0
  98. package/dist/esm/lib/contractsIntegration/TradersPortalService/TradersPortalUtils.js +64 -0
  99. package/dist/esm/lib/contractsIntegration/TradersPortalService/index.d.ts +4 -0
  100. package/dist/esm/lib/contractsIntegration/TradersPortalService/index.d.ts.map +1 -0
  101. package/dist/esm/lib/contractsIntegration/TradersPortalService/index.js +19 -0
  102. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/ITradingFloorLensService.d.ts +76 -0
  103. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/ITradingFloorLensService.d.ts.map +1 -0
  104. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/ITradingFloorLensService.js +61 -0
  105. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/TradingFloorLensService.d.ts +16 -0
  106. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/TradingFloorLensService.d.ts.map +1 -0
  107. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/TradingFloorLensService.js +147 -0
  108. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/index.d.ts +3 -0
  109. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/index.d.ts.map +1 -0
  110. package/dist/esm/lib/contractsIntegration/TradingFloorLensService/index.js +18 -0
  111. package/dist/esm/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts +83 -0
  112. package/dist/esm/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts.map +1 -0
  113. package/dist/esm/lib/contractsIntegration/TradingFloorService/ITradingFloorService.js +2 -0
  114. package/dist/esm/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts +80 -0
  115. package/dist/esm/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts.map +1 -0
  116. package/dist/esm/lib/contractsIntegration/TradingFloorService/TradingFloorService.js +158 -0
  117. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/ITriggersAndPortalLensService.d.ts +33 -0
  118. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/ITriggersAndPortalLensService.d.ts.map +1 -0
  119. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/ITriggersAndPortalLensService.js +30 -0
  120. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/TriggersAndPortalLensService.d.ts +11 -0
  121. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/TriggersAndPortalLensService.d.ts.map +1 -0
  122. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/TriggersAndPortalLensService.js +58 -0
  123. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/index.d.ts +3 -0
  124. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/index.d.ts.map +1 -0
  125. package/dist/esm/lib/contractsIntegration/TriggersAndPortalLensService/index.js +18 -0
  126. package/dist/esm/lib/contractsIntegration/TriggersService/ITriggersService.d.ts +73 -0
  127. package/dist/esm/lib/contractsIntegration/TriggersService/ITriggersService.d.ts.map +1 -0
  128. package/dist/esm/lib/contractsIntegration/TriggersService/ITriggersService.js +2 -0
  129. package/dist/esm/lib/contractsIntegration/TriggersService/TriggersService.d.ts +18 -0
  130. package/dist/esm/lib/contractsIntegration/TriggersService/TriggersService.d.ts.map +1 -0
  131. package/dist/esm/lib/contractsIntegration/TriggersService/TriggersService.js +188 -0
  132. package/dist/esm/lib/contractsIntegration/deployedContractsConnector.d.ts +44 -5
  133. package/dist/esm/lib/contractsIntegration/deployedContractsConnector.d.ts.map +1 -1
  134. package/dist/esm/lib/contractsIntegration/deployedContractsConnector.js +119 -8
  135. package/dist/esm/lib/devex/getChainAddresses.d.ts +20 -0
  136. package/dist/esm/lib/devex/getChainAddresses.d.ts.map +1 -0
  137. package/dist/esm/lib/devex/getChainAddresses.js +65 -0
  138. package/dist/esm/lib/devex/getSupportedEngineChains.d.ts +37 -0
  139. package/dist/esm/lib/devex/getSupportedEngineChains.d.ts.map +1 -0
  140. package/dist/esm/lib/devex/getSupportedEngineChains.js +45 -0
  141. package/dist/esm/lib/devex/index.d.ts +5 -0
  142. package/dist/esm/lib/devex/index.d.ts.map +1 -0
  143. package/dist/esm/lib/devex/index.js +9 -0
  144. package/dist/esm/lib/devex/types.d.ts +20 -0
  145. package/dist/esm/lib/devex/types.d.ts.map +1 -0
  146. package/dist/esm/lib/devex/types.js +2 -0
  147. package/dist/esm/lib/lynxSystem/hashes.d.ts +6 -0
  148. package/dist/esm/lib/lynxSystem/hashes.d.ts.map +1 -1
  149. package/dist/esm/lib/lynxSystem/hashes.js +9 -0
  150. package/dist/esm/lib/lynxSystem/lynxScalesUtils.d.ts +2 -0
  151. package/dist/esm/lib/lynxSystem/lynxScalesUtils.d.ts.map +1 -1
  152. package/dist/esm/lib/lynxSystem/lynxScalesUtils.js +8 -0
  153. package/dist/esm/lib/lynxSystem/registry/registryReading.d.ts +9 -0
  154. package/dist/esm/lib/lynxSystem/registry/registryReading.d.ts.map +1 -0
  155. package/dist/esm/lib/lynxSystem/registry/registryReading.js +38 -0
  156. package/dist/esm/lib/priceFeeds/pyth/pythFeedConstants.d.ts.map +1 -1
  157. package/dist/esm/lib/priceFeeds/pyth/pythFeedConstants.js +1 -2
  158. package/dist/esm/lib/typechain/common.d.ts.map +1 -1
  159. package/dist/esm/lib/typechain/contracts/Lynx/OrderBook/OrderBookProxy.d.ts +151 -0
  160. package/dist/esm/lib/typechain/contracts/Lynx/OrderBook/OrderBookProxy.d.ts.map +1 -0
  161. package/dist/esm/lib/typechain/contracts/Lynx/OrderBook/OrderBookProxy.js +2 -0
  162. package/dist/esm/lib/typechain/contracts/Lynx/OrderBook/OrderBookV1.d.ts +268 -0
  163. package/dist/esm/lib/typechain/contracts/Lynx/OrderBook/OrderBookV1.d.ts.map +1 -0
  164. package/dist/esm/lib/typechain/contracts/Lynx/OrderBook/OrderBookV1.js +2 -0
  165. package/dist/esm/lib/typechain/contracts/Lynx/Registry/RegistryProxy.d.ts +143 -0
  166. package/dist/esm/lib/typechain/contracts/Lynx/Registry/RegistryProxy.d.ts.map +1 -0
  167. package/dist/esm/lib/typechain/contracts/Lynx/Registry/RegistryProxy.js +2 -0
  168. package/dist/esm/lib/typechain/contracts/Lynx/Registry/RegistryV1.d.ts +603 -0
  169. package/dist/esm/lib/typechain/contracts/Lynx/Registry/RegistryV1.d.ts.map +1 -0
  170. package/dist/esm/lib/typechain/contracts/Lynx/Registry/RegistryV1.js +2 -0
  171. package/dist/esm/lib/typechain/contracts/Lynx/TradersPortal/TradersPortalV1.d.ts +571 -0
  172. package/dist/esm/lib/typechain/contracts/Lynx/TradersPortal/TradersPortalV1.d.ts.map +1 -0
  173. package/dist/esm/lib/typechain/contracts/Lynx/TradersPortal/TradersPortalV1.js +2 -0
  174. package/dist/esm/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorProxy.d.ts +151 -0
  175. package/dist/esm/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorProxy.d.ts.map +1 -0
  176. package/dist/esm/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorProxy.js +2 -0
  177. package/dist/esm/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorV1.d.ts +1160 -0
  178. package/dist/esm/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorV1.d.ts.map +1 -0
  179. package/dist/esm/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorV1.js +2 -0
  180. package/dist/esm/lib/typechain/contracts/Lynx/Triggers/TriggersV1.d.ts +977 -0
  181. package/dist/esm/lib/typechain/contracts/Lynx/Triggers/TriggersV1.d.ts.map +1 -0
  182. package/dist/esm/lib/typechain/contracts/Lynx/Triggers/TriggersV1.js +2 -0
  183. package/dist/esm/lib/typechain/contracts/Peripheral/Lens/TradingFloorLens.d.ts +1 -3
  184. package/dist/esm/lib/typechain/contracts/Peripheral/Lens/TradingFloorLens.d.ts.map +1 -1
  185. package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookProxy__factory.d.ts +193 -0
  186. package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookProxy__factory.d.ts.map +1 -0
  187. package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookProxy__factory.js +258 -0
  188. package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.d.ts +407 -0
  189. package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.d.ts.map +1 -0
  190. package/dist/esm/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.js +539 -0
  191. package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryProxy__factory.d.ts +169 -0
  192. package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryProxy__factory.d.ts.map +1 -0
  193. package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryProxy__factory.js +226 -0
  194. package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.d.ts +841 -0
  195. package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.d.ts.map +1 -0
  196. package/dist/esm/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.js +1108 -0
  197. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.d.ts +745 -0
  198. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.d.ts.map +1 -0
  199. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.js +966 -0
  200. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorProxy__factory.d.ts +193 -0
  201. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorProxy__factory.d.ts.map +1 -0
  202. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorProxy__factory.js +258 -0
  203. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts +1374 -0
  204. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts.map +1 -0
  205. package/dist/esm/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.js +1774 -0
  206. package/dist/esm/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.d.ts +1135 -0
  207. package/dist/esm/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.d.ts.map +1 -0
  208. package/dist/esm/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.js +1459 -0
  209. package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.d.ts +1 -1
  210. package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.js +1 -1
  211. package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.d.ts +1 -1
  212. package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.js +1 -1
  213. package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.d.ts +1 -1
  214. package/dist/esm/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.js +1 -1
  215. package/dist/esm/lib/utils/ethersTypes.d.ts +2 -2
  216. package/dist/esm/lib/utils/ethersTypes.d.ts.map +1 -1
  217. package/dist/esm/lib/utils/ethersTypes.js +29 -6
  218. package/dist/types/index.d.ts +7 -0
  219. package/dist/types/index.d.ts.map +1 -1
  220. package/dist/types/lib/chains/chainMappings.d.ts +13 -0
  221. package/dist/types/lib/chains/chainMappings.d.ts.map +1 -0
  222. package/dist/types/lib/chains/chainTypes.d.ts +3 -0
  223. package/dist/types/lib/chains/chainTypes.d.ts.map +1 -1
  224. package/dist/types/lib/constants/contractEnums.d.ts.map +1 -1
  225. package/dist/types/lib/contractsIntegration/IntentsVerifierLensService/IIntentsVerifierLensService.d.ts +20 -0
  226. package/dist/types/lib/contractsIntegration/IntentsVerifierLensService/IIntentsVerifierLensService.d.ts.map +1 -0
  227. package/dist/types/lib/contractsIntegration/IntentsVerifierLensService/IntentsVerifierLensService.d.ts +11 -0
  228. package/dist/types/lib/contractsIntegration/IntentsVerifierLensService/IntentsVerifierLensService.d.ts.map +1 -0
  229. package/dist/types/lib/contractsIntegration/IntentsVerifierLensService/index.d.ts +3 -0
  230. package/dist/types/lib/contractsIntegration/IntentsVerifierLensService/index.d.ts.map +1 -0
  231. package/dist/types/lib/contractsIntegration/LexLensService/ILexLensService.d.ts +85 -0
  232. package/dist/types/lib/contractsIntegration/LexLensService/ILexLensService.d.ts.map +1 -0
  233. package/dist/types/lib/contractsIntegration/LexLensService/LexLensService.d.ts +34 -0
  234. package/dist/types/lib/contractsIntegration/LexLensService/LexLensService.d.ts.map +1 -0
  235. package/dist/types/lib/contractsIntegration/LexLensService/index.d.ts +3 -0
  236. package/dist/types/lib/contractsIntegration/LexLensService/index.d.ts.map +1 -0
  237. package/dist/types/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts +40 -0
  238. package/dist/types/lib/contractsIntegration/OrderBookService/IOrderBookService.d.ts.map +1 -0
  239. package/dist/types/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts +12 -0
  240. package/dist/types/lib/contractsIntegration/OrderBookService/OrderBookService.d.ts.map +1 -0
  241. package/dist/types/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts +61 -0
  242. package/dist/types/lib/contractsIntegration/TradersPortalService/ITradersPortalService.d.ts.map +1 -0
  243. package/dist/types/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts +14 -0
  244. package/dist/types/lib/contractsIntegration/TradersPortalService/TradersPortalServiceService.d.ts.map +1 -0
  245. package/dist/types/lib/contractsIntegration/TradersPortalService/TradersPortalUtils.d.ts +32 -0
  246. package/dist/types/lib/contractsIntegration/TradersPortalService/TradersPortalUtils.d.ts.map +1 -0
  247. package/dist/types/lib/contractsIntegration/TradersPortalService/index.d.ts +4 -0
  248. package/dist/types/lib/contractsIntegration/TradersPortalService/index.d.ts.map +1 -0
  249. package/dist/types/lib/contractsIntegration/TradingFloorLensService/ITradingFloorLensService.d.ts +76 -0
  250. package/dist/types/lib/contractsIntegration/TradingFloorLensService/ITradingFloorLensService.d.ts.map +1 -0
  251. package/dist/types/lib/contractsIntegration/TradingFloorLensService/TradingFloorLensService.d.ts +16 -0
  252. package/dist/types/lib/contractsIntegration/TradingFloorLensService/TradingFloorLensService.d.ts.map +1 -0
  253. package/dist/types/lib/contractsIntegration/TradingFloorLensService/index.d.ts +3 -0
  254. package/dist/types/lib/contractsIntegration/TradingFloorLensService/index.d.ts.map +1 -0
  255. package/dist/types/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts +83 -0
  256. package/dist/types/lib/contractsIntegration/TradingFloorService/ITradingFloorService.d.ts.map +1 -0
  257. package/dist/types/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts +80 -0
  258. package/dist/types/lib/contractsIntegration/TradingFloorService/TradingFloorService.d.ts.map +1 -0
  259. package/dist/types/lib/contractsIntegration/TriggersAndPortalLensService/ITriggersAndPortalLensService.d.ts +33 -0
  260. package/dist/types/lib/contractsIntegration/TriggersAndPortalLensService/ITriggersAndPortalLensService.d.ts.map +1 -0
  261. package/dist/types/lib/contractsIntegration/TriggersAndPortalLensService/TriggersAndPortalLensService.d.ts +11 -0
  262. package/dist/types/lib/contractsIntegration/TriggersAndPortalLensService/TriggersAndPortalLensService.d.ts.map +1 -0
  263. package/dist/types/lib/contractsIntegration/TriggersAndPortalLensService/index.d.ts +3 -0
  264. package/dist/types/lib/contractsIntegration/TriggersAndPortalLensService/index.d.ts.map +1 -0
  265. package/dist/types/lib/contractsIntegration/TriggersService/ITriggersService.d.ts +73 -0
  266. package/dist/types/lib/contractsIntegration/TriggersService/ITriggersService.d.ts.map +1 -0
  267. package/dist/types/lib/contractsIntegration/TriggersService/TriggersService.d.ts +18 -0
  268. package/dist/types/lib/contractsIntegration/TriggersService/TriggersService.d.ts.map +1 -0
  269. package/dist/types/lib/contractsIntegration/deployedContractsConnector.d.ts +44 -5
  270. package/dist/types/lib/contractsIntegration/deployedContractsConnector.d.ts.map +1 -1
  271. package/dist/types/lib/devex/getChainAddresses.d.ts +20 -0
  272. package/dist/types/lib/devex/getChainAddresses.d.ts.map +1 -0
  273. package/dist/types/lib/devex/getSupportedEngineChains.d.ts +37 -0
  274. package/dist/types/lib/devex/getSupportedEngineChains.d.ts.map +1 -0
  275. package/dist/types/lib/devex/index.d.ts +5 -0
  276. package/dist/types/lib/devex/index.d.ts.map +1 -0
  277. package/dist/types/lib/devex/types.d.ts +20 -0
  278. package/dist/types/lib/devex/types.d.ts.map +1 -0
  279. package/dist/types/lib/lynxSystem/hashes.d.ts +6 -0
  280. package/dist/types/lib/lynxSystem/hashes.d.ts.map +1 -1
  281. package/dist/types/lib/lynxSystem/lynxScalesUtils.d.ts +2 -0
  282. package/dist/types/lib/lynxSystem/lynxScalesUtils.d.ts.map +1 -1
  283. package/dist/types/lib/lynxSystem/registry/registryReading.d.ts +9 -0
  284. package/dist/types/lib/lynxSystem/registry/registryReading.d.ts.map +1 -0
  285. package/dist/types/lib/priceFeeds/pyth/pythFeedConstants.d.ts.map +1 -1
  286. package/dist/types/lib/typechain/common.d.ts.map +1 -1
  287. package/dist/types/lib/typechain/contracts/Lynx/OrderBook/OrderBookProxy.d.ts +151 -0
  288. package/dist/types/lib/typechain/contracts/Lynx/OrderBook/OrderBookProxy.d.ts.map +1 -0
  289. package/dist/types/lib/typechain/contracts/Lynx/OrderBook/OrderBookV1.d.ts +268 -0
  290. package/dist/types/lib/typechain/contracts/Lynx/OrderBook/OrderBookV1.d.ts.map +1 -0
  291. package/dist/types/lib/typechain/contracts/Lynx/Registry/RegistryProxy.d.ts +143 -0
  292. package/dist/types/lib/typechain/contracts/Lynx/Registry/RegistryProxy.d.ts.map +1 -0
  293. package/dist/types/lib/typechain/contracts/Lynx/Registry/RegistryV1.d.ts +603 -0
  294. package/dist/types/lib/typechain/contracts/Lynx/Registry/RegistryV1.d.ts.map +1 -0
  295. package/dist/types/lib/typechain/contracts/Lynx/TradersPortal/TradersPortalV1.d.ts +571 -0
  296. package/dist/types/lib/typechain/contracts/Lynx/TradersPortal/TradersPortalV1.d.ts.map +1 -0
  297. package/dist/types/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorProxy.d.ts +151 -0
  298. package/dist/types/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorProxy.d.ts.map +1 -0
  299. package/dist/types/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorV1.d.ts +1160 -0
  300. package/dist/types/lib/typechain/contracts/Lynx/TradingFloor/TradingFloorV1.d.ts.map +1 -0
  301. package/dist/types/lib/typechain/contracts/Lynx/Triggers/TriggersV1.d.ts +977 -0
  302. package/dist/types/lib/typechain/contracts/Lynx/Triggers/TriggersV1.d.ts.map +1 -0
  303. package/dist/types/lib/typechain/contracts/Peripheral/Lens/TradingFloorLens.d.ts +1 -3
  304. package/dist/types/lib/typechain/contracts/Peripheral/Lens/TradingFloorLens.d.ts.map +1 -1
  305. package/dist/types/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookProxy__factory.d.ts +193 -0
  306. package/dist/types/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookProxy__factory.d.ts.map +1 -0
  307. package/dist/types/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.d.ts +407 -0
  308. package/dist/types/lib/typechain/factories/contracts/Lynx/OrderBook/OrderBookV1__factory.d.ts.map +1 -0
  309. package/dist/types/lib/typechain/factories/contracts/Lynx/Registry/RegistryProxy__factory.d.ts +169 -0
  310. package/dist/types/lib/typechain/factories/contracts/Lynx/Registry/RegistryProxy__factory.d.ts.map +1 -0
  311. package/dist/types/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.d.ts +841 -0
  312. package/dist/types/lib/typechain/factories/contracts/Lynx/Registry/RegistryV1__factory.d.ts.map +1 -0
  313. package/dist/types/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.d.ts +745 -0
  314. package/dist/types/lib/typechain/factories/contracts/Lynx/TradersPortal/TradersPortalV1__factory.d.ts.map +1 -0
  315. package/dist/types/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorProxy__factory.d.ts +193 -0
  316. package/dist/types/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorProxy__factory.d.ts.map +1 -0
  317. package/dist/types/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts +1374 -0
  318. package/dist/types/lib/typechain/factories/contracts/Lynx/TradingFloor/TradingFloorV1__factory.d.ts.map +1 -0
  319. package/dist/types/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.d.ts +1135 -0
  320. package/dist/types/lib/typechain/factories/contracts/Lynx/Triggers/TriggersV1__factory.d.ts.map +1 -0
  321. package/dist/types/lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory.d.ts +1 -1
  322. package/dist/types/lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory.d.ts +1 -1
  323. package/dist/types/lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory.d.ts +1 -1
  324. package/dist/types/lib/utils/ethersTypes.d.ts +2 -2
  325. package/dist/types/lib/utils/ethersTypes.d.ts.map +1 -1
  326. package/package.json +7 -7
package/README.md CHANGED
@@ -1,4 +1,393 @@
1
- # Lynx Client
1
+ # Lynx Client SDK
2
2
 
3
- This project introduces a client to interact with Lynx.
4
- It has script examples and api calls to the app, and common logic used by other Lynx repositories.
3
+ A TypeScript SDK for interacting with the Lynx trading protocol across multiple EVM-compatible blockchains.
4
+
5
+ ## Features
6
+
7
+ - 🔒 Type-safe interfaces for all Lynx smart contracts
8
+ - 🌐 Multi-chain support (16+ EVM chains)
9
+ - 📊 Built-in utilities for price, leverage, and fraction conversions
10
+ - 🏗️ Support for both CommonJS and ESM module systems
11
+ - 🔍 Read-only lens contracts for efficient data aggregation
12
+ - 💼 Complete trading lifecycle management
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install lynx-client
18
+ ```
19
+
20
+ ```bash
21
+ yarn add lynx-client
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```typescript
27
+ import {
28
+ connectToLatestRegistry,
29
+ LynxSystemAddresses,
30
+ createTradersPortalService,
31
+ buildPositionRequestIdentifier,
32
+ buildPositionRequestParams
33
+ } from 'lynx-client';
34
+ import { ethers } from 'ethers';
35
+
36
+ // Initialize provider
37
+ const provider = new ethers.JsonRpcProvider('YOUR_RPC_URL');
38
+ const signer = await provider.getSigner();
39
+
40
+ // Get chain-specific addresses
41
+ const addresses = LynxSystemAddresses.arbitrum; // or .sonic, .base, etc.
42
+
43
+ // Connect to contracts
44
+ const registry = connectToLatestRegistry(provider, addresses.registryProxyAddress);
45
+
46
+ // Create a service for trader operations
47
+ const tradersPortal = createTradersPortalService(signer, addresses.tradersPortalAddress);
48
+ ```
49
+
50
+ ## Core Concepts
51
+
52
+ ### Supported Chains
53
+
54
+ #### Engine Chains
55
+ The Lynx protocol is deployed on the following chains:
56
+
57
+ - **Sonic** (146)
58
+ - **Boba** (288)
59
+ - **Flare** (14)
60
+ - **Fantom** (250)
61
+
62
+ #### Source Chains
63
+ Assets can be bridged from these additional chains:
64
+
65
+ - Ethereum Mainnet (1)
66
+ - Optimism (10)
67
+ - BSC (56)
68
+ - Polygon (137)
69
+ - Fuse (122)
70
+ - Goat (2345)
71
+ - Mantle (5000)
72
+ - Base (8453)
73
+ - Mode (34443)
74
+ - Arbitrum (42161)
75
+ - Celo (42220)
76
+ - Linea (59144)
77
+ - Zircuit (48900)
78
+
79
+ ```typescript
80
+ import { LynxSystemAddresses, TSupportedChainIds } from 'lynx-client';
81
+
82
+ // Get addresses for a specific chain
83
+ const sonicAddresses = LynxSystemAddresses.sonic;
84
+ const arbitrumAddresses = LynxSystemAddresses.arbitrum;
85
+ ```
86
+
87
+ ### Contract Services
88
+
89
+ The SDK provides service wrappers for all Lynx contracts:
90
+
91
+ #### Trading Operations
92
+
93
+ ```typescript
94
+ import {
95
+ createTradersPortalService,
96
+ buildPositionRequestIdentifier,
97
+ buildPositionRequestParams,
98
+ TOpenOrderType
99
+ } from 'lynx-client';
100
+
101
+ const tradersPortal = createTradersPortalService(signer, tradersPortalAddress);
102
+
103
+ // Build position parameters using human-readable values
104
+ const identifier = buildPositionRequestIdentifier({
105
+ trader: await signer.getAddress(),
106
+ pairId: 1, // BTC/USD
107
+ settlementAsset: "0x...", // USDC address
108
+ positionIndex: 0
109
+ });
110
+
111
+ const params = buildPositionRequestParams({
112
+ isLong: true,
113
+ collateral: 100, // 100 USDC
114
+ leverage: 25, // 25x leverage
115
+ minPrice: 50000, // $50,000
116
+ maxPrice: 50100, // $50,100
117
+ takeProfit: 55000, // $55,000
118
+ stopLoss: 48000 // $48,000
119
+ });
120
+
121
+ // Open a position
122
+ await tradersPortal.traderRequests.openNewPosition(
123
+ identifier,
124
+ params,
125
+ TOpenOrderType.MARKET,
126
+ "0x", // referrer domain
127
+ "0x", // referrer code
128
+ true, // run cap tests
129
+ ethers.parseEther("0.01") // native fee
130
+ );
131
+ ```
132
+
133
+ #### Lens Services (Read-Only Data)
134
+
135
+ ```typescript
136
+ import { createLexLensService, createTradingFloorLensService } from 'lynx-client';
137
+
138
+ // LEX Pool data (accepts both provider and signer)
139
+ const lexLens = createLexLensService(signerOrProvider, lexLensAddress);
140
+ const poolState = await lexLens.getLexPoolState(lexPoolAddress);
141
+ const pairConfigs = await lexLens.getAllPairConfigurationsInLex(lexPoolAddress);
142
+
143
+ // Trading floor data (accepts both provider and signer)
144
+ const tradingFloorLens = createTradingFloorLensService(signerOrProvider, tradingFloorLensAddress);
145
+ const position = await tradingFloorLens.getCompletePositionData(tradingFloorAddress, positionId);
146
+ ```
147
+
148
+ ### Utility Functions
149
+
150
+ #### Price Conversions
151
+
152
+ ```typescript
153
+ import { floatToPriceBn, priceBnToFloat } from 'lynx-client';
154
+
155
+ // Convert human-readable price to contract format (8 decimals)
156
+ const priceBn = floatToPriceBn(50000.50); // $50,000.50 → BigInt
157
+
158
+ // Convert contract price to human-readable
159
+ const price = priceBnToFloat(priceBn); // BigInt → 50000.50
160
+ ```
161
+
162
+ #### Leverage Conversions
163
+
164
+ ```typescript
165
+ import { floatUnitsToScaledLeverage, scaledLeverageToUnits } from 'lynx-client';
166
+
167
+ // Convert human leverage to contract format
168
+ const scaledLeverage = floatUnitsToScaledLeverage(25); // 25x → 2500
169
+
170
+ // Convert contract leverage to human-readable
171
+ const leverage = scaledLeverageToUnits(2500); // 2500 → 25x
172
+ ```
173
+
174
+ #### Collateral Conversions
175
+
176
+ ```typescript
177
+ import { floatToChipsBn, chipsBnToUnits } from 'lynx-client';
178
+
179
+ // Convert human-readable amount to contract format (18 decimals)
180
+ const collateralBn = floatToChipsBn(100.5); // 100.5 tokens → BigInt
181
+
182
+ // Convert contract amount to human-readable
183
+ const collateral = chipsBnToUnits(collateralBn); // BigInt → 100.5
184
+ ```
185
+
186
+ #### Fraction Conversions
187
+
188
+ ```typescript
189
+ import { floatToFractionBn, fractionBnToFloat } from 'lynx-client';
190
+
191
+ // Convert percentage to contract format
192
+ const fractionBn = floatToFractionBn(0.05); // 5% → 5000
193
+
194
+ // Convert contract fraction to percentage
195
+ const fraction = fractionBnToFloat(5000n); // 5000 → 0.05 (5%)
196
+ ```
197
+
198
+ ## Advanced Usage
199
+
200
+ ### Position Management
201
+
202
+ ```typescript
203
+ // Update position with new TP/SL
204
+ await tradersPortal.traderRequests.updatePositionDoubleFieldTpAndSl(
205
+ positionId,
206
+ floatToPriceBn(55000), // New TP: $55,000
207
+ floatToPriceBn(48000), // New SL: $48,000
208
+ ethers.parseEther("0.01") // Fee
209
+ );
210
+
211
+ // Close position at market
212
+ await tradersPortal.traderRequests.setExistingPositionToMarketClose(
213
+ positionId,
214
+ floatToPriceBn(49900), // Min acceptable price
215
+ floatToPriceBn(50100), // Max acceptable price
216
+ ethers.parseEther("0.01") // Fee
217
+ );
218
+ ```
219
+
220
+ ### Working with Triggers
221
+
222
+ ```typescript
223
+ import { createTriggersService } from 'lynx-client';
224
+
225
+ const triggers = createTriggersService(signer, triggersAddress);
226
+
227
+ // Get trigger configurations
228
+ const configs = await triggers.getTriggersConfigurations();
229
+ const pairConfigs = await triggers.getPairConfigsInTriggers(1); // Pair ID 1
230
+ ```
231
+
232
+ ### LEX Pool Operations
233
+
234
+ ```typescript
235
+ // Get complete LEX pool state
236
+ const completeState = await lexLens.getCompleteStateForLex(lexPoolAddress);
237
+
238
+ // Get supplier state
239
+ const supplierState = await lexLens.getLexPoolSupplierState(
240
+ lexPoolAddress,
241
+ supplierAddress
242
+ );
243
+
244
+ // Get all fee configurations
245
+ const feeConfigs = await lexLens.getAllFeeConfigurationsInLex(lexPoolAddress);
246
+ ```
247
+
248
+ ## Type Safety
249
+
250
+ The SDK provides comprehensive TypeScript types for all contract interactions:
251
+
252
+ ```typescript
253
+ import {
254
+ TPositionRequestIdentifierStruct,
255
+ TPositionRequestParamsStruct,
256
+ TSinglePositionStruct,
257
+ TPairConfigsInTriggersStruct
258
+ } from 'lynx-client';
259
+
260
+ // All contract structs are properly typed
261
+ const position = await tradingFloorLens.getCompletePositionData(tradingFloorAddress, id);
262
+ console.log(position.trader); // string
263
+ console.log(position.collateral); // bigint
264
+ console.log(position.leverage); // bigint
265
+ ```
266
+
267
+ ## Error Handling
268
+
269
+ The SDK validates inputs to prevent common errors:
270
+
271
+ ```typescript
272
+ try {
273
+ // This will throw an error - can't use both price and fraction TP
274
+ const params = buildPositionRequestParams({
275
+ isLong: true,
276
+ collateral: 100,
277
+ leverage: 25,
278
+ minPrice: 50000,
279
+ maxPrice: 50100,
280
+ takeProfit: 55000, // Price-based TP
281
+ takeProfitByFraction: 0.1 // Fraction-based TP - ERROR!
282
+ });
283
+ } catch (error) {
284
+ console.error("Cannot specify both takeProfit and takeProfitByFraction");
285
+ }
286
+ ```
287
+
288
+ ## Type Safety
289
+
290
+ The SDK provides strong type safety with clear distinctions between different numeric types:
291
+
292
+ ### Return Type Conventions
293
+ - **`bigint`**: Used for asset amounts, collateral, and values requiring high precision
294
+ - **`number`**: Used for IDs, timestamps, prices, leverage, and human-readable values
295
+ - **`string`**: Used for addresses and text values
296
+ - **`boolean`**: Used for flags and states
297
+
298
+ ### Lens Service Types
299
+ All Lens services return properly typed data structures:
300
+
301
+ ```typescript
302
+ // Example: TradingFloorLens returns typed position data
303
+ const position = await lensService.getCompletePositionData(tradingFloor, positionId);
304
+ // position.pairId: number (not bigint)
305
+ // position.collateral: bigint (asset amount)
306
+ // position.leverage: number (human-readable)
307
+ // position.openPrice: number (human-readable price)
308
+ ```
309
+
310
+ ## Constants and Enums
311
+
312
+ ```typescript
313
+ import {
314
+ TOpenOrderType,
315
+ TOrderCloseType,
316
+ TPositionField,
317
+ TPairIds,
318
+ CHIP_DECIMALS,
319
+ PRICES_SCALE,
320
+ LEVERAGE_MULTIPLIER_SCALE
321
+ } from 'lynx-client';
322
+
323
+ // Order types
324
+ const marketOrder = TOpenOrderType.MARKET;
325
+ const limitOrder = TOpenOrderType.LIMIT;
326
+
327
+ // Pair IDs
328
+ const btcUsd = TPairIds.BTC_USD;
329
+ const ethUsd = TPairIds.ETH_USD;
330
+ ```
331
+
332
+ ## Best Practices
333
+
334
+ 1. **Always use builder functions** for creating position requests:
335
+ ```typescript
336
+ // ✅ Good
337
+ const params = buildPositionRequestParams({ ... });
338
+
339
+ // ❌ Avoid manual construction
340
+ const params = { long: true, collateral: 100n, ... };
341
+ ```
342
+
343
+ 2. **Use utility functions** for conversions:
344
+ ```typescript
345
+ // ✅ Good
346
+ const priceBn = floatToPriceBn(50000);
347
+
348
+ // ❌ Avoid manual calculations
349
+ const priceBn = BigInt(50000 * 10**8);
350
+ ```
351
+
352
+ 3. **Handle contract errors** appropriately:
353
+ ```typescript
354
+ try {
355
+ await tradersPortal.traderRequests.openNewPosition(...);
356
+ } catch (error) {
357
+ if (error.reason === "Insufficient collateral") {
358
+ // Handle specific error
359
+ }
360
+ }
361
+ ```
362
+
363
+ ## Development
364
+
365
+ ### Building
366
+
367
+ ```bash
368
+ npm run build
369
+ ```
370
+
371
+ ### Testing
372
+
373
+ ```bash
374
+ npm test
375
+ ```
376
+
377
+ ### Contributing
378
+
379
+ 1. Fork the repository
380
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
381
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
382
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
383
+ 5. Open a Pull Request
384
+
385
+ ## License
386
+
387
+ ISC
388
+
389
+ ## Support
390
+
391
+ - [GitHub Issues](https://github.com/lynx-protocol/lynx-client/issues)
392
+ - [Documentation](https://lynx-finance.gitbook.io/lynx-finance/)
393
+ - [Discord](https://discord.gg/4CGxEYwrF2)
package/dist/cjs/index.js CHANGED
@@ -26,6 +26,7 @@ __exportStar(require("./lib/utils/ethersTypes"), exports);
26
26
  __exportStar(require("./lib/lynxSystem/hashes"), exports);
27
27
  __exportStar(require("./lib/lynxSystem/lynxScalesUtils"), exports);
28
28
  __exportStar(require("./lib/utils/types"), exports);
29
+ __exportStar(require("./lib/lynxSystem/registry/registryReading"), exports);
29
30
  __exportStar(require("./lib/constants/contractEnums"), exports);
30
31
  __exportStar(require("./lib/constants/generalConstants"), exports);
31
32
  __exportStar(require("./lib/constants/scales"), exports);
@@ -37,6 +38,11 @@ __exportStar(require("./lib/priceFeeds/pyth/pythFeedFunctions"), exports);
37
38
  __exportStar(require("./lib/addresses/lensAddresses"), exports);
38
39
  __exportStar(require("./lib/addresses/systemAddresses"), exports);
39
40
  __exportStar(require("./lib/contractsIntegration/deployedContractsConnector"), exports);
41
+ __exportStar(require("./lib/contractsIntegration/TradersPortalService"), exports);
42
+ __exportStar(require("./lib/contractsIntegration/IntentsVerifierLensService"), exports);
43
+ __exportStar(require("./lib/contractsIntegration/TriggersAndPortalLensService"), exports);
44
+ __exportStar(require("./lib/contractsIntegration/TradingFloorLensService"), exports);
45
+ __exportStar(require("./lib/contractsIntegration/LexLensService"), exports);
40
46
  __exportStar(require("./lib/typechain/contracts/Peripheral/Lens/IntentsVerifierLens"), exports);
41
47
  __exportStar(require("./lib/typechain/contracts/Peripheral/Lens/TriggersAndPortalLens"), exports);
42
48
  __exportStar(require("./lib/typechain/contracts/Peripheral/Lens/LexLens"), exports);
@@ -45,3 +51,5 @@ __exportStar(require("./lib/typechain/factories/contracts/Peripheral/Lens/Intent
45
51
  __exportStar(require("./lib/typechain/factories/contracts/Peripheral/Lens/TriggersAndPortalLens__factory"), exports);
46
52
  __exportStar(require("./lib/typechain/factories/contracts/Peripheral/Lens/LexLens__factory"), exports);
47
53
  __exportStar(require("./lib/typechain/factories/contracts/Peripheral/Lens/TradingFloorLens__factory"), exports);
54
+ // Developer Experience utilities
55
+ __exportStar(require("./lib/devex"), exports);
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENGINE_CHAIN_DISPLAY_NAME = exports.ENGINE_CHAIN_ID_BY_NAME = void 0;
4
+ const chainConstants_1 = require("./chainConstants");
5
+ // Engine chain mappings
6
+ exports.ENGINE_CHAIN_ID_BY_NAME = {
7
+ sonic: chainConstants_1.CHAIN_ID_SONIC,
8
+ boba: chainConstants_1.CHAIN_ID_BOBA,
9
+ flare: chainConstants_1.CHAIN_ID_FLARE,
10
+ fantom: chainConstants_1.CHAIN_ID_FANTOM,
11
+ };
12
+ exports.ENGINE_CHAIN_DISPLAY_NAME = {
13
+ sonic: "Sonic",
14
+ boba: "Boba",
15
+ flare: "Flare",
16
+ fantom: "Fantom",
17
+ };
@@ -31,6 +31,7 @@ exports.FeeTypeEnums = {
31
31
  CLOSE_FEE: 2,
32
32
  TRIGGER_FEE: 3,
33
33
  };
34
+ // TODO : Can probably delete this type and const (as we have TUpdatePositionFieldOrderType)
34
35
  exports.PositionFieldEnums = {
35
36
  NONE: 0n,
36
37
  TP: 1n,
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMPTY_HASH_BASED_INTENTS_VERIFIER_REQUEST_BUILDING_INFO = exports.EMPTY_ACCOUNT_BASED_INTENTS_VERIFIER_REQUEST_BUILDING_INFO = void 0;
4
+ exports.EMPTY_ACCOUNT_BASED_INTENTS_VERIFIER_REQUEST_BUILDING_INFO = {
5
+ verifier: "",
6
+ account: "",
7
+ actionType: 0,
8
+ currentNonce: 0,
9
+ };
10
+ exports.EMPTY_HASH_BASED_INTENTS_VERIFIER_REQUEST_BUILDING_INFO = {
11
+ verifier: "",
12
+ hash: "",
13
+ actionType: 0,
14
+ currentNonce: 0,
15
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntentsVerifierLensService = void 0;
4
+ const IntentsVerifierLens__factory_1 = require("../../typechain/factories/contracts/Peripheral/Lens/IntentsVerifierLens__factory");
5
+ const ethersTypes_1 = require("../../utils/ethersTypes");
6
+ const IIntentsVerifierLensService_1 = require("./IIntentsVerifierLensService");
7
+ class IntentsVerifierLensService {
8
+ constructor(signerOrProvider, address) {
9
+ this.contract = IntentsVerifierLens__factory_1.IntentsVerifierLens__factory.connect(address, signerOrProvider);
10
+ }
11
+ async getRequestBuildingInfoForChipsIntentsVerifier(account, actionType) {
12
+ const result = await this.contract.getRequestBuildingInfoForChipsIntentsVerifier(account, BigInt(actionType));
13
+ const baseStruct = (0, ethersTypes_1.ethersStructResponseToObject)(result, IIntentsVerifierLensService_1.EMPTY_ACCOUNT_BASED_INTENTS_VERIFIER_REQUEST_BUILDING_INFO);
14
+ return {
15
+ ...baseStruct,
16
+ actionType: Number(baseStruct.actionType),
17
+ currentNonce: Number(baseStruct.currentNonce),
18
+ };
19
+ }
20
+ async getRequestBuildingInfoForLiquidityIntentsVerifier(account, actionType) {
21
+ const result = await this.contract.getRequestBuildingInfoForLiquidityIntentsVerifier(account, BigInt(actionType));
22
+ const baseStruct = (0, ethersTypes_1.ethersStructResponseToObject)(result, IIntentsVerifierLensService_1.EMPTY_ACCOUNT_BASED_INTENTS_VERIFIER_REQUEST_BUILDING_INFO);
23
+ return {
24
+ ...baseStruct,
25
+ actionType: Number(baseStruct.actionType),
26
+ currentNonce: Number(baseStruct.currentNonce),
27
+ };
28
+ }
29
+ async getRequestBuildingInfoForTradeIntentsVerifier(positionId, actionType) {
30
+ const result = await this.contract.getRequestBuildingInfoForTradeIntentsVerifier(positionId, BigInt(actionType));
31
+ const baseStruct = (0, ethersTypes_1.ethersStructResponseToObject)(result, IIntentsVerifierLensService_1.EMPTY_HASH_BASED_INTENTS_VERIFIER_REQUEST_BUILDING_INFO);
32
+ return {
33
+ ...baseStruct,
34
+ actionType: Number(baseStruct.actionType),
35
+ currentNonce: Number(baseStruct.currentNonce),
36
+ };
37
+ }
38
+ async registry() {
39
+ return await this.contract.registry();
40
+ }
41
+ }
42
+ exports.IntentsVerifierLensService = IntentsVerifierLensService;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./IIntentsVerifierLensService"), exports);
18
+ __exportStar(require("./IntentsVerifierLensService"), exports);
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EMPTY_SINGLE_POSITION_OUTPUT = exports.EMPTY_COMPLETE_LEX_CONFIGS = exports.EMPTY_COMPLETE_LEX_STATE = exports.EMPTY_POOL_ACCOUNTANT_CONFIGURATIONS_LENS = exports.EMPTY_POOL_ACCOUNTANT_STATE_LENS = exports.EMPTY_LEX_POOL_SUPPLIER_LENS_STATE = exports.EMPTY_LEX_GROUP_STATE_LENS = exports.EMPTY_LEX_PAIR_STATE_LENS = exports.EMPTY_GROUP_CONFIGS_LENS = exports.EMPTY_FEE_CONFIGS_LENS = exports.EMPTY_PAIR_CONFIGS_LENS = exports.EMPTY_LEX_POOL_LENS_CONFIGS = exports.EMPTY_LEX_POOL_LENS_STATE = exports.EMPTY_LEX_POOL_LENS_PARAMS = exports.EMPTY_PENDING_EPOCH_REDEEM = exports.EMPTY_PENDING_EPOCH_DEPOSIT = void 0;
4
+ // Empty constants
5
+ exports.EMPTY_PENDING_EPOCH_DEPOSIT = {
6
+ account: "",
7
+ amount: 0n,
8
+ epochNumber: 0n,
9
+ minAmountOut: 0n,
10
+ };
11
+ exports.EMPTY_PENDING_EPOCH_REDEEM = {
12
+ account: "",
13
+ amount: 0n,
14
+ epochNumber: 0n,
15
+ maxAmountOut: 0n,
16
+ minAmountOut: 0n,
17
+ };
18
+ exports.EMPTY_LEX_POOL_LENS_PARAMS = {
19
+ lexToken: "",
20
+ name: "",
21
+ symbol: "",
22
+ underlying: "",
23
+ };
24
+ exports.EMPTY_LEX_POOL_LENS_STATE = {
25
+ currentVirtualUtilization: 0n,
26
+ nextEpochStartMin: 0n,
27
+ poolBalance: 0n,
28
+ totalPendingDeposits: 0n,
29
+ totalPendingWithdrawals: 0n,
30
+ totalSupply: 0n,
31
+ virtualBalanceForUtilization: 0n,
32
+ lexPool: "",
33
+ cash: 0n,
34
+ connectedToCenter: false,
35
+ currentEpochNumber: 0n,
36
+ currentExchangeRate: 0n,
37
+ };
38
+ exports.EMPTY_LEX_POOL_LENS_CONFIGS = {
39
+ lexPool: "",
40
+ epochLength: 0n,
41
+ minDepositAmount: 0n,
42
+ epochsDelayDeposit: 0n,
43
+ epochsDelayRedeem: 0n,
44
+ immediateDepositAllowed: false,
45
+ };
46
+ exports.EMPTY_PAIR_CONFIGS_LENS = {
47
+ feeId: 0,
48
+ groupId: 0,
49
+ maxBorrowF: 0n,
50
+ maxGain: 0n,
51
+ maxLeverage: 0n,
52
+ maxOpenInterest: 0n,
53
+ maxPositionSize: 0n,
54
+ maxSkew: 0n,
55
+ minLeverage: 0n,
56
+ pairId: 0,
57
+ minPerformanceFee: 0n,
58
+ minOpenFee: 0n,
59
+ };
60
+ exports.EMPTY_FEE_CONFIGS_LENS = {
61
+ feeId: 0,
62
+ openFeeF: 0,
63
+ closeFeeF: 0,
64
+ performanceFeeF: 0,
65
+ };
66
+ exports.EMPTY_GROUP_CONFIGS_LENS = {
67
+ groupId: 0,
68
+ maxBorrowF: 0,
69
+ maxLeverage: 0n,
70
+ maxPositionSize: 0n,
71
+ minLeverage: 0n,
72
+ };
73
+ exports.EMPTY_LEX_PAIR_STATE_LENS = {
74
+ fundingRate: 0n,
75
+ lexPool: "",
76
+ openInterestLong: 0n,
77
+ openInterestShort: 0n,
78
+ pairId: 0,
79
+ tradersPairGains: 0n,
80
+ pairBorrows: 0n,
81
+ };
82
+ exports.EMPTY_LEX_GROUP_STATE_LENS = {
83
+ lexPool: "",
84
+ groupId: 0,
85
+ groupBorrows: 0n,
86
+ };
87
+ exports.EMPTY_LEX_POOL_SUPPLIER_LENS_STATE = {
88
+ allowanceForLexPool: 0n,
89
+ lexPool: "",
90
+ lxpBalance: 0n,
91
+ lxpBalanceInUnderlying: 0n,
92
+ pendingEpochDeposits: [],
93
+ pendingEpochRedeems: [],
94
+ supplier: "",
95
+ underlyingBalance: 0n,
96
+ };
97
+ exports.EMPTY_POOL_ACCOUNTANT_STATE_LENS = {
98
+ accountant: "",
99
+ borrowRatePerSecond: 0n,
100
+ interestShare: 0n,
101
+ matchingPool: "",
102
+ totalBorrows: 0n,
103
+ unrealizedFunding: 0n,
104
+ fundingShare: 0n,
105
+ };
106
+ exports.EMPTY_POOL_ACCOUNTANT_CONFIGURATIONS_LENS = {
107
+ accountant: "",
108
+ fundingRateModel: "",
109
+ interestRateModel: "",
110
+ interestShareFactor: 0n,
111
+ matchingPool: "",
112
+ minOpenFee: 0n,
113
+ lexPartF: 0n,
114
+ liquidationThresholdF: 0n,
115
+ liquidationFeeF: 0n,
116
+ supportedPairIds: [],
117
+ };
118
+ exports.EMPTY_COMPLETE_LEX_STATE = {
119
+ lexPoolState: exports.EMPTY_LEX_POOL_LENS_STATE,
120
+ poolAccountantState: exports.EMPTY_POOL_ACCOUNTANT_STATE_LENS,
121
+ pairsStates: [],
122
+ groupsStates: [],
123
+ };
124
+ exports.EMPTY_COMPLETE_LEX_CONFIGS = {
125
+ lexPoolParams: exports.EMPTY_LEX_POOL_LENS_PARAMS,
126
+ lexPoolConfigurations: exports.EMPTY_LEX_POOL_LENS_CONFIGS,
127
+ poolAccountantConfigurations: exports.EMPTY_POOL_ACCOUNTANT_CONFIGURATIONS_LENS,
128
+ groupsConfigs: [],
129
+ pairsConfigs: [],
130
+ feesConfigs: [],
131
+ };
132
+ exports.EMPTY_SINGLE_POSITION_OUTPUT = {
133
+ totalValue: 0n,
134
+ safeClosingFee: 0n,
135
+ interest: 0n,
136
+ funding: 0n,
137
+ };