@symmio/trading-react 1.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (543) hide show
  1. package/dist/account-layer/index.d.ts +1 -0
  2. package/dist/account-layer/index.d.ts.map +1 -1
  3. package/dist/account-layer/index.js +26 -25
  4. package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts +53 -0
  5. package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts.map +1 -0
  6. package/dist/account-layer/use-deallocate-and-initiate-withdraw.js +49 -0
  7. package/dist/account-layer/use-deallocate-and-initiate-withdraw.js.map +1 -0
  8. package/dist/account-layer/use-deposit-and-allocate.d.ts +4 -2
  9. package/dist/account-layer/use-deposit-and-allocate.d.ts.map +1 -1
  10. package/dist/account-layer/use-deposit-and-allocate.js +17 -15
  11. package/dist/account-layer/use-deposit-and-allocate.js.map +1 -1
  12. package/dist/account-layer/use-edit-account-name.d.ts.map +1 -1
  13. package/dist/account-layer/use-edit-account-name.js +14 -14
  14. package/dist/account-layer/use-edit-account-name.js.map +1 -1
  15. package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.d.ts +1 -1
  16. package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.js.map +1 -1
  17. package/dist/candles/index.d.ts +5 -0
  18. package/dist/candles/index.d.ts.map +1 -0
  19. package/dist/candles/index.js +5 -0
  20. package/dist/candles/use-binance-candle-source.d.ts +27 -0
  21. package/dist/candles/use-binance-candle-source.d.ts.map +1 -0
  22. package/dist/candles/use-binance-candle-source.js +24 -0
  23. package/dist/candles/use-binance-candle-source.js.map +1 -0
  24. package/dist/candles/use-candle-stream.d.ts +65 -0
  25. package/dist/candles/use-candle-stream.d.ts.map +1 -0
  26. package/dist/candles/use-candle-stream.js +44 -0
  27. package/dist/candles/use-candle-stream.js.map +1 -0
  28. package/dist/candles/use-candles.d.ts +40 -0
  29. package/dist/candles/use-candles.d.ts.map +1 -0
  30. package/dist/candles/use-candles.js +22 -0
  31. package/dist/candles/use-candles.js.map +1 -0
  32. package/dist/candles/use-tradingview-datafeed.d.ts +31 -0
  33. package/dist/candles/use-tradingview-datafeed.d.ts.map +1 -0
  34. package/dist/candles/use-tradingview-datafeed.js +21 -0
  35. package/dist/candles/use-tradingview-datafeed.js.map +1 -0
  36. package/dist/index.d.ts +125 -21
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +201 -113
  39. package/dist/instant-layer/index.d.ts +4 -0
  40. package/dist/instant-layer/index.d.ts.map +1 -1
  41. package/dist/instant-layer/index.js +10 -6
  42. package/dist/instant-layer/use-instant-close-auto.d.ts.map +1 -1
  43. package/dist/instant-layer/use-instant-close-auto.js +12 -11
  44. package/dist/instant-layer/use-instant-close-auto.js.map +1 -1
  45. package/dist/instant-layer/use-instant-close-bulk-auto.d.ts.map +1 -1
  46. package/dist/instant-layer/use-instant-close-bulk-auto.js +12 -11
  47. package/dist/instant-layer/use-instant-close-bulk-auto.js.map +1 -1
  48. package/dist/instant-layer/use-instant-close-bulk.d.ts.map +1 -1
  49. package/dist/instant-layer/use-instant-close-bulk.js +12 -11
  50. package/dist/instant-layer/use-instant-close-bulk.js.map +1 -1
  51. package/dist/instant-layer/use-instant-close.d.ts.map +1 -1
  52. package/dist/instant-layer/use-instant-close.js +12 -11
  53. package/dist/instant-layer/use-instant-close.js.map +1 -1
  54. package/dist/instant-layer/use-instant-open-auto.d.ts.map +1 -1
  55. package/dist/instant-layer/use-instant-open-auto.js +12 -11
  56. package/dist/instant-layer/use-instant-open-auto.js.map +1 -1
  57. package/dist/instant-layer/use-instant-open-fees.d.ts +43 -0
  58. package/dist/instant-layer/use-instant-open-fees.d.ts.map +1 -0
  59. package/dist/instant-layer/use-instant-open-fees.js +111 -0
  60. package/dist/instant-layer/use-instant-open-fees.js.map +1 -0
  61. package/dist/instant-layer/use-instant-open-with-tpsl.d.ts.map +1 -1
  62. package/dist/instant-layer/use-instant-open-with-tpsl.js +34 -31
  63. package/dist/instant-layer/use-instant-open-with-tpsl.js.map +1 -1
  64. package/dist/instant-layer/use-instant-open.d.ts +23 -18
  65. package/dist/instant-layer/use-instant-open.d.ts.map +1 -1
  66. package/dist/instant-layer/use-instant-open.js +12 -11
  67. package/dist/instant-layer/use-instant-open.js.map +1 -1
  68. package/dist/instant-layer/use-instant-opens.d.ts +6 -6
  69. package/dist/instant-layer/use-instant-opens.d.ts.map +1 -1
  70. package/dist/instant-layer/use-instant-opens.js.map +1 -1
  71. package/dist/instant-layer/use-instant-trade-required-selectors.d.ts +25 -0
  72. package/dist/instant-layer/use-instant-trade-required-selectors.d.ts.map +1 -0
  73. package/dist/instant-layer/use-instant-trade-required-selectors.js +13 -0
  74. package/dist/instant-layer/use-instant-trade-required-selectors.js.map +1 -0
  75. package/dist/instant-layer/use-limit-close-auto.d.ts +30 -0
  76. package/dist/instant-layer/use-limit-close-auto.d.ts.map +1 -0
  77. package/dist/instant-layer/use-limit-close-auto.js +33 -0
  78. package/dist/instant-layer/use-limit-close-auto.js.map +1 -0
  79. package/dist/instant-layer/use-limit-open-auto.d.ts +30 -0
  80. package/dist/instant-layer/use-limit-open-auto.d.ts.map +1 -0
  81. package/dist/instant-layer/use-limit-open-auto.js +33 -0
  82. package/dist/instant-layer/use-limit-open-auto.js.map +1 -0
  83. package/dist/inventory/index.d.ts +3 -0
  84. package/dist/inventory/index.d.ts.map +1 -0
  85. package/dist/inventory/index.js +3 -0
  86. package/dist/inventory/use-inventory-tvl-history.d.ts +27 -0
  87. package/dist/inventory/use-inventory-tvl-history.d.ts.map +1 -0
  88. package/dist/inventory/use-inventory-tvl-history.js +28 -0
  89. package/dist/inventory/use-inventory-tvl-history.js.map +1 -0
  90. package/dist/inventory/use-inventory-tvl.d.ts +23 -0
  91. package/dist/inventory/use-inventory-tvl.d.ts.map +1 -0
  92. package/dist/inventory/use-inventory-tvl.js +27 -0
  93. package/dist/inventory/use-inventory-tvl.js.map +1 -0
  94. package/dist/margin/index.d.ts +1 -0
  95. package/dist/margin/index.d.ts.map +1 -1
  96. package/dist/margin/use-account-margin-risk.d.ts +68 -0
  97. package/dist/margin/use-account-margin-risk.d.ts.map +1 -0
  98. package/dist/margin/use-account-margin-risk.js +31 -0
  99. package/dist/margin/use-account-margin-risk.js.map +1 -0
  100. package/dist/margin/use-available-instant-open-margin.d.ts +27 -7
  101. package/dist/margin/use-available-instant-open-margin.d.ts.map +1 -1
  102. package/dist/margin/use-available-instant-open-margin.js +117 -46
  103. package/dist/margin/use-available-instant-open-margin.js.map +1 -1
  104. package/dist/market-info/use-market-info.d.ts +13 -13
  105. package/dist/market-info/use-market-info.d.ts.map +1 -1
  106. package/dist/market-info/use-market-info.js.map +1 -1
  107. package/dist/markets/use-markets.d.ts +14 -8
  108. package/dist/markets/use-markets.d.ts.map +1 -1
  109. package/dist/markets/use-markets.js.map +1 -1
  110. package/dist/muon/index.d.ts +2 -0
  111. package/dist/muon/index.d.ts.map +1 -1
  112. package/dist/muon/use-force-close-price-sig.d.ts +34 -0
  113. package/dist/muon/use-force-close-price-sig.d.ts.map +1 -0
  114. package/dist/muon/use-force-close-price-sig.js +31 -0
  115. package/dist/muon/use-force-close-price-sig.js.map +1 -0
  116. package/dist/muon/use-send-quote-upnl-sig.d.ts +30 -0
  117. package/dist/muon/use-send-quote-upnl-sig.d.ts.map +1 -0
  118. package/dist/muon/use-send-quote-upnl-sig.js +28 -0
  119. package/dist/muon/use-send-quote-upnl-sig.js.map +1 -0
  120. package/dist/notifications/use-search-notifications.d.ts +12 -12
  121. package/dist/notifications/use-search-notifications.d.ts.map +1 -1
  122. package/dist/notifications/use-search-notifications.js.map +1 -1
  123. package/dist/notional-cap/use-notional-cap-by-symbol-id.d.ts +7 -7
  124. package/dist/notional-cap/use-notional-cap-by-symbol-id.d.ts.map +1 -1
  125. package/dist/notional-cap/use-notional-cap-by-symbol-id.js.map +1 -1
  126. package/dist/orderbook/index.d.ts +5 -0
  127. package/dist/orderbook/index.d.ts.map +1 -0
  128. package/dist/orderbook/index.js +5 -0
  129. package/dist/orderbook/use-binance-orderbook-source.d.ts +28 -0
  130. package/dist/orderbook/use-binance-orderbook-source.d.ts.map +1 -0
  131. package/dist/orderbook/use-binance-orderbook-source.js +26 -0
  132. package/dist/orderbook/use-binance-orderbook-source.js.map +1 -0
  133. package/dist/orderbook/use-live-orderbook.d.ts +104 -0
  134. package/dist/orderbook/use-live-orderbook.d.ts.map +1 -0
  135. package/dist/orderbook/use-live-orderbook.js +77 -0
  136. package/dist/orderbook/use-live-orderbook.js.map +1 -0
  137. package/dist/orderbook/use-orderbook-stream.d.ts +73 -0
  138. package/dist/orderbook/use-orderbook-stream.d.ts.map +1 -0
  139. package/dist/orderbook/use-orderbook-stream.js +49 -0
  140. package/dist/orderbook/use-orderbook-stream.js.map +1 -0
  141. package/dist/orderbook/use-orderbook.d.ts +35 -0
  142. package/dist/orderbook/use-orderbook.d.ts.map +1 -0
  143. package/dist/orderbook/use-orderbook.js +22 -0
  144. package/dist/orderbook/use-orderbook.js.map +1 -0
  145. package/dist/pools/index.d.ts +30 -0
  146. package/dist/pools/index.d.ts.map +1 -0
  147. package/dist/pools/index.js +30 -0
  148. package/dist/pools/use-add-market.d.ts +57 -0
  149. package/dist/pools/use-add-market.d.ts.map +1 -0
  150. package/dist/pools/use-add-market.js +30 -0
  151. package/dist/pools/use-add-market.js.map +1 -0
  152. package/dist/pools/use-authenticate-listing.d.ts +45 -0
  153. package/dist/pools/use-authenticate-listing.d.ts.map +1 -0
  154. package/dist/pools/use-authenticate-listing.js +30 -0
  155. package/dist/pools/use-authenticate-listing.js.map +1 -0
  156. package/dist/pools/use-cancel-withdraw.d.ts +47 -0
  157. package/dist/pools/use-cancel-withdraw.d.ts.map +1 -0
  158. package/dist/pools/use-cancel-withdraw.js +30 -0
  159. package/dist/pools/use-cancel-withdraw.js.map +1 -0
  160. package/dist/pools/use-claim-history.d.ts +25 -0
  161. package/dist/pools/use-claim-history.d.ts.map +1 -0
  162. package/dist/pools/use-claim-history.js +27 -0
  163. package/dist/pools/use-claim-history.js.map +1 -0
  164. package/dist/pools/use-claim-profit.d.ts +53 -0
  165. package/dist/pools/use-claim-profit.d.ts.map +1 -0
  166. package/dist/pools/use-claim-profit.js +30 -0
  167. package/dist/pools/use-claim-profit.js.map +1 -0
  168. package/dist/pools/use-deposit-address.d.ts +43 -0
  169. package/dist/pools/use-deposit-address.d.ts.map +1 -0
  170. package/dist/pools/use-deposit-address.js +28 -0
  171. package/dist/pools/use-deposit-address.js.map +1 -0
  172. package/dist/pools/use-listing-config.d.ts +28 -0
  173. package/dist/pools/use-listing-config.d.ts.map +1 -0
  174. package/dist/pools/use-listing-config.js +27 -0
  175. package/dist/pools/use-listing-config.js.map +1 -0
  176. package/dist/pools/use-listing-market-config-projection.d.ts +66 -0
  177. package/dist/pools/use-listing-market-config-projection.d.ts.map +1 -0
  178. package/dist/pools/use-listing-market-config-projection.js +57 -0
  179. package/dist/pools/use-listing-market-config-projection.js.map +1 -0
  180. package/dist/pools/use-listing-market-config.d.ts +49 -0
  181. package/dist/pools/use-listing-market-config.d.ts.map +1 -0
  182. package/dist/pools/use-listing-market-config.js +28 -0
  183. package/dist/pools/use-listing-market-config.js.map +1 -0
  184. package/dist/pools/use-listing-market-detail.d.ts +29 -0
  185. package/dist/pools/use-listing-market-detail.d.ts.map +1 -0
  186. package/dist/pools/use-listing-market-detail.js +27 -0
  187. package/dist/pools/use-listing-market-detail.js.map +1 -0
  188. package/dist/pools/use-listing-markets.d.ts +32 -0
  189. package/dist/pools/use-listing-markets.d.ts.map +1 -0
  190. package/dist/pools/use-listing-markets.js +27 -0
  191. package/dist/pools/use-listing-markets.js.map +1 -0
  192. package/dist/pools/use-listing-status.d.ts +29 -0
  193. package/dist/pools/use-listing-status.d.ts.map +1 -0
  194. package/dist/pools/use-listing-status.js +28 -0
  195. package/dist/pools/use-listing-status.js.map +1 -0
  196. package/dist/pools/use-pool-quotes.d.ts +26 -0
  197. package/dist/pools/use-pool-quotes.d.ts.map +1 -0
  198. package/dist/pools/use-pool-quotes.js +27 -0
  199. package/dist/pools/use-pool-quotes.js.map +1 -0
  200. package/dist/pools/use-pool-reward-chart.d.ts +32 -0
  201. package/dist/pools/use-pool-reward-chart.d.ts.map +1 -0
  202. package/dist/pools/use-pool-reward-chart.js +28 -0
  203. package/dist/pools/use-pool-reward-chart.js.map +1 -0
  204. package/dist/pools/use-pool-total-reward.d.ts +27 -0
  205. package/dist/pools/use-pool-total-reward.d.ts.map +1 -0
  206. package/dist/pools/use-pool-total-reward.js +28 -0
  207. package/dist/pools/use-pool-total-reward.js.map +1 -0
  208. package/dist/pools/use-pool-trade-history.d.ts +26 -0
  209. package/dist/pools/use-pool-trade-history.d.ts.map +1 -0
  210. package/dist/pools/use-pool-trade-history.js +27 -0
  211. package/dist/pools/use-pool-trade-history.js.map +1 -0
  212. package/dist/pools/use-pool-transactions.d.ts +23 -0
  213. package/dist/pools/use-pool-transactions.d.ts.map +1 -0
  214. package/dist/pools/use-pool-transactions.js +27 -0
  215. package/dist/pools/use-pool-transactions.js.map +1 -0
  216. package/dist/pools/use-refund-market.d.ts +51 -0
  217. package/dist/pools/use-refund-market.d.ts.map +1 -0
  218. package/dist/pools/use-refund-market.js +30 -0
  219. package/dist/pools/use-refund-market.js.map +1 -0
  220. package/dist/pools/use-retry-listing-info.d.ts +23 -0
  221. package/dist/pools/use-retry-listing-info.d.ts.map +1 -0
  222. package/dist/pools/use-retry-listing-info.js +27 -0
  223. package/dist/pools/use-retry-listing-info.js.map +1 -0
  224. package/dist/pools/use-retry-listing.d.ts +46 -0
  225. package/dist/pools/use-retry-listing.d.ts.map +1 -0
  226. package/dist/pools/use-retry-listing.js +30 -0
  227. package/dist/pools/use-retry-listing.js.map +1 -0
  228. package/dist/pools/use-supports-listing-service.d.ts +21 -0
  229. package/dist/pools/use-supports-listing-service.d.ts.map +1 -0
  230. package/dist/pools/use-supports-listing-service.js +13 -0
  231. package/dist/pools/use-supports-listing-service.js.map +1 -0
  232. package/dist/pools/use-update-listing-market-config.d.ts +60 -0
  233. package/dist/pools/use-update-listing-market-config.d.ts.map +1 -0
  234. package/dist/pools/use-update-listing-market-config.js +30 -0
  235. package/dist/pools/use-update-listing-market-config.js.map +1 -0
  236. package/dist/pools/use-user-listing-markets.d.ts +40 -0
  237. package/dist/pools/use-user-listing-markets.d.ts.map +1 -0
  238. package/dist/pools/use-user-listing-markets.js +28 -0
  239. package/dist/pools/use-user-listing-markets.js.map +1 -0
  240. package/dist/pools/use-user-profit.d.ts +39 -0
  241. package/dist/pools/use-user-profit.d.ts.map +1 -0
  242. package/dist/pools/use-user-profit.js +28 -0
  243. package/dist/pools/use-user-profit.js.map +1 -0
  244. package/dist/pools/use-user-reward-chart.d.ts +28 -0
  245. package/dist/pools/use-user-reward-chart.d.ts.map +1 -0
  246. package/dist/pools/use-user-reward-chart.js +28 -0
  247. package/dist/pools/use-user-reward-chart.js.map +1 -0
  248. package/dist/pools/use-user-total-reward.d.ts +30 -0
  249. package/dist/pools/use-user-total-reward.d.ts.map +1 -0
  250. package/dist/pools/use-user-total-reward.js +28 -0
  251. package/dist/pools/use-user-total-reward.js.map +1 -0
  252. package/dist/pools/use-user-transactions.d.ts +24 -0
  253. package/dist/pools/use-user-transactions.d.ts.map +1 -0
  254. package/dist/pools/use-user-transactions.js +27 -0
  255. package/dist/pools/use-user-transactions.js.map +1 -0
  256. package/dist/pools/use-weekly-listing-limit.d.ts +28 -0
  257. package/dist/pools/use-weekly-listing-limit.d.ts.map +1 -0
  258. package/dist/pools/use-weekly-listing-limit.js +28 -0
  259. package/dist/pools/use-weekly-listing-limit.js.map +1 -0
  260. package/dist/pools/use-withdraw-lp.d.ts +52 -0
  261. package/dist/pools/use-withdraw-lp.d.ts.map +1 -0
  262. package/dist/pools/use-withdraw-lp.js +30 -0
  263. package/dist/pools/use-withdraw-lp.js.map +1 -0
  264. package/dist/price-service/index.d.ts +8 -0
  265. package/dist/price-service/index.d.ts.map +1 -1
  266. package/dist/price-service/index.js +17 -9
  267. package/dist/price-service/use-binance-health.d.ts +16 -0
  268. package/dist/price-service/use-binance-health.d.ts.map +1 -0
  269. package/dist/price-service/use-binance-health.js +27 -0
  270. package/dist/price-service/use-binance-health.js.map +1 -0
  271. package/dist/price-service/use-binance-premium-index.d.ts +24 -0
  272. package/dist/price-service/use-binance-premium-index.d.ts.map +1 -0
  273. package/dist/price-service/use-binance-premium-index.js +27 -0
  274. package/dist/price-service/use-binance-premium-index.js.map +1 -0
  275. package/dist/price-service/use-binance-prices.d.ts +54 -0
  276. package/dist/price-service/use-binance-prices.d.ts.map +1 -0
  277. package/dist/price-service/use-binance-prices.js +57 -0
  278. package/dist/price-service/use-binance-prices.js.map +1 -0
  279. package/dist/price-service/use-binance-symbols-info.d.ts +18 -0
  280. package/dist/price-service/use-binance-symbols-info.d.ts.map +1 -0
  281. package/dist/price-service/use-binance-symbols-info.js +27 -0
  282. package/dist/price-service/use-binance-symbols-info.js.map +1 -0
  283. package/dist/price-service/use-enigma-price-by-market-id.d.ts +7 -1
  284. package/dist/price-service/use-enigma-price-by-market-id.d.ts.map +1 -1
  285. package/dist/price-service/use-enigma-price-by-market-id.js +1 -1
  286. package/dist/price-service/use-enigma-price-by-market-id.js.map +1 -1
  287. package/dist/price-service/use-mark-prices.d.ts +25 -0
  288. package/dist/price-service/use-mark-prices.d.ts.map +1 -0
  289. package/dist/price-service/use-mark-prices.js +27 -0
  290. package/dist/price-service/use-mark-prices.js.map +1 -0
  291. package/dist/price-service/use-price-by-market-id.d.ts +53 -0
  292. package/dist/price-service/use-price-by-market-id.d.ts.map +1 -0
  293. package/dist/price-service/use-price-by-market-id.js +33 -0
  294. package/dist/price-service/use-price-by-market-id.js.map +1 -0
  295. package/dist/price-service/use-price-by-name.d.ts +48 -0
  296. package/dist/price-service/use-price-by-name.d.ts.map +1 -0
  297. package/dist/price-service/use-price-by-name.js +23 -0
  298. package/dist/price-service/use-price-by-name.js.map +1 -0
  299. package/dist/price-service/use-prices.d.ts +87 -0
  300. package/dist/price-service/use-prices.d.ts.map +1 -0
  301. package/dist/price-service/use-prices.js +77 -0
  302. package/dist/price-service/use-prices.js.map +1 -0
  303. package/dist/provider/symmio-provider.d.ts +8 -2
  304. package/dist/provider/symmio-provider.d.ts.map +1 -1
  305. package/dist/provider/symmio-provider.js +19 -19
  306. package/dist/provider/symmio-provider.js.map +1 -1
  307. package/dist/quotes/confirm-hold.d.ts +121 -0
  308. package/dist/quotes/confirm-hold.d.ts.map +1 -0
  309. package/dist/quotes/confirm-hold.js +59 -0
  310. package/dist/quotes/confirm-hold.js.map +1 -0
  311. package/dist/quotes/index.d.ts +14 -0
  312. package/dist/quotes/index.d.ts.map +1 -1
  313. package/dist/quotes/use-account-upnl.d.ts +66 -0
  314. package/dist/quotes/use-account-upnl.d.ts.map +1 -0
  315. package/dist/quotes/use-account-upnl.js +73 -0
  316. package/dist/quotes/use-account-upnl.js.map +1 -0
  317. package/dist/quotes/use-close-quote-group.d.ts +126 -0
  318. package/dist/quotes/use-close-quote-group.d.ts.map +1 -0
  319. package/dist/quotes/use-close-quote-group.js +172 -0
  320. package/dist/quotes/use-close-quote-group.js.map +1 -0
  321. package/dist/quotes/use-cool-downs-of-ma.d.ts +26 -0
  322. package/dist/quotes/use-cool-downs-of-ma.d.ts.map +1 -0
  323. package/dist/quotes/use-cool-downs-of-ma.js +27 -0
  324. package/dist/quotes/use-cool-downs-of-ma.js.map +1 -0
  325. package/dist/quotes/use-force-cancel-close-request.d.ts +27 -0
  326. package/dist/quotes/use-force-cancel-close-request.d.ts.map +1 -0
  327. package/dist/quotes/use-force-cancel-close-request.js +41 -0
  328. package/dist/quotes/use-force-cancel-close-request.js.map +1 -0
  329. package/dist/quotes/use-force-cancel-quote.d.ts +26 -0
  330. package/dist/quotes/use-force-cancel-quote.d.ts.map +1 -0
  331. package/dist/quotes/use-force-cancel-quote.js +42 -0
  332. package/dist/quotes/use-force-cancel-quote.js.map +1 -0
  333. package/dist/quotes/use-force-close-eligibility.d.ts +30 -0
  334. package/dist/quotes/use-force-close-eligibility.d.ts.map +1 -0
  335. package/dist/quotes/use-force-close-eligibility.js +39 -0
  336. package/dist/quotes/use-force-close-eligibility.js.map +1 -0
  337. package/dist/quotes/use-force-close-params.d.ts +22 -0
  338. package/dist/quotes/use-force-close-params.d.ts.map +1 -0
  339. package/dist/quotes/use-force-close-params.js +27 -0
  340. package/dist/quotes/use-force-close-params.js.map +1 -0
  341. package/dist/quotes/use-force-close.d.ts +30 -0
  342. package/dist/quotes/use-force-close.d.ts.map +1 -0
  343. package/dist/quotes/use-force-close.js +38 -0
  344. package/dist/quotes/use-force-close.js.map +1 -0
  345. package/dist/quotes/use-grouped-quotes.d.ts +50 -10
  346. package/dist/quotes/use-grouped-quotes.d.ts.map +1 -1
  347. package/dist/quotes/use-grouped-quotes.js +40 -14
  348. package/dist/quotes/use-grouped-quotes.js.map +1 -1
  349. package/dist/quotes/use-grouping-isolation.d.ts +35 -0
  350. package/dist/quotes/use-grouping-isolation.d.ts.map +1 -0
  351. package/dist/quotes/use-grouping-isolation.js +39 -0
  352. package/dist/quotes/use-grouping-isolation.js.map +1 -0
  353. package/dist/quotes/use-limit-orders.d.ts +62 -0
  354. package/dist/quotes/use-limit-orders.d.ts.map +1 -0
  355. package/dist/quotes/use-limit-orders.js +82 -0
  356. package/dist/quotes/use-limit-orders.js.map +1 -0
  357. package/dist/quotes/use-managed-quotes.d.ts.map +1 -1
  358. package/dist/quotes/use-managed-quotes.js +198 -166
  359. package/dist/quotes/use-managed-quotes.js.map +1 -1
  360. package/dist/quotes/use-party-a-open-positions.d.ts +26 -6
  361. package/dist/quotes/use-party-a-open-positions.d.ts.map +1 -1
  362. package/dist/quotes/use-party-a-open-positions.js +32 -12
  363. package/dist/quotes/use-party-a-open-positions.js.map +1 -1
  364. package/dist/quotes/use-quote-funding.d.ts +2 -2
  365. package/dist/quotes/use-quote-funding.js.map +1 -1
  366. package/dist/quotes/use-quote-group-funding-history.d.ts +70 -0
  367. package/dist/quotes/use-quote-group-funding-history.d.ts.map +1 -0
  368. package/dist/quotes/use-quote-group-funding-history.js +38 -0
  369. package/dist/quotes/use-quote-group-funding-history.js.map +1 -0
  370. package/dist/quotes/use-quote-group-funding.d.ts +67 -0
  371. package/dist/quotes/use-quote-group-funding.d.ts.map +1 -0
  372. package/dist/quotes/use-quote-group-funding.js +26 -0
  373. package/dist/quotes/use-quote-group-funding.js.map +1 -0
  374. package/dist/quotes/use-quote-group-margin-risk.d.ts +111 -0
  375. package/dist/quotes/use-quote-group-margin-risk.d.ts.map +1 -0
  376. package/dist/quotes/use-quote-group-margin-risk.js +63 -0
  377. package/dist/quotes/use-quote-group-margin-risk.js.map +1 -0
  378. package/dist/quotes/use-quote-upnl-and-pnl.d.ts +4 -3
  379. package/dist/quotes/use-quote-upnl-and-pnl.d.ts.map +1 -1
  380. package/dist/quotes/use-quote-upnl-and-pnl.js +2 -1
  381. package/dist/quotes/use-quote-upnl-and-pnl.js.map +1 -1
  382. package/dist/quotes/use-quotes-funding.d.ts +46 -10
  383. package/dist/quotes/use-quotes-funding.d.ts.map +1 -1
  384. package/dist/quotes/use-quotes-funding.js +44 -42
  385. package/dist/quotes/use-quotes-funding.js.map +1 -1
  386. package/dist/quotes/use-request-to-cancel-close-request.d.ts +27 -0
  387. package/dist/quotes/use-request-to-cancel-close-request.d.ts.map +1 -0
  388. package/dist/quotes/use-request-to-cancel-close-request.js +41 -0
  389. package/dist/quotes/use-request-to-cancel-close-request.js.map +1 -0
  390. package/dist/quotes/use-request-to-cancel-quote.d.ts +32 -0
  391. package/dist/quotes/use-request-to-cancel-quote.d.ts.map +1 -0
  392. package/dist/quotes/use-request-to-cancel-quote.js +42 -0
  393. package/dist/quotes/use-request-to-cancel-quote.js.map +1 -0
  394. package/dist/rasa-solver/index.d.ts +7 -0
  395. package/dist/rasa-solver/index.d.ts.map +1 -0
  396. package/dist/rasa-solver/use-error-message.d.ts +14 -0
  397. package/dist/rasa-solver/use-error-message.d.ts.map +1 -0
  398. package/dist/rasa-solver/use-error-message.js +27 -0
  399. package/dist/rasa-solver/use-error-message.js.map +1 -0
  400. package/dist/rasa-solver/use-party-a-upnl.d.ts +14 -0
  401. package/dist/rasa-solver/use-party-a-upnl.d.ts.map +1 -0
  402. package/dist/rasa-solver/use-party-a-upnl.js +27 -0
  403. package/dist/rasa-solver/use-party-a-upnl.js.map +1 -0
  404. package/dist/rasa-solver/use-solver-balance-info.d.ts +14 -0
  405. package/dist/rasa-solver/use-solver-balance-info.d.ts.map +1 -0
  406. package/dist/rasa-solver/use-solver-balance-info.js +27 -0
  407. package/dist/rasa-solver/use-solver-balance-info.js.map +1 -0
  408. package/dist/rasa-solver/use-solver-open-interest.d.ts +14 -0
  409. package/dist/rasa-solver/use-solver-open-interest.d.ts.map +1 -0
  410. package/dist/rasa-solver/use-solver-open-interest.js +27 -0
  411. package/dist/rasa-solver/use-solver-open-interest.js.map +1 -0
  412. package/dist/rasa-solver/use-solver-price-range.d.ts +14 -0
  413. package/dist/rasa-solver/use-solver-price-range.d.ts.map +1 -0
  414. package/dist/rasa-solver/use-solver-price-range.js +27 -0
  415. package/dist/rasa-solver/use-solver-price-range.js.map +1 -0
  416. package/dist/rasa-solver/use-solver-readiness.d.ts +13 -0
  417. package/dist/rasa-solver/use-solver-readiness.d.ts.map +1 -0
  418. package/dist/rasa-solver/use-solver-readiness.js +27 -0
  419. package/dist/rasa-solver/use-solver-readiness.js.map +1 -0
  420. package/dist/revenue-records/index.d.ts +2 -0
  421. package/dist/revenue-records/index.d.ts.map +1 -0
  422. package/dist/revenue-records/use-revenue-records.d.ts +25 -0
  423. package/dist/revenue-records/use-revenue-records.d.ts.map +1 -0
  424. package/dist/revenue-records/use-revenue-records.js +27 -0
  425. package/dist/revenue-records/use-revenue-records.js.map +1 -0
  426. package/dist/solvers/index.d.ts +3 -0
  427. package/dist/solvers/index.d.ts.map +1 -0
  428. package/dist/solvers/use-solver-capabilities.d.ts +31 -0
  429. package/dist/solvers/use-solver-capabilities.d.ts.map +1 -0
  430. package/dist/solvers/use-solver-capabilities.js +30 -0
  431. package/dist/solvers/use-solver-capabilities.js.map +1 -0
  432. package/dist/solvers/use-solver-revenue.d.ts +28 -0
  433. package/dist/solvers/use-solver-revenue.d.ts.map +1 -0
  434. package/dist/solvers/use-solver-revenue.js +27 -0
  435. package/dist/solvers/use-solver-revenue.js.map +1 -0
  436. package/dist/symbols/index.d.ts +2 -0
  437. package/dist/symbols/index.d.ts.map +1 -0
  438. package/dist/symbols/use-symbols.d.ts +25 -0
  439. package/dist/symbols/use-symbols.d.ts.map +1 -0
  440. package/dist/symbols/use-symbols.js +27 -0
  441. package/dist/symbols/use-symbols.js.map +1 -0
  442. package/dist/tpsl/apply-tpsl-search-snapshot.d.ts +33 -0
  443. package/dist/tpsl/apply-tpsl-search-snapshot.d.ts.map +1 -0
  444. package/dist/tpsl/apply-tpsl-search-snapshot.js +51 -0
  445. package/dist/tpsl/apply-tpsl-search-snapshot.js.map +1 -0
  446. package/dist/tpsl/await-tpsl-confirmation.d.ts +77 -0
  447. package/dist/tpsl/await-tpsl-confirmation.d.ts.map +1 -0
  448. package/dist/tpsl/await-tpsl-confirmation.js +42 -0
  449. package/dist/tpsl/await-tpsl-confirmation.js.map +1 -0
  450. package/dist/tpsl/index.d.ts +11 -0
  451. package/dist/tpsl/index.d.ts.map +1 -1
  452. package/dist/tpsl/invalidate-tpsl.d.ts +23 -0
  453. package/dist/tpsl/invalidate-tpsl.d.ts.map +1 -0
  454. package/dist/tpsl/invalidate-tpsl.js +14 -0
  455. package/dist/tpsl/invalidate-tpsl.js.map +1 -0
  456. package/dist/tpsl/match-tpsl-notification.d.ts +27 -0
  457. package/dist/tpsl/match-tpsl-notification.d.ts.map +1 -0
  458. package/dist/tpsl/match-tpsl-notification.js +22 -0
  459. package/dist/tpsl/match-tpsl-notification.js.map +1 -0
  460. package/dist/tpsl/run-with-concurrency.d.ts +20 -0
  461. package/dist/tpsl/run-with-concurrency.d.ts.map +1 -0
  462. package/dist/tpsl/run-with-concurrency.js +15 -0
  463. package/dist/tpsl/run-with-concurrency.js.map +1 -0
  464. package/dist/tpsl/settled-side.d.ts +31 -0
  465. package/dist/tpsl/settled-side.d.ts.map +1 -0
  466. package/dist/tpsl/settled-side.js +21 -0
  467. package/dist/tpsl/settled-side.js.map +1 -0
  468. package/dist/tpsl/tpsl-fallback-poll.d.ts +74 -0
  469. package/dist/tpsl/tpsl-fallback-poll.d.ts.map +1 -0
  470. package/dist/tpsl/tpsl-fallback-poll.js +101 -0
  471. package/dist/tpsl/tpsl-fallback-poll.js.map +1 -0
  472. package/dist/tpsl/tpsl-store.d.ts +98 -2
  473. package/dist/tpsl/tpsl-store.d.ts.map +1 -1
  474. package/dist/tpsl/tpsl-store.js +111 -63
  475. package/dist/tpsl/tpsl-store.js.map +1 -1
  476. package/dist/tpsl/use-delete-quote-group-tpsl.d.ts +165 -0
  477. package/dist/tpsl/use-delete-quote-group-tpsl.d.ts.map +1 -0
  478. package/dist/tpsl/use-delete-quote-group-tpsl.js +247 -0
  479. package/dist/tpsl/use-delete-quote-group-tpsl.js.map +1 -0
  480. package/dist/tpsl/use-delete-quote-tpsl.d.ts.map +1 -1
  481. package/dist/tpsl/use-delete-quote-tpsl.js +11 -10
  482. package/dist/tpsl/use-delete-quote-tpsl.js.map +1 -1
  483. package/dist/tpsl/use-quote-group-tpsl-editor.d.ts +66 -0
  484. package/dist/tpsl/use-quote-group-tpsl-editor.d.ts.map +1 -0
  485. package/dist/tpsl/use-quote-group-tpsl-editor.js +78 -0
  486. package/dist/tpsl/use-quote-group-tpsl-editor.js.map +1 -0
  487. package/dist/tpsl/use-quote-group-tpsl.d.ts +74 -0
  488. package/dist/tpsl/use-quote-group-tpsl.d.ts.map +1 -0
  489. package/dist/tpsl/use-quote-group-tpsl.js +67 -0
  490. package/dist/tpsl/use-quote-group-tpsl.js.map +1 -0
  491. package/dist/tpsl/use-quote-tpsl.d.ts +18 -2
  492. package/dist/tpsl/use-quote-tpsl.d.ts.map +1 -1
  493. package/dist/tpsl/use-quote-tpsl.js +32 -24
  494. package/dist/tpsl/use-quote-tpsl.js.map +1 -1
  495. package/dist/tpsl/use-search-tpsl-orders.d.ts +30 -0
  496. package/dist/tpsl/use-search-tpsl-orders.d.ts.map +1 -0
  497. package/dist/tpsl/use-search-tpsl-orders.js +27 -0
  498. package/dist/tpsl/use-search-tpsl-orders.js.map +1 -0
  499. package/dist/tpsl/use-set-quote-group-tpsl.d.ts +234 -0
  500. package/dist/tpsl/use-set-quote-group-tpsl.d.ts.map +1 -0
  501. package/dist/tpsl/use-set-quote-group-tpsl.js +358 -0
  502. package/dist/tpsl/use-set-quote-group-tpsl.js.map +1 -0
  503. package/dist/tpsl/use-set-quote-tpsl.d.ts +4 -4
  504. package/dist/tpsl/use-set-quote-tpsl.d.ts.map +1 -1
  505. package/dist/tpsl/use-set-quote-tpsl.js +15 -12
  506. package/dist/tpsl/use-set-quote-tpsl.js.map +1 -1
  507. package/dist/tpsl/use-tpsl-supported.d.ts +22 -0
  508. package/dist/tpsl/use-tpsl-supported.d.ts.map +1 -0
  509. package/dist/tpsl/use-tpsl-supported.js +16 -0
  510. package/dist/tpsl/use-tpsl-supported.js.map +1 -0
  511. package/dist/tpsl/use-watch-tpsl-accounts.d.ts +33 -0
  512. package/dist/tpsl/use-watch-tpsl-accounts.d.ts.map +1 -0
  513. package/dist/tpsl/use-watch-tpsl-accounts.js +44 -0
  514. package/dist/tpsl/use-watch-tpsl-accounts.js.map +1 -0
  515. package/dist/trade-volume/index.d.ts +2 -0
  516. package/dist/trade-volume/index.d.ts.map +1 -0
  517. package/dist/trade-volume/use-trade-volume.d.ts +26 -0
  518. package/dist/trade-volume/use-trade-volume.d.ts.map +1 -0
  519. package/dist/trade-volume/use-trade-volume.js +27 -0
  520. package/dist/trade-volume/use-trade-volume.js.map +1 -0
  521. package/dist/utils/index.d.ts +1 -0
  522. package/dist/utils/index.d.ts.map +1 -1
  523. package/dist/utils/invalidate-account-balances.d.ts +36 -0
  524. package/dist/utils/invalidate-account-balances.d.ts.map +1 -0
  525. package/dist/utils/invalidate-account-balances.js +10 -0
  526. package/dist/utils/invalidate-account-balances.js.map +1 -0
  527. package/dist/websocket/use-notifications.d.ts +3 -1
  528. package/dist/websocket/use-notifications.d.ts.map +1 -1
  529. package/dist/websocket/use-notifications.js +22 -20
  530. package/dist/websocket/use-notifications.js.map +1 -1
  531. package/dist/withdraw/index.d.ts +1 -0
  532. package/dist/withdraw/index.d.ts.map +1 -1
  533. package/dist/withdraw/use-initiate-withdraw.d.ts +1 -1
  534. package/dist/withdraw/use-initiate-withdraw.js.map +1 -1
  535. package/dist/withdraw/use-request-cancel-withdraw.d.ts +4 -2
  536. package/dist/withdraw/use-request-cancel-withdraw.d.ts.map +1 -1
  537. package/dist/withdraw/use-request-cancel-withdraw.js +15 -13
  538. package/dist/withdraw/use-request-cancel-withdraw.js.map +1 -1
  539. package/dist/withdraw/use-withdraw.d.ts +67 -0
  540. package/dist/withdraw/use-withdraw.d.ts.map +1 -0
  541. package/dist/withdraw/use-withdraw.js +49 -0
  542. package/dist/withdraw/use-withdraw.js.map +1 -0
  543. package/package.json +18 -2
