@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
@@ -0,0 +1,33 @@
1
+ "use client";
2
+ import { useMarkets as e } from "../markets/use-markets.js";
3
+ import { usePriceByName as t } from "./use-price-by-name.js";
4
+ import { useMemo as n } from "react";
5
+ //#region src/price-service/use-price-by-market-id.ts
6
+ function r(e) {
7
+ return typeof e == "number" ? e : Number(e);
8
+ }
9
+ function i(i) {
10
+ let { marketId: a, chainId: o, solverId: s, enabled: c = !0, ...l } = i, u = e({
11
+ chainId: o,
12
+ solverId: s,
13
+ ...l
14
+ }), d = n(() => r(a), [a]), f = n(() => u.data ? u.data.find((e) => e.symbolId === d)?.name ?? null : null, [u.data, d]), p = t({
15
+ ...l,
16
+ chainId: o,
17
+ solverId: s,
18
+ name: f ?? void 0,
19
+ enabled: c && f !== null
20
+ });
21
+ return {
22
+ markPrice: p.markPrice,
23
+ marketName: f,
24
+ tick: p.tick,
25
+ status: p.status,
26
+ error: p.error,
27
+ isLoading: u.isLoading || f !== null && p.markPrice === null
28
+ };
29
+ }
30
+ //#endregion
31
+ export { i as usePriceByMarketId };
32
+
33
+ //# sourceMappingURL=use-price-by-market-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-price-by-market-id.js","names":[],"sources":["../../src/price-service/use-price-by-market-id.ts"],"sourcesContent":["\"use client\";\n\nimport type { ConfigParameter, MarkPriceTick, SocketStatus, SolverId } from \"@symmio/trading-core\";\nimport { useMemo } from \"react\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useMarkets } from \"../markets/use-markets\";\nimport { usePriceByName } from \"./use-price-by-name\";\nimport type { UsePricesRestFallback } from \"./use-prices\";\n\n/**\n * Parameters for {@link usePriceByMarketId}.\n */\nexport interface UsePriceByMarketIdParameters extends ConfigParameter {\n /** Solver market id (`symbol_id`). */\n marketId: number | bigint | string;\n /** Target chain id. Defaults to the SDK's active chain. */\n chainId?: number;\n /** Solver whose markets and price provider serve this id. Defaults to the chain's default solver. */\n solverId?: SolverId;\n /** Subscribe only when `true` (and the market resolves). Default `true`. */\n enabled?: boolean;\n /** REST snapshot polling while the socket is degraded. See {@link usePrices}. */\n restFallback?: UsePricesRestFallback;\n}\n\n/**\n * Value returned by {@link usePriceByMarketId}.\n */\nexport interface UsePriceByMarketIdReturnType {\n /** Latest mark price for the resolved market, or `null` until the first tick. */\n markPrice: string | null;\n /** Symbol name resolved from {@link useMarkets}, or `null` if not found yet. */\n marketName: string | null;\n /** The full tick, for provider-specific fields. Narrow on `provider`. */\n tick: MarkPriceTick | null;\n /** Live socket status. */\n status: SocketStatus;\n /** Last transport/parse error, normalized, or `null`. */\n error: SymmioRequestError | null;\n /** True while markets are loading or the price has not ticked yet. */\n isLoading: boolean;\n}\n\nfunction toMarketIdNumber(value: number | bigint | string): number {\n if (typeof value === \"number\") return value;\n if (typeof value === \"bigint\") return Number(value);\n return Number(value);\n}\n\n/**\n * Stream the live mark price for a market resolved by its solver `symbol_id`,\n * from **whichever price provider serves the resolved solver** — Enigma on a\n * lowcap chain, Binance USD-M Futures on a majors chain.\n *\n * Composes {@link useMarkets} (to translate `marketId → name`) with\n * {@link usePriceByName} (to subscribe to just that symbol on the resolved\n * provider). This is the provider-agnostic replacement for\n * `useEnigmaPriceByMarketId`, which asserts an Enigma price service and\n * therefore fails on chains priced by Binance.\n *\n * @example\n * ```tsx\n * const { markPrice, marketName, isLoading } = usePriceByMarketId({ marketId: 132 });\n * ```\n */\nexport function usePriceByMarketId(parameters: UsePriceByMarketIdParameters): UsePriceByMarketIdReturnType {\n const { marketId, chainId, solverId, enabled = true, ...rest } = parameters;\n\n const marketsQuery = useMarkets({ chainId, solverId, ...rest });\n const targetId = useMemo(() => toMarketIdNumber(marketId), [marketId]);\n\n const marketName = useMemo<string | null>(() => {\n if (!marketsQuery.data) return null;\n const market = marketsQuery.data.find((entry) => entry.symbolId === targetId);\n return market?.name ?? null;\n }, [marketsQuery.data, targetId]);\n\n const priceQuery = usePriceByName({\n ...rest,\n chainId,\n solverId,\n name: marketName ?? undefined,\n enabled: enabled && marketName !== null,\n });\n\n return {\n markPrice: priceQuery.markPrice,\n marketName,\n tick: priceQuery.tick,\n status: priceQuery.status,\n error: priceQuery.error,\n isLoading: marketsQuery.isLoading || (marketName !== null && priceQuery.markPrice === null),\n };\n}\n"],"mappings":";;;;;AA2CA,SAAS,EAAiB,GAAyC;CAGjE,OAFI,OAAO,KAAU,WAAiB,IACA,OAAO,CAAK;AAEpD;AAkBA,SAAgB,EAAmB,GAAwE;CACzG,IAAM,EAAE,aAAU,YAAS,aAAU,aAAU,IAAM,GAAG,MAAS,GAE3D,IAAe,EAAW;EAAE;EAAS;EAAU,GAAG;CAAK,CAAC,GACxD,IAAW,QAAc,EAAiB,CAAQ,GAAG,CAAC,CAAQ,CAAC,GAE/D,IAAa,QACZ,EAAa,OACH,EAAa,KAAK,MAAM,MAAU,EAAM,aAAa,CAC7D,GAAQ,QAAQ,OAFQ,MAG9B,CAAC,EAAa,MAAM,CAAQ,CAAC,GAE1B,IAAa,EAAe;EAChC,GAAG;EACH;EACA;EACA,MAAM,KAAc,KAAA;EACpB,SAAS,KAAW,MAAe;CACrC,CAAC;CAED,OAAO;EACL,WAAW,EAAW;EACtB;EACA,MAAM,EAAW;EACjB,QAAQ,EAAW;EACnB,OAAO,EAAW;EAClB,WAAW,EAAa,aAAc,MAAe,QAAQ,EAAW,cAAc;CACxF;AACF"}
@@ -0,0 +1,48 @@
1
+ import { ConfigParameter, MarkPriceTick, SocketStatus, SolverId } from '@symmio/trading-core';
2
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
3
+ import { UsePricesRestFallback } from './use-prices.js';
4
+ /**
5
+ * Parameters for {@link usePriceByName}.
6
+ */
7
+ export interface UsePriceByNameParameters extends ConfigParameter {
8
+ /** Market name to price, e.g. `"BTCUSDT"`. Subscription is disabled while undefined. */
9
+ name?: string;
10
+ /** Target chain id. Defaults to the SDK's active chain. */
11
+ chainId?: number;
12
+ /** Solver whose price provider to subscribe to. Defaults to the chain's default solver. */
13
+ solverId?: SolverId;
14
+ /** Subscribe only when `true`. Default `true`. */
15
+ enabled?: boolean;
16
+ /** REST snapshot polling while the socket is degraded. See {@link usePrices}. */
17
+ restFallback?: UsePricesRestFallback;
18
+ }
19
+ /**
20
+ * Value returned by {@link usePriceByName}.
21
+ */
22
+ export interface UsePriceByNameReturnType {
23
+ /** Latest mark price as a decimal string, or `null` before the first tick. */
24
+ markPrice: string | null;
25
+ /** The full tick, for provider-specific fields. Narrow on `provider`. */
26
+ tick: MarkPriceTick | null;
27
+ /** Live socket status. */
28
+ status: SocketStatus;
29
+ /** Last transport/parse error, normalized, or `null`. */
30
+ error: SymmioRequestError | null;
31
+ }
32
+ /**
33
+ * Track one market's mark price from whichever provider serves the resolved
34
+ * solver.
35
+ *
36
+ * Subscribes with a single-name filter, so on Binance — whose stream pushes every
37
+ * listed symbol once per second — this re-renders on that one market's ticks
38
+ * rather than on all ~740. A ref gate suppresses re-renders when a tick repeats
39
+ * the price already held.
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * const { markPrice, status } = usePriceByName({ name: "BTCUSDT", solverId: "rasa" });
44
+ * return <span>{markPrice ?? "—"} ({status})</span>;
45
+ * ```
46
+ */
47
+ export declare function usePriceByName(parameters: UsePriceByNameParameters): UsePriceByNameReturnType;
48
+ //# sourceMappingURL=use-price-by-name.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-price-by-name.d.ts","sourceRoot":"","sources":["../../src/price-service/use-price-by-name.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEnG,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAa,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,eAAe;IAC/D,wFAAwF;IACxF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iFAAiF;IACjF,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,8EAA8E;IAC9E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,yEAAyE;IACzE,IAAI,EAAE,aAAa,GAAG,IAAI,CAAC;IAC3B,0BAA0B;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,yDAAyD;IACzD,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,wBAAwB,GAAG,wBAAwB,CAiB7F"}
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { usePrices as e } from "./use-prices.js";
3
+ import { useRef as t } from "react";
4
+ //#region src/price-service/use-price-by-name.ts
5
+ function n(n) {
6
+ let { name: r, enabled: i = !0, ...a } = n, { ticks: o, status: s, error: c } = e({
7
+ ...a,
8
+ names: r ? [r] : void 0,
9
+ enabled: i && !!r
10
+ }), l = r ? o[r] ?? null : null, u = t(null);
11
+ l && (u.current = l);
12
+ let d = l ?? u.current;
13
+ return {
14
+ markPrice: d?.markPrice ?? null,
15
+ tick: d,
16
+ status: s,
17
+ error: c
18
+ };
19
+ }
20
+ //#endregion
21
+ export { n as usePriceByName };
22
+
23
+ //# sourceMappingURL=use-price-by-name.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-price-by-name.js","names":[],"sources":["../../src/price-service/use-price-by-name.ts"],"sourcesContent":["\"use client\";\n\nimport type { ConfigParameter, MarkPriceTick, SocketStatus, SolverId } from \"@symmio/trading-core\";\nimport { useRef } from \"react\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { usePrices, type UsePricesRestFallback } from \"./use-prices\";\n\n/**\n * Parameters for {@link usePriceByName}.\n */\nexport interface UsePriceByNameParameters extends ConfigParameter {\n /** Market name to price, e.g. `\"BTCUSDT\"`. Subscription is disabled while undefined. */\n name?: string;\n /** Target chain id. Defaults to the SDK's active chain. */\n chainId?: number;\n /** Solver whose price provider to subscribe to. Defaults to the chain's default solver. */\n solverId?: SolverId;\n /** Subscribe only when `true`. Default `true`. */\n enabled?: boolean;\n /** REST snapshot polling while the socket is degraded. See {@link usePrices}. */\n restFallback?: UsePricesRestFallback;\n}\n\n/**\n * Value returned by {@link usePriceByName}.\n */\nexport interface UsePriceByNameReturnType {\n /** Latest mark price as a decimal string, or `null` before the first tick. */\n markPrice: string | null;\n /** The full tick, for provider-specific fields. Narrow on `provider`. */\n tick: MarkPriceTick | null;\n /** Live socket status. */\n status: SocketStatus;\n /** Last transport/parse error, normalized, or `null`. */\n error: SymmioRequestError | null;\n}\n\n/**\n * Track one market's mark price from whichever provider serves the resolved\n * solver.\n *\n * Subscribes with a single-name filter, so on Binance — whose stream pushes every\n * listed symbol once per second — this re-renders on that one market's ticks\n * rather than on all ~740. A ref gate suppresses re-renders when a tick repeats\n * the price already held.\n *\n * @example\n * ```tsx\n * const { markPrice, status } = usePriceByName({ name: \"BTCUSDT\", solverId: \"rasa\" });\n * return <span>{markPrice ?? \"—\"} ({status})</span>;\n * ```\n */\nexport function usePriceByName(parameters: UsePriceByNameParameters): UsePriceByNameReturnType {\n const { name, enabled = true, ...rest } = parameters;\n\n const { ticks, status, error } = usePrices({\n ...rest,\n names: name ? [name] : undefined,\n enabled: enabled && Boolean(name),\n });\n\n const tick = name ? (ticks[name] ?? null) : null;\n\n // Hold the last non-null tick so a transient gap does not blank the display.\n const lastTickRef = useRef<MarkPriceTick | null>(null);\n if (tick) lastTickRef.current = tick;\n const resolved = tick ?? lastTickRef.current;\n\n return { markPrice: resolved?.markPrice ?? null, tick: resolved, status, error };\n}\n"],"mappings":";;;;AAoDA,SAAgB,EAAe,GAAgE;CAC7F,IAAM,EAAE,SAAM,aAAU,IAAM,GAAG,MAAS,GAEpC,EAAE,UAAO,WAAQ,aAAU,EAAU;EACzC,GAAG;EACH,OAAO,IAAO,CAAC,CAAI,IAAI,KAAA;EACvB,SAAS,KAAW,EAAQ;CAC9B,CAAC,GAEK,IAAO,IAAQ,EAAM,MAAS,OAAQ,MAGtC,IAAc,EAA6B,IAAI;CACrD,AAAI,MAAM,EAAY,UAAU;CAChC,IAAM,IAAW,KAAQ,EAAY;CAErC,OAAO;EAAE,WAAW,GAAU,aAAa;EAAM,MAAM;EAAU;EAAQ;CAAM;AACjF"}
@@ -0,0 +1,87 @@
1
+ import { ConfigParameter, MarkPriceTick, SocketStatus, SolverId } from '@symmio/trading-core';
2
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
3
+ /**
4
+ * REST-fallback behaviour for {@link usePrices}.
5
+ */
6
+ export interface UsePricesRestFallback {
7
+ /** Poll a REST snapshot while the socket is degraded. Default `true`. */
8
+ enabled?: boolean;
9
+ /** Poll interval in ms. Default `5000`. */
10
+ intervalMs?: number;
11
+ }
12
+ /**
13
+ * Parameters for {@link usePrices}.
14
+ */
15
+ export interface UsePricesParameters extends ConfigParameter {
16
+ /** Target chain id. Defaults to the SDK's active chain. */
17
+ chainId?: number;
18
+ /** Solver whose price provider to subscribe to. Defaults to the chain's default solver. */
19
+ solverId?: SolverId;
20
+ /**
21
+ * Restrict the accumulated map to these market names.
22
+ *
23
+ * **Strongly recommended on Binance**, whose stream pushes every listed symbol
24
+ * (~740) once per second — filtering turns that into a handful of state
25
+ * updates instead of a full-map churn every tick.
26
+ */
27
+ names?: readonly string[];
28
+ /** Subscribe only when `true`. Default `true`. */
29
+ enabled?: boolean;
30
+ /** Imperative per-tick callback, invoked in addition to map updates. */
31
+ onTick?: (ticks: MarkPriceTick[]) => void;
32
+ /**
33
+ * REST snapshot polling while the socket is not `"open"`.
34
+ *
35
+ * Implemented as a `useQuery` with `refetchInterval`, so it is visible in
36
+ * devtools, deduplicated by query key, pausable by the app, and stops the
37
+ * moment the socket reports `open`. Deliberately composed here rather than
38
+ * hidden inside `watchPrices`: a watcher that silently became an HTTP poller
39
+ * would report a socket status that no longer described where the data came
40
+ * from.
41
+ */
42
+ restFallback?: UsePricesRestFallback;
43
+ }
44
+ /**
45
+ * Value returned by {@link usePrices}.
46
+ */
47
+ export interface UsePricesReturnType {
48
+ /**
49
+ * Latest full tick keyed by market name. Narrow on `provider` to reach
50
+ * provider-specific fields such as Binance's `indexPrice`.
51
+ */
52
+ ticks: Record<string, MarkPriceTick>;
53
+ /** Latest mark price keyed by market name — the ergonomic shape for display. */
54
+ prices: Record<string, string>;
55
+ /** Live socket status. */
56
+ status: SocketStatus;
57
+ /** Last transport/parse error, normalized, or `null`. */
58
+ error: SymmioRequestError | null;
59
+ }
60
+ /**
61
+ * Subscribe to the live mark-price feed of whichever provider serves the
62
+ * resolved solver — Enigma's lowcap service, or Binance USD-M Futures for
63
+ * majors.
64
+ *
65
+ * Accumulates the latest tick per market name and updates as ticks arrive. The
66
+ * subscription is shared across hook instances via the SDK socket pool, so
67
+ * several `usePrices()` mounts on one chain cost one connection even when they
68
+ * ask for different `names`.
69
+ *
70
+ * Returns **both** shapes on purpose: `prices` for the common display case, and
71
+ * `ticks` so a Binance consumer does not lose `indexPrice` and the funding
72
+ * fields that only exist on the full tick.
73
+ *
74
+ * @example
75
+ * ```tsx
76
+ * const { prices, ticks, status } = usePrices({ solverId: "rasa", names: ["BTCUSDT"] });
77
+ * const tick = ticks["BTCUSDT"];
78
+ * return (
79
+ * <span>
80
+ * BTC {prices["BTCUSDT"] ?? "—"} ({status})
81
+ * {tick?.provider === "binance" ? ` index ${tick.indexPrice}` : null}
82
+ * </span>
83
+ * );
84
+ * ```
85
+ */
86
+ export declare function usePrices(parameters?: UsePricesParameters): UsePricesReturnType;
87
+ //# sourceMappingURL=use-prices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-prices.d.ts","sourceRoot":"","sources":["../../src/price-service/use-prices.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACd,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAOzE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,yEAAyE;IACzE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,IAAI,CAAC;IAC1C;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,qBAAqB,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACrC,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,0BAA0B;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,yDAAyD;IACzD,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,SAAS,CAAC,UAAU,GAAE,mBAAwB,GAAG,mBAAmB,CA+GnF"}
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
+ import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
+ import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
+ import { getMarkPricesQueryOptions as r, watchPrices as i } from "@symmio/trading-core";
6
+ import { useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
7
+ import { useQuery as l } from "@tanstack/react-query";
8
+ //#region src/price-service/use-prices.ts
9
+ var u = 5e3;
10
+ function d(d = {}) {
11
+ let { chainId: f, solverId: p, names: m, enabled: h = !0, onTick: g, restFallback: _ } = d, v = t(d), y = e(), b = f ?? y, [x, S] = c({}), [C, w] = c("closed"), [T, E] = c(null), D = s(g);
12
+ D.current = g;
13
+ let O = m ? m.join(",") : void 0, k = `${b}|${p ?? ""}|${O ?? ""}`, A = s(k);
14
+ A.current !== k && (A.current = k, S({})), a(() => {
15
+ if (!h) {
16
+ w("closed");
17
+ return;
18
+ }
19
+ E(null);
20
+ let e;
21
+ try {
22
+ e = i(v, {
23
+ chainId: b,
24
+ solverId: p,
25
+ names: O ? O.split(",") : void 0,
26
+ onPrices: (e) => {
27
+ S((t) => {
28
+ let n = !1, r = { ...t };
29
+ for (let t of e) r[t.name]?.markPrice !== t.markPrice && (r[t.name] = t, n = !0);
30
+ return n ? r : t;
31
+ }), D.current?.(e);
32
+ },
33
+ onStatusChange: w,
34
+ onError: (e) => E(n(e))
35
+ });
36
+ } catch (e) {
37
+ E(n(e)), w("closed");
38
+ }
39
+ return () => e?.();
40
+ }, [
41
+ h,
42
+ v,
43
+ b,
44
+ p,
45
+ O
46
+ ]);
47
+ let j = h && (_?.enabled ?? !0) && C !== "open", M = l({
48
+ ...r(v, {
49
+ chainId: b,
50
+ solverId: p,
51
+ names: O ? O.split(",") : void 0
52
+ }),
53
+ enabled: j,
54
+ refetchInterval: _?.intervalMs ?? u,
55
+ retry: !1
56
+ });
57
+ return a(() => {
58
+ M.data?.length && S((e) => {
59
+ let t = !1, n = { ...e };
60
+ for (let e of M.data) n[e.name]?.markPrice !== e.markPrice && (n[e.name] = e, t = !0);
61
+ return t ? n : e;
62
+ });
63
+ }, [M.data]), {
64
+ ticks: x,
65
+ prices: o(() => {
66
+ let e = {};
67
+ for (let [t, n] of Object.entries(x)) e[t] = n.markPrice;
68
+ return e;
69
+ }, [x]),
70
+ status: C,
71
+ error: T
72
+ };
73
+ }
74
+ //#endregion
75
+ export { d as usePrices };
76
+
77
+ //# sourceMappingURL=use-prices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-prices.js","names":[],"sources":["../../src/price-service/use-prices.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getMarkPricesQueryOptions,\n watchPrices,\n type ConfigParameter,\n type MarkPriceTick,\n type SocketStatus,\n type SolverId,\n} from \"@symmio/trading-core\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\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 while the socket is not `open`. */\nconst DEFAULT_REST_FALLBACK_INTERVAL_MS = 5_000;\n\n/**\n * REST-fallback behaviour for {@link usePrices}.\n */\nexport interface UsePricesRestFallback {\n /** Poll a REST snapshot while the socket is degraded. Default `true`. */\n enabled?: boolean;\n /** Poll interval in ms. Default `5000`. */\n intervalMs?: number;\n}\n\n/**\n * Parameters for {@link usePrices}.\n */\nexport interface UsePricesParameters extends ConfigParameter {\n /** Target chain id. Defaults to the SDK's active chain. */\n chainId?: number;\n /** Solver whose price provider to subscribe to. Defaults to the chain's default solver. */\n solverId?: SolverId;\n /**\n * Restrict the accumulated map to these market names.\n *\n * **Strongly recommended on Binance**, whose stream pushes every listed symbol\n * (~740) once per second — filtering turns that into a handful of state\n * updates instead of a full-map churn every tick.\n */\n names?: readonly string[];\n /** Subscribe only when `true`. Default `true`. */\n enabled?: boolean;\n /** Imperative per-tick callback, invoked in addition to map updates. */\n onTick?: (ticks: MarkPriceTick[]) => void;\n /**\n * REST snapshot polling while the socket is not `\"open\"`.\n *\n * Implemented as a `useQuery` with `refetchInterval`, so it is visible in\n * devtools, deduplicated by query key, pausable by the app, and stops the\n * moment the socket reports `open`. Deliberately composed here rather than\n * hidden inside `watchPrices`: a watcher that silently became an HTTP poller\n * would report a socket status that no longer described where the data came\n * from.\n */\n restFallback?: UsePricesRestFallback;\n}\n\n/**\n * Value returned by {@link usePrices}.\n */\nexport interface UsePricesReturnType {\n /**\n * Latest full tick keyed by market name. Narrow on `provider` to reach\n * provider-specific fields such as Binance's `indexPrice`.\n */\n ticks: Record<string, MarkPriceTick>;\n /** Latest mark price keyed by market name — the ergonomic shape for display. */\n prices: Record<string, string>;\n /** Live socket status. */\n status: SocketStatus;\n /** Last transport/parse error, normalized, or `null`. */\n error: SymmioRequestError | null;\n}\n\n/**\n * Subscribe to the live mark-price feed of whichever provider serves the\n * resolved solver — Enigma's lowcap service, or Binance USD-M Futures for\n * majors.\n *\n * Accumulates the latest tick per market name and updates as ticks arrive. The\n * subscription is shared across hook instances via the SDK socket pool, so\n * several `usePrices()` mounts on one chain cost one connection even when they\n * ask for different `names`.\n *\n * Returns **both** shapes on purpose: `prices` for the common display case, and\n * `ticks` so a Binance consumer does not lose `indexPrice` and the funding\n * fields that only exist on the full tick.\n *\n * @example\n * ```tsx\n * const { prices, ticks, status } = usePrices({ solverId: \"rasa\", names: [\"BTCUSDT\"] });\n * const tick = ticks[\"BTCUSDT\"];\n * return (\n * <span>\n * BTC {prices[\"BTCUSDT\"] ?? \"—\"} ({status})\n * {tick?.provider === \"binance\" ? ` index ${tick.indexPrice}` : null}\n * </span>\n * );\n * ```\n */\nexport function usePrices(parameters: UsePricesParameters = {}): UsePricesReturnType {\n const { chainId, solverId, names, enabled = true, onTick, restFallback } = parameters;\n const config = useSymmioConfig(parameters);\n const defaultChainId = useSymmioChainId();\n const resolvedChainId = chainId ?? defaultChainId;\n\n const [ticks, setTicks] = useState<Record<string, MarkPriceTick>>({});\n const [status, setStatus] = useState<SocketStatus>(\"closed\");\n const [error, setError] = useState<SymmioRequestError | null>(null);\n\n const onTickRef = useRef(onTick);\n onTickRef.current = onTick;\n\n // Identity-stable across renders so an inline `names` array literal does not\n // resubscribe the socket on every render.\n const namesKey = names ? names.join(\",\") : undefined;\n\n /**\n * Drop accumulated ticks when the subscription target changes.\n *\n * Without this, switching solver (and therefore provider) leaves the previous\n * provider's ticks in the map, so a component renders Enigma prices while\n * labelled as Binance — and a name the new provider does not serve never\n * disappears. Keyed on the target rather than on `enabled`, so stopping and\n * restarting the same feed keeps its last values.\n */\n const subscriptionKey = `${resolvedChainId}|${solverId ?? \"\"}|${namesKey ?? \"\"}`;\n const lastSubscriptionKeyRef = useRef(subscriptionKey);\n if (lastSubscriptionKeyRef.current !== subscriptionKey) {\n lastSubscriptionKeyRef.current = subscriptionKey;\n setTicks({});\n }\n\n useEffect(() => {\n if (!enabled) {\n setStatus(\"closed\");\n return;\n }\n\n setError(null);\n\n let unwatch: (() => void) | undefined;\n try {\n unwatch = watchPrices(config, {\n chainId: resolvedChainId,\n solverId,\n names: namesKey ? namesKey.split(\",\") : undefined,\n onPrices: (batch) => {\n setTicks((prev) => {\n let mutated = false;\n const next = { ...prev };\n for (const tick of batch) {\n if (next[tick.name]?.markPrice !== tick.markPrice) {\n next[tick.name] = tick;\n mutated = true;\n }\n }\n return mutated ? next : prev;\n });\n onTickRef.current?.(batch);\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, config, resolvedChainId, solverId, namesKey]);\n\n /**\n * The fallback runs only while the socket is not delivering, so a healthy feed\n * costs no HTTP at all. `retry: false` keeps a degraded feed from retrying\n * into Binance's 429 → 418 IP-ban escalation.\n */\n const fallbackEnabled = enabled && (restFallback?.enabled ?? true) && status !== \"open\";\n const snapshot = useQuery({\n ...getMarkPricesQueryOptions(config, {\n chainId: resolvedChainId,\n solverId,\n names: namesKey ? namesKey.split(\",\") : undefined,\n }),\n enabled: fallbackEnabled,\n refetchInterval: restFallback?.intervalMs ?? DEFAULT_REST_FALLBACK_INTERVAL_MS,\n retry: false,\n });\n\n useEffect(() => {\n if (!snapshot.data?.length) return;\n setTicks((prev) => {\n let mutated = false;\n const next = { ...prev };\n for (const tick of snapshot.data) {\n if (next[tick.name]?.markPrice !== tick.markPrice) {\n next[tick.name] = tick;\n mutated = true;\n }\n }\n return mutated ? next : prev;\n });\n }, [snapshot.data]);\n\n const prices = useMemo(() => {\n const out: Record<string, string> = {};\n for (const [name, tick] of Object.entries(ticks)) out[name] = tick.markPrice;\n return out;\n }, [ticks]);\n\n return { ticks, prices, status, error };\n}\n"],"mappings":";;;;;;;;AAkBA,IAAM,IAAoC;AAwF1C,SAAgB,EAAU,IAAkC,CAAC,GAAwB;CACnF,IAAM,EAAE,YAAS,aAAU,UAAO,aAAU,IAAM,WAAQ,oBAAiB,GACrE,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAkB,KAAW,GAE7B,CAAC,GAAO,KAAY,EAAwC,CAAC,CAAC,GAC9D,CAAC,GAAQ,KAAa,EAAuB,QAAQ,GACrD,CAAC,GAAO,KAAY,EAAoC,IAAI,GAE5D,IAAY,EAAO,CAAM;CAC/B,EAAU,UAAU;CAIpB,IAAM,IAAW,IAAQ,EAAM,KAAK,GAAG,IAAI,KAAA,GAWrC,IAAkB,GAAG,EAAgB,GAAG,KAAY,GAAG,GAAG,KAAY,MACtE,IAAyB,EAAO,CAAe;CAMrD,AALI,EAAuB,YAAY,MACrC,EAAuB,UAAU,GACjC,EAAS,CAAC,CAAC,IAGb,QAAgB;EACd,IAAI,CAAC,GAAS;GACZ,EAAU,QAAQ;GAClB;EACF;EAEA,EAAS,IAAI;EAEb,IAAI;EACJ,IAAI;GACF,IAAU,EAAY,GAAQ;IAC5B,SAAS;IACT;IACA,OAAO,IAAW,EAAS,MAAM,GAAG,IAAI,KAAA;IACxC,WAAW,MAAU;KAYnB,AAXA,GAAU,MAAS;MACjB,IAAI,IAAU,IACR,IAAO,EAAE,GAAG,EAAK;MACvB,KAAK,IAAM,KAAQ,GACjB,AAAI,EAAK,EAAK,OAAO,cAAc,EAAK,cACtC,EAAK,EAAK,QAAQ,GAClB,IAAU;MAGd,OAAO,IAAU,IAAO;KAC1B,CAAC,GACD,EAAU,UAAU,CAAK;IAC3B;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;EAAiB;EAAU;CAAQ,CAAC;CAOzD,IAAM,IAAkB,MAAY,GAAc,WAAW,OAAS,MAAW,QAC3E,IAAW,EAAS;EACxB,GAAG,EAA0B,GAAQ;GACnC,SAAS;GACT;GACA,OAAO,IAAW,EAAS,MAAM,GAAG,IAAI,KAAA;EAC1C,CAAC;EACD,SAAS;EACT,iBAAiB,GAAc,cAAc;EAC7C,OAAO;CACT,CAAC;CAuBD,OArBA,QAAgB;EACT,EAAS,MAAM,UACpB,GAAU,MAAS;GACjB,IAAI,IAAU,IACR,IAAO,EAAE,GAAG,EAAK;GACvB,KAAK,IAAM,KAAQ,EAAS,MAC1B,AAAI,EAAK,EAAK,OAAO,cAAc,EAAK,cACtC,EAAK,EAAK,QAAQ,GAClB,IAAU;GAGd,OAAO,IAAU,IAAO;EAC1B,CAAC;CACH,GAAG,CAAC,EAAS,IAAI,CAAC,GAQX;EAAE;EAAO,QAND,QAAc;GAC3B,IAAM,IAA8B,CAAC;GACrC,KAAK,IAAM,CAAC,GAAM,MAAS,OAAO,QAAQ,CAAK,GAAG,EAAI,KAAQ,EAAK;GACnE,OAAO;EACT,GAAG,CAAC,CAAK,CAEO;EAAQ;EAAQ;CAAM;AACxC"}
@@ -20,7 +20,13 @@ export interface SymmioProviderProps {
20
20
  * built-in default affiliate and lose attribution.
21
21
  */
22
22
  symmioConfig: CreateConfigParameters["symmioConfig"];
23
- /** Chain used when a hook or action omits `chainId`. Defaults to the first supported chain. */
23
+ /**
24
+ * Fallback chain used when a hook or action omits `chainId` **and** the
25
+ * connected wallet is not on a supported SYMMIO chain (or is disconnected).
26
+ * When the wallet *is* on a supported chain, that chain becomes the default
27
+ * instead — so a no-arg `config.getChainConfig()` always follows the active
28
+ * chain. Defaults to the SDK's first supported chain.
29
+ */
24
30
  defaultChainId?: number;
25
31
  /**
26
32
  * Custom wallet-client resolver. Receives `{ chainId, from? }` from the SDK
@@ -44,7 +50,7 @@ export interface SymmioProviderProps {
44
50
  * ```tsx
45
51
  * <WagmiProvider config={wagmiConfig}>
46
52
  * <QueryClientProvider client={queryClient}>
47
- * <SymmioProvider symmioConfig={{ [SymmioSupportedChainId.HYPER_EVM]: { addresses: { affiliatesAddress: "0x…" } } }}>
53
+ * <SymmioProvider symmioConfig={{ [SymmioSupportedChainId.ARBITRUM]: { addresses: { affiliatesAddress: "0x…" } } }}>
48
54
  * <App />
49
55
  * </SymmioProvider>
50
56
  * </QueryClientProvider>
@@ -1 +1 @@
1
- {"version":3,"file":"symmio-provider.d.ts","sourceRoot":"","sources":["../../src/provider/symmio-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMhD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;;;;;;OAYG;IACH,YAAY,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACrD,+FAA+F;IAC/F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,eAAe,EAAE,mBAAmB,GACrC,EAAE,mBAAmB,+BAsCrB"}
1
+ {"version":3,"file":"symmio-provider.d.ts","sourceRoot":"","sources":["../../src/provider/symmio-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMhD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;;;;;;;;OAYG;IACH,YAAY,EAAE,sBAAsB,CAAC,cAAc,CAAC,CAAC;IACrD;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,iBAAiB,CAAC;CACrC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,eAAe,EAAE,mBAAmB,GACrC,EAAE,mBAAmB,+BAkDrB"}
@@ -1,39 +1,39 @@
1
1
  "use client";
2
2
  import { SymmioConfigContext as e } from "./symmio-config-context.js";
3
- import { SymmError as t, createConfig as n } from "@symmio/trading-core";
4
- import { useMemo as r } from "react";
5
- import { useConfig as i } from "wagmi";
6
- import { getPublicClient as a, getWalletClient as o } from "wagmi/actions";
7
- import { jsx as s } from "react/jsx-runtime";
3
+ import { SymmError as t, createConfig as n, listSupportedChains as r } from "@symmio/trading-core";
4
+ import { useMemo as i } from "react";
5
+ import { useChainId as a, useConfig as o } from "wagmi";
6
+ import { getPublicClient as s, getWalletClient as c } from "wagmi/actions";
7
+ import { jsx as l } from "react/jsx-runtime";
8
8
  //#region src/provider/symmio-provider.tsx
9
- function c({ children: c, symmioConfig: l, defaultChainId: u, getWalletClient: d }) {
10
- let f = i(), p = r(() => n({
11
- symmioConfig: l,
12
- defaultChainId: u,
9
+ function u({ children: u, symmioConfig: d, defaultChainId: f, getWalletClient: p }) {
10
+ let m = o(), h = a(), g = r().some((e) => e === h) ? h : f, _ = i(() => n({
11
+ symmioConfig: d,
12
+ defaultChainId: g,
13
13
  getClient: ({ chainId: e } = {}) => {
14
- let n = a(f, { chainId: e });
14
+ let n = s(m, { chainId: e });
15
15
  if (!n) throw new t("config", "NO_PUBLIC_CLIENT", `No public client available for chain ${e ?? "(default)"}.`);
16
16
  return n;
17
17
  },
18
- getWalletClient: d ?? (async ({ chainId: e }) => {
18
+ getWalletClient: p ?? (async ({ chainId: e }) => {
19
19
  try {
20
- return await o(f, { chainId: e });
20
+ return await c(m, { chainId: e });
21
21
  } catch (e) {
22
22
  throw new t("config", "NO_WALLET_CONNECTED", "No connected wallet. Connect a wallet before sending transactions.", { cause: e instanceof Error ? e : void 0 });
23
23
  }
24
24
  })
25
25
  }), [
26
- l,
27
- u,
28
26
  d,
29
- f
27
+ g,
28
+ p,
29
+ m
30
30
  ]);
31
- return /* @__PURE__ */ s(e.Provider, {
32
- value: p,
33
- children: c
31
+ return /* @__PURE__ */ l(e.Provider, {
32
+ value: _,
33
+ children: u
34
34
  });
35
35
  }
36
36
  //#endregion
37
- export { c as SymmioProvider };
37
+ export { u as SymmioProvider };
38
38
 
39
39
  //# sourceMappingURL=symmio-provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"symmio-provider.js","names":[],"sources":["../../src/provider/symmio-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createConfig,\n SymmError,\n type Config,\n type CreateConfigParameters,\n type GetWalletClientFn,\n} from \"@symmio/trading-core\";\nimport { useMemo, type ReactNode } from \"react\";\nimport type { PublicClient } from \"viem\";\nimport { useConfig } from \"wagmi\";\nimport { getPublicClient, getWalletClient } from \"wagmi/actions\";\nimport { SymmioConfigContext } from \"./symmio-config-context\";\n\n/**\n * Props for {@link SymmioProvider}.\n */\nexport interface SymmioProviderProps {\n /** React subtree that may use SYMMIO SDK hooks. */\n children: ReactNode;\n /**\n * Per-chain SYMMIO configuration, keyed by chain id — deep-merged onto the\n * SDK's built-in defaults (addresses, subgraphs, solver, …).\n *\n * **Required.** Every supported chain must set a non-zero\n * `addresses.affiliatesAddress` — your frontend's on-chain affiliate (your\n * identity in SYMMIO on that chain), attached to every quote so the protocol\n * attributes the trade to you and routes your fee share. Affiliate addresses\n * are per chain (a registration on one chain is not valid on another). The\n * provider throws `AFFILIATE_ADDRESS_REQUIRED` (via `createConfig`) for any\n * supported chain missing it, so trades can never silently fall back to the\n * built-in default affiliate and lose attribution.\n */\n symmioConfig: CreateConfigParameters[\"symmioConfig\"];\n /** Chain used when a hook or action omits `chainId`. Defaults to the first supported chain. */\n defaultChainId?: number;\n /**\n * Custom wallet-client resolver. Receives `{ chainId, from? }` from the SDK\n * and returns the wallet client to sign with. Use this to plug in\n * session-key, multi-signer, or any non-wagmi flow — the resolver decides.\n *\n * When omitted, the provider falls back to wagmi's connected wallet (ignores\n * `from`).\n */\n getWalletClient?: GetWalletClientFn;\n}\n\n/**\n * Provides the SYMMIO {@link Config} to descendant hooks. The config's viem\n * clients are resolved from the host's wagmi config, so this is the only place\n * the SDK touches wagmi.\n *\n * **Mount order matters**: this reads wagmi context and (transitively) the\n * host's `@tanstack/react-query` `QueryClient`. Both must be mounted **outside**\n * `SymmioProvider`:\n *\n * ```tsx\n * <WagmiProvider config={wagmiConfig}>\n * <QueryClientProvider client={queryClient}>\n * <SymmioProvider symmioConfig={{ [SymmioSupportedChainId.HYPER_EVM]: { addresses: { affiliatesAddress: \"0x…\" } } }}>\n * <App />\n * </SymmioProvider>\n * </QueryClientProvider>\n * </WagmiProvider>\n * ```\n *\n * The SDK never mounts wagmi or a `QueryClient` for the host — those (which\n * connectors, which RPC URLs, which shared `QueryClient`) belong to the host.\n */\nexport function SymmioProvider({\n children,\n symmioConfig,\n defaultChainId,\n getWalletClient: getWalletClientProp,\n}: SymmioProviderProps) {\n const wagmiConfig = useConfig();\n\n const config = useMemo<Config>(\n () =>\n createConfig({\n symmioConfig,\n defaultChainId,\n getClient: ({ chainId } = {}): PublicClient => {\n const client = getPublicClient(wagmiConfig, { chainId });\n\n if (!client)\n throw new SymmError(\n \"config\",\n \"NO_PUBLIC_CLIENT\",\n `No public client available for chain ${chainId ?? \"(default)\"}.`,\n );\n return client;\n },\n getWalletClient:\n getWalletClientProp ??\n (async ({ chainId }) => {\n try {\n return await getWalletClient(wagmiConfig, { chainId });\n } catch (err) {\n throw new SymmError(\n \"config\",\n \"NO_WALLET_CONNECTED\",\n \"No connected wallet. Connect a wallet before sending transactions.\",\n { cause: err instanceof Error ? err : undefined },\n );\n }\n }),\n }),\n [symmioConfig, defaultChainId, getWalletClientProp, wagmiConfig],\n );\n\n return <SymmioConfigContext.Provider value={config}>{children}</SymmioConfigContext.Provider>;\n}\n"],"mappings":";;;;;;;;AAsEA,SAAgB,EAAe,EAC7B,aACA,iBACA,mBACA,iBAAiB,KACK;CACtB,IAAM,IAAc,EAAU,GAExB,IAAS,QAEX,EAAa;EACX;EACA;EACA,YAAY,EAAE,eAAY,CAAC,MAAoB;GAC7C,IAAM,IAAS,EAAgB,GAAa,EAAE,WAAQ,CAAC;GAEvD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,UACA,oBACA,wCAAwC,KAAW,YAAY,EACjE;GACF,OAAO;EACT;EACA,iBACE,MACC,OAAO,EAAE,iBAAc;GACtB,IAAI;IACF,OAAO,MAAM,EAAgB,GAAa,EAAE,WAAQ,CAAC;GACvD,SAAS,GAAK;IACZ,MAAM,IAAI,EACR,UACA,uBACA,sEACA,EAAE,OAAO,aAAe,QAAQ,IAAM,KAAA,EAAU,CAClD;GACF;EACF;CACJ,CAAC,GACH;EAAC;EAAc;EAAgB;EAAqB;CAAW,CACjE;CAEA,OAAO,kBAAC,EAAoB,UAArB;EAA8B,OAAO;EAAS;CAAuC,CAAA;AAC9F"}
1
+ {"version":3,"file":"symmio-provider.js","names":[],"sources":["../../src/provider/symmio-provider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createConfig,\n listSupportedChains,\n SymmError,\n type Config,\n type CreateConfigParameters,\n type GetWalletClientFn,\n} from \"@symmio/trading-core\";\nimport { useMemo, type ReactNode } from \"react\";\nimport type { PublicClient } from \"viem\";\nimport { useChainId, useConfig } from \"wagmi\";\nimport { getPublicClient, getWalletClient } from \"wagmi/actions\";\nimport { SymmioConfigContext } from \"./symmio-config-context\";\n\n/**\n * Props for {@link SymmioProvider}.\n */\nexport interface SymmioProviderProps {\n /** React subtree that may use SYMMIO SDK hooks. */\n children: ReactNode;\n /**\n * Per-chain SYMMIO configuration, keyed by chain id — deep-merged onto the\n * SDK's built-in defaults (addresses, subgraphs, solver, …).\n *\n * **Required.** Every supported chain must set a non-zero\n * `addresses.affiliatesAddress` — your frontend's on-chain affiliate (your\n * identity in SYMMIO on that chain), attached to every quote so the protocol\n * attributes the trade to you and routes your fee share. Affiliate addresses\n * are per chain (a registration on one chain is not valid on another). The\n * provider throws `AFFILIATE_ADDRESS_REQUIRED` (via `createConfig`) for any\n * supported chain missing it, so trades can never silently fall back to the\n * built-in default affiliate and lose attribution.\n */\n symmioConfig: CreateConfigParameters[\"symmioConfig\"];\n /**\n * Fallback chain used when a hook or action omits `chainId` **and** the\n * connected wallet is not on a supported SYMMIO chain (or is disconnected).\n * When the wallet *is* on a supported chain, that chain becomes the default\n * instead — so a no-arg `config.getChainConfig()` always follows the active\n * chain. Defaults to the SDK's first supported chain.\n */\n defaultChainId?: number;\n /**\n * Custom wallet-client resolver. Receives `{ chainId, from? }` from the SDK\n * and returns the wallet client to sign with. Use this to plug in\n * session-key, multi-signer, or any non-wagmi flow — the resolver decides.\n *\n * When omitted, the provider falls back to wagmi's connected wallet (ignores\n * `from`).\n */\n getWalletClient?: GetWalletClientFn;\n}\n\n/**\n * Provides the SYMMIO {@link Config} to descendant hooks. The config's viem\n * clients are resolved from the host's wagmi config, so this is the only place\n * the SDK touches wagmi.\n *\n * **Mount order matters**: this reads wagmi context and (transitively) the\n * host's `@tanstack/react-query` `QueryClient`. Both must be mounted **outside**\n * `SymmioProvider`:\n *\n * ```tsx\n * <WagmiProvider config={wagmiConfig}>\n * <QueryClientProvider client={queryClient}>\n * <SymmioProvider symmioConfig={{ [SymmioSupportedChainId.ARBITRUM]: { addresses: { affiliatesAddress: \"0x…\" } } }}>\n * <App />\n * </SymmioProvider>\n * </QueryClientProvider>\n * </WagmiProvider>\n * ```\n *\n * The SDK never mounts wagmi or a `QueryClient` for the host — those (which\n * connectors, which RPC URLs, which shared `QueryClient`) belong to the host.\n */\nexport function SymmioProvider({\n children,\n symmioConfig,\n defaultChainId,\n getWalletClient: getWalletClientProp,\n}: SymmioProviderProps) {\n const wagmiConfig = useConfig();\n const connectedChainId = useChainId();\n\n // Track the connected wallet's chain as the config default whenever it is a\n // supported SYMMIO chain, so a no-arg `config.getChainConfig()` — and any hook\n // that omits `chainId` — resolves to the ACTIVE chain rather than a hardcoded\n // first chain. Single fix for the whole class of \"reads the wrong chain's\n // addresses after switching\". Falls back to the explicit `defaultChainId` prop\n // (then the SDK's first supported chain) when the wallet is on an unsupported\n // chain or disconnected.\n const effectiveDefaultChainId = listSupportedChains().some((id) => id === connectedChainId)\n ? connectedChainId\n : defaultChainId;\n\n const config = useMemo<Config>(\n () =>\n createConfig({\n symmioConfig,\n defaultChainId: effectiveDefaultChainId,\n getClient: ({ chainId } = {}): PublicClient => {\n const client = getPublicClient(wagmiConfig, { chainId });\n\n if (!client)\n throw new SymmError(\n \"config\",\n \"NO_PUBLIC_CLIENT\",\n `No public client available for chain ${chainId ?? \"(default)\"}.`,\n );\n return client;\n },\n getWalletClient:\n getWalletClientProp ??\n (async ({ chainId }) => {\n try {\n return await getWalletClient(wagmiConfig, { chainId });\n } catch (err) {\n throw new SymmError(\n \"config\",\n \"NO_WALLET_CONNECTED\",\n \"No connected wallet. Connect a wallet before sending transactions.\",\n { cause: err instanceof Error ? err : undefined },\n );\n }\n }),\n }),\n [symmioConfig, effectiveDefaultChainId, getWalletClientProp, wagmiConfig],\n );\n\n return <SymmioConfigContext.Provider value={config}>{children}</SymmioConfigContext.Provider>;\n}\n"],"mappings":";;;;;;;;AA6EA,SAAgB,EAAe,EAC7B,aACA,iBACA,mBACA,iBAAiB,KACK;CACtB,IAAM,IAAc,EAAU,GACxB,IAAmB,EAAW,GAS9B,IAA0B,EAAoB,EAAE,MAAM,MAAO,MAAO,CAAgB,IACtF,IACA,GAEE,IAAS,QAEX,EAAa;EACX;EACA,gBAAgB;EAChB,YAAY,EAAE,eAAY,CAAC,MAAoB;GAC7C,IAAM,IAAS,EAAgB,GAAa,EAAE,WAAQ,CAAC;GAEvD,IAAI,CAAC,GACH,MAAM,IAAI,EACR,UACA,oBACA,wCAAwC,KAAW,YAAY,EACjE;GACF,OAAO;EACT;EACA,iBACE,MACC,OAAO,EAAE,iBAAc;GACtB,IAAI;IACF,OAAO,MAAM,EAAgB,GAAa,EAAE,WAAQ,CAAC;GACvD,SAAS,GAAK;IACZ,MAAM,IAAI,EACR,UACA,uBACA,sEACA,EAAE,OAAO,aAAe,QAAQ,IAAM,KAAA,EAAU,CAClD;GACF;EACF;CACJ,CAAC,GACH;EAAC;EAAc;EAAyB;EAAqB;CAAW,CAC1E;CAEA,OAAO,kBAAC,EAAoB,UAArB;EAA8B,OAAO;EAAS;CAAuC,CAAA;AAC9F"}
@@ -0,0 +1,121 @@
1
+ import { UnifiedQuote } from '@symmio/trading-core';
2
+ /**
3
+ * Next interval (ms) for a confirm-hold backoff: double the current delay, capped
4
+ * at `max`. After the immediate refetch the schedule is `first`, `first * 2`, … up to
5
+ * `max`, then steady at `max` until the hold is released.
6
+ *
7
+ * @param current - the current backoff interval (ms).
8
+ * @param max - the ceiling interval (ms).
9
+ */
10
+ export declare function nextConfirmDelay(current: number, max: number): number;
11
+ /**
12
+ * One close-confirm hold entry: its deadline (ms epoch) plus the `closedAmount`
13
+ * the position had **when the fill was seen**. The chase (and the row's
14
+ * `WRITE_ONCHAIN_CLOSE` retention) releases the moment the on-chain `closedAmount`
15
+ * advances past this baseline — a **partial** settle back to a live position —
16
+ * the same as a full settle (row removed) or a `CLOSE_PENDING` status.
17
+ */
18
+ export interface CloseConfirmEntry {
19
+ deadline: number;
20
+ baseClosed: bigint;
21
+ }
22
+ /**
23
+ * Whether the chain has acknowledged a close for a quote that is **still present**
24
+ * in the active set. Releases the close-confirm hold when the on-chain status
25
+ * reflects the pending close (`quoteStatus` `CLOSE_PENDING` / `CANCEL_CLOSE_PENDING`),
26
+ * the quote is terminally `CLOSED`, or `closedAmount` caught up to the full
27
+ * `quantity`. A quote that dropped out of the active set entirely (a full close)
28
+ * is handled by the caller, not here.
29
+ */
30
+ export declare function isCloseConfirmedOnchain(quote: UnifiedQuote): boolean;
31
+ /**
32
+ * Prune the close-confirm hold **in place** against the current active quotes.
33
+ *
34
+ * The hold keeps the managed-quotes on-chain reads accelerated after a close
35
+ * notification until the chain reflects the close — it exists because a rasa
36
+ * instant-close reports `FillMarketOrderInstantClose` while the on-chain read
37
+ * still shows the quote OPENED, and the stateless reconcile would otherwise revert
38
+ * the row to `ONCHAIN` and stop the accelerated poll before the settle lands.
39
+ *
40
+ * Deletes an entry when the chain confirms the close — the row dropped from the
41
+ * active set (full close), or {@link isCloseConfirmedOnchain} for a still-present
42
+ * row — or when its deadline has passed. Returns the ids dropped **only** because
43
+ * their deadline expired without confirmation (a close that never settled), so the
44
+ * caller can surface them; confirmed and absent entries are not returned.
45
+ *
46
+ * @param pending - map of on-chain quoteId → deadline (ms epoch); mutated in place.
47
+ * @param quotes - the current reconciled active quotes.
48
+ * @param now - current time (ms epoch), e.g. `Date.now()`.
49
+ * @returns the quoteIds dropped due to an expired deadline.
50
+ */
51
+ export declare function pruneCloseConfirmHold(pending: Map<string, CloseConfirmEntry>, quotes: readonly UnifiedQuote[], now: number): string[];
52
+ /**
53
+ * Whether the on-chain read has caught up with an anchored open: the row carries
54
+ * the polled struct (`raw.onchain`), so `getPartyAOpenPositions` /
55
+ * `getPartyAPendingQuotes` have actually returned the quote. A row that exists only
56
+ * because a notification anchored it (`WRITE_ONCHAIN`, or a retained anchor) is
57
+ * **not** confirmed — that row is precisely what the hold is waiting to replace.
58
+ */
59
+ export declare function isOpenConfirmedOnchain(quote: UnifiedQuote): boolean;
60
+ /**
61
+ * Prune the open-confirm hold **in place** against the current active quotes.
62
+ *
63
+ * The hold chases the on-chain reads after an open-anchor notification
64
+ * (`SendQuoteTransaction` / `SendQuote` / `FillLimitOrderOpen`) until the read
65
+ * returns the quote. The solver emits that frame when it **broadcasts** the
66
+ * transaction, so the single invalidation it triggers races the block and usually
67
+ * loses; without the chase the position stays invisible until something else
68
+ * happens to refetch, because with the notifications socket live there is no idle
69
+ * poll and the accelerated retry only runs while a `WRITE_ONCHAIN` row exists —
70
+ * which requires a pre-chain row from the hedger feed that may already be gone.
71
+ *
72
+ * Mirror of {@link pruneCloseConfirmHold} with one deliberate difference: for a
73
+ * close, a row **absent** from the active set means the close landed; for an open,
74
+ * absence is the very condition being chased, so it keeps the entry.
75
+ *
76
+ * @param pending - map of on-chain quoteId → deadline (ms epoch); mutated in place.
77
+ * @param quotes - the current reconciled active quotes.
78
+ * @param now - current time (ms epoch), e.g. `Date.now()`.
79
+ * @returns the quoteIds dropped due to an expired deadline (an anchor the read never confirmed).
80
+ */
81
+ export declare function pruneOpenConfirmHold(pending: Map<string, number>, quotes: readonly UnifiedQuote[], now: number): string[];
82
+ /**
83
+ * Whether the chain has settled a cancel for a quote that is **still present** in the
84
+ * active set — only the terminal `CLOSED` lifecycle counts (`CANCELED` / `EXPIRED` /
85
+ * `CLOSED` on-chain). A quote that dropped out of the active set entirely is the
86
+ * normal outcome and is handled by the caller.
87
+ *
88
+ * Deliberately **not** released on `quoteStatus !== CANCEL_PENDING`: the hold is
89
+ * registered off the cancel-request notification, which the solver publishes around
90
+ * the time the request transaction is broadcast, so the read at that moment usually
91
+ * still says `LOCKED`. Releasing on "not CANCEL_PENDING" would end the chase on that
92
+ * stale pre-request read and leave the row stuck exactly as before. Holding through
93
+ * `LOCKED` → `CANCEL_PENDING` → gone is the point.
94
+ */
95
+ export declare function isCancelConfirmedOnchain(quote: UnifiedQuote): boolean;
96
+ /**
97
+ * Prune the cancel-confirm hold **in place** against the current active quotes.
98
+ *
99
+ * The hold chases the on-chain reads after a cancel notification until the chain
100
+ * settles the cancel. It exists because cancelling a `LOCKED` order is a
101
+ * **two-transaction** flow of which only the first is announced:
102
+ * `requestToCancelQuote` moves the quote to `CANCEL_PENDING` and leaves it in
103
+ * `partyAPendingQuotes`, and the solver's later `acceptCancelRequest` — the one that
104
+ * sets `CANCELED` and removes it — publishes no notification frame at all. With the
105
+ * event channel live there is no idle poll and a `CANCEL_PENDING` row does not
106
+ * accelerate anything (its lifecycle is the generic `ONCHAIN`), so without this chase
107
+ * a cancelled order stays on screen until something unrelated happens to refetch.
108
+ *
109
+ * Same shape as {@link pruneCloseConfirmHold}: an entry whose row is **absent** from
110
+ * the active set is confirmed (the accept removed it from the pending array), as is
111
+ * one whose row went terminal ({@link isCancelConfirmedOnchain}). Returns the ids
112
+ * dropped **only** because their deadline passed — a cancel the solver never answered
113
+ * — so the caller can surface them.
114
+ *
115
+ * @param pending - map of on-chain quoteId → deadline (ms epoch); mutated in place.
116
+ * @param quotes - the current reconciled active quotes.
117
+ * @param now - current time (ms epoch), e.g. `Date.now()`.
118
+ * @returns the quoteIds dropped due to an expired deadline.
119
+ */
120
+ export declare function pruneCancelConfirmHold(pending: Map<string, number>, quotes: readonly UnifiedQuote[], now: number): string[];
121
+ //# sourceMappingURL=confirm-hold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm-hold.d.ts","sourceRoot":"","sources":["../../src/quotes/confirm-hold.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEtF;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAErE;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAOpE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,EACvC,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAkBV;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAEnE;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAeV;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAErE;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,MAAM,EAAE,SAAS,YAAY,EAAE,EAC/B,GAAG,EAAE,MAAM,GACV,MAAM,EAAE,CAeV"}
@@ -0,0 +1,59 @@
1
+ import { QuoteLifecycle as e, QuoteStatus as t } from "@symmio/trading-core";
2
+ //#region src/quotes/confirm-hold.ts
3
+ function n(e, t) {
4
+ return Math.min(e * 2, t);
5
+ }
6
+ function r(n) {
7
+ if (n.lifecycle === e.CLOSED || n.quoteStatus === t.CLOSE_PENDING || n.quoteStatus === t.CANCEL_CLOSE_PENDING) return !0;
8
+ let r = n.closedAmount ?? 0n;
9
+ return n.quantity > 0n && r >= n.quantity;
10
+ }
11
+ function i(e, t, n) {
12
+ if (e.size === 0) return [];
13
+ let i = [];
14
+ for (let [a, { deadline: o, baseClosed: s }] of e) {
15
+ let c = t.find((e) => `${e.quoteId}` === a);
16
+ if (!c || r(c) || (c.closedAmount ?? 0n) > s) {
17
+ e.delete(a);
18
+ continue;
19
+ }
20
+ n > o && (e.delete(a), i.push(a));
21
+ }
22
+ return i;
23
+ }
24
+ function a(e) {
25
+ return e.raw.onchain !== void 0;
26
+ }
27
+ function o(e, t, n) {
28
+ if (e.size === 0) return [];
29
+ let r = [];
30
+ for (let [i, o] of e) {
31
+ let s = t.find((e) => `${e.quoteId}` === i);
32
+ if (s && a(s)) {
33
+ e.delete(i);
34
+ continue;
35
+ }
36
+ n > o && (e.delete(i), r.push(i));
37
+ }
38
+ return r;
39
+ }
40
+ function s(t) {
41
+ return t.lifecycle === e.CLOSED;
42
+ }
43
+ function c(e, t, n) {
44
+ if (e.size === 0) return [];
45
+ let r = [];
46
+ for (let [i, a] of e) {
47
+ let o = t.find((e) => `${e.quoteId}` === i);
48
+ if (!o || s(o)) {
49
+ e.delete(i);
50
+ continue;
51
+ }
52
+ n > a && (e.delete(i), r.push(i));
53
+ }
54
+ return r;
55
+ }
56
+ //#endregion
57
+ export { n as nextConfirmDelay, c as pruneCancelConfirmHold, i as pruneCloseConfirmHold, o as pruneOpenConfirmHold };
58
+
59
+ //# sourceMappingURL=confirm-hold.js.map