@levrbet/shared 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (488) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +92 -0
  3. package/bin/setup-prisma.js +44 -0
  4. package/dist/core/config/dotenv.d.ts +16 -0
  5. package/dist/core/config/dotenv.js +77 -0
  6. package/dist/core/config/dotenv.js.map +1 -0
  7. package/dist/core/config/index.d.ts +2 -0
  8. package/dist/core/config/index.js +19 -0
  9. package/dist/core/config/index.js.map +1 -0
  10. package/dist/core/config/urls.d.ts +55 -0
  11. package/dist/core/config/urls.js +61 -0
  12. package/dist/core/config/urls.js.map +1 -0
  13. package/dist/core/contracts/abis/LevrBaseMarket.d.ts +1009 -0
  14. package/dist/core/contracts/abis/LevrBaseMarket.js +976 -0
  15. package/dist/core/contracts/abis/LevrBaseMarket.js.map +1 -0
  16. package/dist/core/contracts/abis/LevrConfigProvider.d.ts +2671 -0
  17. package/dist/core/contracts/abis/LevrConfigProvider.js +2551 -0
  18. package/dist/core/contracts/abis/LevrConfigProvider.js.map +1 -0
  19. package/dist/core/contracts/abis/LevrFeeCollector.d.ts +259 -0
  20. package/dist/core/contracts/abis/LevrFeeCollector.js +143 -0
  21. package/dist/core/contracts/abis/LevrFeeCollector.js.map +1 -0
  22. package/dist/core/contracts/abis/LevrFulltimeMarket.d.ts +1050 -0
  23. package/dist/core/contracts/abis/LevrFulltimeMarket.js +462 -0
  24. package/dist/core/contracts/abis/LevrFulltimeMarket.js.map +1 -0
  25. package/dist/core/contracts/abis/LevrFundManager.d.ts +51 -0
  26. package/dist/core/contracts/abis/LevrFundManager.js +4 -0
  27. package/dist/core/contracts/abis/LevrFundManager.js.map +1 -0
  28. package/dist/core/contracts/abis/LevrLiquidationEngine.d.ts +244 -0
  29. package/dist/core/contracts/abis/LevrLiquidationEngine.js +231 -0
  30. package/dist/core/contracts/abis/LevrLiquidationEngine.js.map +1 -0
  31. package/dist/core/contracts/abis/LevrManager.d.ts +1281 -0
  32. package/dist/core/contracts/abis/LevrManager.js +1090 -0
  33. package/dist/core/contracts/abis/LevrManager.js.map +1 -0
  34. package/dist/core/contracts/abis/LevrMarketFeed.d.ts +902 -0
  35. package/dist/core/contracts/abis/LevrMarketFeed.js +775 -0
  36. package/dist/core/contracts/abis/LevrMarketFeed.js.map +1 -0
  37. package/dist/core/contracts/abis/LevrMarketMaker.d.ts +175 -0
  38. package/dist/core/contracts/abis/LevrMarketMaker.js +108 -0
  39. package/dist/core/contracts/abis/LevrMarketMaker.js.map +1 -0
  40. package/dist/core/contracts/abis/LevrMarketRiskSentinel.d.ts +682 -0
  41. package/dist/core/contracts/abis/LevrMarketRiskSentinel.js +323 -0
  42. package/dist/core/contracts/abis/LevrMarketRiskSentinel.js.map +1 -0
  43. package/dist/core/contracts/abis/LevrMarketRouter.d.ts +281 -0
  44. package/dist/core/contracts/abis/LevrMarketRouter.js +262 -0
  45. package/dist/core/contracts/abis/LevrMarketRouter.js.map +1 -0
  46. package/dist/core/contracts/abis/LevrMvpDepository.d.ts +766 -0
  47. package/dist/core/contracts/abis/LevrMvpDepository.js +396 -0
  48. package/dist/core/contracts/abis/LevrMvpDepository.js.map +1 -0
  49. package/dist/core/contracts/abis/LevrMvpRouter.d.ts +305 -0
  50. package/dist/core/contracts/abis/LevrMvpRouter.js +291 -0
  51. package/dist/core/contracts/abis/LevrMvpRouter.js.map +1 -0
  52. package/dist/core/contracts/abis/LevrMvpStaker.d.ts +746 -0
  53. package/dist/core/contracts/abis/LevrMvpStaker.js +386 -0
  54. package/dist/core/contracts/abis/LevrMvpStaker.js.map +1 -0
  55. package/dist/core/contracts/abis/LevrMvpToken.d.ts +341 -0
  56. package/dist/core/contracts/abis/LevrMvpToken.js +183 -0
  57. package/dist/core/contracts/abis/LevrMvpToken.js.map +1 -0
  58. package/dist/core/contracts/abis/LevrOrderbook.d.ts +471 -0
  59. package/dist/core/contracts/abis/LevrOrderbook.js +486 -0
  60. package/dist/core/contracts/abis/LevrOrderbook.js.map +1 -0
  61. package/dist/core/contracts/abis/LevrOrderbookLens.d.ts +167 -0
  62. package/dist/core/contracts/abis/LevrOrderbookLens.js +103 -0
  63. package/dist/core/contracts/abis/LevrOrderbookLens.js.map +1 -0
  64. package/dist/core/contracts/abis/LevrOverUnderMarket.d.ts +1054 -0
  65. package/dist/core/contracts/abis/LevrOverUnderMarket.js +463 -0
  66. package/dist/core/contracts/abis/LevrOverUnderMarket.js.map +1 -0
  67. package/dist/core/contracts/abis/LevrPythFeed.d.ts +225 -0
  68. package/dist/core/contracts/abis/LevrPythFeed.js +131 -0
  69. package/dist/core/contracts/abis/LevrPythFeed.js.map +1 -0
  70. package/dist/core/contracts/abis/LevrUtil.d.ts +485 -0
  71. package/dist/core/contracts/abis/LevrUtil.js +226 -0
  72. package/dist/core/contracts/abis/LevrUtil.js.map +1 -0
  73. package/dist/core/contracts/abis/Storage.d.ts +34 -0
  74. package/dist/core/contracts/abis/Storage.js +47 -0
  75. package/dist/core/contracts/abis/Storage.js.map +1 -0
  76. package/dist/core/contracts/abis/index.d.ts +12174 -0
  77. package/dist/core/contracts/abis/index.js +51 -0
  78. package/dist/core/contracts/abis/index.js.map +1 -0
  79. package/dist/core/contracts/addresses.d.ts +154 -0
  80. package/dist/core/contracts/addresses.js +160 -0
  81. package/dist/core/contracts/addresses.js.map +1 -0
  82. package/dist/core/contracts/chains.d.ts +4 -0
  83. package/dist/core/contracts/chains.js +14 -0
  84. package/dist/core/contracts/chains.js.map +1 -0
  85. package/dist/core/contracts/clients/index.d.ts +1 -0
  86. package/dist/core/contracts/clients/index.js +18 -0
  87. package/dist/core/contracts/clients/index.js.map +1 -0
  88. package/dist/core/contracts/clients/publicClients.d.ts +24 -0
  89. package/dist/core/contracts/clients/publicClients.js +123 -0
  90. package/dist/core/contracts/clients/publicClients.js.map +1 -0
  91. package/dist/core/contracts/constants.d.ts +15 -0
  92. package/dist/core/contracts/constants.js +30 -0
  93. package/dist/core/contracts/constants.js.map +1 -0
  94. package/dist/core/contracts/index.d.ts +6 -0
  95. package/dist/core/contracts/index.js +23 -0
  96. package/dist/core/contracts/index.js.map +1 -0
  97. package/dist/core/contracts/instances.d.ts +48 -0
  98. package/dist/core/contracts/instances.js +101 -0
  99. package/dist/core/contracts/instances.js.map +1 -0
  100. package/dist/core/index.d.ts +9 -0
  101. package/dist/core/index.js +26 -0
  102. package/dist/core/index.js.map +1 -0
  103. package/dist/core/indexers/envio.test.query.d.ts +5 -0
  104. package/dist/core/indexers/envio.test.query.js +32 -0
  105. package/dist/core/indexers/envio.test.query.js.map +1 -0
  106. package/dist/core/indexers/index.d.ts +1 -0
  107. package/dist/core/indexers/index.js +18 -0
  108. package/dist/core/indexers/index.js.map +1 -0
  109. package/dist/core/indexers/indexers.service.d.ts +19 -0
  110. package/dist/core/indexers/indexers.service.js +104 -0
  111. package/dist/core/indexers/indexers.service.js.map +1 -0
  112. package/dist/core/indexers/subsquid.test.query.d.ts +4 -0
  113. package/dist/core/indexers/subsquid.test.query.js +42 -0
  114. package/dist/core/indexers/subsquid.test.query.js.map +1 -0
  115. package/dist/core/prisma/index.d.ts +1 -0
  116. package/dist/core/prisma/index.js +21 -0
  117. package/dist/core/prisma/index.js.map +1 -0
  118. package/dist/core/prisma/schema.prisma +360 -0
  119. package/dist/core/privy/constants.d.ts +19 -0
  120. package/dist/core/privy/constants.js +28 -0
  121. package/dist/core/privy/constants.js.map +1 -0
  122. package/dist/core/privy/index.d.ts +1 -0
  123. package/dist/core/privy/index.js +18 -0
  124. package/dist/core/privy/index.js.map +1 -0
  125. package/dist/core/socket.io/events.d.ts +20 -0
  126. package/dist/core/socket.io/events.js +20 -0
  127. package/dist/core/socket.io/events.js.map +1 -0
  128. package/dist/core/socket.io/index.d.ts +2 -0
  129. package/dist/core/socket.io/index.js +19 -0
  130. package/dist/core/socket.io/index.js.map +1 -0
  131. package/dist/core/socket.io/rooms.d.ts +6 -0
  132. package/dist/core/socket.io/rooms.js +10 -0
  133. package/dist/core/socket.io/rooms.js.map +1 -0
  134. package/dist/core/types/auth/auth.types.d.ts +31 -0
  135. package/dist/core/types/auth/auth.types.js +15 -0
  136. package/dist/core/types/auth/auth.types.js.map +1 -0
  137. package/dist/core/types/auth/index.d.ts +2 -0
  138. package/dist/core/types/auth/index.js +19 -0
  139. package/dist/core/types/auth/index.js.map +1 -0
  140. package/dist/core/types/auth/request.types.d.ts +19 -0
  141. package/dist/core/types/auth/request.types.js +15 -0
  142. package/dist/core/types/auth/request.types.js.map +1 -0
  143. package/dist/core/types/blockchain/chains.types.d.ts +3 -0
  144. package/dist/core/types/blockchain/chains.types.js +8 -0
  145. package/dist/core/types/blockchain/chains.types.js.map +1 -0
  146. package/dist/core/types/blockchain/contract.types.d.ts +8 -0
  147. package/dist/core/types/blockchain/contract.types.js +13 -0
  148. package/dist/core/types/blockchain/contract.types.js.map +1 -0
  149. package/dist/core/types/blockchain/index.d.ts +3 -0
  150. package/dist/core/types/blockchain/index.js +20 -0
  151. package/dist/core/types/blockchain/index.js.map +1 -0
  152. package/dist/core/types/blockchain/oz.relayer.types.d.ts +7 -0
  153. package/dist/core/types/blockchain/oz.relayer.types.js +13 -0
  154. package/dist/core/types/blockchain/oz.relayer.types.js.map +1 -0
  155. package/dist/core/types/index.d.ts +6 -0
  156. package/dist/core/types/index.js +23 -0
  157. package/dist/core/types/index.js.map +1 -0
  158. package/dist/core/types/indexers.types.d.ts +4 -0
  159. package/dist/core/types/indexers.types.js +9 -0
  160. package/dist/core/types/indexers.types.js.map +1 -0
  161. package/dist/core/types/misc.types.d.ts +6 -0
  162. package/dist/core/types/misc.types.js +11 -0
  163. package/dist/core/types/misc.types.js.map +1 -0
  164. package/dist/core/types/oracle/fixture.types.d.ts +75 -0
  165. package/dist/core/types/oracle/fixture.types.js +4 -0
  166. package/dist/core/types/oracle/fixture.types.js.map +1 -0
  167. package/dist/core/types/oracle/game/game.types.d.ts +108 -0
  168. package/dist/core/types/oracle/game/game.types.js +64 -0
  169. package/dist/core/types/oracle/game/game.types.js.map +1 -0
  170. package/dist/core/types/oracle/game/index.d.ts +2 -0
  171. package/dist/core/types/oracle/game/index.js +19 -0
  172. package/dist/core/types/oracle/game/index.js.map +1 -0
  173. package/dist/core/types/oracle/game/zod.game.types.d.ts +31 -0
  174. package/dist/core/types/oracle/game/zod.game.types.js +22 -0
  175. package/dist/core/types/oracle/game/zod.game.types.js.map +1 -0
  176. package/dist/core/types/oracle/index.d.ts +4 -0
  177. package/dist/core/types/oracle/index.js +21 -0
  178. package/dist/core/types/oracle/index.js.map +1 -0
  179. package/dist/core/types/oracle/market/index.d.ts +3 -0
  180. package/dist/core/types/oracle/market/index.js +20 -0
  181. package/dist/core/types/oracle/market/index.js.map +1 -0
  182. package/dist/core/types/oracle/market/markets.types.d.ts +95 -0
  183. package/dist/core/types/oracle/market/markets.types.js +35 -0
  184. package/dist/core/types/oracle/market/markets.types.js.map +1 -0
  185. package/dist/core/types/oracle/market/odds.types.d.ts +14 -0
  186. package/dist/core/types/oracle/market/odds.types.js +3 -0
  187. package/dist/core/types/oracle/market/odds.types.js.map +1 -0
  188. package/dist/core/types/oracle/market/positions.types.d.ts +57 -0
  189. package/dist/core/types/oracle/market/positions.types.js +3 -0
  190. package/dist/core/types/oracle/market/positions.types.js.map +1 -0
  191. package/dist/core/types/oracle/requests/game.request.types.d.ts +170 -0
  192. package/dist/core/types/oracle/requests/game.request.types.js +126 -0
  193. package/dist/core/types/oracle/requests/game.request.types.js.map +1 -0
  194. package/dist/core/types/oracle/requests/game.response.types.d.ts +8 -0
  195. package/dist/core/types/oracle/requests/game.response.types.js +3 -0
  196. package/dist/core/types/oracle/requests/game.response.types.js.map +1 -0
  197. package/dist/core/types/oracle/requests/index.d.ts +5 -0
  198. package/dist/core/types/oracle/requests/index.js +22 -0
  199. package/dist/core/types/oracle/requests/index.js.map +1 -0
  200. package/dist/core/types/oracle/requests/market.request.types.d.ts +63 -0
  201. package/dist/core/types/oracle/requests/market.request.types.js +41 -0
  202. package/dist/core/types/oracle/requests/market.request.types.js.map +1 -0
  203. package/dist/core/types/oracle/requests/odds.response.types.d.ts +2 -0
  204. package/dist/core/types/oracle/requests/odds.response.types.js +3 -0
  205. package/dist/core/types/oracle/requests/odds.response.types.js.map +1 -0
  206. package/dist/core/types/oracle/requests/user.request.type.d.ts +4 -0
  207. package/dist/core/types/oracle/requests/user.request.type.js +3 -0
  208. package/dist/core/types/oracle/requests/user.request.type.js.map +1 -0
  209. package/dist/core/types/privy.types.d.ts +4 -0
  210. package/dist/core/types/privy.types.js +9 -0
  211. package/dist/core/types/privy.types.js.map +1 -0
  212. package/dist/core/utils/converters.utils.d.ts +29 -0
  213. package/dist/core/utils/converters.utils.js +97 -0
  214. package/dist/core/utils/converters.utils.js.map +1 -0
  215. package/dist/core/utils/game.utils.d.ts +4 -0
  216. package/dist/core/utils/game.utils.js +79 -0
  217. package/dist/core/utils/game.utils.js.map +1 -0
  218. package/dist/core/utils/index.d.ts +4 -0
  219. package/dist/core/utils/index.js +21 -0
  220. package/dist/core/utils/index.js.map +1 -0
  221. package/dist/core/utils/misc.utils.d.ts +14 -0
  222. package/dist/core/utils/misc.utils.js +33 -0
  223. package/dist/core/utils/misc.utils.js.map +1 -0
  224. package/dist/core/utils/position.utils.d.ts +18 -0
  225. package/dist/core/utils/position.utils.js +68 -0
  226. package/dist/core/utils/position.utils.js.map +1 -0
  227. package/dist/core/validators/bytes.validators.d.ts +32 -0
  228. package/dist/core/validators/bytes.validators.js +47 -0
  229. package/dist/core/validators/bytes.validators.js.map +1 -0
  230. package/dist/core/validators/index.d.ts +2 -0
  231. package/dist/core/validators/index.js +19 -0
  232. package/dist/core/validators/index.js.map +1 -0
  233. package/dist/core/validators/mongo.validators.d.ts +2 -0
  234. package/dist/core/validators/mongo.validators.js +10 -0
  235. package/dist/core/validators/mongo.validators.js.map +1 -0
  236. package/dist/index.d.ts +1 -0
  237. package/dist/index.js +23 -0
  238. package/dist/index.js.map +1 -0
  239. package/dist/react/hooks/auth/index.d.ts +1 -0
  240. package/dist/react/hooks/auth/index.js +18 -0
  241. package/dist/react/hooks/auth/index.js.map +1 -0
  242. package/dist/react/hooks/auth/useAuthHeaders.d.ts +45 -0
  243. package/dist/react/hooks/auth/useAuthHeaders.js +58 -0
  244. package/dist/react/hooks/auth/useAuthHeaders.js.map +1 -0
  245. package/dist/react/hooks/contracts/erc20/index.d.ts +6 -0
  246. package/dist/react/hooks/contracts/erc20/index.js +23 -0
  247. package/dist/react/hooks/contracts/erc20/index.js.map +1 -0
  248. package/dist/react/hooks/contracts/erc20/useApproveErc20.d.ts +13 -0
  249. package/dist/react/hooks/contracts/erc20/useApproveErc20.js +28 -0
  250. package/dist/react/hooks/contracts/erc20/useApproveErc20.js.map +1 -0
  251. package/dist/react/hooks/contracts/erc20/useErc20Allowance.d.ts +10 -0
  252. package/dist/react/hooks/contracts/erc20/useErc20Allowance.js +34 -0
  253. package/dist/react/hooks/contracts/erc20/useErc20Allowance.js.map +1 -0
  254. package/dist/react/hooks/contracts/erc20/useErc20Balance.d.ts +22 -0
  255. package/dist/react/hooks/contracts/erc20/useErc20Balance.js +95 -0
  256. package/dist/react/hooks/contracts/erc20/useErc20Balance.js.map +1 -0
  257. package/dist/react/hooks/contracts/erc20/useErc20Decimals.d.ts +8 -0
  258. package/dist/react/hooks/contracts/erc20/useErc20Decimals.js +28 -0
  259. package/dist/react/hooks/contracts/erc20/useErc20Decimals.js.map +1 -0
  260. package/dist/react/hooks/contracts/erc20/useErc20Symbol.d.ts +8 -0
  261. package/dist/react/hooks/contracts/erc20/useErc20Symbol.js +28 -0
  262. package/dist/react/hooks/contracts/erc20/useErc20Symbol.js.map +1 -0
  263. package/dist/react/hooks/contracts/erc20/useTransferErc20.d.ts +13 -0
  264. package/dist/react/hooks/contracts/erc20/useTransferErc20.js +31 -0
  265. package/dist/react/hooks/contracts/erc20/useTransferErc20.js.map +1 -0
  266. package/dist/react/hooks/contracts/index.d.ts +3 -0
  267. package/dist/react/hooks/contracts/index.js +20 -0
  268. package/dist/react/hooks/contracts/index.js.map +1 -0
  269. package/dist/react/hooks/contracts/useContracts.d.ts +120 -0
  270. package/dist/react/hooks/contracts/useContracts.js +81 -0
  271. package/dist/react/hooks/contracts/useContracts.js.map +1 -0
  272. package/dist/react/hooks/contracts/useLevrMarketContractAddresses.d.ts +3 -0
  273. package/dist/react/hooks/contracts/useLevrMarketContractAddresses.js +27 -0
  274. package/dist/react/hooks/contracts/useLevrMarketContractAddresses.js.map +1 -0
  275. package/dist/react/hooks/index.d.ts +2 -0
  276. package/dist/react/hooks/index.js +19 -0
  277. package/dist/react/hooks/index.js.map +1 -0
  278. package/dist/react/index.d.ts +6 -0
  279. package/dist/react/index.js +23 -0
  280. package/dist/react/index.js.map +1 -0
  281. package/dist/react/injectedDependencies.d.ts +78 -0
  282. package/dist/react/injectedDependencies.js +94 -0
  283. package/dist/react/injectedDependencies.js.map +1 -0
  284. package/dist/react/queryClient.d.ts +9 -0
  285. package/dist/react/queryClient.js +13 -0
  286. package/dist/react/queryClient.js.map +1 -0
  287. package/dist/react/queryKeys.d.ts +17 -0
  288. package/dist/react/queryKeys.js +23 -0
  289. package/dist/react/queryKeys.js.map +1 -0
  290. package/dist/react/types/contracts.types.d.ts +4 -0
  291. package/dist/react/types/contracts.types.js +3 -0
  292. package/dist/react/types/contracts.types.js.map +1 -0
  293. package/dist/react/types/index.d.ts +1 -0
  294. package/dist/react/types/index.js +18 -0
  295. package/dist/react/types/index.js.map +1 -0
  296. package/dist/server/config/cloudflare.d.ts +30 -0
  297. package/dist/server/config/cloudflare.js +45 -0
  298. package/dist/server/config/cloudflare.js.map +1 -0
  299. package/dist/server/config/constants.d.ts +1 -0
  300. package/dist/server/config/constants.js +7 -0
  301. package/dist/server/config/constants.js.map +1 -0
  302. package/dist/server/config/dotenv.d.ts +35 -0
  303. package/dist/server/config/dotenv.js +42 -0
  304. package/dist/server/config/dotenv.js.map +1 -0
  305. package/dist/server/config/index.d.ts +9 -0
  306. package/dist/server/config/index.js +31 -0
  307. package/dist/server/config/index.js.map +1 -0
  308. package/dist/server/config/kms.d.ts +22 -0
  309. package/dist/server/config/kms.js +54 -0
  310. package/dist/server/config/kms.js.map +1 -0
  311. package/dist/server/config/prisma.d.ts +20 -0
  312. package/dist/server/config/prisma.js +40 -0
  313. package/dist/server/config/prisma.js.map +1 -0
  314. package/dist/server/config/redis.d.ts +57 -0
  315. package/dist/server/config/redis.js +121 -0
  316. package/dist/server/config/redis.js.map +1 -0
  317. package/dist/server/config/urls.d.ts +49 -0
  318. package/dist/server/config/urls.js +7 -0
  319. package/dist/server/config/urls.js.map +1 -0
  320. package/dist/server/config/winston.d.ts +3 -0
  321. package/dist/server/config/winston.js +14 -0
  322. package/dist/server/config/winston.js.map +1 -0
  323. package/dist/server/contracts/clients/index.d.ts +1 -0
  324. package/dist/server/contracts/clients/index.js +18 -0
  325. package/dist/server/contracts/clients/index.js.map +1 -0
  326. package/dist/server/contracts/clients/ozRelayerService.d.ts +18 -0
  327. package/dist/server/contracts/clients/ozRelayerService.js +167 -0
  328. package/dist/server/contracts/clients/ozRelayerService.js.map +1 -0
  329. package/dist/server/contracts/index.d.ts +2 -0
  330. package/dist/server/contracts/index.js +19 -0
  331. package/dist/server/contracts/index.js.map +1 -0
  332. package/dist/server/contracts/instances.d.ts +20 -0
  333. package/dist/server/contracts/instances.js +28 -0
  334. package/dist/server/contracts/instances.js.map +1 -0
  335. package/dist/server/index.d.ts +11 -0
  336. package/dist/server/index.js +36 -0
  337. package/dist/server/index.js.map +1 -0
  338. package/dist/server/instrumentation.d.ts +9 -0
  339. package/dist/server/instrumentation.js +37 -0
  340. package/dist/server/instrumentation.js.map +1 -0
  341. package/dist/server/liquidation-engine/index.d.ts +3 -0
  342. package/dist/server/liquidation-engine/index.js +20 -0
  343. package/dist/server/liquidation-engine/index.js.map +1 -0
  344. package/dist/server/liquidation-engine/redis.cache.manager/cache.keys.util.d.ts +10 -0
  345. package/dist/server/liquidation-engine/redis.cache.manager/cache.keys.util.js +15 -0
  346. package/dist/server/liquidation-engine/redis.cache.manager/cache.keys.util.js.map +1 -0
  347. package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.d.ts +124 -0
  348. package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.js +242 -0
  349. package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.js.map +1 -0
  350. package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.test.d.ts +1 -0
  351. package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.test.js +115 -0
  352. package/dist/server/liquidation-engine/redis.cache.manager/prices.set.manager.test.js.map +1 -0
  353. package/dist/server/liquidation-engine/types/index.d.ts +1 -0
  354. package/dist/server/liquidation-engine/types/index.js +3 -0
  355. package/dist/server/liquidation-engine/types/index.js.map +1 -0
  356. package/dist/server/middleware/auth/cloudflare.handler.d.ts +6 -0
  357. package/dist/server/middleware/auth/cloudflare.handler.js +37 -0
  358. package/dist/server/middleware/auth/cloudflare.handler.js.map +1 -0
  359. package/dist/server/middleware/auth/hmac.handler.d.ts +11 -0
  360. package/dist/server/middleware/auth/hmac.handler.js +157 -0
  361. package/dist/server/middleware/auth/hmac.handler.js.map +1 -0
  362. package/dist/server/middleware/auth/index.d.ts +3 -0
  363. package/dist/server/middleware/auth/index.js +20 -0
  364. package/dist/server/middleware/auth/index.js.map +1 -0
  365. package/dist/server/middleware/auth/privy.handler.d.ts +7 -0
  366. package/dist/server/middleware/auth/privy.handler.js +31 -0
  367. package/dist/server/middleware/auth/privy.handler.js.map +1 -0
  368. package/dist/server/middleware/index.d.ts +2 -0
  369. package/dist/server/middleware/index.js +19 -0
  370. package/dist/server/middleware/index.js.map +1 -0
  371. package/dist/server/middleware/multiAuth.examples.d.ts +46 -0
  372. package/dist/server/middleware/multiAuth.examples.js +123 -0
  373. package/dist/server/middleware/multiAuth.examples.js.map +1 -0
  374. package/dist/server/middleware/multiAuth.middleware.d.ts +30 -0
  375. package/dist/server/middleware/multiAuth.middleware.js +90 -0
  376. package/dist/server/middleware/multiAuth.middleware.js.map +1 -0
  377. package/dist/server/middleware/rateLimit.middleware.d.ts +1 -0
  378. package/dist/server/middleware/rateLimit.middleware.js +19 -0
  379. package/dist/server/middleware/rateLimit.middleware.js.map +1 -0
  380. package/dist/server/oracle/index.d.ts +3 -0
  381. package/dist/server/oracle/index.js +20 -0
  382. package/dist/server/oracle/index.js.map +1 -0
  383. package/dist/server/oracle/redis-cache-manager/cache.keys.utils.d.ts +90 -0
  384. package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js +147 -0
  385. package/dist/server/oracle/redis-cache-manager/cache.keys.utils.js.map +1 -0
  386. package/dist/server/oracle/redis-cache-manager/channels.d.ts +2 -0
  387. package/dist/server/oracle/redis-cache-manager/channels.js +11 -0
  388. package/dist/server/oracle/redis-cache-manager/channels.js.map +1 -0
  389. package/dist/server/oracle/redis-cache-manager/game.cache.service.d.ts +184 -0
  390. package/dist/server/oracle/redis-cache-manager/game.cache.service.js +698 -0
  391. package/dist/server/oracle/redis-cache-manager/game.cache.service.js.map +1 -0
  392. package/dist/server/oracle/redis-cache-manager/index.d.ts +4 -0
  393. package/dist/server/oracle/redis-cache-manager/index.js +21 -0
  394. package/dist/server/oracle/redis-cache-manager/index.js.map +1 -0
  395. package/dist/server/oracle/redis-cache-manager/market.cache.service.d.ts +115 -0
  396. package/dist/server/oracle/redis-cache-manager/market.cache.service.js +279 -0
  397. package/dist/server/oracle/redis-cache-manager/market.cache.service.js.map +1 -0
  398. package/dist/server/oracle/rmq-manager/base.queue.manager.d.ts +21 -0
  399. package/dist/server/oracle/rmq-manager/base.queue.manager.js +128 -0
  400. package/dist/server/oracle/rmq-manager/base.queue.manager.js.map +1 -0
  401. package/dist/server/oracle/rmq-manager/index.d.ts +2 -0
  402. package/dist/server/oracle/rmq-manager/index.js +19 -0
  403. package/dist/server/oracle/rmq-manager/index.js.map +1 -0
  404. package/dist/server/oracle/rmq-manager/queue.configs.d.ts +5 -0
  405. package/dist/server/oracle/rmq-manager/queue.configs.js +38 -0
  406. package/dist/server/oracle/rmq-manager/queue.configs.js.map +1 -0
  407. package/dist/server/oracle/types/index.d.ts +2 -0
  408. package/dist/server/oracle/types/index.js +19 -0
  409. package/dist/server/oracle/types/index.js.map +1 -0
  410. package/dist/server/oracle/types/providers/index.d.ts +4 -0
  411. package/dist/server/oracle/types/providers/index.js +21 -0
  412. package/dist/server/oracle/types/providers/index.js.map +1 -0
  413. package/dist/server/oracle/types/providers/lsports.types.d.ts +148 -0
  414. package/dist/server/oracle/types/providers/lsports.types.js +13 -0
  415. package/dist/server/oracle/types/providers/lsports.types.js.map +1 -0
  416. package/dist/server/oracle/types/providers/optic.odds.types.d.ts +293 -0
  417. package/dist/server/oracle/types/providers/optic.odds.types.js +140 -0
  418. package/dist/server/oracle/types/providers/optic.odds.types.js.map +1 -0
  419. package/dist/server/oracle/types/providers/providers.types.d.ts +5 -0
  420. package/dist/server/oracle/types/providers/providers.types.js +10 -0
  421. package/dist/server/oracle/types/providers/providers.types.js.map +1 -0
  422. package/dist/server/oracle/types/providers/rundown.types.d.ts +194 -0
  423. package/dist/server/oracle/types/providers/rundown.types.js +22 -0
  424. package/dist/server/oracle/types/providers/rundown.types.js.map +1 -0
  425. package/dist/server/oracle/types/queue/index.d.ts +2 -0
  426. package/dist/server/oracle/types/queue/index.js +19 -0
  427. package/dist/server/oracle/types/queue/index.js.map +1 -0
  428. package/dist/server/oracle/types/queue/queue.constant.d.ts +10 -0
  429. package/dist/server/oracle/types/queue/queue.constant.js +14 -0
  430. package/dist/server/oracle/types/queue/queue.constant.js.map +1 -0
  431. package/dist/server/oracle/types/queue/queue.types.d.ts +5 -0
  432. package/dist/server/oracle/types/queue/queue.types.js +3 -0
  433. package/dist/server/oracle/types/queue/queue.types.js.map +1 -0
  434. package/dist/server/prisma/index.d.ts +2 -0
  435. package/dist/server/prisma/index.js +24 -0
  436. package/dist/server/prisma/index.js.map +1 -0
  437. package/dist/server/repositories/apiKey.repository.d.ts +7 -0
  438. package/dist/server/repositories/apiKey.repository.js +19 -0
  439. package/dist/server/repositories/apiKey.repository.js.map +1 -0
  440. package/dist/server/repositories/index.d.ts +1 -0
  441. package/dist/server/repositories/index.js +18 -0
  442. package/dist/server/repositories/index.js.map +1 -0
  443. package/dist/server/services/cloudflare.service.d.ts +12 -0
  444. package/dist/server/services/cloudflare.service.js +24 -0
  445. package/dist/server/services/cloudflare.service.js.map +1 -0
  446. package/dist/server/services/crypto.service.d.ts +17 -0
  447. package/dist/server/services/crypto.service.js +50 -0
  448. package/dist/server/services/crypto.service.js.map +1 -0
  449. package/dist/server/services/hmac.service.d.ts +52 -0
  450. package/dist/server/services/hmac.service.js +115 -0
  451. package/dist/server/services/hmac.service.js.map +1 -0
  452. package/dist/server/services/index.d.ts +5 -0
  453. package/dist/server/services/index.js +22 -0
  454. package/dist/server/services/index.js.map +1 -0
  455. package/dist/server/services/presigned.urls.d.ts +11 -0
  456. package/dist/server/services/presigned.urls.js +41 -0
  457. package/dist/server/services/presigned.urls.js.map +1 -0
  458. package/dist/server/services/privy.service.d.ts +30 -0
  459. package/dist/server/services/privy.service.js +122 -0
  460. package/dist/server/services/privy.service.js.map +1 -0
  461. package/dist/server/test-relayers.d.ts +1 -0
  462. package/dist/server/test-relayers.js +17 -0
  463. package/dist/server/test-relayers.js.map +1 -0
  464. package/dist/server/types/auth.types.d.ts +8 -0
  465. package/dist/server/types/auth.types.js +3 -0
  466. package/dist/server/types/auth.types.js.map +1 -0
  467. package/dist/server/types/global.types.d.ts +35 -0
  468. package/dist/server/types/global.types.js +4 -0
  469. package/dist/server/types/global.types.js.map +1 -0
  470. package/dist/server/types/index.d.ts +2 -0
  471. package/dist/server/types/index.js +19 -0
  472. package/dist/server/types/index.js.map +1 -0
  473. package/dist/server/utils/express.utils.d.ts +24 -0
  474. package/dist/server/utils/express.utils.js +36 -0
  475. package/dist/server/utils/express.utils.js.map +1 -0
  476. package/dist/server/utils/index.d.ts +2 -0
  477. package/dist/server/utils/index.js +19 -0
  478. package/dist/server/utils/index.js.map +1 -0
  479. package/dist/server/utils/tracing/index.d.ts +2 -0
  480. package/dist/server/utils/tracing/index.js +19 -0
  481. package/dist/server/utils/tracing/index.js.map +1 -0
  482. package/dist/server/utils/tracing/trace.d.ts +12 -0
  483. package/dist/server/utils/tracing/trace.js +50 -0
  484. package/dist/server/utils/tracing/trace.js.map +1 -0
  485. package/dist/server/utils/tracing/wrap.module.with.tracing.d.ts +126 -0
  486. package/dist/server/utils/tracing/wrap.module.with.tracing.js +202 -0
  487. package/dist/server/utils/tracing/wrap.module.with.tracing.js.map +1 -0
  488. package/package.json +126 -0