@@ -3,26 +3,26 @@ import { UseQueryResult } from '@tanstack/react-query';
3
3
  import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /**
5
5
  * Parameters for {@link useSearchNotifications}: the core search options
6
- * (`filter`, `size`, `start`, chain id, TanStack `query` overrides) plus an
6
+ * (`solverId`, common filters `account` / `quoteId` / `tempQuoteId` /
7
+ * `timestampGte`, `size`, `start`, chain id, TanStack `query` overrides) plus an
7
8
  * optional `config`.
8
9
  */
9
10
  export type UseSearchNotificationsParameters = SearchNotificationsOptions & ConfigParameter;
10
- /** Return type of {@link useSearchNotifications}. */
11
+ /** Return type of {@link useSearchNotifications}: the per-kind {@link SearchNotificationsReturnType} union. */
11
12
  export type UseSearchNotificationsReturnType = UseQueryResult<SearchNotificationsReturnType, SymmioRequestError>;
12
13
  /**
13
- * Search stored notifications via the notification service's free-form
14
- * `POST /api/v1/search` endpoint. The `filter` matches keys exactly — top-level
15
- * fields (`app_name`, …) or dotted payload paths (`data.temp_quote_id`, …).
16
- *
17
- * The query is disabled until `filter` has at least one key. `chainId` defaults
18
- * to the connected chain. Errors are normalized to {@link SymmioRequestError}.
14
+ * Search stored notifications for a solver — one hook over both kinds, dispatched
15
+ * by the resolved `solverId`: an **enigma** solver hits the notification service
16
+ * (`POST /api/v1/search`), a **rasa** solver hits its own position-state
17
+ * endpoint. `chainId` / `solverId` default to the connected chain's default
18
+ * solver. The result is a per-kind union — narrow on `data.kind`. Errors are
19
+ * normalized to {@link SymmioRequestError}.
19
20
  *
20
21
  * @example
21
22
  * ```tsx
22
- * const { data, isLoading } = useSearchNotifications({
23
- * filter: { app_name: "Base_Superflow_Stage", "data.temp_quote_id": -172 },
24
- * });
25
- * data?.documents.forEach((d) => console.log(d.id));
23
+ * const { data } = useSearchNotifications({ account: subAccount, quoteId: 1024 });
24
+ * if (data?.kind === "enigma") data.rows.forEach((d) => console.log(d.id));
25
+ * if (data?.kind === "rasa") data.rows.forEach((r) => console.log(r.quote_id));
26
26
  * ```
27
27
  */
