@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,67 @@
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 { useTpSlRecords as r, useTpSlStore as i } from "./tpsl-store.js";
6
+ import { dedupeAddresses as a, useWatchTpSlAccounts as o } from "./use-watch-tpsl-accounts.js";
7
+ import { getQuoteTpSlQueryOptions as s, summarizeQuoteGroupTpSl as c, supportsTpSl as l, toGroupTpSlChildren as u, toGroupTpSlOrders as d } from "@symmio/trading-core";
8
+ import { useCallback as f, useMemo as p, useRef as m } from "react";
9
+ import { useQueries as h } from "@tanstack/react-query";
10
+ //#region src/tpsl/use-quote-group-tpsl.ts
11
+ function g(g) {
12
+ let { quotes: v, overrides: y, live: b = !0, enabled: x = !0 } = g, S = t(g), C = e(), w = g.chainId ?? C, T = l(S, { chainId: w }), E = p(() => v.map(_), [v]), D = h({ queries: v.map((e, t) => {
13
+ let r = E[t] ?? 0n, a = s(S, {
14
+ chainId: w,
15
+ quoteId: r,
16
+ query: g.query
17
+ });
18
+ return {
19
+ ...a,
20
+ enabled: (a.enabled ?? !0) && x && T,
21
+ queryFn: async () => {
22
+ try {
23
+ let e = await a.queryFn();
24
+ return i.getState().setRows(r, e), e;
25
+ } catch (e) {
26
+ throw n(e);
27
+ }
28
+ }
29
+ };
30
+ }) });
31
+ o({
32
+ accounts: p(() => g.accounts ? a(g.accounts) : a([g.subAccount, ...v.map((e) => e.vaAddress ?? e.partyA)]), [
33
+ g.accounts,
34
+ g.subAccount,
35
+ v
36
+ ]),
37
+ ids: E,
38
+ chainId: w,
39
+ config: g.config,
40
+ enabled: b && x && T
41
+ });
42
+ let O = r(E), k = p(() => {
43
+ let e = /* @__PURE__ */ new Map();
44
+ return v.forEach((t, n) => e.set(t.key, O[n])), u(v, (t) => e.get(t.key));
45
+ }, [v, O]), A = p(() => c(k, { overrides: y }), [k, y]), j = p(() => d(k, { overrides: y }), [k, y]), M = m(D);
46
+ M.current = D;
47
+ let N = f(async () => {
48
+ await Promise.all(M.current.map((e) => e.refetch()));
49
+ }, []);
50
+ return {
51
+ children: k,
52
+ summary: A,
53
+ orders: j,
54
+ isLoading: D.some((e) => e.isLoading),
55
+ isFetching: D.some((e) => e.isFetching),
56
+ error: D.find((e) => e.error)?.error ?? null,
57
+ refetch: N
58
+ };
59
+ }
60
+ function _(e) {
61
+ if (e.quoteId !== void 0) return e.quoteId;
62
+ if (e.tempQuoteId !== void 0) return BigInt(e.tempQuoteId);
63
+ }
64
+ //#endregion
65
+ export { g as useQuoteGroupTpSl };
66
+
67
+ //# sourceMappingURL=use-quote-group-tpsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-group-tpsl.js","names":[],"sources":["../../src/tpsl/use-quote-group-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteTpSlQueryOptions,\n summarizeQuoteGroupTpSl,\n supportsTpSl,\n toGroupTpSlChildren,\n toGroupTpSlOrders,\n type ConfigParameter,\n type GetQuoteTpSlOptions,\n type GroupTpSlChild,\n type GroupTpSlDesiredMap,\n type GroupTpSlOrder,\n type QuoteGroupTpSlSummary,\n type QuoteTpSl,\n type UnifiedQuote,\n} from \"@symmio/trading-core\";\nimport { useQueries } from \"@tanstack/react-query\";\nimport { useCallback, useMemo, useRef } from \"react\";\nimport type { Address } from \"viem\";\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\";\nimport { useTpSlRecords, useTpSlStore } from \"./tpsl-store\";\nimport { dedupeAddresses, useWatchTpSlAccounts } from \"./use-watch-tpsl-accounts\";\n\n/** Parameters for {@link useQuoteGroupTpSl}. */\nexport interface UseQuoteGroupTpSlParameters extends ConfigParameter {\n /** The grouped position's child quotes — pass `group.quotes`. */\n quotes: readonly UnifiedQuote[];\n /**\n * SubAccount that owns the children's Virtual Accounts.\n *\n * Pass it. The handler publishes TP/SL reports on the **subscribing account's**\n * stream, not on the VA that owns the order — a report's `address` is the same\n * for two quotes under different VAs. Without it this hook only hears the VA\n * channels, and a live update arrives whenever the next REST read happens to run.\n */\n subAccount?: Address;\n /**\n * Accounts whose TP/SL streams report on these children. Overrides the\n * default, which is `subAccount` plus the deduped `vaAddress ?? partyA`\n * across `quotes` — a grouped position can span Virtual Accounts, since the\n * VA is not part of the group key.\n */\n accounts?: readonly Address[];\n /** Pending per-child edits that win over the confirmed snapshot. */\n overrides?: GroupTpSlDesiredMap;\n /** Subscribe to the TP/SL WebSocket. Default `true`. */\n live?: boolean;\n /** Master switch. When `false` every child query is idle. Default `true`. */\n enabled?: boolean;\n /** Chain override; defaults to the connected chain. */\n chainId?: number;\n /** Query overrides forwarded to every child fetch. */\n query?: GetQuoteTpSlOptions[\"query\"];\n}\n\n/** Return type of {@link useQuoteGroupTpSl}. */\nexport interface UseQuoteGroupTpSlReturnType {\n /** Children with their confirmed snapshots, in input order — the input to every core helper. */\n children: GroupTpSlChild[];\n /** Folded cell/modal state: counts, uniform-vs-mixed, notional coverage. */\n summary: QuoteGroupTpSlSummary;\n /** One row per live-or-desired TP/SL order, for an overview list. */\n orders: GroupTpSlOrder[];\n /** `true` while any child's first fetch is in flight. */\n isLoading: boolean;\n /** `true` while any child query is fetching, including background refetches. */\n isFetching: boolean;\n /** First normalized error across the fan-out, or `null`. */\n error: SymmioRequestError | null;\n /** Refetch every child. Resolves when all settle. */\n refetch: () => Promise<void>;\n}\n\n/**\n * Read the folded TP/SL state of a grouped position.\n *\n * One TanStack query per child — keyed with the shared `getQuoteTpSlQueryKey`,\n * so a row that also renders the per-quote `useQuoteTpSl` issues **one** request\n * per quote rather than two — all writing into the same module-level TP/SL\n * store, plus one WebSocket subscription per **distinct account** rather than\n * one per child. Everything above the store is `@symmio/trading-core`'s pure\n * `summarizeQuoteGroupTpSl` / `toGroupTpSlOrders`.\n *\n * @param parameters - The group's quotes plus optional accounts, edits and query overrides.\n * @returns Children, the folded summary, the order rows, and the load surface.\n *\n * @example\n * ```tsx\n * const { summary, children } = useQuoteGroupTpSl({ quotes: group.quotes });\n * if (summary.isEmpty) return <span>Not set</span>;\n * if (summary.takeProfit.display === \"uniform\") return <span>{summary.takeProfit.price}</span>;\n * return <span>{summary.takeProfit.count} TP</span>;\n * ```\n */\nexport function useQuoteGroupTpSl(parameters: UseQuoteGroupTpSlParameters): UseQuoteGroupTpSlReturnType {\n const { quotes, overrides, live = true, enabled = true } = parameters;\n const config = useSymmioConfig(parameters);\n const defaultChainId = useSymmioChainId();\n const chainId = parameters.chainId ?? defaultChainId;\n // The resolved solver may have no TP/SL handler (e.g. rasa on Base). When it\n // doesn't, keep every child query idle and skip the subscription so the hook\n // returns an empty summary instead of throwing `TPSL_NOT_CONFIGURED`.\n const supported = supportsTpSl(config, { chainId });\n\n /** One addressable TP/SL id per child: the on-chain id, else the hedger temp id. */\n const ids = useMemo(() => quotes.map(tpslIdOf), [quotes]);\n\n const results = useQueries({\n queries: quotes.map((_quote, index) => {\n const id = ids[index] ?? 0n;\n const options = getQuoteTpSlQueryOptions(config, { chainId, quoteId: id, query: parameters.query });\n return {\n ...options,\n enabled: (options.enabled ?? true) && enabled && supported,\n queryFn: async () => {\n try {\n const rows = await options.queryFn();\n useTpSlStore.getState().setRows(id, rows);\n return rows;\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n };\n }),\n });\n\n /**\n * Accounts to watch: the SubAccount, where the handler publishes its reports,\n * plus every Virtual Account the children live under — a grouped position can\n * span several, and one of them may be where a given deployment reports.\n */\n const accounts = useMemo(() => {\n if (parameters.accounts) return dedupeAddresses(parameters.accounts);\n return dedupeAddresses([parameters.subAccount, ...quotes.map((quote) => quote.vaAddress ?? quote.partyA)]);\n }, [parameters.accounts, parameters.subAccount, quotes]);\n\n useWatchTpSlAccounts({\n accounts,\n ids,\n chainId,\n config: parameters.config,\n enabled: live && enabled && supported,\n });\n\n const records = useTpSlRecords(ids);\n const children = useMemo(() => {\n const byKey = new Map<string, QuoteTpSl | undefined>();\n quotes.forEach((quote, index) => byKey.set(quote.key, records[index]));\n return toGroupTpSlChildren(quotes, (quote) => byKey.get(quote.key));\n }, [quotes, records]);\n\n const summary = useMemo(() => summarizeQuoteGroupTpSl(children, { overrides }), [children, overrides]);\n const orders = useMemo(() => toGroupTpSlOrders(children, { overrides }), [children, overrides]);\n\n /** `useQueries` hands back a fresh array each render; keep `refetch` stable. */\n const resultsRef = useRef(results);\n resultsRef.current = results;\n const refetch = useCallback(async () => {\n await Promise.all(resultsRef.current.map((result) => result.refetch()));\n }, []);\n\n return {\n children,\n summary,\n orders,\n isLoading: results.some((result) => result.isLoading),\n isFetching: results.some((result) => result.isFetching),\n error: (results.find((result) => result.error)?.error as SymmioRequestError | undefined) ?? null,\n refetch,\n };\n}\n\n/** The id a quote's TP/SL record is addressed by: on-chain first, else the hedger temp id. */\nfunction tpslIdOf(quote: UnifiedQuote): bigint | undefined {\n if (quote.quoteId !== undefined) return quote.quoteId;\n if (quote.tempQuoteId !== undefined) return BigInt(quote.tempQuoteId);\n return undefined;\n}\n"],"mappings":";;;;;;;;;;AAkGA,SAAgB,EAAkB,GAAsE;CACtG,IAAM,EAAE,WAAQ,cAAW,UAAO,IAAM,aAAU,OAAS,GACrD,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAIhC,IAAY,EAAa,GAAQ,EAAE,WAAQ,CAAC,GAG5C,IAAM,QAAc,EAAO,IAAI,CAAQ,GAAG,CAAC,CAAM,CAAC,GAElD,IAAU,EAAW,EACzB,SAAS,EAAO,KAAK,GAAQ,MAAU;EACrC,IAAM,IAAK,EAAI,MAAU,IACnB,IAAU,EAAyB,GAAQ;GAAE;GAAS,SAAS;GAAI,OAAO,EAAW;EAAM,CAAC;EAClG,OAAO;GACL,GAAG;GACH,UAAU,EAAQ,WAAW,OAAS,KAAW;GACjD,SAAS,YAAY;IACnB,IAAI;KACF,IAAM,IAAO,MAAM,EAAQ,QAAQ;KAEnC,OADA,EAAa,SAAS,EAAE,QAAQ,GAAI,CAAI,GACjC;IACT,SAAS,GAAK;KACZ,MAAM,EAAmB,CAAG;IAC9B;GACF;EACF;CACF,CAAC,EACH,CAAC;CAYD,EAAqB;EACnB,UANe,QACX,EAAW,WAAiB,EAAgB,EAAW,QAAQ,IAC5D,EAAgB,CAAC,EAAW,YAAY,GAAG,EAAO,KAAK,MAAU,EAAM,aAAa,EAAM,MAAM,CAAC,CAAC,GACxG;GAAC,EAAW;GAAU,EAAW;GAAY;EAAM,CAGpD;EACA;EACA;EACA,QAAQ,EAAW;EACnB,SAAS,KAAQ,KAAW;CAC9B,CAAC;CAED,IAAM,IAAU,EAAe,CAAG,GAC5B,IAAW,QAAc;EAC7B,IAAM,oBAAQ,IAAI,IAAmC;EAErD,OADA,EAAO,SAAS,GAAO,MAAU,EAAM,IAAI,EAAM,KAAK,EAAQ,EAAM,CAAC,GAC9D,EAAoB,IAAS,MAAU,EAAM,IAAI,EAAM,GAAG,CAAC;CACpE,GAAG,CAAC,GAAQ,CAAO,CAAC,GAEd,IAAU,QAAc,EAAwB,GAAU,EAAE,aAAU,CAAC,GAAG,CAAC,GAAU,CAAS,CAAC,GAC/F,IAAS,QAAc,EAAkB,GAAU,EAAE,aAAU,CAAC,GAAG,CAAC,GAAU,CAAS,CAAC,GAGxF,IAAa,EAAO,CAAO;CACjC,EAAW,UAAU;CACrB,IAAM,IAAU,EAAY,YAAY;EACtC,MAAM,QAAQ,IAAI,EAAW,QAAQ,KAAK,MAAW,EAAO,QAAQ,CAAC,CAAC;CACxE,GAAG,CAAC,CAAC;CAEL,OAAO;EACL;EACA;EACA;EACA,WAAW,EAAQ,MAAM,MAAW,EAAO,SAAS;EACpD,YAAY,EAAQ,MAAM,MAAW,EAAO,UAAU;EACtD,OAAQ,EAAQ,MAAM,MAAW,EAAO,KAAK,GAAG,SAA4C;EAC5F;CACF;AACF;AAGA,SAAS,EAAS,GAAyC;CACzD,IAAI,EAAM,YAAY,KAAA,GAAW,OAAO,EAAM;CAC9C,IAAI,EAAM,gBAAgB,KAAA,GAAW,OAAO,OAAO,EAAM,WAAW;AAEtE"}
@@ -1,4 +1,4 @@
1
- import { ConfigParameter, GetQuoteTpSlOptions } from '@symmio/trading-core';
1
+ import { ConfigParameter, GetQuoteTpSlOptions, QuoteTpSlRow } from '@symmio/trading-core';
2
2
  import { UseQueryResult } from '@tanstack/react-query';
