@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,247 @@
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 { TPSL_CONFIRMATION_TIMEOUT_CODE as a, awaitTpSlConfirmation as o, tpslConfirmationTimeoutError as s } from "./await-tpsl-confirmation.js";
7
+ import { invalidateTpSlReads as c } from "./invalidate-tpsl.js";
8
+ import { startTpSlFallbackPoll as l } from "./tpsl-fallback-poll.js";
9
+ import { runWithConcurrency as u } from "./run-with-concurrency.js";
10
+ import { isCancelSideSettled as d } from "./settled-side.js";
11
+ import { dedupeAddresses as f, useWatchTpSlAccounts as p } from "./use-watch-tpsl-accounts.js";
12
+ import { deleteQuoteTpSlMutationOptions as m, planGroupTpSlDelete as h } from "@symmio/trading-core";
13
+ import { useCallback as g, useEffect as _, useMemo as v, useRef as y, useState as b } from "react";
14
+ import { useQueryClient as x } from "@tanstack/react-query";
15
+ //#region src/tpsl/use-delete-quote-group-tpsl.ts
16
+ var S = {
17
+ status: "idle",
18
+ steps: []
19
+ }, C = {
20
+ targets: [],
21
+ skipped: [],
22
+ isNoop: !0
23
+ };
24
+ function w(d = {}) {
25
+ let f = t(d), w = e(), A = x(), [j, M] = b(S), N = y(S), P = y(!1), F = y(void 0), [I, L] = b([]), R = y(void 0), z = g((e) => {
26
+ N.current = e, M(e);
27
+ }, []), B = v(() => Array.from(new Set(j.steps.filter((e) => e.status === "confirming").map((e) => e.quoteId))), [j.steps]);
28
+ p({
29
+ accounts: I,
30
+ ids: B,
31
+ chainId: R.current,
32
+ config: d.config,
33
+ enabled: I.length > 0 && B.length > 0
34
+ });
35
+ let V = g(() => {
36
+ let e = N.current;
37
+ if (!e.steps.some((e) => e.status === "confirming")) return;
38
+ let t = E(e.steps);
39
+ t && z({
40
+ ...e,
41
+ steps: t,
42
+ status: k(t)
43
+ });
44
+ }, [z]);
45
+ _(() => {
46
+ V();
47
+ }, [r(B), V]);
48
+ let H = g(async (e) => {
49
+ if (P.current) return {
50
+ ok: !1,
51
+ deletedCount: 0,
52
+ confirmedCount: 0,
53
+ failedCount: 0,
54
+ steps: [],
55
+ plan: C,
56
+ error: n(/* @__PURE__ */ Error("A grouped TP/SL cancel is already in flight."))
57
+ };
58
+ let t = e.chainId ?? w, r = h(e.children, e.scope), d = e.only === void 0 ? void 0 : new Set(e.only), p = r.targets.filter((e) => d === void 0 || d.has(T(e))), g = p.map((e) => ({
59
+ id: T(e),
60
+ key: e.key,
61
+ quoteId: e.quoteId,
62
+ conditionalOrderType: e.conditionalOrderType,
63
+ cohQuoteId: e.cohQuoteId,
64
+ status: "queued"
65
+ })), _ = /* @__PURE__ */ new Map();
66
+ for (let e of p) _.set(e.quoteId, e.virtualAccount);
67
+ if (F.current = e, R.current = t, L(O(e, p)), z({
68
+ status: p.length > 0 ? "deleting" : "success",
69
+ steps: g,
70
+ plan: r
71
+ }), p.length === 0) return {
72
+ ok: !0,
73
+ deletedCount: 0,
74
+ confirmedCount: 0,
75
+ failedCount: 0,
76
+ steps: g,
77
+ plan: r
78
+ };
79
+ P.current = !0;
80
+ let v = m(f), y = i.getState().markConfirming;
81
+ function b(e, t) {
82
+ let n = N.current, r = n.steps.findIndex((t) => t.id === e);
83
+ if (r < 0) return;
84
+ let i = [...n.steps];
85
+ i[r] = t(i[r]), z({
86
+ ...n,
87
+ steps: i,
88
+ status: k(i)
89
+ });
90
+ }
91
+ let x = async (r) => {
92
+ let i = T(r);
93
+ b(i, (e) => ({
94
+ ...e,
95
+ status: "deleting"
96
+ }));
97
+ try {
98
+ await v.mutationFn({
99
+ quoteId: r.quoteId,
100
+ virtualAccount: r.virtualAccount,
101
+ cohQuoteId: r.cohQuoteId,
102
+ conditionalOrderType: r.conditionalOrderType,
103
+ from: e.from,
104
+ chainId: t
105
+ }), y(r.quoteId, r.conditionalOrderType === "take_profit" ? "tp" : "sl", { intent: "cancel" }), b(i, (e) => ({
106
+ ...e,
107
+ status: "confirming"
108
+ }));
109
+ } catch (e) {
110
+ let t = n(e);
111
+ b(i, (e) => ({
112
+ ...e,
113
+ status: "failed",
114
+ error: t
115
+ }));
116
+ }
117
+ };
118
+ function S() {
119
+ let e = i.getState(), t = [];
120
+ for (let n of N.current.steps) n.status === "confirming" && (e.clearConfirming(n.quoteId, n.conditionalOrderType === "take_profit" ? "tp" : "sl"), t.push(n.quoteId));
121
+ if (t.length === 0) return;
122
+ let n = s(), r = N.current, a = r.steps.map((e) => e.status === "confirming" ? {
123
+ ...e,
124
+ status: "failed",
125
+ error: n
126
+ } : e);
127
+ z({
128
+ ...r,
129
+ steps: a,
130
+ status: k(a),
131
+ error: r.error ?? n
132
+ }), c(A, t);
133
+ }
134
+ try {
135
+ await u(p, e.concurrency ?? 4, x), await o({
136
+ settle: V,
137
+ hasPending: () => N.current.steps.some((e) => e.status === "confirming"),
138
+ onTimeout: () => void c(A, N.current.steps.filter((e) => e.status === "confirming").map((e) => e.quoteId)),
139
+ onExpire: S,
140
+ onWait: () => l(f, {
141
+ chainId: t,
142
+ delayMs: e.fallbackPollDelayMs,
143
+ intervalMs: e.fallbackPollIntervalMs,
144
+ getWaiting: () => D(N.current.steps, _)
145
+ }).stop,
146
+ timeoutMs: e.confirmationTimeoutMs ?? 6e4
147
+ });
148
+ } finally {
149
+ P.current = !1;
150
+ }
151
+ let E = N.current.steps, j = E.filter((e) => e.status === "failed"), M = E.filter((e) => e.status === "done"), I = j.filter((e) => e.error?.code === a);
152
+ return z({
153
+ ...N.current,
154
+ status: k(E),
155
+ error: j[0]?.error
156
+ }), c(A, M.map((e) => e.quoteId)), {
157
+ ok: j.length === 0,
158
+ deletedCount: M.length + I.length,
159
+ confirmedCount: M.length,
160
+ failedCount: j.length,
161
+ steps: [...E],
162
+ plan: r,
163
+ error: j[0]?.error
164
+ };
165
+ }, [
166
+ z,
167
+ f,
168
+ w,
169
+ A,
170
+ V
171
+ ]), U = g(async (e) => {
172
+ let t = F.current, n = N.current.steps.filter((e) => e.status === "failed").map((e) => e.id);
173
+ return !t || n.length === 0 ? {
174
+ ok: !0,
175
+ deletedCount: 0,
176
+ confirmedCount: 0,
177
+ failedCount: 0,
178
+ steps: [...N.current.steps],
179
+ plan: N.current.plan ?? C
180
+ } : H({
181
+ ...t,
182
+ children: e ?? t.children,
183
+ only: n
184
+ });
185
+ }, [H]), W = g(() => {
186
+ P.current || (R.current = void 0, L([]), F.current = void 0, z(S));
187
+ }, [z]), G = v(() => {
188
+ if (j.steps.length === 0) return 0;
189
+ let e = j.steps.filter((e) => e.status === "done" || e.status === "failed").length;
190
+ return Math.round(e / j.steps.length * 1e4) / 100;
191
+ }, [j.steps]);
192
+ return {
193
+ deleteOrders: H,
194
+ retryFailed: U,
195
+ reset: W,
196
+ status: j.status,
197
+ isDeleting: j.status === "deleting",
198
+ isConfirming: j.status === "confirming",
199
+ progressPercent: G,
200
+ steps: j.steps,
201
+ plan: j.plan,
202
+ error: j.error
203
+ };
204
+ }
205
+ function T(e) {
206
+ return `${e.key}:${e.conditionalOrderType}`;
207
+ }
208
+ function E(e) {
209
+ let t = i.getState(), n = !1, r = e.map((e) => {
210
+ if (e.status !== "confirming") return e;
211
+ let r = t.get(e.quoteId);
212
+ return !r || !d(r, e.conditionalOrderType) ? e : (n = !0, {
213
+ ...e,
214
+ status: "done"
215
+ });
216
+ });
217
+ return n ? r : void 0;
218
+ }
219
+ function D(e, t) {
220
+ let n = [];
221
+ for (let r of e) {
222
+ if (r.status !== "confirming") continue;
223
+ let e = t.get(r.quoteId);
224
+ e && n.push({
225
+ quoteId: r.quoteId,
226
+ side: r.conditionalOrderType,
227
+ intent: "cancel",
228
+ cohQuoteId: r.cohQuoteId,
229
+ account: e
230
+ });
231
+ }
232
+ return n;
233
+ }
234
+ function O(e, t) {
235
+ return e.notificationsAccounts ? f(e.notificationsAccounts) : f([e.notificationsAccount ?? e.subAccount, ...t.map((e) => e.virtualAccount)]);
236
+ }
237
+ function k(e) {
238
+ if (e.length === 0) return "success";
239
+ if (e.some((e) => e.status === "queued" || e.status === "deleting")) return "deleting";
240
+ if (e.some((e) => e.status === "confirming")) return "confirming";
241
+ let t = e.filter((e) => e.status === "failed").length;
242
+ return t === e.length ? "failed" : t > 0 ? "partial" : "success";
243
+ }
244
+ //#endregion
245
+ export { w as useDeleteQuoteGroupTpSl };
246
+
247
+ //# sourceMappingURL=use-delete-quote-group-tpsl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-delete-quote-group-tpsl.js","names":[],"sources":["../../src/tpsl/use-delete-quote-group-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deleteQuoteTpSlMutationOptions,\n planGroupTpSlDelete,\n type ConfigParameter,\n type GroupTpSlChild,\n type GroupTpSlDeleteScope,\n type PlanGroupTpSlDeleteResult,\n type TpSlConditionalOrderType,\n} from \"@symmio/trading-core\";\nimport { useQueryClient } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useMemo, useRef, useState } 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 {\n awaitTpSlConfirmation,\n DEFAULT_TPSL_CONFIRMATION_TIMEOUT_MS,\n TPSL_CONFIRMATION_TIMEOUT_CODE,\n tpslConfirmationTimeoutError,\n} from \"./await-tpsl-confirmation\";\nimport { invalidateTpSlReads } from \"./invalidate-tpsl\";\nimport { runWithConcurrency } from \"./run-with-concurrency\";\nimport { isCancelSideSettled } from \"./settled-side\";\nimport { startTpSlFallbackPoll, type TpSlPollWaitingSide } from \"./tpsl-fallback-poll\";\nimport { useTpSlRecords, useTpSlStore } from \"./tpsl-store\";\nimport { dedupeAddresses, useWatchTpSlAccounts } from \"./use-watch-tpsl-accounts\";\n\n/**\n * Lifecycle of one cancel inside a grouped TP/SL delete run: `queued` →\n * `deleting` (request in flight) → `confirming` (handler returned 200) →\n * `done` (the WebSocket reported the order gone), or `failed`.\n */\nexport type DeleteQuoteGroupTpSlStepStatus = \"queued\" | \"deleting\" | \"confirming\" | \"done\" | \"failed\";\n\n/** Live state of one cancel. */\nexport interface DeleteQuoteGroupTpSlStep {\n /** Stable step identity, `\"<childKey>:<side>\"`. */\n id: string;\n /** Child identity (`GroupTpSlChild.key`). */\n key: string;\n /** On-chain quote id. */\n quoteId: bigint;\n /** Side being cancelled. */\n conditionalOrderType: TpSlConditionalOrderType;\n /** Handler-issued conditional-order id being cancelled. */\n cohQuoteId: string;\n /** Current stage. */\n status: DeleteQuoteGroupTpSlStepStatus;\n /** Normalized error, when `status` is `\"failed\"`. */\n error?: SymmioRequestError;\n}\n\n/** Overall lifecycle of a grouped TP/SL delete run. */\nexport type DeleteQuoteGroupTpSlStatus =\n | \"idle\"\n /** At least one cancel is in flight. */\n | \"deleting\"\n /** Every request settled; at least one cancel still awaits its handler report. */\n | \"confirming\"\n /** Every cancel is confirmed gone. */\n | \"success\"\n /** Some cancels were accepted, some failed. */\n | \"partial\"\n /** Every cancel failed. */\n | \"failed\";\n\n/** Inputs for one {@link UseDeleteQuoteGroupTpSlReturnType.deleteOrders} run. */\nexport interface DeleteQuoteGroupTpSlParameters {\n /** Children with their confirmed snapshots — from {@link useQuoteGroupTpSl}. */\n children: readonly GroupTpSlChild[];\n /** Which side(s) to cancel. Default `\"all\"`. */\n scope?: GroupTpSlDeleteScope;\n /**\n * SubAccount that owns the orders' Virtual Accounts. Pass it: the handler\n * publishes its reports on this account's stream, so without it a cancel is\n * only confirmed by the fallback sweep.\n */\n subAccount?: Address;\n /**\n * Accounts whose live streams confirm the cancels. Overrides the default,\n * which is `subAccount` plus every targeted order's Virtual Account.\n */\n notificationsAccounts?: readonly Address[];\n /**\n * Single-account form of {@link DeleteQuoteGroupTpSlParameters.notificationsAccounts}.\n *\n * @deprecated Pass `notificationsAccounts`. A grouped position can span\n * Virtual Accounts, so one address rarely covers the whole run.\n */\n notificationsAccount?: Address;\n /**\n * How long a cancel may wait for its report before the run refetches the\n * handler's rows and, failing that, gives up on it. Defaults to\n * {@link DEFAULT_TPSL_CONFIRMATION_TIMEOUT_MS}.\n */\n confirmationTimeoutMs?: number;\n /**\n * How long the WebSocket report gets on its own before the fallback sweep\n * starts, in milliseconds. Defaults to {@link TPSL_FALLBACK_POLL_DELAY_MS}.\n */\n fallbackPollDelayMs?: number;\n /**\n * Cadence of the fallback sweep once it has started, in milliseconds.\n * Defaults to {@link TPSL_FALLBACK_POLL_INTERVAL_MS}; `0` disables it.\n */\n fallbackPollIntervalMs?: number;\n /** Delegated session key to sign from, when delegation is active. */\n from?: Address;\n /**\n * How many cancels may be in flight at once. Default `4` — a cancel is a\n * short signed request with no price to confirm, so a bounded pool is a large\n * UX win over serializing. Set `1` when signing with a popup wallet.\n */\n concurrency?: number;\n /** Chain override; defaults to the connected chain. */\n chainId?: number;\n /** Restrict the run to these `\"<childKey>:<side>\"` step ids — the retry-failed-only path. */\n only?: readonly string[];\n}\n\n/**\n * Outcome of one delete run, reported once the handler has confirmed every\n * cancel gone — or the run has given up waiting for it.\n */\nexport interface DeleteQuoteGroupTpSlSummary {\n /** `true` when every planned cancel was accepted **and** confirmed gone. */\n ok: boolean;\n /** Cancels the handler accepted. */\n deletedCount: number;\n /** Cancels the handler's report confirmed gone. */\n confirmedCount: number;\n /** Cancels that failed. */\n failedCount: number;\n /** Per-step final states at resolve time. */\n steps: DeleteQuoteGroupTpSlStep[];\n /** The plan the run executed — inspect `skipped` for in-flight or local-only sides. */\n plan: PlanGroupTpSlDeleteResult;\n /** First error, when any cancel failed. */\n error?: SymmioRequestError;\n}\n\n/** Return type of {@link useDeleteQuoteGroupTpSl}. */\nexport interface UseDeleteQuoteGroupTpSlReturnType {\n /**\n * Plan and execute a grouped cancel. Resolves once the handler has reported\n * every order gone or the run gave up waiting (never rejects).\n */\n deleteOrders: (parameters: DeleteQuoteGroupTpSlParameters) => Promise<DeleteQuoteGroupTpSlSummary>;\n /** Re-run only the cancels that failed, against fresh children when supplied. Never rejects. */\n retryFailed: (children?: readonly GroupTpSlChild[]) => Promise<DeleteQuoteGroupTpSlSummary>;\n /** Clear the run state back to `idle`. No-op while a run is in flight. */\n reset: () => void;\n /** Overall run lifecycle. */\n status: DeleteQuoteGroupTpSlStatus;\n /** `true` while a cancel request is in flight. */\n isDeleting: boolean;\n /** `true` while every request has settled but some cancel still awaits its handler report. */\n isConfirming: boolean;\n /**\n * Step-weighted completion, `0`–`100` (2-decimal resolution). A cancel the\n * handler accepted but has not reported gone yet does **not** count.\n */\n progressPercent: number;\n /** Per-step states of the current/last run, in execution order. */\n steps: DeleteQuoteGroupTpSlStep[];\n /** The last run's plan. */\n plan?: PlanGroupTpSlDeleteResult;\n /** First error of the last run, when a cancel failed. */\n error?: SymmioRequestError;\n}\n\n/** Parameters for {@link useDeleteQuoteGroupTpSl}. */\nexport type UseDeleteQuoteGroupTpSlParameters = ConfigParameter;\n\ninterface RunState {\n status: DeleteQuoteGroupTpSlStatus;\n steps: DeleteQuoteGroupTpSlStep[];\n plan?: PlanGroupTpSlDeleteResult;\n error?: SymmioRequestError;\n}\n\nconst IDLE: RunState = { status: \"idle\", steps: [] };\n\n/** A plan that found nothing — returned when a run never got off the ground. */\nconst EMPTY_PLAN: PlanGroupTpSlDeleteResult = { targets: [], skipped: [], isNoop: true };\n\n/**\n * Cancel take-profit / stop-loss orders across a grouped position.\n *\n * `planGroupTpSlDelete` enumerates the cancellable orders first, reading each\n * `cohQuoteId` off the child's **confirmed** snapshot — never off an edit\n * buffer — and excluding sides that are still mid-flight. The cancels then run\n * through a bounded worker pool (4 at a time by default) with no\n * short-circuit: one rejection fails only its own step.\n *\n * A cancel goes `confirming` on a 200 and `done` when the WebSocket reports the\n * order gone.\n *\n * @param parameters - Optional config override.\n * @returns The run controls and its live per-step state.\n *\n * @example\n * ```tsx\n * const { deleteOrders, steps } = useDeleteQuoteGroupTpSl();\n * const summary = await deleteOrders({ children, scope: \"all\" });\n * ```\n */\nexport function useDeleteQuoteGroupTpSl(\n parameters: UseDeleteQuoteGroupTpSlParameters = {},\n): UseDeleteQuoteGroupTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const connectedChainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const [state, setState] = useState<RunState>(IDLE);\n const runRef = useRef<RunState>(IDLE);\n const inFlight = useRef(false);\n const lastRunRef = useRef<DeleteQuoteGroupTpSlParameters | undefined>(undefined);\n const [watchAccounts, setWatchAccounts] = useState<Address[]>([]);\n const watchChainIdRef = useRef<number | undefined>(undefined);\n\n const commit = useCallback((next: RunState) => {\n runRef.current = next;\n setState(next);\n }, []);\n\n /** Confirming steps' quote ids — the frames this run is listening for. */\n const confirmingIds = useMemo(\n () => Array.from(new Set(state.steps.filter((step) => step.status === \"confirming\").map((step) => step.quoteId))),\n [state.steps],\n );\n\n /**\n * Watch every Virtual Account the run touches. Frames land in the shared\n * store and resolution reads that store, so a cancel confirms no matter which\n * subscription delivered the `gone` frame.\n */\n useWatchTpSlAccounts({\n accounts: watchAccounts,\n ids: confirmingIds,\n chainId: watchChainIdRef.current,\n config: parameters.config,\n enabled: watchAccounts.length > 0 && confirmingIds.length > 0,\n });\n\n /** Reconcile confirming cancels against the store. Safe to call at any time. */\n const settle = useCallback(() => {\n const run = runRef.current;\n if (!run.steps.some((step) => step.status === \"confirming\")) return;\n const next = settleSteps(run.steps);\n if (next) commit({ ...run, steps: next, status: resolveStatus(next) });\n }, [commit]);\n\n // Keep the rendered state in step with the store while this hook is mounted.\n // The run's own waiter drives the same reconcile off its store subscription,\n // so a run still resolves after the component unmounts.\n const confirmingRecords = useTpSlRecords(confirmingIds);\n useEffect(() => {\n settle();\n }, [confirmingRecords, settle]);\n\n const run = useCallback(\n async (runParameters: DeleteQuoteGroupTpSlParameters): Promise<DeleteQuoteGroupTpSlSummary> => {\n if (inFlight.current) {\n return {\n ok: false,\n deletedCount: 0,\n confirmedCount: 0,\n failedCount: 0,\n steps: [],\n plan: EMPTY_PLAN,\n error: normalizeSymmError(new Error(\"A grouped TP/SL cancel is already in flight.\")),\n };\n }\n\n const chainId = runParameters.chainId ?? connectedChainId;\n const plan = planGroupTpSlDelete(runParameters.children, runParameters.scope);\n const allowed = runParameters.only === undefined ? undefined : new Set(runParameters.only);\n const targets = plan.targets.filter((target) => allowed === undefined || allowed.has(stepIdOf(target)));\n\n const steps: DeleteQuoteGroupTpSlStep[] = targets.map((target) => ({\n id: stepIdOf(target),\n key: target.key,\n quoteId: target.quoteId,\n conditionalOrderType: target.conditionalOrderType,\n cohQuoteId: target.cohQuoteId,\n status: \"queued\",\n }));\n /** Which Virtual Account each targeted order lives under. */\n const virtualAccountByQuoteId = new Map<bigint, Address>();\n for (const target of targets) virtualAccountByQuoteId.set(target.quoteId, target.virtualAccount);\n\n lastRunRef.current = runParameters;\n watchChainIdRef.current = chainId;\n setWatchAccounts(watchAccountsOf(runParameters, targets));\n commit({ status: targets.length > 0 ? \"deleting\" : \"success\", steps, plan });\n if (targets.length === 0) {\n return { ok: true, deletedCount: 0, confirmedCount: 0, failedCount: 0, steps, plan };\n }\n\n inFlight.current = true;\n const base = deleteQuoteTpSlMutationOptions(config);\n const markConfirming = useTpSlStore.getState().markConfirming;\n\n function patchStep(id: string, mutate: (step: DeleteQuoteGroupTpSlStep) => DeleteQuoteGroupTpSlStep): void {\n const current = runRef.current;\n const index = current.steps.findIndex((step) => step.id === id);\n if (index < 0) return;\n const next = [...current.steps];\n next[index] = mutate(next[index]!);\n commit({ ...current, steps: next, status: resolveStatus(next) });\n }\n\n const cancelOne = async (target: PlanGroupTpSlDeleteResult[\"targets\"][number]) => {\n const id = stepIdOf(target);\n patchStep(id, (step) => ({ ...step, status: \"deleting\" }));\n try {\n await base.mutationFn({\n quoteId: target.quoteId,\n virtualAccount: target.virtualAccount,\n cohQuoteId: target.cohQuoteId,\n conditionalOrderType: target.conditionalOrderType,\n from: runParameters.from,\n chainId,\n });\n markConfirming(target.quoteId, target.conditionalOrderType === \"take_profit\" ? \"tp\" : \"sl\", {\n intent: \"cancel\",\n });\n patchStep(id, (step) => ({ ...step, status: \"confirming\" }));\n } catch (err) {\n const error = normalizeSymmError(err);\n patchStep(id, (step) => ({ ...step, status: \"failed\", error }));\n }\n };\n\n /**\n * Stop waiting on the cancels the handler never reported. Their\n * store-side guard is dropped first, so the refetch that follows writes\n * the handler's real rows through.\n */\n function expirePending(): void {\n const store = useTpSlStore.getState();\n const expired: bigint[] = [];\n for (const step of runRef.current.steps) {\n if (step.status !== \"confirming\") continue;\n store.clearConfirming(step.quoteId, step.conditionalOrderType === \"take_profit\" ? \"tp\" : \"sl\");\n expired.push(step.quoteId);\n }\n if (expired.length === 0) return;\n const error = tpslConfirmationTimeoutError();\n const current = runRef.current;\n const next = current.steps.map((step) =>\n step.status === \"confirming\" ? { ...step, status: \"failed\" as const, error } : step,\n );\n commit({ ...current, steps: next, status: resolveStatus(next), error: current.error ?? error });\n void invalidateTpSlReads(queryClient, expired);\n }\n\n try {\n await runWithConcurrency(targets, runParameters.concurrency ?? 4, cancelOne);\n\n // Every request has been answered; now wait for the handler to report\n // each accepted cancel gone. Refetching is the fallback, not the\n // signal, so it fires only once a report is overdue.\n await awaitTpSlConfirmation({\n settle,\n hasPending: () => runRef.current.steps.some((step) => step.status === \"confirming\"),\n onTimeout: () =>\n void invalidateTpSlReads(\n queryClient,\n runRef.current.steps.filter((step) => step.status === \"confirming\").map((step) => step.quoteId),\n ),\n onExpire: expirePending,\n onWait: () =>\n startTpSlFallbackPoll(config, {\n chainId,\n delayMs: runParameters.fallbackPollDelayMs,\n intervalMs: runParameters.fallbackPollIntervalMs,\n getWaiting: () => waitingSidesOf(runRef.current.steps, virtualAccountByQuoteId),\n }).stop,\n timeoutMs: runParameters.confirmationTimeoutMs ?? DEFAULT_TPSL_CONFIRMATION_TIMEOUT_MS,\n });\n } finally {\n inFlight.current = false;\n }\n\n const finalSteps = runRef.current.steps;\n const failed = finalSteps.filter((step) => step.status === \"failed\");\n const confirmed = finalSteps.filter((step) => step.status === \"done\");\n /** Accepted but never reported gone — the handler took it, the confirmation never came. */\n const unconfirmed = failed.filter((step) => step.error?.code === TPSL_CONFIRMATION_TIMEOUT_CODE);\n commit({ ...runRef.current, status: resolveStatus(finalSteps), error: failed[0]?.error });\n\n // Reconcile against the handler's rows now that the run is over.\n void invalidateTpSlReads(\n queryClient,\n confirmed.map((step) => step.quoteId),\n );\n\n return {\n ok: failed.length === 0,\n deletedCount: confirmed.length + unconfirmed.length,\n confirmedCount: confirmed.length,\n failedCount: failed.length,\n steps: [...finalSteps],\n plan,\n error: failed[0]?.error,\n };\n },\n [commit, config, connectedChainId, queryClient, settle],\n );\n\n const retryFailed = useCallback(\n async (children?: readonly GroupTpSlChild[]): Promise<DeleteQuoteGroupTpSlSummary> => {\n const last = lastRunRef.current;\n const failedIds = runRef.current.steps.filter((step) => step.status === \"failed\").map((step) => step.id);\n if (!last || failedIds.length === 0) {\n return {\n ok: true,\n deletedCount: 0,\n confirmedCount: 0,\n failedCount: 0,\n steps: [...runRef.current.steps],\n plan: runRef.current.plan ?? EMPTY_PLAN,\n };\n }\n return run({ ...last, children: children ?? last.children, only: failedIds });\n },\n [run],\n );\n\n const reset = useCallback(() => {\n if (inFlight.current) return;\n watchChainIdRef.current = undefined;\n setWatchAccounts([]);\n lastRunRef.current = undefined;\n commit(IDLE);\n }, [commit]);\n\n const progressPercent = useMemo(() => {\n if (state.steps.length === 0) return 0;\n /** A cancel the handler accepted but has not reported gone is not progress yet. */\n const settled = state.steps.filter((step) => step.status === \"done\" || step.status === \"failed\").length;\n return Math.round((settled / state.steps.length) * 10_000) / 100;\n }, [state.steps]);\n\n return {\n deleteOrders: run,\n retryFailed,\n reset,\n status: state.status,\n isDeleting: state.status === \"deleting\",\n isConfirming: state.status === \"confirming\",\n progressPercent,\n steps: state.steps,\n plan: state.plan,\n error: state.error,\n };\n}\n\n/** Stable per-side step identity. */\nfunction stepIdOf(target: { key: string; conditionalOrderType: TpSlConditionalOrderType }): string {\n return `${target.key}:${target.conditionalOrderType}`;\n}\n\n/**\n * Reconcile confirming cancels against the shared store: a cancel is `done`\n * once the store shows that side gone.\n *\n * @param steps - The run's current steps.\n * @returns The updated list, or `undefined` when nothing moved.\n */\nfunction settleSteps(steps: DeleteQuoteGroupTpSlStep[]): DeleteQuoteGroupTpSlStep[] | undefined {\n const store = useTpSlStore.getState();\n let changed = false;\n const next = steps.map((step) => {\n if (step.status !== \"confirming\") return step;\n const record = store.get(step.quoteId);\n if (!record || !isCancelSideSettled(record, step.conditionalOrderType)) return step;\n changed = true;\n return { ...step, status: \"done\" as const };\n });\n return changed ? next : undefined;\n}\n\n/**\n * The cancels this run is still waiting on, in the shape the fallback sweep\n * needs. Each carries the `cohQuoteId` that must disappear — the sweep confirms\n * a cancel by that specific order going away, not by an empty result.\n */\nfunction waitingSidesOf(\n steps: readonly DeleteQuoteGroupTpSlStep[],\n accounts: ReadonlyMap<bigint, Address>,\n): TpSlPollWaitingSide[] {\n const waiting: TpSlPollWaitingSide[] = [];\n for (const step of steps) {\n if (step.status !== \"confirming\") continue;\n const account = accounts.get(step.quoteId);\n if (!account) continue;\n waiting.push({\n quoteId: step.quoteId,\n side: step.conditionalOrderType,\n intent: \"cancel\",\n cohQuoteId: step.cohQuoteId,\n account,\n });\n }\n return waiting;\n}\n\n/**\n * The accounts whose streams report on this run.\n *\n * The SubAccount first — that is the channel the handler publishes reports on,\n * regardless of which Virtual Account owns the order — then the targeted\n * orders' VAs, which cost one pooled subscription each and cover a deployment\n * that reports there instead.\n */\nfunction watchAccountsOf(\n parameters: DeleteQuoteGroupTpSlParameters,\n targets: PlanGroupTpSlDeleteResult[\"targets\"],\n): Address[] {\n if (parameters.notificationsAccounts) return dedupeAddresses(parameters.notificationsAccounts);\n return dedupeAddresses([\n parameters.notificationsAccount ?? parameters.subAccount,\n ...targets.map((target) => target.virtualAccount),\n ]);\n}\n\n/**\n * Derive the run status from the current step list. `confirming` outranks\n * `partial` so a failure elsewhere cannot make the status terminal while\n * another cancel still awaits its report.\n */\nfunction resolveStatus(steps: DeleteQuoteGroupTpSlStep[]): DeleteQuoteGroupTpSlStatus {\n if (steps.length === 0) return \"success\";\n if (steps.some((step) => step.status === \"queued\" || step.status === \"deleting\")) return \"deleting\";\n if (steps.some((step) => step.status === \"confirming\")) return \"confirming\";\n const failed = steps.filter((step) => step.status === \"failed\").length;\n if (failed === steps.length) return \"failed\";\n if (failed > 0) return \"partial\";\n return \"success\";\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyLA,IAAM,IAAiB;CAAE,QAAQ;CAAQ,OAAO,CAAC;AAAE,GAG7C,IAAwC;CAAE,SAAS,CAAC;CAAG,S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AM,EAAK;GACX,QAAQ;GACR,YAAY,EAAK;GACjB;EACF,CAAC;CACH;CACA,OAAO;AACT;AAUA,SAAS,EACP,GACA,GACW;CAEX,OADI,EAAW,wBAA8B,EAAgB,EAAW,qBAAqB,IACtF,EAAgB,CACrB,EAAW,wBAAwB,EAAW,YAC9C,GAAG,EAAQ,KAAK,MAAW,EAAO,cAAc,CAClD,CAAC;AACH;AAOA,SAAS,EAAc,GAA+D;CACpF,IAAI,EAAM,WAAW,GAAG,OAAO;CAC/B,IAAI,EAAM,MAAM,MAAS,EAAK,WAAW,YAAY,EAAK,WAAW,UAAU,GAAG,OAAO;CACzF,IAAI,EAAM,MAAM,MAAS,EAAK,WAAW,YAAY,GAAG,OAAO;CAC/D,IAAM,IAAS,EAAM,QAAQ,MAAS,EAAK,WAAW,QAAQ,EAAE;CAGhE,OAFI,MAAW,EAAM,SAAe,WAChC,IAAS,IAAU,YAChB;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-delete-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-delete-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAe,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,yBAAyB,EACzB,kBAAkB,EAClB,yBAAyB,CAC1B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CAoB9G"}
1
+ {"version":3,"file":"use-delete-quote-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-delete-quote-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAMzE,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,eAAe,CAAC;AAE3D,iDAAiD;AACjD,MAAM,MAAM,4BAA4B,GAAG,iBAAiB,CAC1D,yBAAyB,EACzB,kBAAkB,EAClB,yBAAyB,CAC1B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,GAAE,4BAAiC,GAAG,4BAA4B,CA4B9G"}
@@ -3,29 +3,30 @@ 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 { useTpSlStore as r } from "./tpsl-store.js";
6
- import { deleteQuoteTpSlMutationOptions as i } from "@symmio/trading-core";
7
- import { useMutation as a } from "@tanstack/react-query";
6
+ import { invalidateTpSlReads as i } from "./invalidate-tpsl.js";
7
+ import { deleteQuoteTpSlMutationOptions as a } from "@symmio/trading-core";
8
+ import { useMutation as o, useQueryClient as s } from "@tanstack/react-query";
8
9
  //#region src/tpsl/use-delete-quote-tpsl.ts