@@ -0,0 +1,147 @@
1
+ "use strict";
2
+ /**
3
+ * @memberof RedisCacheKeysUtils
4
+ * @description Key for storing the mapping of fixture ids to levr ids in redis
5
+ *
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.getRevokedApiKey = exports.getGamesKeyByChainId = exports.getCompletedMarketsField = exports.getCompletedMarketsKey = exports.getGameToMarketsOfOddsInCacheKey = exports.getMarketOddsByGameUniqueIdKeyAndMarketType = exports.getMarketOddsByMarketIdKey = exports.getLevrFixtureIdToProviderIdsKey = exports.getProviderIdsToLevrFixtureIdKey = exports.getMarketOddsField = exports.getCachedLevrByFixtureIdKey = exports.getCacheLevrGameIdKey = exports.getMoneylineByGameIdKey = exports.cacheTimeInvalidation = exports.marketByGameUniqueIdKeyAndMarketType = exports.marketByMarketIdKey = exports.marketOddsKey = exports.baseBallGamePeriodInfo = exports.gameToMarketOfOddsInCache = exports.levrGames = exports.getGameScoreByFixtureIdHash = exports.gameIdsToFixtureIds = exports.gameIdsToLevrFixtureIdsMap = exports.schedulesHash = exports.RedisNumStates = exports.GameCollectionKeys = exports.queueBlockHashKey = exports.levrIdToProviderIds = exports.providerFixtureIdToLevrId = void 0;
9
+ exports.providerFixtureIdToLevrId = "provider_fixture_id_to_levrId";
10
+ exports.levrIdToProviderIds = "levr_id_to_provider_ids";
11
+ exports.queueBlockHashKey = "queue_block_key";
12
+ var GameCollectionKeys;
13
+ (function (GameCollectionKeys) {
14
+ GameCollectionKeys["activeGamesHash"] = "active_games_hash";
15
+ GameCollectionKeys["postGamesHash"] = "post_games_hash";
16
+ })(GameCollectionKeys || (exports.GameCollectionKeys = GameCollectionKeys = {}));
17
+ var RedisNumStates;
18
+ (function (RedisNumStates) {
19
+ RedisNumStates[RedisNumStates["success"] = 1] = "success";
20
+ RedisNumStates[RedisNumStates["failure"] = 0] = "failure";
21
+ })(RedisNumStates || (exports.RedisNumStates = RedisNumStates = {}));
22
+ exports.schedulesHash = "schedules_hash";
23
+ exports.gameIdsToLevrFixtureIdsMap = "game_ids_to_levr_ids";
24
+ /**
25
+ * @memberof RedisCacheKeysUtils
26
+ * @description Key for storing the mapping of levr ids to fixture ids in redis
27
+ */
28
+ exports.gameIdsToFixtureIds = "game_ids_to_fixture_ids";
29
+ /**
30
+ * @memberof RedisCacheKeysUtils
31
+ * @description stores the list moneylines for the given gameId appended to it
32
+ */
33
+ const moneyLineByGameId = "moneyline_by_game_Id_";
34
+ /**
35
+ * @memberof RedisCacheKeysUtils
36
+ * @description stores the list of scores for the given gameId appended to it
37
+ */
38
+ exports.getGameScoreByFixtureIdHash = "game_scores_by_fixture_id_hash";
39
+ /**
40
+ * @memberof RedisCacheKeysUtils
41
+ * @description stores the list of all levr games in cache
42
+ */
43
+ exports.levrGames = "levr_games";
44
+ /**
45
+ * @memberof RedisCacheKeysUtils
46
+ * @description stores the levr game for the given gameId appended to it
47
+
48
+ *
49
+ */
50
+ const levrGame = "levr_game_";
51
+ exports.gameToMarketOfOddsInCache = "game_to_market_ids_of_odds_in_cache_";
52
+ /**
53
+ * @memberof RedisCacheKeysUtils
54
+ * @description stores the game period info for the given gameId appended to it
55
+ * @example {
56
+ * gameId: 1,
57
+ * period: 1,
58
+ * timeUpdated: 1714857600
59
+ * }
60
+ */
61
+ exports.baseBallGamePeriodInfo = "baseball_game_period_info";
62
+ /**
63
+ * @memberof RedisCacheKeysUtils
64
+ * @description stores the full time odds for the given gameId appended to it
65
+ * @example {
66
+ * gameId: 1,
67
+ * odds:
68
+ * }
69
+ */
70
+ exports.marketOddsKey = "market_odds";
71
+ exports.marketByMarketIdKey = "market_by_market_id_";
72
+ exports.marketByGameUniqueIdKeyAndMarketType = "market_by_game_unique_id_";
73
+ /**
74
+ * @memberof RedisCacheKeysUtils
75
+ * @description stores the time invalidation for the cache
76
+ */
77
+ exports.cacheTimeInvalidation = 60; // 1 minute.
78
+ /** @audit levr fixture ids must be the same for games across all chains */
79
+ /**
80
+ * @memberof RedisCacheKeysUtils
81
+ * @param gameId
82
+ * @returns
83
+ */
84
+ const getMoneylineByGameIdKey = (gameId) => {
85
+ return `${moneyLineByGameId}${gameId.toString()}`;
86
+ };
87
+ exports.getMoneylineByGameIdKey = getMoneylineByGameIdKey;
88
+ /**
89
+ * @memberof RedisCacheKeysUtils
90
+ * @param gameId
91
+ * @returns
92
+ */
93
+ const getCacheLevrGameIdKey = (gameId) => {
94
+ return `${levrGame}${gameId.toString()}`;
95
+ };
96
+ exports.getCacheLevrGameIdKey = getCacheLevrGameIdKey;
97
+ /**
98
+ * @memberof RedisCacheKeysUtils
99
+ * @param fixtureId
100
+ * @returns
101
+ */
102
+ const getCachedLevrByFixtureIdKey = (fixtureId, chainId) => {
103
+ return `${levrGame}${fixtureId}_${chainId.toString()}`;
104
+ };
105
+ exports.getCachedLevrByFixtureIdKey = getCachedLevrByFixtureIdKey;
106
+ const getMarketOddsField = (gameUniqueId, marketType) => {
107
+ return `${gameUniqueId}:${marketType}`;
108
+ };
109
+ exports.getMarketOddsField = getMarketOddsField;
110
+ const getProviderIdsToLevrFixtureIdKey = (providerId) => {
111
+ return `${exports.providerFixtureIdToLevrId}${providerId}`;
112
+ };
113
+ exports.getProviderIdsToLevrFixtureIdKey = getProviderIdsToLevrFixtureIdKey;
114
+ const getLevrFixtureIdToProviderIdsKey = (levrFixtureId) => {
115
+ return `${exports.levrIdToProviderIds}${levrFixtureId}`;
116
+ };
117
+ exports.getLevrFixtureIdToProviderIdsKey = getLevrFixtureIdToProviderIdsKey;
118
+ const getMarketOddsByMarketIdKey = (marketId) => {
119
+ return `${exports.marketByMarketIdKey}${marketId}`;
120
+ };
121
+ exports.getMarketOddsByMarketIdKey = getMarketOddsByMarketIdKey;
122
+ const getMarketOddsByGameUniqueIdKeyAndMarketType = (gameUniqueId) => {
123
+ return `${exports.marketByGameUniqueIdKeyAndMarketType}${gameUniqueId}`;
124
+ };
125
+ exports.getMarketOddsByGameUniqueIdKeyAndMarketType = getMarketOddsByGameUniqueIdKeyAndMarketType;
126
+ const getGameToMarketsOfOddsInCacheKey = (gameUniqueId) => {
127
+ return `${exports.gameToMarketOfOddsInCache}${gameUniqueId}`;
128
+ };
129
+ exports.getGameToMarketsOfOddsInCacheKey = getGameToMarketsOfOddsInCacheKey;
130
+ const getCompletedMarketsKey = (marketType) => {
131
+ return `completed_markets:${marketType}`;
132
+ };
133
+ exports.getCompletedMarketsKey = getCompletedMarketsKey;
134
+ const getCompletedMarketsField = (gameUniqueId, marketType) => {
135
+ return `${gameUniqueId}:${marketType}:completed`;
136
+ };
137
+ exports.getCompletedMarketsField = getCompletedMarketsField;
138
+ const getGamesKeyByChainId = (gameCollectionKey, chainId) => {
139
+ return `${gameCollectionKey}_${chainId.toString()}`;
140
+ };
141
+ exports.getGamesKeyByChainId = getGamesKeyByChainId;
142
+ // auth
143
+ const getRevokedApiKey = (keyId) => {
144
+ return `revoked:${keyId}`;
145
+ };
146
+ exports.getRevokedApiKey = getRevokedApiKey;
147
+ //# sourceMappingURL=cache.keys.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.keys.utils.js","sourceRoot":"","sources":["../../../../src/server/oracle/redis-cache-manager/cache.keys.utils.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ import Redis from "ioredis";
2
+ export declare const publishToChannel: (redis: Redis, channel: string, data: unknown) => Promise<void>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.publishToChannel = void 0;
4
+ const cache_keys_utils_1 = require("./cache.keys.utils");
5
+ const publishToChannel = async (redis, channel, data) => {
6
+ const success = (await redis.publish(channel, JSON.stringify(data)));
7
+ if (success <= cache_keys_utils_1.RedisNumStates.failure)
8
+ throw Error(`Failed to publish to redis channel ${channel}`);
9
+ };
10
+ exports.publishToChannel = publishToChannel;
11
+ //# sourceMappingURL=channels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channels.js","sourceRoot":"","sources":["../../../../src/server/oracle/redis-cache-manager/channels.ts"],"names":[],"mappings":";;;AACA,yDAAmD;AAE5C,MAAM,gBAAgB,GAAG,KAAK,EAAE,KAAY,EAAE,OAAe,EAAE,IAAa,EAAiB,EAAE;IAClG,MAAM,OAAO,GAAG,CAAC,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAmB,CAAA;IACtF,IAAI,OAAO,IAAI,iCAAc,CAAC,OAAO;QAAE,MAAM,KAAK,CAAC,sCAAsC,OAAO,EAAE,CAAC,CAAA;AACvG,CAAC,CAAA;AAHY,QAAA,gBAAgB,oBAG5B"}
@@ -0,0 +1,184 @@
1
+ /**
2
+ * @fileoverview Game Cache Service - Manages Redis caching operations for game-related data
3
+ * This module provides functionality for caching and retrieving game data, including:
4
+ * - Game schedules
5
+ * - Active and post-game data
6
+ * - Game scores and period information
7
+ * - Fixture ID mappings between different providers
8
+ *
9
+ * @module game.cache.service
10
+ */
11
+ import { type ChainableCommander, Redis } from "ioredis";
12
+ import { FixtureIdsType, GamePhase, LevrChain, LevrGame, LevrGameWithRelationsPeriphery, LevrScores } from "../../../core";
13
+ import { GameCollectionKeys } from "./cache.keys.utils";
14
+ /**
15
+ * Caches active games in Redis.
16
+ * @param {ChainableCommander} pipeline - Redis pipeline
17
+ * @param {string} levrFixtureId - Fixture identifier
18
+ * @param {LevrGame[]} games - Games to cache
19
+ * @returns {Promise<void>}
20
+ */
21
+ export declare const setActiveGamesCache: (pipeline: ChainableCommander, games: LevrGame[]) => Promise<void>;
22
+ /**
23
+ * Caches post-game data in Redis.
24
+ * @param {ChainableCommander} pipeline - Redis pipeline
25
+ * @param {string} levrFixtureId - Fixture identifier
26
+ * @param {LevrGame[]} games - Games to cache
27
+ * @returns {Promise<void>}
28
+ */
29
+ export declare const setPostGamesCache: (pipeline: ChainableCommander, games: LevrGame[]) => Promise<void>;
30
+ /**
31
+ * Retrieves a game from the Redis cache using its game ID.
32
+ * @param gameId - The ID of the game.
33
+ * @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
34
+ */
35
+ export declare const getActiveGameCacheByGameId: (redis: Redis, gameId: number, chainId: LevrChain) => Promise<LevrGame | null>;
36
+ /**
37
+ * Retrieves a game from the Redis cache using its game ID.
38
+ * @param gameId - The ID of the game.
39
+ * @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
40
+ */
41
+ export declare const getPostGameCacheByGameId: (redis: Redis, gameId: number, chainId: LevrChain) => Promise<LevrGame | null>;
42
+ /**
43
+ * Retrieves all games for a given fixture ID from the Redis cache.
44
+ * @param redis
45
+ * @param levrFixtureId
46
+ * @param gameCollectionKey
47
+ * @returns {Promise<LevrGame[]>} - A promise that resolves with an array of LevrGame objects.
48
+ * @notice all games are related to the fixtureId across all chains.
49
+ */
50
+ export declare const getGamesByFixtureId: (redis: Redis, levrFixtureId: string, gameCollectionKey: GameCollectionKeys) => Promise<LevrGame[]>;
51
+ /**
52
+ * Retrieves all active games for a given fixture ID from the Redis cache.
53
+ * @param redis - Redis client instance
54
+ * @param levrFixtureId - The unique identifier for the fixture
55
+ * @param gameCollectionKey - The Redis hash key under which the games are stored
56
+ * @returns {Promise<LevrGame[]>} - A promise that resolves with an array of LevrGame objects
57
+ * @notice all games are related to the fixtureId across all chains.
58
+ */
59
+ export declare const getActiveGamesByFixtureId: (redis: Redis, levrFixtureId: string) => Promise<LevrGame[]>;
60
+ export declare const getPostGamesByFixtureId: (redis: Redis, levrFixtureId: string) => Promise<LevrGame[]>;
61
+ /**
62
+ * Retrieves specific games from the cache based on game IDs
63
+ *
64
+ * @param redis - Redis client instance
65
+ * @param gameCollectionKey - Key for the game collection in Redis
66
+ * @param gameIds - Array of game IDs to retrieve
67
+ * @param chainId - Blockchain network chain ID
68
+ *
69
+ * @returns Promise containing array of LevrGame objects
70
+ *
71
+ * Process:
72
+ * 1. Uses Redis pipeline for batch operations
73
+ * 2. Looks up fixture IDs from gameIdsToLevrFixtureIdsMap using game IDs
74
+ * 3. Filters out null fixture IDs and creates cache keys for each fixture
75
+ * 4. Retrieves game data from gameCollectionKey using fixture cache keys
76
+ * 5. Parses JSON strings into LevrGame objects
77
+ * 6. Returns flattened array of games
78
+ */
79
+ export declare const getSpecificGamesCacheByGameIds: (redis: Redis, gameCollectionKey: GameCollectionKeys, gameIds: string[], chainId: LevrChain, withRelations?: boolean) => Promise<LevrGame[] | LevrGameWithRelationsPeriphery[]>;
80
+ export declare const getSpecificGamesCacheByFixtureIds: (redis: Redis, fixtureIds: string[], chainId: LevrChain, withRelations?: boolean, active?: boolean) => Promise<LevrGame[] | LevrGameWithRelationsPeriphery[]>;
81
+ export declare const getActiveGamesCache: (redis: Redis, chainId: LevrChain) => Promise<LevrGame[]>;
82
+ export declare const getActiveGamesCacheWithRelations: (redis: Redis, chainId: LevrChain) => Promise<LevrGameWithRelationsPeriphery[]>;
83
+ export declare const getPostGamesCache: (redis: Redis, chainId: LevrChain) => Promise<LevrGame[]>;
84
+ /**
85
+ * Retrieves active games from the Redis cache using its fixture ID.
86
+ * @param fixtureId - The unique identifier for the fixture.
87
+ * @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
88
+ */
89
+ export declare const getGameCacheByFixtureId: (redis: Redis, fixtureId: string) => Promise<LevrGame[] | null>;
90
+ /**
91
+ * Retrieves a game from the Redis cache using the provider's fixture ID.
92
+ * @param providerFixtureId - The fixture ID provided by the odds provider, e.g (lsports, rundown, optic odds)
93
+ * @returns {Promise<LevrGame | null>} - A promise that resolves with a LevrGame object or null if not found.
94
+ */
95
+ export declare const getGameCacheByFixtureIdWithProviderFixtureId: (redis: Redis, providerFixtureId: string) => Promise<LevrGame[] | null>;
96
+ export declare const removeActiveGamesCache: (redis: Redis, levrFixtureId: string, chainId: LevrChain) => Promise<void>;
97
+ export declare const removePostGamesCache: (redis: Redis, levrFixtureId: string, chainId: LevrChain) => Promise<void>;
98
+ /**
99
+ * Maps a game ID to a Levr fixture ID in Redis.
100
+ * @param gameId - The game ID to be mapped.
101
+ * @param levrFixtureId - The corresponding Levr fixture ID.
102
+ * @returns {Promise<void>} - A promise that resolves when the operation is complete.
103
+ */
104
+ export declare const mapGameIdToLevrFixtureId: (redis: Redis, gameId: number, levrFixtureId: string) => Promise<void>;
105
+ export declare const mapProviderFixtureIdToLevrFixtureId: (redis: Redis, fixtureIds: FixtureIdsType) => Promise<void>;
106
+ export declare const mapProviderFixtureIdToLevrFixtureIdMany: (pipeline: ChainableCommander, fixtureIdsList: FixtureIdsType[]) => Promise<void>;
107
+ /**
108
+ * Retrieves the Levr fixture ID using a game ID from Redis.
109
+ * @param gameId - The ID of the game.
110
+ * @returns {Promise<string | null>} - A promise that resolves with the Levr fixture ID or null if not found.
111
+ */
112
+ export declare const getLevrFixtureIdUsingGameId: (redis: Redis, gameId: number) => Promise<string | null>;
113
+ /**
114
+ * Updates the game clock in the Redis cache or in the database if not found in cache.
115
+ * @param gameId - The ID of the game.
116
+ * @param gameClock - The current game clock value.
117
+ * @param gamePeriod - The current game period.
118
+ * @returns {Promise<void>} - A promise that resolves when the operation is complete.
119
+ */
120
+ export declare const updateGamesClockInCache: (redis: Redis, levrFixtureId: string, gameClock: string, gamePeriod: number) => Promise<void>;
121
+ /**
122
+ * Sets the game score in the Redis cache.
123
+ * @param gameId - The ID of the game.
124
+ * @param score - The Scores object to be cached.
125
+ * @returns {Promise<void>} - A promise that resolves when the operation is complete.
126
+ */
127
+ export declare const setGamesScoreCache: (redis: Redis, fixtureId: string, score: LevrScores) => Promise<void>;
128
+ /**
129
+ * Retrieves the game score from the Redis cache.
130
+ * @param gameId - The ID of the game.
131
+ * @returns {Promise<LevrScores | null>} - A promise that resolves with a Scores object or null if not found.
132
+ */
133
+ export declare const getGameScoreCache: (redis: Redis, fixtureId: string) => Promise<LevrScores | null>;
134
+ /**
135
+ * Updates the game status in the Redis cache or in the database if not found in cache.
136
+ * @param gameId - The ID of the game.
137
+ * @param gamePhase - The new GamePhase value.
138
+ * @returns {Promise<void>} - A promise that resolves when the operation is complete.
139
+ */
140
+ export declare const updateGameStatusInCache: (redis: Redis, gameIds: number[], levrFixtureId: string, gamePhase: GamePhase) => Promise<void>;
141
+ /**
142
+ * Deletes all sub-keys associated with a given Levr fixture ID.
143
+ * @param levrFixtureId - The Levr fixture ID.
144
+ * @returns {Promise<void>} - A promise that resolves when the operation is complete.
145
+ */
146
+ export declare const deleteAllSubKeys: (redis: Redis, levrFixtureId: string) => Promise<void>;
147
+ /**
148
+ * Invalidates the game score cache.
149
+ * @param gameId - The ID of the game.
150
+ * @returns {Promise<void>} - A promise that resolves when the operation is complete.
151
+ */
152
+ export declare const invalidateScoreCache: (redis: Redis, fixtureId: string, callbackPromise: () => Promise<void>) => Promise<void>;
153
+ /**
154
+ * Retrieves all provider fixture IDs associated with multiple Levr fixture IDs.
155
+ *
156
+ * This function queries Redis to find all provider-specific fixture IDs that correspond
157
+ * to the given Levr fixture IDs. It uses a Redis pipeline to efficiently batch
158
+ * multiple queries into a single network request.
159
+ *
160
+ * @param redis - The Redis client instance used to perform the queries
161
+ * @param levrFixtureIda - An array of Levr fixture IDs to look up
162
+ *
163
+ * @returns A Promise resolving to a Record/object where:
164
+ * - Keys are Levr fixture IDs from the input array
165
+ * - Values are arrays of provider-specific fixture IDs associated with each Levr ID
166
+ * - If a Levr ID has no associated provider IDs or doesn't exist, it will map to an empty array
167
+ *
168
+ * @example
169
+ * Get provider IDs for two Levr fixture IDs
170
+ * const providerMap = await getAllProvidersIdsForLevrFixtureIds(redisClient, ['levr-123', 'levr-456']);
171
+ * Result might be: { 'levr-123': ['provider1-789', 'provider2-012'], 'levr-456': ['provider1-345'] }
172
+ *
173
+ * @throws Will throw an error if the Redis operation fails
174
+ */
175
+ export declare const getAllProvidersIdsForLevrFixtureIds: (redis: Redis, levrFixtureIds: string[]) => Promise<Record<string, string[]>>;
176
+ /**
177
+ * Gets all fixture IDs associated with a list of game IDs from Redis
178
+ *
179
+ * @param redis - Redis client instance
180
+ * @param gameIds - Array of game IDs to lookup
181
+ * @returns Record mapping game IDs to arrays of fixture IDs
182
+ * @throws Will throw an error if the Redis operation fails
183
+ */
184
+ export declare const getAllFixtureIdsForGameIds: (redis: Redis, gameIds: string[]) => Promise<Record<string, string[]>>;