3
3
  import { Address } from 'viem';
4
4
  import { SymmioRequestError } from '../errors/symmio-request-error.js';
@@ -18,7 +18,20 @@ export type UseQuoteTpSlParameters = Omit<GetQuoteTpSlOptions, "quoteId"> & Conf
18
18
  account?: Address;
19
19
  };
20
20
  /** Return type of {@link useQuoteTpSl}. */
21
- export type UseQuoteTpSlReturnType = UseQueryResult<TpSlRecord, SymmioRequestError>;
21
+ export interface UseQuoteTpSlReturnType {
22
+ /** The folded TP/SL snapshot from the shared store, or `undefined` before the first load. */
23
+ data?: TpSlRecord;
24
+ /** `true` while the first fetch for this quote is in flight. */
25
+ isLoading: boolean;
26
+ /** `true` while any fetch is in flight, including background refetches. */
27
+ isFetching: boolean;
28
+ /** Normalized fetch error, or `null`. */
29
+ error: SymmioRequestError | null;
30
+ /** Re-read the handler rows for this quote. */
31
+ refetch: () => Promise<void>;
32
+ /** The underlying handler-row query, for advanced use. */
33
+ query: UseQueryResult<QuoteTpSlRow[], SymmioRequestError>;
34
+ }
22
35
  /**
23
36
  * Read the folded TP/SL snapshot for one quote. Pass either the on-chain
24
37
  * `quoteId` or the hedger `tempQuoteId` — the store keeps a single record per
@@ -28,6 +41,9 @@ export type UseQuoteTpSlReturnType = UseQueryResult<TpSlRecord, SymmioRequestErr
28
41
  * The `confirming` overlay ("POST accepted, awaiting handler") is merged into
29
42
  * `tpState` / `slState` at read time — a side flagged as confirming reports
30
43
  * state `"confirming"` regardless of what the row set says.
44
+ *
45
+ * @param parameters - Quote id, optional sub-account for the live stream, query overrides.
46
+ * @returns The snapshot plus the usual load/error/refetch surface.
31
47
  */