28
28
  export declare function useSearchNotifications(parameters: UseSearchNotificationsParameters): UseSearchNotificationsReturnType;
@@ -1 +1 @@
1
- {"version":3,"file":"use-search-notifications.d.ts","sourceRoot":"","sources":["../../src/notifications/use-search-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;GAIG;AACH,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GAAG,eAAe,CAAC;AAE5F,qDAAqD;AACrD,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,6BAA6B,EAAE,kBAAkB,CAAC,CAAC;AAEjH;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gCAAgC,GAAG,gCAAgC,CAkBrH"}
1
+ {"version":3,"file":"use-search-notifications.d.ts","sourceRoot":"","sources":["../../src/notifications/use-search-notifications.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EACnC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;;GAKG;AACH,MAAM,MAAM,gCAAgC,GAAG,0BAA0B,GAAG,eAAe,CAAC;AAE5F,+GAA+G;AAC/G,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,6BAA6B,EAAE,kBAAkB,CAAC,CAAC;AAEjH;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gCAAgC,GAAG,gCAAgC,CAkBrH"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-search-notifications.js","names":[],"sources":["../../src/notifications/use-search-notifications.ts"],"sourcesContent":["\"use client\";\n\nimport {\n searchNotificationsQueryOptions,\n type ConfigParameter,\n type SearchNotificationsOptions,\n type SearchNotificationsReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useSearchNotifications}: the core search options\n * (`filter`, `size`, `start`, chain id, TanStack `query` overrides) plus an\n * optional `config`.\n */\nexport type UseSearchNotificationsParameters = SearchNotificationsOptions & ConfigParameter;\n\n/** Return type of {@link useSearchNotifications}. */\nexport type UseSearchNotificationsReturnType = UseQueryResult<SearchNotificationsReturnType, SymmioRequestError>;\n\n/**\n * Search stored notifications via the notification service's free-form\n * `POST /api/v1/search` endpoint. The `filter` matches keys exactly — top-level\n * fields (`app_name`, …) or dotted payload paths (`data.temp_quote_id`, …).\n *\n * The query is disabled until `filter` has at least one key. `chainId` defaults\n * to the connected chain. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data, isLoading } = useSearchNotifications({\n * filter: { app_name: \"Base_Superflow_Stage\", \"data.temp_quote_id\": -172 },\n * });\n * data?.documents.forEach((d) => console.log(d.id));\n * ```\n */\nexport function useSearchNotifications(parameters: UseSearchNotificationsParameters): UseSearchNotificationsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = searchNotificationsQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseSearchNotificationsReturnType;\n}\n"],"mappings":";;;;;;;AAwCA,SAAgB,EAAuB,GAAgF;CACrH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAgC,GAAQ;EACtD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-search-notifications.js","names":[],"sources":["../../src/notifications/use-search-notifications.ts"],"sourcesContent":["\"use client\";\n\nimport {\n searchNotificationsQueryOptions,\n type ConfigParameter,\n type SearchNotificationsOptions,\n type SearchNotificationsReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useSearchNotifications}: the core search options\n * (`solverId`, common filters `account` / `quoteId` / `tempQuoteId` /\n * `timestampGte`, `size`, `start`, chain id, TanStack `query` overrides) plus an\n * optional `config`.\n */\nexport type UseSearchNotificationsParameters = SearchNotificationsOptions & ConfigParameter;\n\n/** Return type of {@link useSearchNotifications}: the per-kind {@link SearchNotificationsReturnType} union. */\nexport type UseSearchNotificationsReturnType = UseQueryResult<SearchNotificationsReturnType, SymmioRequestError>;\n\n/**\n * Search stored notifications for a solver — one hook over both kinds, dispatched\n * by the resolved `solverId`: an **enigma** solver hits the notification service\n * (`POST /api/v1/search`), a **rasa** solver hits its own position-state\n * endpoint. `chainId` / `solverId` default to the connected chain's default\n * solver. The result is a per-kind union — narrow on `data.kind`. Errors are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useSearchNotifications({ account: subAccount, quoteId: 1024 });\n * if (data?.kind === \"enigma\") data.rows.forEach((d) => console.log(d.id));\n * if (data?.kind === \"rasa\") data.rows.forEach((r) => console.log(r.quote_id));\n * ```\n */\nexport function useSearchNotifications(parameters: UseSearchNotificationsParameters): UseSearchNotificationsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = searchNotificationsQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseSearchNotificationsReturnType;\n}\n"],"mappings":";;;;;;;AAwCA,SAAgB,EAAuB,GAAgF;CACrH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAgC,GAAQ;EACtD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import { ConfigParameter, GetNotionalCapBySymbolIdOptions, GetNotionalCapBySymbolIdReturnType } from '@symmio/trading-core';
1
+ import { ConfigParameter, GetNotionalCapBySymbolIdOptions, GetNotionalCapBySymbolIdReturnType, SymmioSolverKind } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
3
  import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
4
  /** Default polling cadence — 15 s, matching how often the solver re-publishes caps. */
@@ -8,7 +8,7 @@ export declare const DEFAULT_NOTIONAL_CAP_POLLING_MS = 15000;
8
8
  * (symbol id, chain id, TanStack `query` overrides) plus an optional `config`
9
9
  * and a `pollingInterval` knob layered on top of `query.refetchInterval`.
10
10
  */
11
- export type UseNotionalCapBySymbolIdParameters = GetNotionalCapBySymbolIdOptions & ConfigParameter & {
11
+ export type UseNotionalCapBySymbolIdParameters<K extends SymmioSolverKind = SymmioSolverKind> = GetNotionalCapBySymbolIdOptions<K> & ConfigParameter & {
12
12
  /**
13
13
  * Polling cadence in milliseconds. Defaults to
14
14
  * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS}. Pass `false` to disable polling
@@ -16,8 +16,8 @@ export type UseNotionalCapBySymbolIdParameters = GetNotionalCapBySymbolIdOptions
16
16
  */
17
17
  pollingInterval?: number | false;
18
18
  };
19
- /** Return type of {@link useNotionalCapBySymbolId}. */
20
- export type UseNotionalCapBySymbolIdReturnType = UseQueryResult<GetNotionalCapBySymbolIdReturnType, SymmioRequestError>;
19
+ /** Return type of {@link useNotionalCapBySymbolId}, generic over the solver kind `K`. */
20
+ export type UseNotionalCapBySymbolIdReturnType<K extends SymmioSolverKind = SymmioSolverKind> = UseQueryResult<GetNotionalCapBySymbolIdReturnType<K>, SymmioRequestError>;
21
21
  /**
22
22
  * Read the solver's available-liquidity figures for a market. Polls every
23
23
  * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS} by default; pass
@@ -28,9 +28,9 @@ export type UseNotionalCapBySymbolIdReturnType = UseQueryResult<GetNotionalCapBy
28
28
  *
29
29
  * @example
30
30
  * ```tsx
31
- * const { data, isLoading } = useNotionalCapBySymbolId({ symbolId: 132 });
32
- * console.log(data?.availableToLong);
31
+ * const { data } = useNotionalCapBySymbolId({ symbolId: 132 });
32
+ * if (data?.kind === "enigma") console.log(data.availableToLong); // Enigma-only
33
33
  * ```
34
34
  */
35
- export declare function useNotionalCapBySymbolId(parameters: UseNotionalCapBySymbolIdParameters): UseNotionalCapBySymbolIdReturnType;
35
+ export declare function useNotionalCapBySymbolId<K extends SymmioSolverKind = SymmioSolverKind>(parameters: UseNotionalCapBySymbolIdParameters<K>): UseNotionalCapBySymbolIdReturnType<K>;
36
36
  //# sourceMappingURL=use-notional-cap-by-symbol-id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-notional-cap-by-symbol-id.d.ts","sourceRoot":"","sources":["../../src/notional-cap/use-notional-cap-by-symbol-id.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACxC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,uFAAuF;AACvF,eAAO,MAAM,+BAA+B,QAAS,CAAC;AAEtD;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,GAAG,+BAA+B,GAC9E,eAAe,GAAG;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAClC,CAAC;AAEJ,uDAAuD;AACvD,MAAM,MAAM,kCAAkC,GAAG,cAAc,CAAC,kCAAkC,EAAE,kBAAkB,CAAC,CAAC;AAExH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,kCAAkC,GAC7C,kCAAkC,CAuBpC"}
1
+ {"version":3,"file":"use-notional-cap-by-symbol-id.d.ts","sourceRoot":"","sources":["../../src/notional-cap/use-notional-cap-by-symbol-id.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,+BAA+B,EACpC,KAAK,kCAAkC,EACvC,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,uFAAuF;AACvF,eAAO,MAAM,+BAA+B,QAAS,CAAC;AAEtD;;;;GAIG;AACH,MAAM,MAAM,kCAAkC,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IAC1F,+BAA+B,CAAC,CAAC,CAAC,GAChC,eAAe,GAAG;IAChB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAClC,CAAC;AAEN,yFAAyF;AACzF,MAAM,MAAM,kCAAkC,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,cAAc,CAC5G,kCAAkC,CAAC,CAAC,CAAC,EACrC,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,EACpF,UAAU,EAAE,kCAAkC,CAAC,CAAC,CAAC,GAChD,kCAAkC,CAAC,CAAC,CAAC,CAuBvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-notional-cap-by-symbol-id.js","names":[],"sources":["../../src/notional-cap/use-notional-cap-by-symbol-id.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getNotionalCapBySymbolIdQueryOptions,\n type ConfigParameter,\n type GetNotionalCapBySymbolIdOptions,\n type GetNotionalCapBySymbolIdReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Default polling cadence — 15 s, matching how often the solver re-publishes caps. */\nexport const DEFAULT_NOTIONAL_CAP_POLLING_MS = 15_000;\n\n/**\n * Parameters for {@link useNotionalCapBySymbolId}: the core query options\n * (symbol id, chain id, TanStack `query` overrides) plus an optional `config`\n * and a `pollingInterval` knob layered on top of `query.refetchInterval`.\n */\nexport type UseNotionalCapBySymbolIdParameters = GetNotionalCapBySymbolIdOptions &\n ConfigParameter & {\n /**\n * Polling cadence in milliseconds. Defaults to\n * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS}. Pass `false` to disable polling\n * (the query still refetches on focus / reconnect per TanStack defaults).\n */\n pollingInterval?: number | false;\n };\n\n/** Return type of {@link useNotionalCapBySymbolId}. */\nexport type UseNotionalCapBySymbolIdReturnType = UseQueryResult<GetNotionalCapBySymbolIdReturnType, SymmioRequestError>;\n\n/**\n * Read the solver's available-liquidity figures for a market. Polls every\n * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS} by default; pass\n * `pollingInterval: <ms>` to change the cadence or `pollingInterval: false` to\n * disable it.\n *\n * Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data, isLoading } = useNotionalCapBySymbolId({ symbolId: 132 });\n * console.log(data?.availableToLong);\n * ```\n */\nexport function useNotionalCapBySymbolId(\n parameters: UseNotionalCapBySymbolIdParameters,\n): UseNotionalCapBySymbolIdReturnType {\n const { pollingInterval = DEFAULT_NOTIONAL_CAP_POLLING_MS, query, ...rest } = parameters;\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getNotionalCapBySymbolIdQueryOptions(config, {\n ...rest,\n chainId: rest.chainId ?? chainId,\n query: {\n refetchInterval: pollingInterval === false ? false : pollingInterval,\n ...query,\n },\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseNotionalCapBySymbolIdReturnType;\n}\n"],"mappings":";;;;;;;AAeA,IAAa,IAAkC;AAkC/C,SAAgB,EACd,GACoC;CACpC,IAAM,EAAE,qBAAkB,GAAiC,UAAO,GAAG,MAAS,GACxE,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAqC,GAAQ;EAC3D,GAAG;EACH,SAAS,EAAK,WAAW;EACzB,OAAO;GACL,iBAAiB,MAAoB,KAAQ,KAAQ;GACrD,GAAG;EACL;CACF,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-notional-cap-by-symbol-id.js","names":[],"sources":["../../src/notional-cap/use-notional-cap-by-symbol-id.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getNotionalCapBySymbolIdQueryOptions,\n type ConfigParameter,\n type GetNotionalCapBySymbolIdOptions,\n type GetNotionalCapBySymbolIdReturnType,\n type SymmioSolverKind,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Default polling cadence — 15 s, matching how often the solver re-publishes caps. */\nexport const DEFAULT_NOTIONAL_CAP_POLLING_MS = 15_000;\n\n/**\n * Parameters for {@link useNotionalCapBySymbolId}: the core query options\n * (symbol id, chain id, TanStack `query` overrides) plus an optional `config`\n * and a `pollingInterval` knob layered on top of `query.refetchInterval`.\n */\nexport type UseNotionalCapBySymbolIdParameters<K extends SymmioSolverKind = SymmioSolverKind> =\n GetNotionalCapBySymbolIdOptions<K> &\n ConfigParameter & {\n /**\n * Polling cadence in milliseconds. Defaults to\n * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS}. Pass `false` to disable polling\n * (the query still refetches on focus / reconnect per TanStack defaults).\n */\n pollingInterval?: number | false;\n };\n\n/** Return type of {@link useNotionalCapBySymbolId}, generic over the solver kind `K`. */\nexport type UseNotionalCapBySymbolIdReturnType<K extends SymmioSolverKind = SymmioSolverKind> = UseQueryResult<\n GetNotionalCapBySymbolIdReturnType<K>,\n SymmioRequestError\n>;\n\n/**\n * Read the solver's available-liquidity figures for a market. Polls every\n * {@link DEFAULT_NOTIONAL_CAP_POLLING_MS} by default; pass\n * `pollingInterval: <ms>` to change the cadence or `pollingInterval: false` to\n * disable it.\n *\n * Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useNotionalCapBySymbolId({ symbolId: 132 });\n * if (data?.kind === \"enigma\") console.log(data.availableToLong); // Enigma-only\n * ```\n */\nexport function useNotionalCapBySymbolId<K extends SymmioSolverKind = SymmioSolverKind>(\n parameters: UseNotionalCapBySymbolIdParameters<K>,\n): UseNotionalCapBySymbolIdReturnType<K> {\n const { pollingInterval = DEFAULT_NOTIONAL_CAP_POLLING_MS, query, ...rest } = parameters;\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getNotionalCapBySymbolIdQueryOptions<K>(config, {\n ...rest,\n chainId: rest.chainId ?? chainId,\n query: {\n refetchInterval: pollingInterval === false ? false : pollingInterval,\n ...query,\n },\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseNotionalCapBySymbolIdReturnType<K>;\n}\n"],"mappings":";;;;;;;AAgBA,IAAa,IAAkC;AAsC/C,SAAgB,EACd,GACuC;CACvC,IAAM,EAAE,qBAAkB,GAAiC,UAAO,GAAG,MAAS,GACxE,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAwC,GAAQ;EAC9D,GAAG;EACH,SAAS,EAAK,WAAW;EACzB,OAAO;GACL,iBAAiB,MAAoB,KAAQ,KAAQ;GACrD,GAAG;EACL;CACF,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
@@ -0,0 +1,5 @@
1
+ export * from './use-binance-orderbook-source.js';
2
+ export * from './use-live-orderbook.js';
3
+ export * from './use-orderbook.js';
4
+ export * from './use-orderbook-stream.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/orderbook/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { useBinanceOrderbookSource as e } from "./use-binance-orderbook-source.js";
2
+ import { useOrderbookStream as t } from "./use-orderbook-stream.js";
3
+ import { useLiveOrderbook as n } from "./use-live-orderbook.js";
4
+ import { useOrderbook as r } from "./use-orderbook.js";
5
+ export { e as useBinanceOrderbookSource, n as useLiveOrderbook, r as useOrderbook, t as useOrderbookStream };
@@ -0,0 +1,28 @@
1
+ import { BinanceOrderbookSourceParameters, OrderbookSource } from '@symmio/trading-core';
2
+ /**
3
+ * Parameters for {@link useBinanceOrderbookSource} — the same options
4
+ * {@link createBinanceOrderbookSource} takes.
5
+ */
6
+ export type UseBinanceOrderbookSourceParameters = BinanceOrderbookSourceParameters;
7
+ /**
8
+ * Create a memoized Binance {@link OrderbookSource}.
9
+ *
10
+ * A source caches the venue's `exchangeInfo` for its lifetime, so recreating it
11
+ * on every render would refetch that on every symbol resolve — and, worse, a
12
+ * new source identity tears down and re-dials any live subscription built on
13
+ * it. This hook keeps one instance alive for as long as its options are unchanged.
14
+ *
15
+ * `resolveSymbol` participates in the memo: pass a stable reference (module
16
+ * scope, or your own `useCallback`) or the source is rebuilt each render.
17
+ *
18
+ * @param parameters - Market selection, endpoint overrides, and symbol mapping.
19
+ * @returns A stable order-book source.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * const source = useBinanceOrderbookSource();
24
+ * const { orderbook } = useLiveOrderbook({ source, marketName: "BTCUSDT" });
25
+ * ```
26
+ */
27
+ export declare function useBinanceOrderbookSource(parameters?: UseBinanceOrderbookSourceParameters): OrderbookSource;
28
+ //# sourceMappingURL=use-binance-orderbook-source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-binance-orderbook-source.d.ts","sourceRoot":"","sources":["../../src/orderbook/use-binance-orderbook-source.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,gCAAgC,EACrC,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAG9B;;;GAGG;AACH,MAAM,MAAM,mCAAmC,GAAG,gCAAgC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,GAAE,mCAAwC,GAAG,eAAe,CAO/G"}
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { createBinanceOrderbookSource as e } from "@symmio/trading-core";
3
+ import { useMemo as t } from "react";
4
+ //#region src/orderbook/use-binance-orderbook-source.ts
5
+ function n(n = {}) {
6
+ let { market: r, restUrl: i, wsUrl: a, updateSpeed: o, resolveSymbol: s, webSocketConstructor: c } = n;
7
+ return t(() => e({
8
+ market: r,
9
+ restUrl: i,
10
+ wsUrl: a,
11
+ updateSpeed: o,
12
+ resolveSymbol: s,
13
+ webSocketConstructor: c
14
+ }), [
15
+ r,
16
+ i,
17
+ a,
18
+ o,
19
+ s,
20
+ c
21
+ ]);
22
+ }
23
+ //#endregion
24
+ export { n as useBinanceOrderbookSource };
25
+
26
+ //# sourceMappingURL=use-binance-orderbook-source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-binance-orderbook-source.js","names":[],"sources":["../../src/orderbook/use-binance-orderbook-source.ts"],"sourcesContent":["\"use client\";\n\nimport {\n createBinanceOrderbookSource,\n type BinanceOrderbookSourceParameters,\n type OrderbookSource,\n} from \"@symmio/trading-core\";\nimport { useMemo } from \"react\";\n\n/**\n * Parameters for {@link useBinanceOrderbookSource} — the same options\n * {@link createBinanceOrderbookSource} takes.\n */\nexport type UseBinanceOrderbookSourceParameters = BinanceOrderbookSourceParameters;\n\n/**\n * Create a memoized Binance {@link OrderbookSource}.\n *\n * A source caches the venue's `exchangeInfo` for its lifetime, so recreating it\n * on every render would refetch that on every symbol resolve — and, worse, a\n * new source identity tears down and re-dials any live subscription built on\n * it. This hook keeps one instance alive for as long as its options are unchanged.\n *\n * `resolveSymbol` participates in the memo: pass a stable reference (module\n * scope, or your own `useCallback`) or the source is rebuilt each render.\n *\n * @param parameters - Market selection, endpoint overrides, and symbol mapping.\n * @returns A stable order-book source.\n *\n * @example\n * ```tsx\n * const source = useBinanceOrderbookSource();\n * const { orderbook } = useLiveOrderbook({ source, marketName: \"BTCUSDT\" });\n * ```\n */\nexport function useBinanceOrderbookSource(parameters: UseBinanceOrderbookSourceParameters = {}): OrderbookSource {\n const { market, restUrl, wsUrl, updateSpeed, resolveSymbol, webSocketConstructor } = parameters;\n\n return useMemo(\n () => createBinanceOrderbookSource({ market, restUrl, wsUrl, updateSpeed, resolveSymbol, webSocketConstructor }),\n [market, restUrl, wsUrl, updateSpeed, resolveSymbol, webSocketConstructor],\n );\n}\n"],"mappings":";;;;AAmCA,SAAgB,EAA0B,IAAkD,CAAC,GAAoB;CAC/G,IAAM,EAAE,WAAQ,YAAS,UAAO,gBAAa,kBAAe,4BAAyB;CAErF,OAAO,QACC,EAA6B;EAAE;EAAQ;EAAS;EAAO;EAAa;EAAe;CAAqB,CAAC,GAC/G;EAAC;EAAQ;EAAS;EAAO;EAAa;EAAe;CAAoB,CAC3E;AACF"}
@@ -0,0 +1,104 @@
1
+ import { Orderbook, OrderbookDepthLevel, OrderbookResyncReason, OrderbookSource, OrderbookSpread, OrderbookSymbol, SocketStatus } from '@symmio/trading-core';
2
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
3
+ /**
4
+ * Parameters for {@link useLiveOrderbook}.
5
+ */
6
+ export interface UseLiveOrderbookParameters {
7
+ /** The order-book source to stream from. */
8
+ source: OrderbookSource;
9
+ /** Market name as SYMMIO names it. */
10
+ marketName: string;
11
+ /** Snapshot depth the live book is built on. Defaults to the source's own default. */
12
+ limit?: number;
13
+ /**
14
+ * Levels per side to receive before grouping.
15
+ *
16
+ * Derived from `rows` and the active grouping by default, and normally best
17
+ * left alone: grouping collapses levels, so a fixed budget that fills the
18
+ * ladder at the venue tick starves it at ten times that tick. Set it only to
19
+ * cap the per-update cost deliberately, accepting that a coarse grouping may
20
+ * then render fewer than `rows` rows.
21
+ */
22
+ levels?: number;
23
+ /**
24
+ * Rows per side to return after grouping. Defaults to `15`.
25
+ *
26
+ * Both sides get the same budget, so `rows: 5` yields five bids and five asks.
27
+ */
28
+ rows?: number;
29
+ /**
30
+ * Price grouping. Defaults to the venue's own tick size, i.e. no grouping.
31
+ *
32
+ * Pick from {@link UseLiveOrderbookReturnType.tickSizeOptions} to keep a
33
+ * selector's choices to groupings the venue can actually quote.
34
+ */
35
+ tickSize?: number;
36
+ /** Subscribe only when `true`. Default `true`. */
37
+ enabled?: boolean;
38
+ }
39
+ /**
40
+ * Value returned by {@link useLiveOrderbook}.
41
+ */
42
+ export interface UseLiveOrderbookReturnType {
43
+ /** Grouped bid rows with cumulative depth, best price first. */
44
+ bids: OrderbookDepthLevel[];
45
+ /** Grouped ask rows with cumulative depth, best price first. */
46
+ asks: OrderbookDepthLevel[];
47
+ /** Best prices and the gap between them, from the **ungrouped** book. */
48
+ spread: OrderbookSpread | undefined;
49
+ /**
50
+ * Largest cumulative total across both returned sides.
51
+ *
52
+ * Normalize depth bars against this so the two sides share one scale and a
53
+ * thin side reads as thin rather than being stretched to fill its column.
54
+ */
55
+ maxTotal: number;
56
+ /** Symbol metadata: assets, precisions, and the venue tick. */
57
+ symbol: OrderbookSymbol | undefined;
58
+ /** The grouping actually applied, or `undefined` before the symbol resolves. */
59
+ tickSize: number | undefined;
60
+ /** Groupings worth offering in a selector, ascending from the venue tick. */
61
+ tickSizeOptions: number[];
62
+ /** The raw ungrouped book, for callers that want to do their own aggregation. */
63
+ orderbook: Orderbook | null;
64
+ /** `true` while the book is being rebuilt; the returned rows are the last good ones. */
65
+ isResyncing: boolean;
66
+ /** Why the current or most recent rebuild happened. */
67
+ resyncReason: OrderbookResyncReason | null;
68
+ /** `true` until the first book arrives. */
69
+ isLoading: boolean;
70
+ /** Live socket status. */
71
+ status: SocketStatus;
72
+ /** Last transport, parse, or snapshot error, normalized, or `null`. */
73
+ error: SymmioRequestError | null;
74
+ /** `true` when the source does not carry this market. */
75
+ isUnsupported: boolean;
76
+ }
77
+ /**
78
+ * A ladder-ready order book: synchronized, grouped, and accumulated.
79
+ *
80
+ * This is the hook most consumers want. It resolves the market's symbol
81
+ * metadata, holds one synchronized subscription, collapses the book onto the
82
+ * requested tick, attaches cumulative depth to every row, and reports the
83
+ * spread from the ungrouped book — grouping moves the touch prices, so a
84
+ * spread read off grouped rows would overstate it by up to two ticks.
85
+ *
86
+ * Drop to `useOrderbookStream` when you want the raw synchronized book, or to
87
+ * `useOrderbook` for a one-off snapshot.
88
+ *
89
+ * @param parameters - Source, market, depth, grouping, and row count.
90
+ * @returns Rows, spread, symbol metadata, and connection state.
91
+ *
92
+ * @example
93
+ * ```tsx
94
+ * const source = useBinanceOrderbookSource();
95
+ * const { bids, asks, spread, maxTotal, tickSizeOptions } = useLiveOrderbook({
96
+ * source,
97
+ * marketName: "BTCUSDT",
98
+ * tickSize: 0.1,
99
+ * rows: 15,
100
+ * });
101
+ * ```
102
+ */
103
+ export declare function useLiveOrderbook(parameters: UseLiveOrderbookParameters): UseLiveOrderbookReturnType;
104
+ //# sourceMappingURL=use-live-orderbook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-live-orderbook.d.ts","sourceRoot":"","sources":["../../src/orderbook/use-live-orderbook.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAkCzE;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,4CAA4C;IAC5C,MAAM,EAAE,eAAe,CAAC;IACxB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,gEAAgE;IAChE,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,gEAAgE;IAChE,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,yEAAyE;IACzE,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC;IACpC;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,MAAM,EAAE,eAAe,GAAG,SAAS,CAAC;IACpC,gFAAgF;IAChF,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,6EAA6E;IAC7E,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,iFAAiF;IACjF,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,wFAAwF;IACxF,WAAW,EAAE,OAAO,CAAC;IACrB,uDAAuD;IACvD,YAAY,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC3C,2CAA2C;IAC3C,SAAS,EAAE,OAAO,CAAC;IACnB,0BAA0B;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,uEAAuE;IACvE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjC,yDAAyD;IACzD,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,0BAA0B,GAAG,0BAA0B,CAqGnG"}
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { normalizeSymmError as e } from "../errors/normalize-symm-error.js";
3
+ import { useOrderbookStream as t } from "./use-orderbook-stream.js";
4
+ import { accumulateOrderbook as n, getOrderbookSpread as r, groupOrderbook as i, suggestOrderbookTickSizes as a } from "@symmio/trading-core";
5
+ import { useMemo as o } from "react";
6
+ import { useQuery as s } from "@tanstack/react-query";
7
+ //#region src/orderbook/use-live-orderbook.ts
8
+ var c = [
9
+ 100,
10
+ 250,
11
+ 500,
12
+ 1e3
13
+ ], l = 1e3;
14
+ function u(e, t) {
15
+ let n = Math.ceil(e * t * 1.5);
16
+ return c.find((e) => e >= n) ?? l;
17
+ }
18
+ function d(c) {
19
+ let { source: l, marketName: d, limit: f, levels: p, rows: m = 15, tickSize: h, enabled: g = !0 } = c, _ = s({
20
+ queryKey: [
21
+ "orderbookSymbol",
22
+ l.id,
23
+ d
24
+ ],
25
+ queryFn: async () => {
26
+ try {
27
+ return await l.getSymbol(d) ?? null;
28
+ } catch (t) {
29
+ throw e(t);
30
+ }
31
+ },
32
+ staleTime: Infinity,
33
+ enabled: g
34
+ }), v = _.data ?? void 0, y = _.data === null, b = _.isSuccess || _.isError, x = h ?? v?.tickSize, S = v && x && v.tickSize > 0 ? Math.max(1, x / v.tickSize) : 1, C = t({
35
+ source: l,
36
+ marketName: d,
37
+ limit: f,
38
+ levels: p ?? u(m, S),
39
+ enabled: g && b && !y
40
+ }), w = o(() => C.orderbook ? r(C.orderbook) : void 0, [C.orderbook]), T = w ? Number(w.midPrice.toPrecision(2)) : void 0, E = o(() => v && T ? a(v.tickSize, T) : [], [v, T]), { bids: D, asks: O, maxTotal: k } = o(() => {
41
+ if (!C.orderbook) return {
42
+ bids: [],
43
+ asks: [],
44
+ maxTotal: 0
45
+ };
46
+ let e = x && x > 0 ? i(C.orderbook, x) : C.orderbook, t = n(e.bids).slice(0, m), r = n(e.asks).slice(0, m);
47
+ return {
48
+ bids: t,
49
+ asks: r,
50
+ maxTotal: Math.max(t.at(-1)?.total ?? 0, r.at(-1)?.total ?? 0)
51
+ };
52
+ }, [
53
+ C.orderbook,
54
+ x,
55
+ m
56
+ ]);
57
+ return {
58
+ bids: D,
59
+ asks: O,
60
+ spread: w,
61
+ maxTotal: k,
62
+ symbol: v,
63
+ tickSize: x,
64
+ tickSizeOptions: E,
65
+ orderbook: C.orderbook,
66
+ isResyncing: C.isResyncing,
67
+ resyncReason: C.resyncReason,
68
+ isLoading: g && !y && C.orderbook === null && C.error === null && !_.isError,
69
+ status: C.status,
70
+ error: C.error ?? _.error ?? null,
71
+ isUnsupported: y
72
+ };
73
+ }
74
+ //#endregion
75
+ export { d as useLiveOrderbook };
76
+
77
+ //# sourceMappingURL=use-live-orderbook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-live-orderbook.js","names":[],"sources":["../../src/orderbook/use-live-orderbook.ts"],"sourcesContent":["\"use client\";\n\nimport {\n accumulateOrderbook,\n getOrderbookSpread,\n groupOrderbook,\n suggestOrderbookTickSizes,\n type Orderbook,\n type OrderbookDepthLevel,\n type OrderbookResyncReason,\n type OrderbookSource,\n type OrderbookSpread,\n type OrderbookSymbol,\n type SocketStatus,\n} from \"@symmio/trading-core\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useOrderbookStream } from \"./use-orderbook-stream\";\n\n/**\n * Level budgets the subscription rounds up to.\n *\n * Quantized on purpose: `levels` is a subscription parameter, so recomputing it\n * exactly would re-dial the socket and refetch a snapshot every time the\n * grouping nudged. Rounding into a handful of buckets means only a real jump in\n * appetite costs a resubscribe.\n */\nconst LEVEL_BUDGETS = [100, 250, 500, 1000] as const;\n\n/**\n * Ceiling on the derived budget.\n *\n * Past this the venue's own snapshot depth becomes the binding constraint, so\n * asking for more buys nothing but per-tick allocation.\n */\nconst MAX_LEVEL_BUDGET = 1000;\n\n/**\n * Levels to stream so that `rows` rows can actually be filled after grouping.\n *\n * The naive product (`rows × groupingRatio`) assumes every venue tick is\n * occupied. Real books thin out away from the touch, so the estimate carries\n * headroom — without it a coarse grouping starves the ladder and it renders\n * half-empty.\n */\nfunction resolveLevelBudget(rows: number, groupingRatio: number): number {\n const needed = Math.ceil(rows * groupingRatio * 1.5);\n return LEVEL_BUDGETS.find((budget) => budget >= needed) ?? MAX_LEVEL_BUDGET;\n}\n\n/**\n * Parameters for {@link useLiveOrderbook}.\n */\nexport interface UseLiveOrderbookParameters {\n /** The order-book source to stream from. */\n source: OrderbookSource;\n /** Market name as SYMMIO names it. */\n marketName: string;\n /** Snapshot depth the live book is built on. Defaults to the source's own default. */\n limit?: number;\n /**\n * Levels per side to receive before grouping.\n *\n * Derived from `rows` and the active grouping by default, and normally best\n * left alone: grouping collapses levels, so a fixed budget that fills the\n * ladder at the venue tick starves it at ten times that tick. Set it only to\n * cap the per-update cost deliberately, accepting that a coarse grouping may\n * then render fewer than `rows` rows.\n */\n levels?: number;\n /**\n * Rows per side to return after grouping. Defaults to `15`.\n *\n * Both sides get the same budget, so `rows: 5` yields five bids and five asks.\n */\n rows?: number;\n /**\n * Price grouping. Defaults to the venue's own tick size, i.e. no grouping.\n *\n * Pick from {@link UseLiveOrderbookReturnType.tickSizeOptions} to keep a\n * selector's choices to groupings the venue can actually quote.\n */\n tickSize?: number;\n /** Subscribe only when `true`. Default `true`. */\n enabled?: boolean;\n}\n\n/**\n * Value returned by {@link useLiveOrderbook}.\n */\nexport interface UseLiveOrderbookReturnType {\n /** Grouped bid rows with cumulative depth, best price first. */\n bids: OrderbookDepthLevel[];\n /** Grouped ask rows with cumulative depth, best price first. */\n asks: OrderbookDepthLevel[];\n /** Best prices and the gap between them, from the **ungrouped** book. */\n spread: OrderbookSpread | undefined;\n /**\n * Largest cumulative total across both returned sides.\n *\n * Normalize depth bars against this so the two sides share one scale and a\n * thin side reads as thin rather than being stretched to fill its column.\n */\n maxTotal: number;\n /** Symbol metadata: assets, precisions, and the venue tick. */\n symbol: OrderbookSymbol | undefined;\n /** The grouping actually applied, or `undefined` before the symbol resolves. */\n tickSize: number | undefined;\n /** Groupings worth offering in a selector, ascending from the venue tick. */\n tickSizeOptions: number[];\n /** The raw ungrouped book, for callers that want to do their own aggregation. */\n orderbook: Orderbook | null;\n /** `true` while the book is being rebuilt; the returned rows are the last good ones. */\n isResyncing: boolean;\n /** Why the current or most recent rebuild happened. */\n resyncReason: OrderbookResyncReason | null;\n /** `true` until the first book arrives. */\n isLoading: boolean;\n /** Live socket status. */\n status: SocketStatus;\n /** Last transport, parse, or snapshot error, normalized, or `null`. */\n error: SymmioRequestError | null;\n /** `true` when the source does not carry this market. */\n isUnsupported: boolean;\n}\n\n/**\n * A ladder-ready order book: synchronized, grouped, and accumulated.\n *\n * This is the hook most consumers want. It resolves the market's symbol\n * metadata, holds one synchronized subscription, collapses the book onto the\n * requested tick, attaches cumulative depth to every row, and reports the\n * spread from the ungrouped book — grouping moves the touch prices, so a\n * spread read off grouped rows would overstate it by up to two ticks.\n *\n * Drop to `useOrderbookStream` when you want the raw synchronized book, or to\n * `useOrderbook` for a one-off snapshot.\n *\n * @param parameters - Source, market, depth, grouping, and row count.\n * @returns Rows, spread, symbol metadata, and connection state.\n *\n * @example\n * ```tsx\n * const source = useBinanceOrderbookSource();\n * const { bids, asks, spread, maxTotal, tickSizeOptions } = useLiveOrderbook({\n * source,\n * marketName: \"BTCUSDT\",\n * tickSize: 0.1,\n * rows: 15,\n * });\n * ```\n */\nexport function useLiveOrderbook(parameters: UseLiveOrderbookParameters): UseLiveOrderbookReturnType {\n const { source, marketName, limit, levels, rows = 15, tickSize, enabled = true } = parameters;\n\n const symbolQuery = useQuery({\n queryKey: [\"orderbookSymbol\", source.id, marketName],\n queryFn: async () => {\n try {\n /** `undefined` means \"not listed here\", which TanStack cannot cache — `null` can. */\n return (await source.getSymbol(marketName)) ?? null;\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n /** Listings change on a delisting, not on a render. */\n staleTime: Number.POSITIVE_INFINITY,\n enabled,\n });\n\n const symbol = symbolQuery.data ?? undefined;\n const isUnsupported = symbolQuery.data === null;\n\n /**\n * Streaming waits for the listing check to land. Dialing first and tearing\n * down once the answer arrives costs a wasted socket and a snapshot request\n * that the venue rejects outright for a market it does not list.\n *\n * A failed check fails **open**: a transient metadata error should not stand\n * between a listed market and its book.\n */\n const isListingKnown = symbolQuery.isSuccess || symbolQuery.isError;\n\n const appliedTickSize = tickSize ?? symbol?.tickSize;\n\n /**\n * How many venue ticks one rendered row spans. Grouping at ten times the\n * venue tick means each row swallows up to ten levels, so the ladder needs\n * roughly ten times as many of them to fill the same number of rows.\n */\n const groupingRatio =\n symbol && appliedTickSize && symbol.tickSize > 0 ? Math.max(1, appliedTickSize / symbol.tickSize) : 1;\n\n const streamLevels = levels ?? resolveLevelBudget(rows, groupingRatio);\n\n const stream = useOrderbookStream({\n source,\n marketName,\n limit,\n levels: streamLevels,\n enabled: enabled && isListingKnown && !isUnsupported,\n });\n\n const spread = useMemo(\n () => (stream.orderbook ? getOrderbookSpread(stream.orderbook) : undefined),\n [stream.orderbook],\n );\n\n /**\n * The ladder is scaled against the price's order of magnitude, not its live\n * mid. Recomputing on every tick would hand a selector a new array of\n * options several times a second, for a list that should look fixed.\n */\n const referencePrice = spread ? Number(spread.midPrice.toPrecision(2)) : undefined;\n\n const tickSizeOptions = useMemo(\n () => (symbol && referencePrice ? suggestOrderbookTickSizes(symbol.tickSize, referencePrice) : []),\n [symbol, referencePrice],\n );\n\n const { bids, asks, maxTotal } = useMemo(() => {\n if (!stream.orderbook) return { bids: [], asks: [], maxTotal: 0 };\n\n const grouped =\n appliedTickSize && appliedTickSize > 0 ? groupOrderbook(stream.orderbook, appliedTickSize) : stream.orderbook;\n\n const groupedBids = accumulateOrderbook(grouped.bids).slice(0, rows);\n const groupedAsks = accumulateOrderbook(grouped.asks).slice(0, rows);\n\n return {\n bids: groupedBids,\n asks: groupedAsks,\n /** Both sides share one scale, so a thin side reads as thin. */\n maxTotal: Math.max(groupedBids.at(-1)?.total ?? 0, groupedAsks.at(-1)?.total ?? 0),\n };\n }, [stream.orderbook, appliedTickSize, rows]);\n\n return {\n bids,\n asks,\n spread,\n maxTotal,\n symbol,\n tickSize: appliedTickSize,\n tickSizeOptions,\n orderbook: stream.orderbook,\n isResyncing: stream.isResyncing,\n resyncReason: stream.resyncReason,\n isLoading: enabled && !isUnsupported && stream.orderbook === null && stream.error === null && !symbolQuery.isError,\n status: stream.status,\n error: stream.error ?? (symbolQuery.error as SymmioRequestError | null) ?? null,\n isUnsupported,\n };\n}\n"],"mappings":";;;;;;;AA6BA,IAAM,IAAgB;CAAC;CAAK;CAAK;CAAK;AAAI,GAQpC,IAAmB;AAUzB,SAAS,EAAmB,GAAc,GAA+B;CACvE,IAAM,IAAS,KAAK,KAAK,IAAO,IAAgB,GAAG;CACnD,OAAO,EAAc,MAAM,MAAW,KAAU,CAAM,KAAK;AAC7D;AAwGA,SAAgB,EAAiB,GAAoE;CACnG,IAAM,EAAE,WAAQ,eAAY,UAAO,WAAQ,UAAO,IAAI,aAAU,aAAU,OAAS,GAE7E,IAAc,EAAS;EAC3B,UAAU;GAAC;GAAmB,EAAO;GAAI;EAAU;EACnD,SAAS,YAAY;GACnB,IAAI;IAEF,OAAQ,MAAM,EAAO,UAAU,CAAU,KAAM;GACjD,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EAEA,WAAW;EACX;CACF,CAAC,GAEK,IAAS,EAAY,QAAQ,KAAA,GAC7B,IAAgB,EAAY,SAAS,MAUrC,IAAiB,EAAY,aAAa,EAAY,SAEtD,IAAkB,KAAY,GAAQ,UAOtC,IACJ,KAAU,KAAmB,EAAO,WAAW,IAAI,KAAK,IAAI,GAAG,IAAkB,EAAO,QAAQ,IAAI,GAIhG,IAAS,EAAmB;EAChC;EACA;EACA;EACA,QANmB,KAAU,EAAmB,GAAM,CAAa;EAOnE,SAAS,KAAW,KAAkB,CAAC;CACzC,CAAC,GAEK,IAAS,QACN,EAAO,YAAY,EAAmB,EAAO,SAAS,IAAI,KAAA,GACjE,CAAC,EAAO,SAAS,CACnB,GAOM,IAAiB,IAAS,OAAO,EAAO,SAAS,YAAY,CAAC,CAAC,IAAI,KAAA,GAEnE,IAAkB,QACf,KAAU,IAAiB,EAA0B,EAAO,UAAU,CAAc,IAAI,CAAC,GAChG,CAAC,GAAQ,CAAc,CACzB,GAEM,EAAE,SAAM,SAAM,gBAAa,QAAc;EAC7C,IAAI,CAAC,EAAO,WAAW,OAAO;GAAE,MAAM,CAAC;GAAG,MAAM,CAAC;GAAG,UAAU;EAAE;EAEhE,IAAM,IACJ,KAAmB,IAAkB,IAAI,EAAe,EAAO,WAAW,CAAe,IAAI,EAAO,WAEhG,IAAc,EAAoB,EAAQ,IAAI,EAAE,MAAM,GAAG,CAAI,GAC7D,IAAc,EAAoB,EAAQ,IAAI,EAAE,MAAM,GAAG,CAAI;EAEnE,OAAO;GACL,MAAM;GACN,MAAM;GAEN,UAAU,KAAK,IAAI,EAAY,GAAG,EAAE,GAAG,SAAS,GAAG,EAAY,GAAG,EAAE,GAAG,SAAS,CAAC;EACnF;CACF,GAAG;EAAC,EAAO;EAAW;EAAiB;CAAI,CAAC;CAE5C,OAAO;EACL;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA,WAAW,EAAO;EAClB,aAAa,EAAO;EACpB,cAAc,EAAO;EACrB,WAAW,KAAW,CAAC,KAAiB,EAAO,cAAc,QAAQ,EAAO,UAAU,QAAQ,CAAC,EAAY;EAC3G,QAAQ,EAAO;EACf,OAAO,EAAO,SAAU,EAAY,SAAuC;EAC3E;CACF;AACF"}
@@ -0,0 +1,73 @@
1
+ import { Orderbook, OrderbookResyncReason, OrderbookSource, SocketStatus } from '@symmio/trading-core';
2
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
3
+ /**
4
+ * Parameters for {@link useOrderbookStream}.
5
+ */
6
+ export interface UseOrderbookStreamParameters {
7
+ /** The order-book source to stream from. Must implement `watchOrderbook`. */
8
+ source: OrderbookSource;
9
+ /** Market name as SYMMIO names it. */
10
+ marketName: string;
11
+ /** Snapshot depth the live book is built on. Defaults to the source's own default. */
12
+ limit?: number;
13
+ /** Levels per side to receive on each update. Defaults to the source's own default. */
14
+ levels?: number;
15
+ /** Subscribe only when `true`. Default `true`. */
16
+ enabled?: boolean;
17
+ /**
18
+ * Called for every book update, ahead of the state update.
19
+ *
20
+ * Use this to drive a canvas depth chart imperatively without re-rendering on
21
+ * every tick. The reference is read through a ref, so an inline arrow does
22
+ * not re-subscribe.
23
+ */
24
+ onOrderbook?: (orderbook: Orderbook) => void;
25
+ /** Called whenever the book is being rebuilt. Read through a ref. */
26
+ onResync?: (reason: OrderbookResyncReason) => void;
27
+ }
28
+ /**
29
+ * Value returned by {@link useOrderbookStream}.
30
+ */
31
+ export interface UseOrderbookStreamReturnType {
32
+ /** The latest synchronized book, or `null` until the first one arrives. */
33
+ orderbook: Orderbook | null;
34
+ /**
35
+ * `true` while the book is being rebuilt from a fresh snapshot.
36
+ *
37
+ * {@link UseOrderbookStreamReturnType.orderbook} still holds the last good
38
+ * book during a rebuild — show it dimmed rather than blanking the ladder.
39
+ */
40
+ isResyncing: boolean;
41
+ /** Why the current or most recent rebuild happened, or `null` before the first. */
42
+ resyncReason: OrderbookResyncReason | null;
43
+ /** Live socket status. */
44
+ status: SocketStatus;
45
+ /** Last transport, parse, or snapshot error, normalized, or `null`. */
46
+ error: SymmioRequestError | null;
47
+ }
48
+ /**
49
+ * Subscribe to a continuously synchronized order book for one market.
50
+ *
51
+ * The heavy lifting — buffering, snapshot ordering, sequence verification and
52
+ * rebuilding on a gap — happens inside the source. What this adds is the React
53
+ * lifecycle: one subscription per (source, market, depth), torn down on unmount
54
+ * or when `enabled` goes false, with handlers read through refs so inline
55
+ * arrows never re-dial the socket.
56
+ *
57
+ * Prefer `useLiveOrderbook` when you want a ladder: it layers grouping,
58
+ * cumulative depth and the spread on top of this.
59
+ *
60
+ * @param parameters - Source, market, depth, and handlers.
61
+ * @returns The latest book plus connection and resync state.
62
+ *
63
+ * @example
64
+ * ```tsx
65
+ * const { orderbook, isResyncing, status } = useOrderbookStream({
66
+ * source,
67
+ * marketName: "BTCUSDT",
68
+ * levels: 15,
69
+ * });
70
+ * ```
71
+ */
72
+ export declare function useOrderbookStream(parameters: UseOrderbookStreamParameters): UseOrderbookStreamReturnType;
73
+ //# sourceMappingURL=use-orderbook-stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-orderbook-stream.d.ts","sourceRoot":"","sources":["../../src/orderbook/use-orderbook-stream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG5G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,MAAM,EAAE,eAAe,CAAC;IACxB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IAC7C,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,2EAA2E;IAC3E,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B;;;;;OAKG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,mFAAmF;IACnF,YAAY,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC3C,0BAA0B;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,uEAAuE;IACvE,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,4BAA4B,GAAG,4BAA4B,CAwDzG"}
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { normalizeSymmError as e } from "../errors/normalize-symm-error.js";
3
+ import { useEffect as t, useRef as n, useState as r } from "react";
4
+ //#region src/orderbook/use-orderbook-stream.ts
5
+ function i(i) {
6
+ let { source: a, marketName: o, limit: s, levels: c, enabled: l = !0, onOrderbook: u, onResync: d } = i, [f, p] = r(null), [m, h] = r(!1), [g, _] = r(null), [v, y] = r("closed"), [b, x] = r(null), S = n(u), C = n(d);
7
+ return S.current = u, C.current = d, t(() => {
8
+ if (!l || !a.watchOrderbook) {
9
+ y("closed");
10
+ return;
11
+ }
12
+ x(null), p(null);
13
+ let t;
14
+ try {
15
+ t = a.watchOrderbook({
16
+ marketName: o,
17
+ limit: s,
18
+ levels: c,
19
+ onOrderbook: (e) => {
20
+ S.current?.(e), p(e), h(!1);
21
+ },
22
+ onResync: (e) => {
23
+ C.current?.(e), _(e), h(!0);
24
+ },
25
+ onStatusChange: y,
26
+ onError: (t) => x(e(t))
27
+ });
28
+ } catch (t) {
29
+ x(e(t)), y("closed");
30
+ }
31
+ return () => t?.();
32
+ }, [
33
+ l,
34
+ a,
35
+ o,
36
+ s,
37
+ c
38
+ ]), {
39
+ orderbook: f,
40
+ isResyncing: m,
41
+ resyncReason: g,
42
+ status: v,
43
+ error: b
44
+ };
45
+ }
46
+ //#endregion
47
+ export { i as useOrderbookStream };
48
+
49
+ //# sourceMappingURL=use-orderbook-stream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-orderbook-stream.js","names":[],"sources":["../../src/orderbook/use-orderbook-stream.ts"],"sourcesContent":["\"use client\";\n\nimport type { Orderbook, OrderbookResyncReason, OrderbookSource, SocketStatus } from \"@symmio/trading-core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\n\n/**\n * Parameters for {@link useOrderbookStream}.\n */\nexport interface UseOrderbookStreamParameters {\n /** The order-book source to stream from. Must implement `watchOrderbook`. */\n source: OrderbookSource;\n /** Market name as SYMMIO names it. */\n marketName: string;\n /** Snapshot depth the live book is built on. Defaults to the source's own default. */\n limit?: number;\n /** Levels per side to receive on each update. Defaults to the source's own default. */\n levels?: number;\n /** Subscribe only when `true`. Default `true`. */\n enabled?: boolean;\n /**\n * Called for every book update, ahead of the state update.\n *\n * Use this to drive a canvas depth chart imperatively without re-rendering on\n * every tick. The reference is read through a ref, so an inline arrow does\n * not re-subscribe.\n */\n onOrderbook?: (orderbook: Orderbook) => void;\n /** Called whenever the book is being rebuilt. Read through a ref. */\n onResync?: (reason: OrderbookResyncReason) => void;\n}\n\n/**\n * Value returned by {@link useOrderbookStream}.\n */\nexport interface UseOrderbookStreamReturnType {\n /** The latest synchronized book, or `null` until the first one arrives. */\n orderbook: Orderbook | null;\n /**\n * `true` while the book is being rebuilt from a fresh snapshot.\n *\n * {@link UseOrderbookStreamReturnType.orderbook} still holds the last good\n * book during a rebuild — show it dimmed rather than blanking the ladder.\n */\n isResyncing: boolean;\n /** Why the current or most recent rebuild happened, or `null` before the first. */\n resyncReason: OrderbookResyncReason | null;\n /** Live socket status. */\n status: SocketStatus;\n /** Last transport, parse, or snapshot error, normalized, or `null`. */\n error: SymmioRequestError | null;\n}\n\n/**\n * Subscribe to a continuously synchronized order book for one market.\n *\n * The heavy lifting — buffering, snapshot ordering, sequence verification and\n * rebuilding on a gap — happens inside the source. What this adds is the React\n * lifecycle: one subscription per (source, market, depth), torn down on unmount\n * or when `enabled` goes false, with handlers read through refs so inline\n * arrows never re-dial the socket.\n *\n * Prefer `useLiveOrderbook` when you want a ladder: it layers grouping,\n * cumulative depth and the spread on top of this.\n *\n * @param parameters - Source, market, depth, and handlers.\n * @returns The latest book plus connection and resync state.\n *\n * @example\n * ```tsx\n * const { orderbook, isResyncing, status } = useOrderbookStream({\n * source,\n * marketName: \"BTCUSDT\",\n * levels: 15,\n * });\n * ```\n */\nexport function useOrderbookStream(parameters: UseOrderbookStreamParameters): UseOrderbookStreamReturnType {\n const { source, marketName, limit, levels, enabled = true, onOrderbook, onResync } = parameters;\n\n const [orderbook, setOrderbook] = useState<Orderbook | null>(null);\n const [isResyncing, setIsResyncing] = useState(false);\n const [resyncReason, setResyncReason] = useState<OrderbookResyncReason | null>(null);\n const [status, setStatus] = useState<SocketStatus>(\"closed\");\n const [error, setError] = useState<SymmioRequestError | null>(null);\n\n /**\n * Handlers are read through refs so a consumer passing inline arrows does not\n * tear down and re-dial the socket on every render.\n */\n const onOrderbookRef = useRef(onOrderbook);\n const onResyncRef = useRef(onResync);\n onOrderbookRef.current = onOrderbook;\n onResyncRef.current = onResync;\n\n useEffect(() => {\n if (!enabled || !source.watchOrderbook) {\n setStatus(\"closed\");\n return;\n }\n\n setError(null);\n /** A new market's book has nothing to do with the previous one's. */\n setOrderbook(null);\n\n let unwatch: (() => void) | undefined;\n try {\n unwatch = source.watchOrderbook({\n marketName,\n limit,\n levels,\n onOrderbook: (next) => {\n onOrderbookRef.current?.(next);\n setOrderbook(next);\n setIsResyncing(false);\n },\n onResync: (reason) => {\n onResyncRef.current?.(reason);\n setResyncReason(reason);\n setIsResyncing(true);\n },\n onStatusChange: setStatus,\n onError: (err) => setError(normalizeSymmError(err)),\n });\n } catch (err) {\n setError(normalizeSymmError(err));\n setStatus(\"closed\");\n }\n\n return () => unwatch?.();\n }, [enabled, source, marketName, limit, levels]);\n\n return { orderbook, isResyncing, resyncReason, status, error };\n}\n"],"mappings":";;;;AA8EA,SAAgB,EAAmB,GAAwE;CACzG,IAAM,EAAE,WAAQ,eAAY,UAAO,WAAQ,aAAU,IAAM,gBAAa,gBAAa,GAE/E,CAAC,GAAW,KAAgB,EAA2B,IAAI,GAC3D,CAAC,GAAa,KAAkB,EAAS,EAAK,GAC9C,CAAC,GAAc,KAAmB,EAAuC,IAAI,GAC7E,CAAC,GAAQ,KAAa,EAAuB,QAAQ,GACrD,CAAC,GAAO,KAAY,EAAoC,IAAI,GAM5D,IAAiB,EAAO,CAAW,GACnC,IAAc,EAAO,CAAQ;CAyCnC,OAxCA,EAAe,UAAU,GACzB,EAAY,UAAU,GAEtB,QAAgB;EACd,IAAI,CAAC,KAAW,CAAC,EAAO,gBAAgB;GACtC,EAAU,QAAQ;GAClB;EACF;EAIA,AAFA,EAAS,IAAI,GAEb,EAAa,IAAI;EAEjB,IAAI;EACJ,IAAI;GACF,IAAU,EAAO,eAAe;IAC9B;IACA;IACA;IACA,cAAc,MAAS;KAGrB,AAFA,EAAe,UAAU,CAAI,GAC7B,EAAa,CAAI,GACjB,EAAe,EAAK;IACtB;IACA,WAAW,MAAW;KAGpB,AAFA,EAAY,UAAU,CAAM,GAC5B,EAAgB,CAAM,GACtB,EAAe,EAAI;IACrB;IACA,gBAAgB;IAChB,UAAU,MAAQ,EAAS,EAAmB,CAAG,CAAC;GACpD,CAAC;EACH,SAAS,GAAK;GAEZ,AADA,EAAS,EAAmB,CAAG,CAAC,GAChC,EAAU,QAAQ;EACpB;EAEA,aAAa,IAAU;CACzB,GAAG;EAAC;EAAS;EAAQ;EAAY;EAAO;CAAM,CAAC,GAExC;EAAE;EAAW;EAAa;EAAc;EAAQ;CAAM;AAC/D"}
@@ -0,0 +1,35 @@
1
+ import { GetOrderbookOptions, Orderbook, OrderbookSource } from '@symmio/trading-core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /**
5
+ * Parameters for {@link useOrderbook}: the source to read from, the book to
6
+ * fetch, and TanStack `query` overrides.
7
+ */
8
+ export type UseOrderbookParameters = GetOrderbookOptions & {
9
+ /** The order-book source to read from, e.g. from {@link useBinanceOrderbookSource}. */
10
+ source: OrderbookSource;
11
+ };
12
+ /** Return type of {@link useOrderbook}. */
13
+ export type UseOrderbookReturnType = UseQueryResult<Orderbook, SymmioRequestError>;
14
+ /**
15
+ * Fetch a point-in-time order-book snapshot from an {@link OrderbookSource}.
16
+ *
17
+ * The source's `id` is part of the query key, so switching venues does not read
18
+ * another venue's cached book.
19
+ *
20
+ * A snapshot is stale the moment it lands. Use this for a one-off read — sizing
21
+ * a single order, an impact estimate, a server-rendered summary. For anything a
22
+ * user watches, use `useLiveOrderbook`: a synchronized diff stream is fresher
23
+ * than any poll interval and costs a fraction of the venue's rate-limit weight.
24
+ *
25
+ * @param parameters - Source, market, depth, and query overrides.
26
+ * @returns A TanStack query result carrying the book.
27
+ *
28
+ * @example
29
+ * ```tsx
30
+ * const source = useBinanceOrderbookSource();
31
+ * const { data, isLoading } = useOrderbook({ source, marketName: "BTCUSDT", limit: 20 });
32
+ * ```
33
+ */
34
+ export declare function useOrderbook(parameters: UseOrderbookParameters): UseOrderbookReturnType;
35
+ //# sourceMappingURL=use-orderbook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-orderbook.d.ts","sourceRoot":"","sources":["../../src/orderbook/use-orderbook.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,SAAS,EACd,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG;IACzD,uFAAuF;IACvF,MAAM,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAEnF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,sBAAsB,GAAG,sBAAsB,CAcvF"}