9
- function o(o = {}) {
10
- let s = t(o), c = e(), l = i(s), u = r((e) => e.markConfirming);
11
- return a({
12
- mutationKey: l.mutationKey,
10
+ function c(c = {}) {
11
+ let l = t(c), u = e(), d = s(), f = a(l), p = r((e) => e.markConfirming);
12
+ return o({
13
+ mutationKey: f.mutationKey,
13
14
  mutationFn: async (e) => {
14
15
  try {
15
- return await l.mutationFn({
16
+ return await f.mutationFn({
16
17
  ...e,
17
- chainId: e.chainId ?? c
18
+ chainId: e.chainId ?? u
18
19
  });
19
20
  } catch (e) {
20
21
  throw n(e);
21
22
  }
22
23
  },
23
24
  onSuccess: (e, t) => {
24
- t.conditionalOrderType === "take_profit" && u(t.quoteId, "tp"), t.conditionalOrderType === "stop_loss" && u(t.quoteId, "sl");
25
+ t.conditionalOrderType === "take_profit" && p(t.quoteId, "tp", { intent: "cancel" }), t.conditionalOrderType === "stop_loss" && p(t.quoteId, "sl", { intent: "cancel" }), i(d, [t.quoteId]);
25
26
  }
26
27
  });
27
28
  }
28
29
  //#endregion
29
- export { o as useDeleteQuoteTpSl };
30
+ export { c as useDeleteQuoteTpSl };
30
31
 
31
32
  //# sourceMappingURL=use-delete-quote-tpsl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-delete-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-delete-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deleteQuoteTpSlMutationOptions,\n type ConfigParameter,\n type DeleteQuoteTpSlParameters,\n type DeleteQuoteTpSlReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, type UseMutationResult } 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\";\nimport { useTpSlStore } from \"./tpsl-store\";\n\n/** Parameters for {@link useDeleteQuoteTpSl}. */\nexport type UseDeleteQuoteTpSlParameters = ConfigParameter;\n\n/** Return type of {@link useDeleteQuoteTpSl}. */\nexport type UseDeleteQuoteTpSlReturnType = UseMutationResult<\n DeleteQuoteTpSlReturnType,\n SymmioRequestError,\n DeleteQuoteTpSlParameters\n>;\n\n/**\n * Cancel a live TP or SL by its `cohQuoteId`. Signs an EIP-712 delete message\n * with the session-key wallet and calls `DELETE /api/v5/`. On 200 the target\n * side is marked `\"confirming\"` in the shared TP/SL store; the WS `cancel`\n * report flips it to `\"canceled\"` via `applyNotification`.\n */\nexport function useDeleteQuoteTpSl(parameters: UseDeleteQuoteTpSlParameters = {}): UseDeleteQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const base = deleteQuoteTpSlMutationOptions(config);\n const markConfirming = useTpSlStore((state) => state.markConfirming);\n\n return useMutation<DeleteQuoteTpSlReturnType, SymmioRequestError, DeleteQuoteTpSlParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n if (variables.conditionalOrderType === \"take_profit\") markConfirming(variables.quoteId, \"tp\");\n if (variables.conditionalOrderType === \"stop_loss\") markConfirming(variables.quoteId, \"sl\");\n },\n });\n}\n"],"mappings":";;;;;;;;AA+BA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAO,EAA+B,CAAM,GAC5C,IAAiB,GAAc,MAAU,EAAM,cAAc;CAEnE,OAAO,EAAsF;EAC3F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GAEjC,AADI,EAAU,yBAAyB,iBAAe,EAAe,EAAU,SAAS,IAAI,GACxF,EAAU,yBAAyB,eAAa,EAAe,EAAU,SAAS,IAAI;EAC5F;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"use-delete-quote-tpsl.js","names":[],"sources":["../../src/tpsl/use-delete-quote-tpsl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n deleteQuoteTpSlMutationOptions,\n type ConfigParameter,\n type DeleteQuoteTpSlParameters,\n type DeleteQuoteTpSlReturnType,\n} from \"@symmio/trading-core\";\nimport { useMutation, useQueryClient, type UseMutationResult } 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\";\nimport { invalidateTpSlReads } from \"./invalidate-tpsl\";\nimport { useTpSlStore } from \"./tpsl-store\";\n\n/** Parameters for {@link useDeleteQuoteTpSl}. */\nexport type UseDeleteQuoteTpSlParameters = ConfigParameter;\n\n/** Return type of {@link useDeleteQuoteTpSl}. */\nexport type UseDeleteQuoteTpSlReturnType = UseMutationResult<\n DeleteQuoteTpSlReturnType,\n SymmioRequestError,\n DeleteQuoteTpSlParameters\n>;\n\n/**\n * Cancel a live TP or SL by its `cohQuoteId`. Signs an EIP-712 delete message\n * with the session-key wallet and calls `DELETE /api/v5/`. On 200 the target\n * side is marked `\"confirming\"` in the shared TP/SL store; the WS `cancel`\n * report flips it to `\"canceled\"` via `applyNotification`.\n */\nexport function useDeleteQuoteTpSl(parameters: UseDeleteQuoteTpSlParameters = {}): UseDeleteQuoteTpSlReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = deleteQuoteTpSlMutationOptions(config);\n const markConfirming = useTpSlStore((state) => state.markConfirming);\n\n return useMutation<DeleteQuoteTpSlReturnType, SymmioRequestError, DeleteQuoteTpSlParameters>({\n mutationKey: base.mutationKey,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n onSuccess: (_result, variables) => {\n // `intent: \"cancel\"` — this side is waiting to disappear, so an empty\n // refetch confirms it instead of being held off as a pending write.\n if (variables.conditionalOrderType === \"take_profit\") {\n markConfirming(variables.quoteId, \"tp\", { intent: \"cancel\" });\n }\n if (variables.conditionalOrderType === \"stop_loss\") {\n markConfirming(variables.quoteId, \"sl\", { intent: \"cancel\" });\n }\n void invalidateTpSlReads(queryClient, [variables.quoteId]);\n },\n });\n}\n"],"mappings":";;;;;;;;;AAgCA,SAAgB,EAAmB,IAA2C,CAAC,GAAiC;CAC9G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA+B,CAAM,GAC5C,IAAiB,GAAc,MAAU,EAAM,cAAc;CAEnE,OAAO,EAAsF;EAC3F,aAAa,EAAK;EAClB,YAAY,OAAO,MAAc;GAC/B,IAAI;IACF,OAAO,MAAM,EAAK,WAAW;KAAE,GAAG;KAAW,SAAS,EAAU,WAAW;IAAQ,CAAC;GACtF,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;EACA,YAAY,GAAS,MAAc;GASjC,AANI,EAAU,yBAAyB,iBACrC,EAAe,EAAU,SAAS,MAAM,EAAE,QAAQ,SAAS,CAAC,GAE1D,EAAU,yBAAyB,eACrC,EAAe,EAAU,SAAS,MAAM,EAAE,QAAQ,SAAS,CAAC,GAE9D,EAAyB,GAAa,CAAC,EAAU,OAAO,CAAC;EAC3D;CACF,CAAC;AACH"}
@@ -0,0 +1,66 @@
1
+ import { GroupTpSlChild, GroupTpSlDesiredMap, GroupTpSlDesiredSide, GroupTpSlReturnEstimate, GroupTpSlSideKey, PlanGroupTpSlResult, TpSlConfig, TpSlPriceType, TpSlValidation } from '@symmio/trading-core';
2
+ /** Parameters for {@link useQuoteGroupTpSlEditor}. */
3
+ export interface UseQuoteGroupTpSlEditorParameters {
4
+ /** Children with their confirmed snapshots — from {@link useQuoteGroupTpSl}. */
5
+ children: readonly GroupTpSlChild[];
6
+ /** Market price precision. Trigger prices are rounded to it before diffing. */
7
+ pricePrecision: number;
8
+ /** Reference price for validation (decimal string) — pass the live mark price. */
9
+ referencePrice?: string;
10
+ /** Live handler `/configs/` rules. Validation only runs when this and `referencePrice` are set. */
11
+ config?: TpSlConfig;
12
+ }
13
+ /** Return type of {@link useQuoteGroupTpSlEditor}. */
14
+ export interface UseQuoteGroupTpSlEditorReturnType {
15
+ /** The current edit buffer — hand this straight to {@link useSetQuoteGroupTpSl}. */
16
+ desired: GroupTpSlDesiredMap;
17
+ /** Set (or clear, with an empty trigger price) one side of one child. */
18
+ setChildSide: (key: string, side: GroupTpSlSideKey, value: GroupTpSlDesiredSide | undefined) => void;
19
+ /** Write one trigger price across **every** child — the "apply to entire position" control. */
20
+ applyToAll: (side: GroupTpSlSideKey, triggerPrice: string, priceType?: TpSlPriceType) => void;
21
+ /** Clear one side across every child (queues deletes for the live orders). */
22
+ clearSide: (side: GroupTpSlSideKey) => void;
23
+ /** Drop every pending edit and fall back to the confirmed snapshots. */
24
+ reset: () => void;
25
+ /** The live plan for the current buffer — what a submit would actually do. */
26
+ plan: PlanGroupTpSlResult;
27
+ /** Per-child validation failures, keyed by child key. Empty when everything passes. */
28
+ errors: Record<string, TpSlValidation>;
29
+ /** `true` when at least one child has an edit staged. */
30
+ isDirty: boolean;
31
+ /** `true` when the plan would write or cancel nothing. */
32
+ isNoop: boolean;
33
+ /** `true` when any child failed validation — gate the submit on this. */
34
+ hasInvalid: boolean;
35
+ /** Estimated group return per side at the currently staged triggers. */
36
+ estimate: {
37
+ takeProfit: GroupTpSlReturnEstimate;
38
+ stopLoss: GroupTpSlReturnEstimate;
39
+ };
40
+ }
41
+ /**
42
+ * Own the edit buffer behind a grouped TP/SL editor.
43
+ *
44
+ * The buffer is a `GroupTpSlDesiredMap` layered over the confirmed snapshots:
45
+ * an entry wins over the handler's value, and an entry with an empty
46
+ * `triggerPrice` clears that side. Every derived value — the live plan, the
47
+ * per-child validation errors, the estimated return — is recomputed from
48
+ * `@symmio/trading-core`'s pure helpers, so this hook holds state and nothing
49
+ * else.
50
+ *
51
+ * Note that `applyToAll` writes the value to every child including ones the
52
+ * planner will later skip (unanchored, closed): the plan is the authority on
53
+ * what gets submitted, not the buffer.
54
+ *
55
+ * @param parameters - Children, price precision, and optional validation inputs.
56
+ * @returns The buffer, its mutators, and everything derived from it.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * const editor = useQuoteGroupTpSlEditor({ children, pricePrecision, referencePrice: markPrice, config });
61
+ * editor.applyToAll("tp", "150");
62
+ * if (!editor.hasInvalid) await set({ children, desired: editor.desired, subAccount, pricePrecision });
63
+ * ```
64
+ */
65
+ export declare function useQuoteGroupTpSlEditor(parameters: UseQuoteGroupTpSlEditorParameters): UseQuoteGroupTpSlEditorReturnType;
66
+ //# sourceMappingURL=use-quote-group-tpsl-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-group-tpsl-editor.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-quote-group-tpsl-editor.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAG9B,sDAAsD;AACtD,MAAM,WAAW,iCAAiC;IAChD,gFAAgF;IAChF,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IACpC,+EAA+E;IAC/E,cAAc,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mGAAmG;IACnG,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,sDAAsD;AACtD,MAAM,WAAW,iCAAiC;IAChD,oFAAoF;IACpF,OAAO,EAAE,mBAAmB,CAAC;IAC7B,yEAAyE;IACzE,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,oBAAoB,GAAG,SAAS,KAAK,IAAI,CAAC;IACrG,+FAA+F;IAC/F,UAAU,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9F,8EAA8E;IAC9E,SAAS,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5C,wEAAwE;IACxE,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,8EAA8E;IAC9E,IAAI,EAAE,mBAAmB,CAAC;IAC1B,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACvC,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,MAAM,EAAE,OAAO,CAAC;IAChB,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAC;IACpB,wEAAwE;IACxE,QAAQ,EAAE;QAAE,UAAU,EAAE,uBAAuB,CAAC;QAAC,QAAQ,EAAE,uBAAuB,CAAA;KAAE,CAAC;CACtF;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,iCAAiC,GAC5C,iCAAiC,CA0EnC"}
@@ -0,0 +1,78 @@
1
+ "use client";
2
+ import { estimateGroupTpSlReturn as e, planGroupTpSl as t } from "@symmio/trading-core";
3
+ import { useCallback as n, useMemo as r, useState as i } from "react";
4
+ //#region src/tpsl/use-quote-group-tpsl-editor.ts
5
+ function a(a) {
6
+ let { children: o, pricePrecision: s, referencePrice: c, config: l } = a, [u, d] = i({}), f = n((e, t, n) => {
7
+ d((r) => {
8
+ let i = {
9
+ ...r[e],
10
+ [t]: n
11
+ };
12
+ if (i.tp === void 0 && i.sl === void 0) {
13
+ let t = { ...r };
14
+ return delete t[e], t;
15
+ }
16
+ return {
17
+ ...r,
18
+ [e]: i
19
+ };
20
+ });
21
+ }, []), p = n((e, t, n) => {
22
+ d((r) => {
23
+ let i = { ...r };
24
+ for (let r of o) i[r.key] = {
25
+ ...i[r.key],
26
+ [e]: {
27
+ triggerPrice: t,
28
+ priceType: n
29
+ }
30
+ };
31
+ return i;
32
+ });
33
+ }, [o]), m = n((e) => {
34
+ p(e, "");
35
+ }, [p]), h = n(() => d({}), []), g = r(() => t({
36
+ children: o,
37
+ desired: u,
38
+ pricePrecision: s,
39
+ referencePrice: c,
40
+ config: l
41
+ }), [
42
+ o,
43
+ u,
44
+ s,
45
+ c,
46
+ l
47
+ ]), _ = r(() => {
48
+ let e = {};
49
+ for (let t of g.skips) t.reason === "invalid" && t.validation && (e[t.key] = t.validation);
50
+ return e;
51
+ }, [g]), v = r(() => ({
52
+ takeProfit: e(o, {
53
+ conditionalOrderType: "take_profit",
54
+ overrides: u
55
+ }),
56
+ stopLoss: e(o, {
57
+ conditionalOrderType: "stop_loss",
58
+ overrides: u
59
+ })
60
+ }), [o, u]);
61
+ return {
62
+ desired: u,
63
+ setChildSide: f,
64
+ applyToAll: p,
65
+ clearSide: m,
66
+ reset: h,
67
+ plan: g,
68
+ errors: _,
69
+ isDirty: Object.keys(u).length > 0,
70
+ isNoop: g.isNoop,
71
+ hasInvalid: g.hasInvalid,
72
+ estimate: v
73
+ };
74
+ }
75
+ //#endregion
76
+ export { a as useQuoteGroupTpSlEditor };
77
+
78
+ //# sourceMappingURL=use-quote-group-tpsl-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-group-tpsl-editor.js","names":[],"sources":["../../src/tpsl/use-quote-group-tpsl-editor.ts"],"sourcesContent":["\"use client\";\n\nimport {\n estimateGroupTpSlReturn,\n planGroupTpSl,\n type GroupTpSlChild,\n type GroupTpSlDesiredMap,\n type GroupTpSlDesiredSide,\n type GroupTpSlReturnEstimate,\n type GroupTpSlSideKey,\n type PlanGroupTpSlResult,\n type TpSlConfig,\n type TpSlPriceType,\n type TpSlValidation,\n} from \"@symmio/trading-core\";\nimport { useCallback, useMemo, useState } from \"react\";\n\n/** Parameters for {@link useQuoteGroupTpSlEditor}. */\nexport interface UseQuoteGroupTpSlEditorParameters {\n /** Children with their confirmed snapshots — from {@link useQuoteGroupTpSl}. */\n children: readonly GroupTpSlChild[];\n /** Market price precision. Trigger prices are rounded to it before diffing. */\n pricePrecision: number;\n /** Reference price for validation (decimal string) — pass the live mark price. */\n referencePrice?: string;\n /** Live handler `/configs/` rules. Validation only runs when this and `referencePrice` are set. */\n config?: TpSlConfig;\n}\n\n/** Return type of {@link useQuoteGroupTpSlEditor}. */\nexport interface UseQuoteGroupTpSlEditorReturnType {\n /** The current edit buffer — hand this straight to {@link useSetQuoteGroupTpSl}. */\n desired: GroupTpSlDesiredMap;\n /** Set (or clear, with an empty trigger price) one side of one child. */\n setChildSide: (key: string, side: GroupTpSlSideKey, value: GroupTpSlDesiredSide | undefined) => void;\n /** Write one trigger price across **every** child — the \"apply to entire position\" control. */\n applyToAll: (side: GroupTpSlSideKey, triggerPrice: string, priceType?: TpSlPriceType) => void;\n /** Clear one side across every child (queues deletes for the live orders). */\n clearSide: (side: GroupTpSlSideKey) => void;\n /** Drop every pending edit and fall back to the confirmed snapshots. */\n reset: () => void;\n /** The live plan for the current buffer — what a submit would actually do. */\n plan: PlanGroupTpSlResult;\n /** Per-child validation failures, keyed by child key. Empty when everything passes. */\n errors: Record<string, TpSlValidation>;\n /** `true` when at least one child has an edit staged. */\n isDirty: boolean;\n /** `true` when the plan would write or cancel nothing. */\n isNoop: boolean;\n /** `true` when any child failed validation — gate the submit on this. */\n hasInvalid: boolean;\n /** Estimated group return per side at the currently staged triggers. */\n estimate: { takeProfit: GroupTpSlReturnEstimate; stopLoss: GroupTpSlReturnEstimate };\n}\n\n/**\n * Own the edit buffer behind a grouped TP/SL editor.\n *\n * The buffer is a `GroupTpSlDesiredMap` layered over the confirmed snapshots:\n * an entry wins over the handler's value, and an entry with an empty\n * `triggerPrice` clears that side. Every derived value — the live plan, the\n * per-child validation errors, the estimated return — is recomputed from\n * `@symmio/trading-core`'s pure helpers, so this hook holds state and nothing\n * else.\n *\n * Note that `applyToAll` writes the value to every child including ones the\n * planner will later skip (unanchored, closed): the plan is the authority on\n * what gets submitted, not the buffer.\n *\n * @param parameters - Children, price precision, and optional validation inputs.\n * @returns The buffer, its mutators, and everything derived from it.\n *\n * @example\n * ```tsx\n * const editor = useQuoteGroupTpSlEditor({ children, pricePrecision, referencePrice: markPrice, config });\n * editor.applyToAll(\"tp\", \"150\");\n * if (!editor.hasInvalid) await set({ children, desired: editor.desired, subAccount, pricePrecision });\n * ```\n */\nexport function useQuoteGroupTpSlEditor(\n parameters: UseQuoteGroupTpSlEditorParameters,\n): UseQuoteGroupTpSlEditorReturnType {\n const { children, pricePrecision, referencePrice, config } = parameters;\n const [desired, setDesired] = useState<GroupTpSlDesiredMap>({});\n\n const setChildSide = useCallback((key: string, side: GroupTpSlSideKey, value: GroupTpSlDesiredSide | undefined) => {\n setDesired((previous) => {\n const entry = { ...previous[key], [side]: value };\n // An entry with neither side is indistinguishable from no entry, and a\n // stale empty object would keep `isDirty` true forever.\n if (entry.tp === undefined && entry.sl === undefined) {\n const rest = { ...previous };\n delete rest[key];\n return rest;\n }\n return { ...previous, [key]: entry };\n });\n }, []);\n\n const applyToAll = useCallback(\n (side: GroupTpSlSideKey, triggerPrice: string, priceType?: TpSlPriceType) => {\n setDesired((previous) => {\n const next: Record<string, GroupTpSlDesiredMap[string]> = { ...previous };\n for (const child of children) {\n next[child.key] = { ...next[child.key], [side]: { triggerPrice, priceType } };\n }\n return next;\n });\n },\n [children],\n );\n\n const clearSide = useCallback(\n (side: GroupTpSlSideKey) => {\n applyToAll(side, \"\");\n },\n [applyToAll],\n );\n\n const reset = useCallback(() => setDesired({}), []);\n\n const plan = useMemo(\n () => planGroupTpSl({ children, desired, pricePrecision, referencePrice, config }),\n [children, desired, pricePrecision, referencePrice, config],\n );\n\n const errors = useMemo(() => {\n const map: Record<string, TpSlValidation> = {};\n for (const skip of plan.skips) {\n if (skip.reason === \"invalid\" && skip.validation) map[skip.key] = skip.validation;\n }\n return map;\n }, [plan]);\n\n const estimate = useMemo(\n () => ({\n takeProfit: estimateGroupTpSlReturn(children, { conditionalOrderType: \"take_profit\", overrides: desired }),\n stopLoss: estimateGroupTpSlReturn(children, { conditionalOrderType: \"stop_loss\", overrides: desired }),\n }),\n [children, desired],\n );\n\n return {\n desired,\n setChildSide,\n applyToAll,\n clearSide,\n reset,\n plan,\n errors,\n isDirty: Object.keys(desired).length > 0,\n isNoop: plan.isNoop,\n hasInvalid: plan.hasInvalid,\n estimate,\n };\n}\n"],"mappings":";;;;AA+EA,SAAgB,EACd,GACmC;CACnC,IAAM,EAAE,aAAU,mBAAgB,mBAAgB,cAAW,GACvD,CAAC,GAAS,KAAc,EAA8B,CAAC,CAAC,GAExD,IAAe,GAAa,GAAa,GAAwB,MAA4C;EACjH,GAAY,MAAa;GACvB,IAAM,IAAQ;IAAE,GAAG,EAAS;KAAO,IAAO;GAAM;GAGhD,IAAI,EAAM,OAAO,KAAA,KAAa,EAAM,OAAO,KAAA,GAAW;IACpD,IAAM,IAAO,EAAE,GAAG,EAAS;IAE3B,OADA,OAAO,EAAK,IACL;GACT;GACA,OAAO;IAAE,GAAG;KAAW,IAAM;GAAM;EACrC,CAAC;CACH,GAAG,CAAC,CAAC,GAEC,IAAa,GAChB,GAAwB,GAAsB,MAA8B;EAC3E,GAAY,MAAa;GACvB,IAAM,IAAoD,EAAE,GAAG,EAAS;GACxE,KAAK,IAAM,KAAS,GAClB,EAAK,EAAM,OAAO;IAAE,GAAG,EAAK,EAAM;KAAO,IAAO;KAAE;KAAc;IAAU;GAAE;GAE9E,OAAO;EACT,CAAC;CACH,GACA,CAAC,CAAQ,CACX,GAEM,IAAY,GACf,MAA2B;EAC1B,EAAW,GAAM,EAAE;CACrB,GACA,CAAC,CAAU,CACb,GAEM,IAAQ,QAAkB,EAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAE5C,IAAO,QACL,EAAc;EAAE;EAAU;EAAS;EAAgB;EAAgB;CAAO,CAAC,GACjF;EAAC;EAAU;EAAS;EAAgB;EAAgB;CAAM,CAC5D,GAEM,IAAS,QAAc;EAC3B,IAAM,IAAsC,CAAC;EAC7C,KAAK,IAAM,KAAQ,EAAK,OACtB,AAAI,EAAK,WAAW,aAAa,EAAK,eAAY,EAAI,EAAK,OAAO,EAAK;EAEzE,OAAO;CACT,GAAG,CAAC,CAAI,CAAC,GAEH,IAAW,SACR;EACL,YAAY,EAAwB,GAAU;GAAE,sBAAsB;GAAe,WAAW;EAAQ,CAAC;EACzG,UAAU,EAAwB,GAAU;GAAE,sBAAsB;GAAa,WAAW;EAAQ,CAAC;CACvG,IACA,CAAC,GAAU,CAAO,CACpB;CAEA,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA,SAAS,OAAO,KAAK,CAAO,EAAE,SAAS;EACvC,QAAQ,EAAK;EACb,YAAY,EAAK;EACjB;CACF;AACF"}
@@ -0,0 +1,74 @@
1
+ import { ConfigParameter, GetQuoteTpSlOptions, GroupTpSlChild, GroupTpSlDesiredMap, GroupTpSlOrder, QuoteGroupTpSlSummary, UnifiedQuote } from '@symmio/trading-core';
2
+ import { Address } from 'viem';
3
+ import { SymmioRequestError } from '../errors/symmio-request-error.js';
4
+ /** Parameters for {@link useQuoteGroupTpSl}. */
5
+ export interface UseQuoteGroupTpSlParameters extends ConfigParameter {
6
+ /** The grouped position's child quotes — pass `group.quotes`. */
7
+ quotes: readonly UnifiedQuote[];
8
+ /**
9
+ * SubAccount that owns the children's Virtual Accounts.
10
+ *
11
+ * Pass it. The handler publishes TP/SL reports on the **subscribing account's**
12
+ * stream, not on the VA that owns the order — a report's `address` is the same
13
+ * for two quotes under different VAs. Without it this hook only hears the VA
14
+ * channels, and a live update arrives whenever the next REST read happens to run.
15
+ */
16
+ subAccount?: Address;
17
+ /**
18
+ * Accounts whose TP/SL streams report on these children. Overrides the
19
+ * default, which is `subAccount` plus the deduped `vaAddress ?? partyA`
20
+ * across `quotes` — a grouped position can span Virtual Accounts, since the
21
+ * VA is not part of the group key.
22
+ */
23
+ accounts?: readonly Address[];
24
+ /** Pending per-child edits that win over the confirmed snapshot. */
25
+ overrides?: GroupTpSlDesiredMap;
26
+ /** Subscribe to the TP/SL WebSocket. Default `true`. */
27
+ live?: boolean;
28
+ /** Master switch. When `false` every child query is idle. Default `true`. */
29
+ enabled?: boolean;
30
+ /** Chain override; defaults to the connected chain. */
31
+ chainId?: number;
32
+ /** Query overrides forwarded to every child fetch. */
33
+ query?: GetQuoteTpSlOptions["query"];
34
+ }
35
+ /** Return type of {@link useQuoteGroupTpSl}. */
36
+ export interface UseQuoteGroupTpSlReturnType {
37
+ /** Children with their confirmed snapshots, in input order — the input to every core helper. */
38
+ children: GroupTpSlChild[];
39
+ /** Folded cell/modal state: counts, uniform-vs-mixed, notional coverage. */
40
+ summary: QuoteGroupTpSlSummary;
41
+ /** One row per live-or-desired TP/SL order, for an overview list. */
42
+ orders: GroupTpSlOrder[];
43
+ /** `true` while any child's first fetch is in flight. */
44
+ isLoading: boolean;
45
+ /** `true` while any child query is fetching, including background refetches. */
46
+ isFetching: boolean;
47
+ /** First normalized error across the fan-out, or `null`. */
48
+ error: SymmioRequestError | null;
49
+ /** Refetch every child. Resolves when all settle. */
50
+ refetch: () => Promise<void>;
51
+ }
52
+ /**
53
+ * Read the folded TP/SL state of a grouped position.
54
+ *
55
+ * One TanStack query per child — keyed with the shared `getQuoteTpSlQueryKey`,
56
+ * so a row that also renders the per-quote `useQuoteTpSl` issues **one** request
57
+ * per quote rather than two — all writing into the same module-level TP/SL
58
+ * store, plus one WebSocket subscription per **distinct account** rather than
59
+ * one per child. Everything above the store is `@symmio/trading-core`'s pure
60
+ * `summarizeQuoteGroupTpSl` / `toGroupTpSlOrders`.
61
+ *
62
+ * @param parameters - The group's quotes plus optional accounts, edits and query overrides.
63
+ * @returns Children, the folded summary, the order rows, and the load surface.
64
+ *
65
+ * @example
66
+ * ```tsx
67
+ * const { summary, children } = useQuoteGroupTpSl({ quotes: group.quotes });
68
+ * if (summary.isEmpty) return <span>Not set</span>;
69
+ * if (summary.takeProfit.display === "uniform") return <span>{summary.takeProfit.price}</span>;
70
+ * return <span>{summary.takeProfit.count} TP</span>;
71
+ * ```
72
+ */
73
+ export declare function useQuoteGroupTpSl(parameters: UseQuoteGroupTpSlParameters): UseQuoteGroupTpSlReturnType;
74
+ //# sourceMappingURL=use-quote-group-tpsl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-quote-group-tpsl.d.ts","sourceRoot":"","sources":["../../src/tpsl/use-quote-group-tpsl.ts"],"names":[],"mappings":"AAEA,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,qBAAqB,EAE1B,KAAK,YAAY,EAClB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAMzE,gDAAgD;AAChD,MAAM,WAAW,2BAA4B,SAAQ,eAAe;IAClE,iEAAiE;IACjE,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IAC9B,oEAAoE;IACpE,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,wDAAwD;IACxD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sDAAsD;IACtD,KAAK,CAAC,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CACtC;AAED,gDAAgD;AAChD,MAAM,WAAW,2BAA2B;IAC1C,g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