32
48
  export declare function useQuoteTpSl(parameters: UseQuoteTpSlParameters): UseQuoteTpSlReturnType;
33
49
  //# sourceMappingURL=use-quote-tpsl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGzE,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG5E,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GACvE,eAAe,GAAG;IAChB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,cAAc,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;AAEpF;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,sBAAsB,GAAG,sBAAsB,CA8CvF"}
1
+ {"version":3,"file":"use-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,OAAO,EAA+B,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG5E,2CAA2C;AAC3C,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,mBAAmB,EAAE,SAAS,CAAC,GACvE,eAAe,GAAG;IAChB;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEJ,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,6FAA6F;IAC7F,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,gEAAgE;IAChE,SAAS,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,UAAU,EAAE,OAAO,CAAC;IACpB,yCAAyC;IACzC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACjC,+CAA+C;IAC/C,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,0DAA0D;IAC1D,KAAK,EAAE,cAAc,CAAC,YAAY,EAAE,EAAE,kBAAkB,CAAC,CAAC;CAC3D;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,sBAAsB,GAAG,sBAAsB,CA+DvF"}
@@ -3,42 +3,50 @@ import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
3
3
  import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
4
4
  import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
5
5
  import { useTpSlRecord as r, useTpSlStore as i } from "./tpsl-store.js";
6
- import { useWatchTpSlNotifications as a } from "./use-watch-tpsl-notifications.js";
7
- import { getQuoteTpSlQueryOptions as o } from "@symmio/trading-core";
8
- import { useQuery as s } from "@tanstack/react-query";
6
+ import { linkTpSlNotificationIds as a, matchTpSlNotification as o } from "./match-tpsl-notification.js";
7
+ import { useWatchTpSlNotifications as s } from "./use-watch-tpsl-notifications.js";
8
+ import { getQuoteTpSlQueryOptions as c } from "@symmio/trading-core";
9
+ import { useCallback as l } from "react";
10
+ import { useQuery as u } from "@tanstack/react-query";
9
11
  //#region src/tpsl/use-quote-tpsl.ts
10
- function c(c) {
11
- let u = t(c), d = e(), f = c.chainId ?? d, p = r(c.quoteId), m = o(u, {
12
- ...c,
13
- chainId: f,
14
- quoteId: c.quoteId
15
- }), h = s({
16
- ...m,
12
+ function d(d) {
13
+ let f = t(d), p = e(), m = d.chainId ?? p, h = r(d.quoteId), g = c(f, {
14
+ chainId: m,
15
+ quoteId: d.quoteId,
16
+ query: d.query
17
+ }), _ = u({
18
+ ...g,
17
19
  queryFn: async () => {
18
20
  try {
19
- let e = await m.queryFn();
20
- return i.getState().setRows(c.quoteId, e), e;
21
+ let e = await g.queryFn();
22
+ return i.getState().setRows(d.quoteId, e), e;
21
23
  } catch (e) {
22
24
  throw n(e);
23
25
  }
24
26
  }
25
27
  });
26
- return a({
27
- account: c.account,
28
- enabled: !!c.account && c.quoteId !== 0n,
28
+ s({
29
+ account: d.account,
30
+ enabled: !!d.account && d.quoteId !== 0n,
29
31
  onNotification: (e) => {
30
- e.primaryIdentifier !== 0 && e.secondaryIdentifier !== 0 && i.getState().link(BigInt(e.primaryIdentifier), BigInt(e.secondaryIdentifier)), l(e, c.quoteId) && i.getState().applyNotification(c.quoteId, e);
32
+ a(e);
33
+ let t = o(e, [d.quoteId]);
34
+ t !== void 0 && i.getState().applyNotification(t, e);
31
35
  }
32
- }), {
33
- query: h,
34
- data: p
36
+ });
37
+ let v = l(async () => {
38
+ await _.refetch();
39
+ }, [_]);
40
+ return {
41
+ data: h,
42
+ isLoading: _.isLoading,
43
+ isFetching: _.isFetching,
44
+ error: _.error ?? null,
45
+ refetch: v,
46
+ query: _
35
47
  };
36
48
  }
37
- function l(e, t) {
38
- let n = i.getState(), r = n.get(t);
39
- return r ? e.primaryIdentifier !== 0 && n.get(BigInt(e.primaryIdentifier)) === r || e.secondaryIdentifier !== 0 && n.get(BigInt(e.secondaryIdentifier)) === r : e.primaryIdentifier === Number(t) || e.secondaryIdentifier === Number(t) || e.quoteId === Number(t);
40
- }
41
49
  //#endregion
42
- export { c as useQuoteTpSl };
50
+ export { d as useQuoteTpSl };
43
51
 
44
52
  //# sourceMappingURL=use-quote-tpsl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteTpSlQueryOptions,\n type ConfigParameter,\n type GetQuoteTpSlOptions,\n type TpSlNotification,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport type { Address } from \"viem\";\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\";\nimport { useTpSlRecord, useTpSlStore, type TpSlRecord } from \"./tpsl-store\";\nimport { useWatchTpSlNotifications } from \"./use-watch-tpsl-notifications\";\n\n/** Parameters for {@link useQuoteTpSl}. */\nexport type UseQuoteTpSlParameters = Omit<GetQuoteTpSlOptions, \"quoteId\"> &\n ConfigParameter & {\n /**\n * Quote id — accepts either the on-chain `quoteId` or the hedger\n * `tempQuoteId`. Whichever is passed, the hook resolves to the same\n * shared record via the store's id index.\n */\n quoteId: bigint;\n /**\n * SubAccount address — when provided, the hook also subscribes to the\n * TP/SL WebSocket and reconciles the record without manual polling.\n */\n account?: Address;\n };\n\n/** Return type of {@link useQuoteTpSl}. */\nexport type UseQuoteTpSlReturnType = UseQueryResult<TpSlRecord, SymmioRequestError>;\n\n/**\n * Read the folded TP/SL snapshot for one quote. Pass either the on-chain\n * `quoteId` or the hedger `tempQuoteId` — the store keeps a single record per\n * quote indexed under every id it has learned for that quote, so both callers\n * get the same object.\n *\n * The `confirming` overlay (\"POST accepted, awaiting handler\") is merged into\n * `tpState` / `slState` at read time — a side flagged as confirming reports\n * state `\"confirming\"` regardless of what the row set says.\n */\nexport function useQuoteTpSl(parameters: UseQuoteTpSlParameters): UseQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const defaultChainId = useSymmioChainId();\n const chainId = parameters.chainId ?? defaultChainId;\n\n const record = useTpSlRecord(parameters.quoteId);\n const options = getQuoteTpSlQueryOptions(config, {\n ...parameters,\n chainId,\n quoteId: parameters.quoteId,\n });\n // Re-fetch is driven by TanStack Query cache: mutations invalidate `rowsKey`,\n // which triggers a refetch here so the store record picks up the newly\n // committed tp/sl values. (An earlier version gated on `record === undefined`\n // to avoid a duplicate fetch when the on-chain quoteId first appeared, but\n // that also swallowed post-mutation invalidations — leaving the box stuck on\n // the old values.)\n const queryResult = useQuery({\n ...options,\n queryFn: async () => {\n try {\n const rows = await options.queryFn();\n useTpSlStore.getState().setRows(parameters.quoteId, rows);\n return rows;\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n });\n\n useWatchTpSlNotifications({\n account: parameters.account,\n enabled: Boolean(parameters.account) && parameters.quoteId !== 0n,\n onNotification: (notification) => {\n if (notification.primaryIdentifier !== 0 && notification.secondaryIdentifier !== 0) {\n useTpSlStore.getState().link(BigInt(notification.primaryIdentifier), BigInt(notification.secondaryIdentifier));\n }\n if (!matchesQuote(notification, parameters.quoteId)) return;\n useTpSlStore.getState().applyNotification(parameters.quoteId, notification);\n },\n });\n\n return {\n query: queryResult,\n data: record,\n } as unknown as UseQuoteTpSlReturnType;\n}\n\n/**\n * True when the notification and the caller address the same store record.\n * Uses the store's id index — every id linked to the same record maps to\n * the same object, so reference equality decides the match.\n */\nfunction matchesQuote(notification: TpSlNotification, quoteId: bigint): boolean {\n const store = useTpSlStore.getState();\n const target = store.get(quoteId);\n if (!target) {\n // No record yet for the target — fall back to raw-id compare so the\n // first \"seed\" frame still matches.\n return (\n notification.primaryIdentifier === Number(quoteId) ||\n notification.secondaryIdentifier === Number(quoteId) ||\n notification.quoteId === Number(quoteId)\n );\n }\n if (notification.primaryIdentifier !== 0 && store.get(BigInt(notification.primaryIdentifier)) === target) return true;\n if (notification.secondaryIdentifier !== 0 && store.get(BigInt(notification.secondaryIdentifier)) === target)\n return true;\n return false;\n}\n"],"mappings":";;;;;;;;;AA8CA,SAAgB,EAAa,GAA4D;CACvF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAEhC,IAAS,EAAc,EAAW,OAAO,GACzC,IAAU,EAAyB,GAAQ;EAC/C,GAAG;EACH;EACA,SAAS,EAAW;CACtB,CAAC,GAOK,IAAc,EAAS;EAC3B,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,IAAM,IAAO,MAAM,EAAQ,QAAQ;IAEnC,OADA,EAAa,SAAS,EAAE,QAAQ,EAAW,SAAS,CAAI,GACjD;GACT,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;CAcD,OAZA,EAA0B;EACxB,SAAS,EAAW;EACpB,SAAS,EAAQ,EAAW,WAAY,EAAW,YAAY;EAC/D,iBAAiB,MAAiB;GAChC,AAAI,EAAa,sBAAsB,KAAK,EAAa,wBAAwB,KAC/E,EAAa,SAAS,EAAE,KAAK,OAAO,EAAa,iBAAiB,GAAG,OAAO,EAAa,mBAAmB,CAAC,GAE1G,EAAa,GAAc,EAAW,OAAO,KAClD,EAAa,SAAS,EAAE,kBAAkB,EAAW,SAAS,CAAY;EAC5E;CACF,CAAC,GAEM;EACL,OAAO;EACP,MAAM;CACR;AACF;AAOA,SAAS,EAAa,GAAgC,GAA0B;CAC9E,IAAM,IAAQ,EAAa,SAAS,GAC9B,IAAS,EAAM,IAAI,CAAO;CAahC,OAZK,IASD,EAAa,sBAAsB,KAAK,EAAM,IAAI,OAAO,EAAa,iBAAiB,CAAC,MAAM,KAC9F,EAAa,wBAAwB,KAAK,EAAM,IAAI,OAAO,EAAa,mBAAmB,CAAC,MAAM,IANlG,EAAa,sBAAsB,OAAO,CAAO,KACjD,EAAa,wBAAwB,OAAO,CAAO,KACnD,EAAa,YAAY,OAAO,CAAO;AAO7C"}
1
+ {"version":3,"file":"use-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getQuoteTpSlQueryOptions,\n type ConfigParameter,\n type GetQuoteTpSlOptions,\n type QuoteTpSlRow,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { useCallback } from \"react\";\nimport type { Address } from \"viem\";\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\";\nimport { linkTpSlNotificationIds, matchTpSlNotification } from \"./match-tpsl-notification\";\nimport { useTpSlRecord, useTpSlStore, type TpSlRecord } from \"./tpsl-store\";\nimport { useWatchTpSlNotifications } from \"./use-watch-tpsl-notifications\";\n\n/** Parameters for {@link useQuoteTpSl}. */\nexport type UseQuoteTpSlParameters = Omit<GetQuoteTpSlOptions, \"quoteId\"> &\n ConfigParameter & {\n /**\n * Quote id — accepts either the on-chain `quoteId` or the hedger\n * `tempQuoteId`. Whichever is passed, the hook resolves to the same\n * shared record via the store's id index.\n */\n quoteId: bigint;\n /**\n * SubAccount address — when provided, the hook also subscribes to the\n * TP/SL WebSocket and reconciles the record without manual polling.\n */\n account?: Address;\n };\n\n/** Return type of {@link useQuoteTpSl}. */\nexport interface UseQuoteTpSlReturnType {\n /** The folded TP/SL snapshot from the shared store, or `undefined` before the first load. */\n data?: TpSlRecord;\n /** `true` while the first fetch for this quote is in flight. */\n isLoading: boolean;\n /** `true` while any fetch is in flight, including background refetches. */\n isFetching: boolean;\n /** Normalized fetch error, or `null`. */\n error: SymmioRequestError | null;\n /** Re-read the handler rows for this quote. */\n refetch: () => Promise<void>;\n /** The underlying handler-row query, for advanced use. */\n query: UseQueryResult<QuoteTpSlRow[], SymmioRequestError>;\n}\n\n/**\n * Read the folded TP/SL snapshot for one quote. Pass either the on-chain\n * `quoteId` or the hedger `tempQuoteId` — the store keeps a single record per\n * quote indexed under every id it has learned for that quote, so both callers\n * get the same object.\n *\n * The `confirming` overlay (\"POST accepted, awaiting handler\") is merged into\n * `tpState` / `slState` at read time — a side flagged as confirming reports\n * state `\"confirming\"` regardless of what the row set says.\n *\n * @param parameters - Quote id, optional sub-account for the live stream, query overrides.\n * @returns The snapshot plus the usual load/error/refetch surface.\n */\nexport function useQuoteTpSl(parameters: UseQuoteTpSlParameters): UseQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const defaultChainId = useSymmioChainId();\n const chainId = parameters.chainId ?? defaultChainId;\n\n const record = useTpSlRecord(parameters.quoteId);\n /**\n * Only the fields the read itself takes are forwarded — never the whole\n * `parameters`. `account` selects which WebSocket to subscribe to and has no\n * bearing on `GET /api/v5/?quote_id=…`, but the key factory hashes every\n * field it is handed, so spreading it fragmented the cache: the same quote\n * read from a flow (`account: subAccount`), from a row cell\n * (`account: vaAddress`) and from `useQuoteGroupTpSl` (no account) landed in\n * three separate entries, and one invalidation fired three identical\n * requests.\n */\n const options = getQuoteTpSlQueryOptions(config, {\n chainId,\n quoteId: parameters.quoteId,\n query: parameters.query,\n });\n // Re-fetch is driven by TanStack Query cache: mutations invalidate `rowsKey`,\n // which triggers a refetch here so the store record picks up the newly\n // committed tp/sl values. (An earlier version gated on `record === undefined`\n // to avoid a duplicate fetch when the on-chain quoteId first appeared, but\n // that also swallowed post-mutation invalidations — leaving the box stuck on\n // the old values.)\n const query = useQuery({\n ...options,\n queryFn: async () => {\n try {\n const rows = await options.queryFn();\n useTpSlStore.getState().setRows(parameters.quoteId, rows);\n return rows;\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseQueryResult<QuoteTpSlRow[], SymmioRequestError>;\n\n useWatchTpSlNotifications({\n account: parameters.account,\n enabled: Boolean(parameters.account) && parameters.quoteId !== 0n,\n onNotification: (notification) => {\n linkTpSlNotificationIds(notification);\n const target = matchTpSlNotification(notification, [parameters.quoteId]);\n if (target === undefined) return;\n useTpSlStore.getState().applyNotification(target, notification);\n },\n });\n\n const refetch = useCallback(async () => {\n await query.refetch();\n }, [query]);\n\n return {\n data: record,\n isLoading: query.isLoading,\n isFetching: query.isFetching,\n error: query.error ?? null,\n refetch,\n query,\n };\n}\n"],"mappings":";;;;;;;;;;;AAgEA,SAAgB,EAAa,GAA4D;CACvF,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAiB,EAAiB,GAClC,IAAU,EAAW,WAAW,GAEhC,IAAS,EAAc,EAAW,OAAO,GAWzC,IAAU,EAAyB,GAAQ;EAC/C;EACA,SAAS,EAAW;EACpB,OAAO,EAAW;CACpB,CAAC,GAOK,IAAQ,EAAS;EACrB,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,IAAM,IAAO,MAAM,EAAQ,QAAQ;IAEnC,OADA,EAAa,SAAS,EAAE,QAAQ,EAAW,SAAS,CAAI,GACjD;GACT,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;CAED,EAA0B;EACxB,SAAS,EAAW;EACpB,SAAS,EAAQ,EAAW,WAAY,EAAW,YAAY;EAC/D,iBAAiB,MAAiB;GAChC,EAAwB,CAAY;GACpC,IAAM,IAAS,EAAsB,GAAc,CAAC,EAAW,OAAO,CAAC;GACnE,MAAW,KAAA,KACf,EAAa,SAAS,EAAE,kBAAkB,GAAQ,CAAY;EAChE;CACF,CAAC;CAED,IAAM,IAAU,EAAY,YAAY;EACtC,MAAM,EAAM,QAAQ;CACtB,GAAG,CAAC,CAAK,CAAC;CAEV,OAAO;EACL,MAAM;EACN,WAAW,EAAM;EACjB,YAAY,EAAM;EAClB,OAAO,EAAM,SAAS;EACtB;EACA;CACF;AACF"}
@@ -0,0 +1,30 @@
1
+ import { ConfigParameter, SearchTpSlOrdersOptions, SearchTpSlOrdersReturnType } from '@symmio/trading-core';
2
+ import { UseQueryResult } from '@tanstack/react-query';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /** Parameters for {@link useSearchTpSlOrders}: the core query options plus an optional `config`. */
5
+ export type UseSearchTpSlOrdersParameters = SearchTpSlOrdersOptions & ConfigParameter;
6
+ /** Return type of {@link useSearchTpSlOrders}: one page of conditional-order rows. */
7
+ export type UseSearchTpSlOrdersReturnType = UseQueryResult<SearchTpSlOrdersReturnType, SymmioRequestError>;
8
+ /**
9
+ * Search conditional orders at the chain's TP/SL handler.
10
+ *
11
+ * Every filter is optional, including `account`. Pass one to read a single
12
+ * account's TP/SL legs; **omit it** to read across accounts — which is how a
13
+ * pool's order book is read: filter by `symbolId` and
14
+ * `conditionalOrderType: "send_quote"` and you get every trader's pending
15
+ * trigger-to-open orders on that market.
16
+ *
17
+ * `isComplete` is the field to trust when deciding whether an absent order is
18
+ * really gone; `count` is advisory. Errors are normalized to
19
+ * {@link SymmioRequestError}.
20
+ *
21
+ * @example
22
+ * ```tsx
23
+ * const { data } = useSearchTpSlOrders({
24
+ * symbolId,
25
+ * conditionalOrderType: ConditionalOrderType.send_quote,
26
+ * });
27
+ * ```
28
+ */
29
+ export declare function useSearchTpSlOrders(parameters?: UseSearchTpSlOrdersParameters): UseSearchTpSlOrdersReturnType;
30
+ //# sourceMappingURL=use-search-tpsl-orders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-search-tpsl-orders.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-search-tpsl-orders.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,oGAAoG;AACpG,MAAM,MAAM,6BAA6B,GAAG,uBAAuB,GAAG,eAAe,CAAC;AAEtF,sFAAsF;AACtF,MAAM,MAAM,6BAA6B,GAAG,cAAc,CAAC,0BAA0B,EAAE,kBAAkB,CAAC,CAAC;AAE3G;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,GAAE,6BAAkC,GAAG,6BAA6B,CAkBjH"}
@@ -0,0 +1,27 @@
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 { searchTpSlOrdersQueryOptions as r } from "@symmio/trading-core";
6
+ import { useQuery as i } from "@tanstack/react-query";
7
+ //#region src/tpsl/use-search-tpsl-orders.ts
8
+ function a(a = {}) {
9
+ let o = t(a), s = e(), c = r(o, {
10
+ ...a,
11
+ chainId: a.chainId ?? s
12
+ });
13
+ return i({
14
+ ...c,
15
+ queryFn: async () => {
16
+ try {
17
+ return await c.queryFn();
18
+ } catch (e) {
19
+ throw n(e);
20
+ }
21
+ }
22
+ });
23
+ }
24
+ //#endregion
25
+ export { a as useSearchTpSlOrders };
26
+
27
+ //# sourceMappingURL=use-search-tpsl-orders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-search-tpsl-orders.js","names":[],"sources":["../../src/tpsl/use-search-tpsl-orders.ts"],"sourcesContent":["\"use client\";\n\nimport {\n searchTpSlOrdersQueryOptions,\n type ConfigParameter,\n type SearchTpSlOrdersOptions,\n type SearchTpSlOrdersReturnType,\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/** Parameters for {@link useSearchTpSlOrders}: the core query options plus an optional `config`. */\nexport type UseSearchTpSlOrdersParameters = SearchTpSlOrdersOptions & ConfigParameter;\n\n/** Return type of {@link useSearchTpSlOrders}: one page of conditional-order rows. */\nexport type UseSearchTpSlOrdersReturnType = UseQueryResult<SearchTpSlOrdersReturnType, SymmioRequestError>;\n\n/**\n * Search conditional orders at the chain's TP/SL handler.\n *\n * Every filter is optional, including `account`. Pass one to read a single\n * account's TP/SL legs; **omit it** to read across accounts — which is how a\n * pool's order book is read: filter by `symbolId` and\n * `conditionalOrderType: \"send_quote\"` and you get every trader's pending\n * trigger-to-open orders on that market.\n *\n * `isComplete` is the field to trust when deciding whether an absent order is\n * really gone; `count` is advisory. Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useSearchTpSlOrders({\n * symbolId,\n * conditionalOrderType: ConditionalOrderType.send_quote,\n * });\n * ```\n */\nexport function useSearchTpSlOrders(parameters: UseSearchTpSlOrdersParameters = {}): UseSearchTpSlOrdersReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = searchTpSlOrdersQueryOptions(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 UseSearchTpSlOrdersReturnType;\n}\n"],"mappings":";;;;;;;AAyCA,SAAgB,EAAoB,IAA4C,CAAC,GAAkC;CACjH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA6B,GAAQ;EACnD,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"}
@@ -0,0 +1,234 @@
1
+ import { ConfigParameter, GroupTpSlChild, GroupTpSlDesiredMap, GroupTpSlSkipReason, PlanGroupTpSlResult, TpSlConditionalOrderType, TpSlConfig, TpSlValidation } from '@symmio/trading-core';
2
+ import { Address } from 'viem';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /**
5
+ * Lifecycle of one step inside a grouped TP/SL run:
6
+ * `queued` → `submitting` (request in flight) → `confirming` (handler returned
7
+ * 200) → `done` (the WebSocket reported the order live, or gone for a cancel),
8
+ * or `failed`, or `skipped` (the plan decided the leg needs no write).
9
+ */
10
+ export type SetQuoteGroupTpSlStepStatus = "queued" | "submitting" | "confirming" | "done" | "failed" | "skipped";
11
+ /** What a step does. A leg can produce a `cancel` **and** a `write` in one run. */
12
+ export type SetQuoteGroupTpSlStepKind = "write" | "cancel" | "skip";
13
+ /** Live state of one step. */
14
+ export interface SetQuoteGroupTpSlStep {
15
+ /**
16
+ * Stable step identity, unique within a run. A leg may yield several steps
17
+ * (cancel one side, write the other), so this — not `key` — is what a
18
+ * consumer should use as a list key.
19
+ */
20
+ id: string;
21
+ /** Leg identity (`GroupTpSlChild.key`). Several steps can share it. */
22
+ key: string;
23
+ /** What this step does. */
24
+ kind: SetQuoteGroupTpSlStepKind;
25
+ /** On-chain quote id. `0n` for a leg the plan skipped before it anchored. */
26
+ quoteId: bigint;
27
+ /**
28
+ * Sides this step still awaits confirmation for. A write starts with the
29
+ * sides it wrote and empties as reports land; a cancel carries exactly one.
30
+ */
31
+ sides: TpSlConditionalOrderType[];
32
+ /** Current stage. */
33
+ status: SetQuoteGroupTpSlStepStatus;
34
+ /** Why the leg was skipped, when `status` is `"skipped"`. */
35
+ skipReason?: GroupTpSlSkipReason;
36
+ /** Per-side validation errors, when `skipReason` is `"invalid"`. */
37
+ validation?: TpSlValidation;
38
+ /** Handler-issued conditional-order id — reported by a write, targeted by a cancel. */
39
+ cohQuoteId?: string;
40
+ /** Normalized error, when `status` is `"failed"`. */
41
+ error?: SymmioRequestError;
42
+ }
43
+ /** Overall lifecycle of a grouped TP/SL run. */
44
+ export type SetQuoteGroupTpSlStatus = "idle"
45
+ /** At least one request is in flight. */
46
+ | "submitting"
47
+ /** Every request settled; at least one step still awaits its handler report. */
48
+ | "confirming"
49
+ /** Every written and cancelled step is confirmed. */
50
+ | "success"
51
+ /** Some steps were accepted, some failed. */
52
+ | "partial"
53
+ /** Every step failed. */
54
+ | "failed";
55
+ /** Inputs for one {@link UseSetQuoteGroupTpSlReturnType.set} run. */
56
+ export interface SetQuoteGroupTpSlParameters {
57
+ /** Legs with their confirmed snapshots — from {@link useQuoteGroupTpSl}. */
58
+ children: readonly GroupTpSlChild[];
59
+ /** Desired per-leg state, keyed by `GroupTpSlChild.key`. */
60
+ desired: GroupTpSlDesiredMap;
61
+ /** SubAccount that owns every leg's Virtual Account — required in the signed message. */
62
+ subAccount: Address;
63
+ /** Market price precision. One value per run — a grouped position is one market. */
64
+ pricePrecision: number;
65
+ /** Live handler `/configs/` rules; with `referencePrice`, invalid legs are skipped, not submitted. */
66
+ config?: TpSlConfig;
67
+ /** Reference price for validation (decimal string) — pass the live mark price. */
68
+ referencePrice?: string;
69
+ /** Slippage percent forwarded to every write. Defaults to the SDK's TP/SL default. */
70
+ slippage?: number;
71
+ /** Affiliate override forwarded to every write. */
72
+ affiliate?: Address;
73
+ /** Delegated session key to sign from, when delegation is active. */
74
+ from?: Address;
75
+ /**
76
+ * How many requests may be in flight at once. Default `1` — every leg needs
77
+ * its own EIP-712 signature from the same wallet client, and serializing
78
+ * avoids signature races and simultaneous wallet prompts. Raise it only when
79
+ * signing with a session key.
80
+ */
81
+ concurrency?: number;
82
+ /**
83
+ * Stop the run when the wallet rejects a signature, instead of prompting for
84
+ * every remaining leg. Default `true` — a trader who dismisses one prompt did
85
+ * not consent to five more.
86
+ */
87
+ stopOnUserRejection?: boolean;
88
+ /**
89
+ * Accounts whose live streams confirm the run. Defaults to the deduped
90
+ * Virtual Account of every leg the plan touches — the channel the handler
91
+ * reports these orders on, and the reason a group spanning several VAs is
92
+ * fully covered.
93
+ */
94
+ notificationsAccounts?: readonly Address[];
95
+ /**
96
+ * Single-account form of {@link SetQuoteGroupTpSlParameters.notificationsAccounts}.
97
+ *
98
+ * @deprecated Pass `notificationsAccounts`. A grouped position can span
99
+ * Virtual Accounts, so one address rarely covers the whole run.
100
+ */
101
+ notificationsAccount?: Address;
102
+ /**
103
+ * How long a step may wait for its report before the run refetches the
104
+ * handler's rows and, failing that, gives up on it. Defaults to
105
+ * {@link DEFAULT_TPSL_CONFIRMATION_TIMEOUT_MS}.
106
+ */
107
+ confirmationTimeoutMs?: number;
108
+ /**
109
+ * How long the WebSocket report gets on its own before the fallback sweep
110
+ * starts, in milliseconds. Defaults to {@link TPSL_FALLBACK_POLL_DELAY_MS}.
111
+ *
112
+ * The sweep exists for reports that never come; while one can still
113
+ * plausibly arrive, reading the handler adds load and answers nothing.
114
+ */
115
+ fallbackPollDelayMs?: number;
116
+ /**
117
+ * Cadence of the fallback sweep once it has started, in milliseconds.
118
+ * Defaults to {@link TPSL_FALLBACK_POLL_INTERVAL_MS}; `0` disables the sweep
119
+ * and leaves the WebSocket report as the only confirmation signal.
120
+ */
121
+ fallbackPollIntervalMs?: number;
122
+ /** Chain override; defaults to the connected chain. */
123
+ chainId?: number;
124
+ /** Restrict the run to these leg keys — the retry-failed-only path. */
125
+ only?: readonly string[];
126
+ }
127
+ /**
128
+ * Outcome of one run, reported once every step has been confirmed by the
129
+ * handler's report — or given up on. Nothing about the run is still in flight
130
+ * when this resolves.
131
+ */
132
+ export interface SetQuoteGroupTpSlSummary {
133
+ /** `true` when every planned step was accepted **and** confirmed. */
134
+ ok: boolean;
135
+ /** Steps the handler accepted (writes and cancels). */
136
+ submittedCount: number;
137
+ /** Steps the handler's report confirmed. */
138
+ confirmedCount: number;
139
+ /** Steps that failed. */
140
+ failedCount: number;
141
+ /** Legs the plan skipped. */
142
+ skippedCount: number;
143
+ /** Per-step final states at resolve time. */
144
+ steps: SetQuoteGroupTpSlStep[];
145
+ /** The plan the run executed — inspect `skips` for why a leg was left out. */
146
+ plan: PlanGroupTpSlResult;
147
+ /** `true` when the run stopped early because the wallet rejected a signature. */
148
+ stoppedByUser: boolean;
149
+ /** First error, when any step failed. */
150
+ error?: SymmioRequestError;
151
+ }
152
+ /** Return type of {@link useSetQuoteGroupTpSl}. */
153
+ export interface UseSetQuoteGroupTpSlReturnType {
154
+ /**
155
+ * Plan and apply. Resolves once every step has been confirmed by the
156
+ * handler's report or given up on (never rejects).
157
+ */
158
+ set: (parameters: SetQuoteGroupTpSlParameters) => Promise<SetQuoteGroupTpSlSummary>;
159
+ /**
160
+ * Re-run only the steps that failed, against fresh children when supplied
161
+ * (so a leg that confirmed via a race is diffed away). Steps that already
162
+ * succeeded are preserved, not reset. Never rejects.
163
+ */
164
+ retryFailed: (children?: readonly GroupTpSlChild[]) => Promise<SetQuoteGroupTpSlSummary>;
165
+ /** Clear the run state back to `idle`. No-op while a run is in flight. */
166
+ reset: () => void;
167
+ /** Overall run lifecycle. */
168
+ status: SetQuoteGroupTpSlStatus;
169
+ /** `true` while a request is in flight. */
170
+ isSubmitting: boolean;
171
+ /** `true` while every request has settled but some step still awaits its handler report. */
172
+ isConfirming: boolean;
173
+ /**
174
+ * Share of steps that reached a terminal state — confirmed or failed — as
175
+ * `0`–`100` (2-decimal resolution). A step the handler accepted but has not
176
+ * reported on yet does **not** count.
177
+ */
178
+ progressPercent: number;
179
+ /** Steps the handler accepted so far — **excludes** failures. */
180
+ acceptedCount: number;
181
+ /** Steps the handler's report has confirmed so far. */
182
+ confirmedCount: number;
183
+ /** Steps that failed so far. */
184
+ failedCount: number;
185
+ /** Steps the current/last run intends to execute (writes + cancels). */
186
+ totalCount: number;
187
+ /** Per-step states of the current/last run, in execution order. */
188
+ steps: SetQuoteGroupTpSlStep[];
189
+ /** The last run's plan, for UI gating. */
190
+ plan?: PlanGroupTpSlResult;
191
+ /** First error of the last run, when a step failed. */
192
+ error?: SymmioRequestError;
193
+ }
194
+ /** Parameters for {@link useSetQuoteGroupTpSl}. */
195
+ export type UseSetQuoteGroupTpSlParameters = ConfigParameter;
196
+ /**
197
+ * Apply a desired take-profit / stop-loss state across a grouped position.
198
+ *
199
+ * The run first diffs the desired state with `planGroupTpSl`, so a leg whose
200
+ * trigger price and price type already match the handler is never re-submitted
201
+ * and a side that did not change is dropped from its request. It then executes
202
+ * the plan — **one signed request per leg, sequentially by default**, because
203
+ * the conditional-order handler has no bulk endpoint and every request needs
204
+ * its own EIP-712 signature.
205
+ *
206
+ * Both halves of the plan run: a side the caller cleared becomes a cancel
207
+ * (`deleteQuoteTpSl`), a side with a new value becomes a write
208
+ * (`setQuoteTpSl`). One leg can do both in the same run.
209
+ *
210
+ * A step goes `confirming` as soon as the handler returns 200 (the shared TP/SL
211
+ * store is marked so the UI can show the target price straight away) and `done`
212
+ * once the WebSocket reports the matching transition — live for a write, gone
213
+ * for a cancel. **`set()` waits for those reports**: it resolves only when every
214
+ * step is confirmed, so a caller that awaits it can trust the exits are real.
215
+ * A step whose report never arrives falls back to the handler's REST rows after
216
+ * `confirmationTimeoutMs` and fails if those do not show it either.
217
+ *
218
+ * A failed step fails only itself and the run ends as `"partial"`, except when
219
+ * the wallet rejects a signature, which stops the run rather than prompting
220
+ * again.
221
+ *
222
+ * @param parameters - Optional config override.
223
+ * @returns The run controls and its live per-step state.
224
+ *
225
+ * @example
226
+ * ```tsx
227
+ * const { set, steps, isConfirming } = useSetQuoteGroupTpSl();
228
+ * // Resolves once the handler has reported every leg live.
229
+ * const summary = await set({ children, desired: editor.desired, subAccount, pricePrecision });
230
+ * if (!summary.ok) showError(summary.error);
231
+ * ```
232
+ */
233
+ export declare function useSetQuoteGroupTpSl(parameters?: UseSetQuoteGroupTpSlParameters): UseSetQuoteGroupTpSlReturnType;
234
+ //# sourceMappingURL=use-set-quote-group-tpsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-set-quote-group-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-set-quote-group-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,eAAe,EAEpB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,UAAU,EACf,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAgBzE;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,QAAQ,GAAG,YAAY,GAAG,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEjH,mFAAmF;AACnF,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEpE,8BAA8B;AAC9B,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,IAAI,EAAE,yBAAyB,CAAC;IAChC,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,EAAE,wBAAwB,EAAE,CAAC;IAClC,qBAAqB;IACrB,MAAM,EAAE,2BAA2B,CAAC;IACpC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,oEAAoE;IACpE,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,uFAAuF;IACvF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,gDAAgD;AAChD,MAAM,MAAM,uBAAuB,GAC/B,MAAM;AACR,yCAAyC;GACvC,YAAY;AACd,gFAAgF;GAC9E,YAAY;AACd,qDAAqD;GACnD,SAAS;AACX,6CAA6C;GAC3C,SAAS;AACX,yBAAyB;GACvB,QAAQ,CAAC;AAEb,qEAAqE;AACrE,MAAM,WAAW,2BAA2B;IAC1C,4EAA4E;IAC5E,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IACpC,4DAA4D;IAC5D,OAAO,EAAE,mBAAmB,CAAC;IAC7B,yFAAyF;IACzF,UAAU,EAAE,OAAO,CAAC;IACpB,oFAAoF;IACpF,cAAc,EAAE,MAAM,CAAC;IACvB,sGAAsG;IACtG,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,qEAAqE;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC3C;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,qEAAqE;IACrE,EAAE,EAAE,OAAO,CAAC;IACZ,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,yBAAyB;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,6CAA6C;IAC7C,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,8EAA8E;IAC9E,IAAI,EAAE,mBAAmB,CAAC;IAC1B,iFAAiF;IACjF,aAAa,EAAE,OAAO,CAAC;IACvB,yCAAyC;IACzC,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,mDAAmD;AACnD,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,GAAG,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACpF;;;;OAIG;IACH,WAAW,EAAE,CAAC,QAAQ,CAAC,EAAE,SAAS,cAAc,EAAE,KAAK,OAAO,CAAC,wBAAwB,CAAC,CAAC;IACzF,0EAA0E;IAC1E,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,6BAA6B;IAC7B,MAAM,EAAE,uBAAuB,CAAC;IAChC,2CAA2C;IAC3C,YAAY,EAAE,OAAO,CAAC;IACtB,4FAA4F;IAC5F,YAAY,EAAE,OAAO,CAAC;IACtB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,iEAAiE;IACjE,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,cAAc,EAAE,MAAM,CAAC;IACvB,gCAAgC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,KAAK,EAAE,qBAAqB,EAAE,CAAC;IAC/B,0CAA0C;IAC1C,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,uDAAuD;IACvD,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED,mDAAmD;AACnD,MAAM,MAAM,8BAA8B,GAAG,eAAe,CAAC;AAqB7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,GAAE,8BAAmC,GAAG,8BAA8B,CA8WpH"}