@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.
- package/dist/account-layer/index.d.ts +1 -0
- package/dist/account-layer/index.d.ts.map +1 -1
- package/dist/account-layer/index.js +26 -25
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts +53 -0
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts.map +1 -0
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.js +49 -0
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.js.map +1 -0
- package/dist/account-layer/use-deposit-and-allocate.d.ts +4 -2
- package/dist/account-layer/use-deposit-and-allocate.d.ts.map +1 -1
- package/dist/account-layer/use-deposit-and-allocate.js +17 -15
- package/dist/account-layer/use-deposit-and-allocate.js.map +1 -1
- package/dist/account-layer/use-edit-account-name.d.ts.map +1 -1
- package/dist/account-layer/use-edit-account-name.js +14 -14
- package/dist/account-layer/use-edit-account-name.js.map +1 -1
- package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.d.ts +1 -1
- package/dist/account-layer/use-virtual-accounts-addresses-of-sub-account.js.map +1 -1
- package/dist/candles/index.d.ts +5 -0
- package/dist/candles/index.d.ts.map +1 -0
- package/dist/candles/index.js +5 -0
- package/dist/candles/use-binance-candle-source.d.ts +27 -0
- package/dist/candles/use-binance-candle-source.d.ts.map +1 -0
- package/dist/candles/use-binance-candle-source.js +24 -0
- package/dist/candles/use-binance-candle-source.js.map +1 -0
- package/dist/candles/use-candle-stream.d.ts +65 -0
- package/dist/candles/use-candle-stream.d.ts.map +1 -0
- package/dist/candles/use-candle-stream.js +44 -0
- package/dist/candles/use-candle-stream.js.map +1 -0
- package/dist/candles/use-candles.d.ts +40 -0
- package/dist/candles/use-candles.d.ts.map +1 -0
- package/dist/candles/use-candles.js +22 -0
- package/dist/candles/use-candles.js.map +1 -0
- package/dist/candles/use-tradingview-datafeed.d.ts +31 -0
- package/dist/candles/use-tradingview-datafeed.d.ts.map +1 -0
- package/dist/candles/use-tradingview-datafeed.js +21 -0
- package/dist/candles/use-tradingview-datafeed.js.map +1 -0
- package/dist/index.d.ts +125 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +201 -113
- package/dist/instant-layer/index.d.ts +4 -0
- package/dist/instant-layer/index.d.ts.map +1 -1
- package/dist/instant-layer/index.js +10 -6
- package/dist/instant-layer/use-instant-close-auto.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-close-auto.js +12 -11
- package/dist/instant-layer/use-instant-close-auto.js.map +1 -1
- package/dist/instant-layer/use-instant-close-bulk-auto.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-close-bulk-auto.js +12 -11
- package/dist/instant-layer/use-instant-close-bulk-auto.js.map +1 -1
- package/dist/instant-layer/use-instant-close-bulk.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-close-bulk.js +12 -11
- package/dist/instant-layer/use-instant-close-bulk.js.map +1 -1
- package/dist/instant-layer/use-instant-close.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-close.js +12 -11
- package/dist/instant-layer/use-instant-close.js.map +1 -1
- package/dist/instant-layer/use-instant-open-auto.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-open-auto.js +12 -11
- package/dist/instant-layer/use-instant-open-auto.js.map +1 -1
- package/dist/instant-layer/use-instant-open-fees.d.ts +43 -0
- package/dist/instant-layer/use-instant-open-fees.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-open-fees.js +111 -0
- package/dist/instant-layer/use-instant-open-fees.js.map +1 -0
- package/dist/instant-layer/use-instant-open-with-tpsl.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-open-with-tpsl.js +34 -31
- package/dist/instant-layer/use-instant-open-with-tpsl.js.map +1 -1
- package/dist/instant-layer/use-instant-open.d.ts +23 -18
- package/dist/instant-layer/use-instant-open.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-open.js +12 -11
- package/dist/instant-layer/use-instant-open.js.map +1 -1
- package/dist/instant-layer/use-instant-opens.d.ts +6 -6
- package/dist/instant-layer/use-instant-opens.d.ts.map +1 -1
- package/dist/instant-layer/use-instant-opens.js.map +1 -1
- package/dist/instant-layer/use-instant-trade-required-selectors.d.ts +25 -0
- package/dist/instant-layer/use-instant-trade-required-selectors.d.ts.map +1 -0
- package/dist/instant-layer/use-instant-trade-required-selectors.js +13 -0
- package/dist/instant-layer/use-instant-trade-required-selectors.js.map +1 -0
- package/dist/instant-layer/use-limit-close-auto.d.ts +30 -0
- package/dist/instant-layer/use-limit-close-auto.d.ts.map +1 -0
- package/dist/instant-layer/use-limit-close-auto.js +33 -0
- package/dist/instant-layer/use-limit-close-auto.js.map +1 -0
- package/dist/instant-layer/use-limit-open-auto.d.ts +30 -0
- package/dist/instant-layer/use-limit-open-auto.d.ts.map +1 -0
- package/dist/instant-layer/use-limit-open-auto.js +33 -0
- package/dist/instant-layer/use-limit-open-auto.js.map +1 -0
- package/dist/inventory/index.d.ts +3 -0
- package/dist/inventory/index.d.ts.map +1 -0
- package/dist/inventory/index.js +3 -0
- package/dist/inventory/use-inventory-tvl-history.d.ts +27 -0
- package/dist/inventory/use-inventory-tvl-history.d.ts.map +1 -0
- package/dist/inventory/use-inventory-tvl-history.js +28 -0
- package/dist/inventory/use-inventory-tvl-history.js.map +1 -0
- package/dist/inventory/use-inventory-tvl.d.ts +23 -0
- package/dist/inventory/use-inventory-tvl.d.ts.map +1 -0
- package/dist/inventory/use-inventory-tvl.js +27 -0
- package/dist/inventory/use-inventory-tvl.js.map +1 -0
- package/dist/margin/index.d.ts +1 -0
- package/dist/margin/index.d.ts.map +1 -1
- package/dist/margin/use-account-margin-risk.d.ts +68 -0
- package/dist/margin/use-account-margin-risk.d.ts.map +1 -0
- package/dist/margin/use-account-margin-risk.js +31 -0
- package/dist/margin/use-account-margin-risk.js.map +1 -0
- package/dist/margin/use-available-instant-open-margin.d.ts +27 -7
- package/dist/margin/use-available-instant-open-margin.d.ts.map +1 -1
- package/dist/margin/use-available-instant-open-margin.js +117 -46
- package/dist/margin/use-available-instant-open-margin.js.map +1 -1
- package/dist/market-info/use-market-info.d.ts +13 -13
- package/dist/market-info/use-market-info.d.ts.map +1 -1
- package/dist/market-info/use-market-info.js.map +1 -1
- package/dist/markets/use-markets.d.ts +14 -8
- package/dist/markets/use-markets.d.ts.map +1 -1
- package/dist/markets/use-markets.js.map +1 -1
- package/dist/muon/index.d.ts +2 -0
- package/dist/muon/index.d.ts.map +1 -1
- package/dist/muon/use-force-close-price-sig.d.ts +34 -0
- package/dist/muon/use-force-close-price-sig.d.ts.map +1 -0
- package/dist/muon/use-force-close-price-sig.js +31 -0
- package/dist/muon/use-force-close-price-sig.js.map +1 -0
- package/dist/muon/use-send-quote-upnl-sig.d.ts +30 -0
- package/dist/muon/use-send-quote-upnl-sig.d.ts.map +1 -0
- package/dist/muon/use-send-quote-upnl-sig.js +28 -0
- package/dist/muon/use-send-quote-upnl-sig.js.map +1 -0
- package/dist/notifications/use-search-notifications.d.ts +12 -12
- package/dist/notifications/use-search-notifications.d.ts.map +1 -1
- package/dist/notifications/use-search-notifications.js.map +1 -1
- package/dist/notional-cap/use-notional-cap-by-symbol-id.d.ts +7 -7
- package/dist/notional-cap/use-notional-cap-by-symbol-id.d.ts.map +1 -1
- package/dist/notional-cap/use-notional-cap-by-symbol-id.js.map +1 -1
- package/dist/orderbook/index.d.ts +5 -0
- package/dist/orderbook/index.d.ts.map +1 -0
- package/dist/orderbook/index.js +5 -0
- package/dist/orderbook/use-binance-orderbook-source.d.ts +28 -0
- package/dist/orderbook/use-binance-orderbook-source.d.ts.map +1 -0
- package/dist/orderbook/use-binance-orderbook-source.js +26 -0
- package/dist/orderbook/use-binance-orderbook-source.js.map +1 -0
- package/dist/orderbook/use-live-orderbook.d.ts +104 -0
- package/dist/orderbook/use-live-orderbook.d.ts.map +1 -0
- package/dist/orderbook/use-live-orderbook.js +77 -0
- package/dist/orderbook/use-live-orderbook.js.map +1 -0
- package/dist/orderbook/use-orderbook-stream.d.ts +73 -0
- package/dist/orderbook/use-orderbook-stream.d.ts.map +1 -0
- package/dist/orderbook/use-orderbook-stream.js +49 -0
- package/dist/orderbook/use-orderbook-stream.js.map +1 -0
- package/dist/orderbook/use-orderbook.d.ts +35 -0
- package/dist/orderbook/use-orderbook.d.ts.map +1 -0
- package/dist/orderbook/use-orderbook.js +22 -0
- package/dist/orderbook/use-orderbook.js.map +1 -0
- package/dist/pools/index.d.ts +30 -0
- package/dist/pools/index.d.ts.map +1 -0
- package/dist/pools/index.js +30 -0
- package/dist/pools/use-add-market.d.ts +57 -0
- package/dist/pools/use-add-market.d.ts.map +1 -0
- package/dist/pools/use-add-market.js +30 -0
- package/dist/pools/use-add-market.js.map +1 -0
- package/dist/pools/use-authenticate-listing.d.ts +45 -0
- package/dist/pools/use-authenticate-listing.d.ts.map +1 -0
- package/dist/pools/use-authenticate-listing.js +30 -0
- package/dist/pools/use-authenticate-listing.js.map +1 -0
- package/dist/pools/use-cancel-withdraw.d.ts +47 -0
- package/dist/pools/use-cancel-withdraw.d.ts.map +1 -0
- package/dist/pools/use-cancel-withdraw.js +30 -0
- package/dist/pools/use-cancel-withdraw.js.map +1 -0
- package/dist/pools/use-claim-history.d.ts +25 -0
- package/dist/pools/use-claim-history.d.ts.map +1 -0
- package/dist/pools/use-claim-history.js +27 -0
- package/dist/pools/use-claim-history.js.map +1 -0
- package/dist/pools/use-claim-profit.d.ts +53 -0
- package/dist/pools/use-claim-profit.d.ts.map +1 -0
- package/dist/pools/use-claim-profit.js +30 -0
- package/dist/pools/use-claim-profit.js.map +1 -0
- package/dist/pools/use-deposit-address.d.ts +43 -0
- package/dist/pools/use-deposit-address.d.ts.map +1 -0
- package/dist/pools/use-deposit-address.js +28 -0
- package/dist/pools/use-deposit-address.js.map +1 -0
- package/dist/pools/use-listing-config.d.ts +28 -0
- package/dist/pools/use-listing-config.d.ts.map +1 -0
- package/dist/pools/use-listing-config.js +27 -0
- package/dist/pools/use-listing-config.js.map +1 -0
- package/dist/pools/use-listing-market-config-projection.d.ts +66 -0
- package/dist/pools/use-listing-market-config-projection.d.ts.map +1 -0
- package/dist/pools/use-listing-market-config-projection.js +57 -0
- package/dist/pools/use-listing-market-config-projection.js.map +1 -0
- package/dist/pools/use-listing-market-config.d.ts +49 -0
- package/dist/pools/use-listing-market-config.d.ts.map +1 -0
- package/dist/pools/use-listing-market-config.js +28 -0
- package/dist/pools/use-listing-market-config.js.map +1 -0
- package/dist/pools/use-listing-market-detail.d.ts +29 -0
- package/dist/pools/use-listing-market-detail.d.ts.map +1 -0
- package/dist/pools/use-listing-market-detail.js +27 -0
- package/dist/pools/use-listing-market-detail.js.map +1 -0
- package/dist/pools/use-listing-markets.d.ts +32 -0
- package/dist/pools/use-listing-markets.d.ts.map +1 -0
- package/dist/pools/use-listing-markets.js +27 -0
- package/dist/pools/use-listing-markets.js.map +1 -0
- package/dist/pools/use-listing-status.d.ts +29 -0
- package/dist/pools/use-listing-status.d.ts.map +1 -0
- package/dist/pools/use-listing-status.js +28 -0
- package/dist/pools/use-listing-status.js.map +1 -0
- package/dist/pools/use-pool-quotes.d.ts +26 -0
- package/dist/pools/use-pool-quotes.d.ts.map +1 -0
- package/dist/pools/use-pool-quotes.js +27 -0
- package/dist/pools/use-pool-quotes.js.map +1 -0
- package/dist/pools/use-pool-reward-chart.d.ts +32 -0
- package/dist/pools/use-pool-reward-chart.d.ts.map +1 -0
- package/dist/pools/use-pool-reward-chart.js +28 -0
- package/dist/pools/use-pool-reward-chart.js.map +1 -0
- package/dist/pools/use-pool-total-reward.d.ts +27 -0
- package/dist/pools/use-pool-total-reward.d.ts.map +1 -0
- package/dist/pools/use-pool-total-reward.js +28 -0
- package/dist/pools/use-pool-total-reward.js.map +1 -0
- package/dist/pools/use-pool-trade-history.d.ts +26 -0
- package/dist/pools/use-pool-trade-history.d.ts.map +1 -0
- package/dist/pools/use-pool-trade-history.js +27 -0
- package/dist/pools/use-pool-trade-history.js.map +1 -0
- package/dist/pools/use-pool-transactions.d.ts +23 -0
- package/dist/pools/use-pool-transactions.d.ts.map +1 -0
- package/dist/pools/use-pool-transactions.js +27 -0
- package/dist/pools/use-pool-transactions.js.map +1 -0
- package/dist/pools/use-refund-market.d.ts +51 -0
- package/dist/pools/use-refund-market.d.ts.map +1 -0
- package/dist/pools/use-refund-market.js +30 -0
- package/dist/pools/use-refund-market.js.map +1 -0
- package/dist/pools/use-retry-listing-info.d.ts +23 -0
- package/dist/pools/use-retry-listing-info.d.ts.map +1 -0
- package/dist/pools/use-retry-listing-info.js +27 -0
- package/dist/pools/use-retry-listing-info.js.map +1 -0
- package/dist/pools/use-retry-listing.d.ts +46 -0
- package/dist/pools/use-retry-listing.d.ts.map +1 -0
- package/dist/pools/use-retry-listing.js +30 -0
- package/dist/pools/use-retry-listing.js.map +1 -0
- package/dist/pools/use-supports-listing-service.d.ts +21 -0
- package/dist/pools/use-supports-listing-service.d.ts.map +1 -0
- package/dist/pools/use-supports-listing-service.js +13 -0
- package/dist/pools/use-supports-listing-service.js.map +1 -0
- package/dist/pools/use-update-listing-market-config.d.ts +60 -0
- package/dist/pools/use-update-listing-market-config.d.ts.map +1 -0
- package/dist/pools/use-update-listing-market-config.js +30 -0
- package/dist/pools/use-update-listing-market-config.js.map +1 -0
- package/dist/pools/use-user-listing-markets.d.ts +40 -0
- package/dist/pools/use-user-listing-markets.d.ts.map +1 -0
- package/dist/pools/use-user-listing-markets.js +28 -0
- package/dist/pools/use-user-listing-markets.js.map +1 -0
- package/dist/pools/use-user-profit.d.ts +39 -0
- package/dist/pools/use-user-profit.d.ts.map +1 -0
- package/dist/pools/use-user-profit.js +28 -0
- package/dist/pools/use-user-profit.js.map +1 -0
- package/dist/pools/use-user-reward-chart.d.ts +28 -0
- package/dist/pools/use-user-reward-chart.d.ts.map +1 -0
- package/dist/pools/use-user-reward-chart.js +28 -0
- package/dist/pools/use-user-reward-chart.js.map +1 -0
- package/dist/pools/use-user-total-reward.d.ts +30 -0
- package/dist/pools/use-user-total-reward.d.ts.map +1 -0
- package/dist/pools/use-user-total-reward.js +28 -0
- package/dist/pools/use-user-total-reward.js.map +1 -0
- package/dist/pools/use-user-transactions.d.ts +24 -0
- package/dist/pools/use-user-transactions.d.ts.map +1 -0
- package/dist/pools/use-user-transactions.js +27 -0
- package/dist/pools/use-user-transactions.js.map +1 -0
- package/dist/pools/use-weekly-listing-limit.d.ts +28 -0
- package/dist/pools/use-weekly-listing-limit.d.ts.map +1 -0
- package/dist/pools/use-weekly-listing-limit.js +28 -0
- package/dist/pools/use-weekly-listing-limit.js.map +1 -0
- package/dist/pools/use-withdraw-lp.d.ts +52 -0
- package/dist/pools/use-withdraw-lp.d.ts.map +1 -0
- package/dist/pools/use-withdraw-lp.js +30 -0
- package/dist/pools/use-withdraw-lp.js.map +1 -0
- package/dist/price-service/index.d.ts +8 -0
- package/dist/price-service/index.d.ts.map +1 -1
- package/dist/price-service/index.js +17 -9
- package/dist/price-service/use-binance-health.d.ts +16 -0
- package/dist/price-service/use-binance-health.d.ts.map +1 -0
- package/dist/price-service/use-binance-health.js +27 -0
- package/dist/price-service/use-binance-health.js.map +1 -0
- package/dist/price-service/use-binance-premium-index.d.ts +24 -0
- package/dist/price-service/use-binance-premium-index.d.ts.map +1 -0
- package/dist/price-service/use-binance-premium-index.js +27 -0
- package/dist/price-service/use-binance-premium-index.js.map +1 -0
- package/dist/price-service/use-binance-prices.d.ts +54 -0
- package/dist/price-service/use-binance-prices.d.ts.map +1 -0
- package/dist/price-service/use-binance-prices.js +57 -0
- package/dist/price-service/use-binance-prices.js.map +1 -0
- package/dist/price-service/use-binance-symbols-info.d.ts +18 -0
- package/dist/price-service/use-binance-symbols-info.d.ts.map +1 -0
- package/dist/price-service/use-binance-symbols-info.js +27 -0
- package/dist/price-service/use-binance-symbols-info.js.map +1 -0
- package/dist/price-service/use-enigma-price-by-market-id.d.ts +7 -1
- package/dist/price-service/use-enigma-price-by-market-id.d.ts.map +1 -1
- package/dist/price-service/use-enigma-price-by-market-id.js +1 -1
- package/dist/price-service/use-enigma-price-by-market-id.js.map +1 -1
- package/dist/price-service/use-mark-prices.d.ts +25 -0
- package/dist/price-service/use-mark-prices.d.ts.map +1 -0
- package/dist/price-service/use-mark-prices.js +27 -0
- package/dist/price-service/use-mark-prices.js.map +1 -0
- package/dist/price-service/use-price-by-market-id.d.ts +53 -0
- package/dist/price-service/use-price-by-market-id.d.ts.map +1 -0
- package/dist/price-service/use-price-by-market-id.js +33 -0
- package/dist/price-service/use-price-by-market-id.js.map +1 -0
- package/dist/price-service/use-price-by-name.d.ts +48 -0
- package/dist/price-service/use-price-by-name.d.ts.map +1 -0
- package/dist/price-service/use-price-by-name.js +23 -0
- package/dist/price-service/use-price-by-name.js.map +1 -0
- package/dist/price-service/use-prices.d.ts +87 -0
- package/dist/price-service/use-prices.d.ts.map +1 -0
- package/dist/price-service/use-prices.js +77 -0
- package/dist/price-service/use-prices.js.map +1 -0
- package/dist/provider/symmio-provider.d.ts +8 -2
- package/dist/provider/symmio-provider.d.ts.map +1 -1
- package/dist/provider/symmio-provider.js +19 -19
- package/dist/provider/symmio-provider.js.map +1 -1
- package/dist/quotes/confirm-hold.d.ts +121 -0
- package/dist/quotes/confirm-hold.d.ts.map +1 -0
- package/dist/quotes/confirm-hold.js +59 -0
- package/dist/quotes/confirm-hold.js.map +1 -0
- package/dist/quotes/index.d.ts +14 -0
- package/dist/quotes/index.d.ts.map +1 -1
- package/dist/quotes/use-account-upnl.d.ts +66 -0
- package/dist/quotes/use-account-upnl.d.ts.map +1 -0
- package/dist/quotes/use-account-upnl.js +73 -0
- package/dist/quotes/use-account-upnl.js.map +1 -0
- package/dist/quotes/use-close-quote-group.d.ts +126 -0
- package/dist/quotes/use-close-quote-group.d.ts.map +1 -0
- package/dist/quotes/use-close-quote-group.js +172 -0
- package/dist/quotes/use-close-quote-group.js.map +1 -0
- package/dist/quotes/use-cool-downs-of-ma.d.ts +26 -0
- package/dist/quotes/use-cool-downs-of-ma.d.ts.map +1 -0
- package/dist/quotes/use-cool-downs-of-ma.js +27 -0
- package/dist/quotes/use-cool-downs-of-ma.js.map +1 -0
- package/dist/quotes/use-force-cancel-close-request.d.ts +27 -0
- package/dist/quotes/use-force-cancel-close-request.d.ts.map +1 -0
- package/dist/quotes/use-force-cancel-close-request.js +41 -0
- package/dist/quotes/use-force-cancel-close-request.js.map +1 -0
- package/dist/quotes/use-force-cancel-quote.d.ts +26 -0
- package/dist/quotes/use-force-cancel-quote.d.ts.map +1 -0
- package/dist/quotes/use-force-cancel-quote.js +42 -0
- package/dist/quotes/use-force-cancel-quote.js.map +1 -0
- package/dist/quotes/use-force-close-eligibility.d.ts +30 -0
- package/dist/quotes/use-force-close-eligibility.d.ts.map +1 -0
- package/dist/quotes/use-force-close-eligibility.js +39 -0
- package/dist/quotes/use-force-close-eligibility.js.map +1 -0
- package/dist/quotes/use-force-close-params.d.ts +22 -0
- package/dist/quotes/use-force-close-params.d.ts.map +1 -0
- package/dist/quotes/use-force-close-params.js +27 -0
- package/dist/quotes/use-force-close-params.js.map +1 -0
- package/dist/quotes/use-force-close.d.ts +30 -0
- package/dist/quotes/use-force-close.d.ts.map +1 -0
- package/dist/quotes/use-force-close.js +38 -0
- package/dist/quotes/use-force-close.js.map +1 -0
- package/dist/quotes/use-grouped-quotes.d.ts +50 -10
- package/dist/quotes/use-grouped-quotes.d.ts.map +1 -1
- package/dist/quotes/use-grouped-quotes.js +40 -14
- package/dist/quotes/use-grouped-quotes.js.map +1 -1
- package/dist/quotes/use-grouping-isolation.d.ts +35 -0
- package/dist/quotes/use-grouping-isolation.d.ts.map +1 -0
- package/dist/quotes/use-grouping-isolation.js +39 -0
- package/dist/quotes/use-grouping-isolation.js.map +1 -0
- package/dist/quotes/use-limit-orders.d.ts +62 -0
- package/dist/quotes/use-limit-orders.d.ts.map +1 -0
- package/dist/quotes/use-limit-orders.js +82 -0
- package/dist/quotes/use-limit-orders.js.map +1 -0
- package/dist/quotes/use-managed-quotes.d.ts.map +1 -1
- package/dist/quotes/use-managed-quotes.js +198 -166
- package/dist/quotes/use-managed-quotes.js.map +1 -1
- package/dist/quotes/use-party-a-open-positions.d.ts +26 -6
- package/dist/quotes/use-party-a-open-positions.d.ts.map +1 -1
- package/dist/quotes/use-party-a-open-positions.js +32 -12
- package/dist/quotes/use-party-a-open-positions.js.map +1 -1
- package/dist/quotes/use-quote-funding.d.ts +2 -2
- package/dist/quotes/use-quote-funding.js.map +1 -1
- package/dist/quotes/use-quote-group-funding-history.d.ts +70 -0
- package/dist/quotes/use-quote-group-funding-history.d.ts.map +1 -0
- package/dist/quotes/use-quote-group-funding-history.js +38 -0
- package/dist/quotes/use-quote-group-funding-history.js.map +1 -0
- package/dist/quotes/use-quote-group-funding.d.ts +67 -0
- package/dist/quotes/use-quote-group-funding.d.ts.map +1 -0
- package/dist/quotes/use-quote-group-funding.js +26 -0
- package/dist/quotes/use-quote-group-funding.js.map +1 -0
- package/dist/quotes/use-quote-group-margin-risk.d.ts +111 -0
- package/dist/quotes/use-quote-group-margin-risk.d.ts.map +1 -0
- package/dist/quotes/use-quote-group-margin-risk.js +63 -0
- package/dist/quotes/use-quote-group-margin-risk.js.map +1 -0
- package/dist/quotes/use-quote-upnl-and-pnl.d.ts +4 -3
- package/dist/quotes/use-quote-upnl-and-pnl.d.ts.map +1 -1
- package/dist/quotes/use-quote-upnl-and-pnl.js +2 -1
- package/dist/quotes/use-quote-upnl-and-pnl.js.map +1 -1
- package/dist/quotes/use-quotes-funding.d.ts +46 -10
- package/dist/quotes/use-quotes-funding.d.ts.map +1 -1
- package/dist/quotes/use-quotes-funding.js +44 -42
- package/dist/quotes/use-quotes-funding.js.map +1 -1
- package/dist/quotes/use-request-to-cancel-close-request.d.ts +27 -0
- package/dist/quotes/use-request-to-cancel-close-request.d.ts.map +1 -0
- package/dist/quotes/use-request-to-cancel-close-request.js +41 -0
- package/dist/quotes/use-request-to-cancel-close-request.js.map +1 -0
- package/dist/quotes/use-request-to-cancel-quote.d.ts +32 -0
- package/dist/quotes/use-request-to-cancel-quote.d.ts.map +1 -0
- package/dist/quotes/use-request-to-cancel-quote.js +42 -0
- package/dist/quotes/use-request-to-cancel-quote.js.map +1 -0
- package/dist/rasa-solver/index.d.ts +7 -0
- package/dist/rasa-solver/index.d.ts.map +1 -0
- package/dist/rasa-solver/use-error-message.d.ts +14 -0
- package/dist/rasa-solver/use-error-message.d.ts.map +1 -0
- package/dist/rasa-solver/use-error-message.js +27 -0
- package/dist/rasa-solver/use-error-message.js.map +1 -0
- package/dist/rasa-solver/use-party-a-upnl.d.ts +14 -0
- package/dist/rasa-solver/use-party-a-upnl.d.ts.map +1 -0
- package/dist/rasa-solver/use-party-a-upnl.js +27 -0
- package/dist/rasa-solver/use-party-a-upnl.js.map +1 -0
- package/dist/rasa-solver/use-solver-balance-info.d.ts +14 -0
- package/dist/rasa-solver/use-solver-balance-info.d.ts.map +1 -0
- package/dist/rasa-solver/use-solver-balance-info.js +27 -0
- package/dist/rasa-solver/use-solver-balance-info.js.map +1 -0
- package/dist/rasa-solver/use-solver-open-interest.d.ts +14 -0
- package/dist/rasa-solver/use-solver-open-interest.d.ts.map +1 -0
- package/dist/rasa-solver/use-solver-open-interest.js +27 -0
- package/dist/rasa-solver/use-solver-open-interest.js.map +1 -0
- package/dist/rasa-solver/use-solver-price-range.d.ts +14 -0
- package/dist/rasa-solver/use-solver-price-range.d.ts.map +1 -0
- package/dist/rasa-solver/use-solver-price-range.js +27 -0
- package/dist/rasa-solver/use-solver-price-range.js.map +1 -0
- package/dist/rasa-solver/use-solver-readiness.d.ts +13 -0
- package/dist/rasa-solver/use-solver-readiness.d.ts.map +1 -0
- package/dist/rasa-solver/use-solver-readiness.js +27 -0
- package/dist/rasa-solver/use-solver-readiness.js.map +1 -0
- package/dist/revenue-records/index.d.ts +2 -0
- package/dist/revenue-records/index.d.ts.map +1 -0
- package/dist/revenue-records/use-revenue-records.d.ts +25 -0
- package/dist/revenue-records/use-revenue-records.d.ts.map +1 -0
- package/dist/revenue-records/use-revenue-records.js +27 -0
- package/dist/revenue-records/use-revenue-records.js.map +1 -0
- package/dist/solvers/index.d.ts +3 -0
- package/dist/solvers/index.d.ts.map +1 -0
- package/dist/solvers/use-solver-capabilities.d.ts +31 -0
- package/dist/solvers/use-solver-capabilities.d.ts.map +1 -0
- package/dist/solvers/use-solver-capabilities.js +30 -0
- package/dist/solvers/use-solver-capabilities.js.map +1 -0
- package/dist/solvers/use-solver-revenue.d.ts +28 -0
- package/dist/solvers/use-solver-revenue.d.ts.map +1 -0
- package/dist/solvers/use-solver-revenue.js +27 -0
- package/dist/solvers/use-solver-revenue.js.map +1 -0
- package/dist/symbols/index.d.ts +2 -0
- package/dist/symbols/index.d.ts.map +1 -0
- package/dist/symbols/use-symbols.d.ts +25 -0
- package/dist/symbols/use-symbols.d.ts.map +1 -0
- package/dist/symbols/use-symbols.js +27 -0
- package/dist/symbols/use-symbols.js.map +1 -0
- package/dist/tpsl/apply-tpsl-search-snapshot.d.ts +33 -0
- package/dist/tpsl/apply-tpsl-search-snapshot.d.ts.map +1 -0
- package/dist/tpsl/apply-tpsl-search-snapshot.js +51 -0
- package/dist/tpsl/apply-tpsl-search-snapshot.js.map +1 -0
- package/dist/tpsl/await-tpsl-confirmation.d.ts +77 -0
- package/dist/tpsl/await-tpsl-confirmation.d.ts.map +1 -0
- package/dist/tpsl/await-tpsl-confirmation.js +42 -0
- package/dist/tpsl/await-tpsl-confirmation.js.map +1 -0
- package/dist/tpsl/index.d.ts +11 -0
- package/dist/tpsl/index.d.ts.map +1 -1
- package/dist/tpsl/invalidate-tpsl.d.ts +23 -0
- package/dist/tpsl/invalidate-tpsl.d.ts.map +1 -0
- package/dist/tpsl/invalidate-tpsl.js +14 -0
- package/dist/tpsl/invalidate-tpsl.js.map +1 -0
- package/dist/tpsl/match-tpsl-notification.d.ts +27 -0
- package/dist/tpsl/match-tpsl-notification.d.ts.map +1 -0
- package/dist/tpsl/match-tpsl-notification.js +22 -0
- package/dist/tpsl/match-tpsl-notification.js.map +1 -0
- package/dist/tpsl/run-with-concurrency.d.ts +20 -0
- package/dist/tpsl/run-with-concurrency.d.ts.map +1 -0
- package/dist/tpsl/run-with-concurrency.js +15 -0
- package/dist/tpsl/run-with-concurrency.js.map +1 -0
- package/dist/tpsl/settled-side.d.ts +31 -0
- package/dist/tpsl/settled-side.d.ts.map +1 -0
- package/dist/tpsl/settled-side.js +21 -0
- package/dist/tpsl/settled-side.js.map +1 -0
- package/dist/tpsl/tpsl-fallback-poll.d.ts +74 -0
- package/dist/tpsl/tpsl-fallback-poll.d.ts.map +1 -0
- package/dist/tpsl/tpsl-fallback-poll.js +101 -0
- package/dist/tpsl/tpsl-fallback-poll.js.map +1 -0
- package/dist/tpsl/tpsl-store.d.ts +98 -2
- package/dist/tpsl/tpsl-store.d.ts.map +1 -1
- package/dist/tpsl/tpsl-store.js +111 -63
- package/dist/tpsl/tpsl-store.js.map +1 -1
- package/dist/tpsl/use-delete-quote-group-tpsl.d.ts +165 -0
- package/dist/tpsl/use-delete-quote-group-tpsl.d.ts.map +1 -0
- package/dist/tpsl/use-delete-quote-group-tpsl.js +247 -0
- package/dist/tpsl/use-delete-quote-group-tpsl.js.map +1 -0
- package/dist/tpsl/use-delete-quote-tpsl.d.ts.map +1 -1
- package/dist/tpsl/use-delete-quote-tpsl.js +11 -10
- package/dist/tpsl/use-delete-quote-tpsl.js.map +1 -1
- package/dist/tpsl/use-quote-group-tpsl-editor.d.ts +66 -0
- package/dist/tpsl/use-quote-group-tpsl-editor.d.ts.map +1 -0
- package/dist/tpsl/use-quote-group-tpsl-editor.js +78 -0
- package/dist/tpsl/use-quote-group-tpsl-editor.js.map +1 -0
- package/dist/tpsl/use-quote-group-tpsl.d.ts +74 -0
- package/dist/tpsl/use-quote-group-tpsl.d.ts.map +1 -0
- package/dist/tpsl/use-quote-group-tpsl.js +67 -0
- package/dist/tpsl/use-quote-group-tpsl.js.map +1 -0
- package/dist/tpsl/use-quote-tpsl.d.ts +18 -2
- package/dist/tpsl/use-quote-tpsl.d.ts.map +1 -1
- package/dist/tpsl/use-quote-tpsl.js +32 -24
- package/dist/tpsl/use-quote-tpsl.js.map +1 -1
- package/dist/tpsl/use-search-tpsl-orders.d.ts +30 -0
- package/dist/tpsl/use-search-tpsl-orders.d.ts.map +1 -0
- package/dist/tpsl/use-search-tpsl-orders.js +27 -0
- package/dist/tpsl/use-search-tpsl-orders.js.map +1 -0
- package/dist/tpsl/use-set-quote-group-tpsl.d.ts +234 -0
- package/dist/tpsl/use-set-quote-group-tpsl.d.ts.map +1 -0
- package/dist/tpsl/use-set-quote-group-tpsl.js +358 -0
- package/dist/tpsl/use-set-quote-group-tpsl.js.map +1 -0
- package/dist/tpsl/use-set-quote-tpsl.d.ts +4 -4
- package/dist/tpsl/use-set-quote-tpsl.d.ts.map +1 -1
- package/dist/tpsl/use-set-quote-tpsl.js +15 -12
- package/dist/tpsl/use-set-quote-tpsl.js.map +1 -1
- package/dist/tpsl/use-tpsl-supported.d.ts +22 -0
- package/dist/tpsl/use-tpsl-supported.d.ts.map +1 -0
- package/dist/tpsl/use-tpsl-supported.js +16 -0
- package/dist/tpsl/use-tpsl-supported.js.map +1 -0
- package/dist/tpsl/use-watch-tpsl-accounts.d.ts +33 -0
- package/dist/tpsl/use-watch-tpsl-accounts.d.ts.map +1 -0
- package/dist/tpsl/use-watch-tpsl-accounts.js +44 -0
- package/dist/tpsl/use-watch-tpsl-accounts.js.map +1 -0
- package/dist/trade-volume/index.d.ts +2 -0
- package/dist/trade-volume/index.d.ts.map +1 -0
- package/dist/trade-volume/use-trade-volume.d.ts +26 -0
- package/dist/trade-volume/use-trade-volume.d.ts.map +1 -0
- package/dist/trade-volume/use-trade-volume.js +27 -0
- package/dist/trade-volume/use-trade-volume.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/invalidate-account-balances.d.ts +36 -0
- package/dist/utils/invalidate-account-balances.d.ts.map +1 -0
- package/dist/utils/invalidate-account-balances.js +10 -0
- package/dist/utils/invalidate-account-balances.js.map +1 -0
- package/dist/websocket/use-notifications.d.ts +3 -1
- package/dist/websocket/use-notifications.d.ts.map +1 -1
- package/dist/websocket/use-notifications.js +22 -20
- package/dist/websocket/use-notifications.js.map +1 -1
- package/dist/withdraw/index.d.ts +1 -0
- package/dist/withdraw/index.d.ts.map +1 -1
- package/dist/withdraw/use-initiate-withdraw.d.ts +1 -1
- package/dist/withdraw/use-initiate-withdraw.js.map +1 -1
- package/dist/withdraw/use-request-cancel-withdraw.d.ts +4 -2
- package/dist/withdraw/use-request-cancel-withdraw.d.ts.map +1 -1
- package/dist/withdraw/use-request-cancel-withdraw.js +15 -13
- package/dist/withdraw/use-request-cancel-withdraw.js.map +1 -1
- package/dist/withdraw/use-withdraw.d.ts +67 -0
- package/dist/withdraw/use-withdraw.d.ts.map +1 -0
- package/dist/withdraw/use-withdraw.js +49 -0
- package/dist/withdraw/use-withdraw.js.map +1 -0
- package/package.json +18 -2
|
@@ -3,30 +3,31 @@ 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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { invalidateAccountBalances as i } from "../utils/invalidate-account-balances.js";
|
|
7
|
+
import { getInstantOpensQueryKey as a, instantOpenMutationOptions as o } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as s, useQueryClient as c } from "@tanstack/react-query";
|
|
8
9
|
//#region src/instant-layer/use-instant-open.ts
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
return
|
|
12
|
-
mutationKey:
|
|
10
|
+
function l(l = {}) {
|
|
11
|
+
let u = t(l), d = e(), f = c(), p = o(u);
|
|
12
|
+
return s({
|
|
13
|
+
mutationKey: p.mutationKey,
|
|
13
14
|
mutationFn: async (e) => {
|
|
14
15
|
try {
|
|
15
|
-
return await
|
|
16
|
+
return await p.mutationFn({
|
|
16
17
|
...e,
|
|
17
|
-
chainId: e.chainId ??
|
|
18
|
+
chainId: e.chainId ?? d
|
|
18
19
|
});
|
|
19
20
|
} catch (e) {
|
|
20
21
|
throw n(e);
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
24
|
onSuccess: (e, t) => {
|
|
24
|
-
let n =
|
|
25
|
-
|
|
25
|
+
let n = u.getChainConfigKey(t.chainId ?? d);
|
|
26
|
+
f.invalidateQueries({ predicate: r(a, { configKey: n }) }), i(f, { configKey: n });
|
|
26
27
|
}
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
//#endregion
|
|
30
|
-
export {
|
|
31
|
+
export { l as useInstantOpen };
|
|
31
32
|
|
|
32
33
|
//# sourceMappingURL=use-instant-open.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-instant-open.js","names":[],"sources":["../../src/instant-layer/use-instant-open.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryKey,\n instantOpenMutationOptions,\n type ConfigParameter,\n type InstantOpenParameters,\n type InstantOpenReturnType,\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 { predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useInstantOpen}.\n */\nexport type UseInstantOpenParameters = ConfigParameter;\n\n/** Return type of {@link useInstantOpen}
|
|
1
|
+
{"version":3,"file":"use-instant-open.js","names":[],"sources":["../../src/instant-layer/use-instant-open.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryKey,\n instantOpenMutationOptions,\n type ConfigParameter,\n type InstantOpenParameters,\n type InstantOpenReturnType,\n type SymmioSolverKind,\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 { invalidateAccountBalances, predicateMatch } from \"../utils\";\n\n/**\n * Parameters for {@link useInstantOpen}.\n */\nexport type UseInstantOpenParameters = ConfigParameter;\n\n/** Return type of {@link useInstantOpen}, narrowed by the target solver kind `K`. */\nexport type UseInstantOpenReturnType<K extends SymmioSolverKind = SymmioSolverKind> = UseMutationResult<\n InstantOpenReturnType<K>,\n SymmioRequestError,\n InstantOpenParameters<K>\n>;\n\n/**\n * Open an instant position via the pure `instantOpen` primitive.\n *\n * Every value is already final wei — the SDK does no fetching or math here. Use\n * this hook when the caller already has market metadata, locked params, mark\n * price, and fee rates in hand. For the friendlier \"just give me the trade\n * intent\" path, use {@link useInstantOpenAuto}.\n *\n * The submitted shape depends on the solver: **Enigma (lowcap)** funds a fresh\n * virtual account, so `margin` is required; **Rasa (majors)** is cross-margin,\n * ignores `margin`, and fetches a live Muon signature before signing. The result\n * is discriminated on `kind`. Bind the generic to keep it narrowed for a hook\n * that always targets one solver.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useInstantOpen<\"rasa\">();\n * const { tempQuoteId, rfq } = await mutateAsync({\n * solverId: \"rasa\",\n * subAccountAddress,\n * marketId: 1,\n * positionType: PositionType.LONG,\n * order: { price, quantity },\n * lockedParam: { cva, lf, partyAmm, partyBmm },\n * });\n * ```\n */\nexport function useInstantOpen<K extends SymmioSolverKind = SymmioSolverKind>(\n parameters: UseInstantOpenParameters = {},\n): UseInstantOpenReturnType<K> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = instantOpenMutationOptions<K>(config);\n\n return useMutation<InstantOpenReturnType<K>, SymmioRequestError, InstantOpenParameters<K>>({\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 /**\n * A freshly submitted instant-open exists on the hedger but not in any\n * cached read yet. Invalidate the instant-opens feed so it refetches and\n * the optimistic row appears immediately — without waiting for a poll.\n */\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantOpensQueryKey, { configKey }) });\n /** The open locks margin and charges a fee — every balance read on this chain is now suspect. */\n invalidateAccountBalances(queryClient, { configKey });\n },\n });\n}\n"],"mappings":";;;;;;;;;AAwDA,SAAgB,EACd,IAAuC,CAAC,GACX;CAC7B,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA8B,CAAM;CAEjD,OAAO,EAAoF;EACzF,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;GAMjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GAGvE,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAyB,EAAE,aAAU,CAAC,EAAE,CAAC,GAExG,EAA0B,GAAa,EAAE,aAAU,CAAC;EACtD;CACF,CAAC;AACH"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { ConfigParameter, GetInstantOpensOptions, GetInstantOpensReturnType } from '@symmio/trading-core';
|
|
1
|
+
import { ConfigParameter, GetInstantOpensOptions, GetInstantOpensReturnType, SymmioSolverKind } from '@symmio/trading-core';
|
|
2
2
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for {@link useInstantOpens}: the core query options (partyA,
|
|
6
6
|
* optional hedger `baseUrl`, chain id, TanStack `query` overrides incl.
|
|
7
|
-
* `refetchInterval`) plus an optional `config`.
|
|
7
|
+
* `refetchInterval`) plus an optional `config`. Generic over the solver kind `K`.
|
|
8
8
|
*/
|
|
9
|
-
export type UseInstantOpensParameters = GetInstantOpensOptions & ConfigParameter;
|
|
10
|
-
/** Return type of {@link useInstantOpens}
|
|
11
|
-
export type UseInstantOpensReturnType = UseQueryResult<GetInstantOpensReturnType
|
|
9
|
+
export type UseInstantOpensParameters<K extends SymmioSolverKind = SymmioSolverKind> = GetInstantOpensOptions<K> & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useInstantOpens}, generic over the solver kind `K`. */
|
|
11
|
+
export type UseInstantOpensReturnType<K extends SymmioSolverKind = SymmioSolverKind> = UseQueryResult<GetInstantOpensReturnType<K>, SymmioRequestError>;
|
|
12
12
|
/**
|
|
13
13
|
* Read a sub-account's pending instant-open records from one hedger, with
|
|
14
14
|
* caller-tunable polling via `query.refetchInterval`. `chainId` defaults to the
|
|
@@ -21,5 +21,5 @@ export type UseInstantOpensReturnType = UseQueryResult<GetInstantOpensReturnType
|
|
|
21
21
|
* const { data } = useInstantOpens({ partyA, query: { refetchInterval: 3_000 } });
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export declare function useInstantOpens(parameters: UseInstantOpensParameters): UseInstantOpensReturnType
|
|
24
|
+
export declare function useInstantOpens<K extends SymmioSolverKind = SymmioSolverKind>(parameters: UseInstantOpensParameters<K>): UseInstantOpensReturnType<K>;
|
|
25
25
|
//# sourceMappingURL=use-instant-opens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-instant-opens.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-opens.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,
|
|
1
|
+
{"version":3,"file":"use-instant-opens.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-opens.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;GAIG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,sBAAsB,CAAC,CAAC,CAAC,GAC9G,eAAe,CAAC;AAElB,gFAAgF;AAChF,MAAM,MAAM,yBAAyB,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,cAAc,CACnG,yBAAyB,CAAC,CAAC,CAAC,EAC5B,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,gBAAgB,GAAG,gBAAgB,EAC3E,UAAU,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACvC,yBAAyB,CAAC,CAAC,CAAC,CAkB9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-instant-opens.js","names":[],"sources":["../../src/instant-layer/use-instant-opens.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryOptions,\n type ConfigParameter,\n type GetInstantOpensOptions,\n type GetInstantOpensReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useInstantOpens}: the core query options (partyA,\n * optional hedger `baseUrl`, chain id, TanStack `query` overrides incl.\n * `refetchInterval`) plus an optional `config`.\n */\nexport type UseInstantOpensParameters = GetInstantOpensOptions
|
|
1
|
+
{"version":3,"file":"use-instant-opens.js","names":[],"sources":["../../src/instant-layer/use-instant-opens.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryOptions,\n type ConfigParameter,\n type GetInstantOpensOptions,\n type GetInstantOpensReturnType,\n type SymmioSolverKind,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useInstantOpens}: the core query options (partyA,\n * optional hedger `baseUrl`, chain id, TanStack `query` overrides incl.\n * `refetchInterval`) plus an optional `config`. Generic over the solver kind `K`.\n */\nexport type UseInstantOpensParameters<K extends SymmioSolverKind = SymmioSolverKind> = GetInstantOpensOptions<K> &\n ConfigParameter;\n\n/** Return type of {@link useInstantOpens}, generic over the solver kind `K`. */\nexport type UseInstantOpensReturnType<K extends SymmioSolverKind = SymmioSolverKind> = UseQueryResult<\n GetInstantOpensReturnType<K>,\n SymmioRequestError\n>;\n\n/**\n * Read a sub-account's pending instant-open records from one hedger, with\n * caller-tunable polling via `query.refetchInterval`. `chainId` defaults to the\n * connected chain; disable the query from the consumer via `query.enabled`\n * (e.g. until a valid `partyA` is entered). Errors are normalized to\n * {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data } = useInstantOpens({ partyA, query: { refetchInterval: 3_000 } });\n * ```\n */\nexport function useInstantOpens<K extends SymmioSolverKind = SymmioSolverKind>(\n parameters: UseInstantOpensParameters<K>,\n): UseInstantOpensReturnType<K> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getInstantOpensQueryOptions<K>(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 UseInstantOpensReturnType<K>;\n}\n"],"mappings":";;;;;;;AAyCA,SAAgB,EACd,GAC8B;CAC9B,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA+B,GAAQ;EACrD,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,25 @@
|
|
|
1
|
+
import { ConfigParameter, INSTANT_TRADE_REQUIRED_SELECTORS, LEGACY_INSTANT_TRADE_REQUIRED_SELECTORS } from '@symmio/trading-core';
|
|
2
|
+
/** Parameters for {@link useInstantTradeRequiredSelectors}. */
|
|
3
|
+
export interface UseInstantTradeRequiredSelectorsParameters extends ConfigParameter {
|
|
4
|
+
/** Chain to resolve for; defaults to the connected chain. */
|
|
5
|
+
chainId?: number;
|
|
6
|
+
}
|
|
7
|
+
/** Return type of {@link useInstantTradeRequiredSelectors}: the chain's selector set. */
|
|
8
|
+
export type UseInstantTradeRequiredSelectorsReturnType = typeof INSTANT_TRADE_REQUIRED_SELECTORS | typeof LEGACY_INSTANT_TRADE_REQUIRED_SELECTORS;
|
|
9
|
+
/**
|
|
10
|
+
* The session-key delegation selector set for the connected (or given) chain,
|
|
11
|
+
* resolved by its `contractsVersion` — `sendQuote` on a perps-core v0.8.6
|
|
12
|
+
* chain, the legacy `sendQuoteWithAffiliateAndData` on v0.8.5.
|
|
13
|
+
*
|
|
14
|
+
* Use this instead of hardcoding `INSTANT_TRADE_REQUIRED_SELECTORS` in any flow
|
|
15
|
+
* that can point at more than one chain: a hardcoded set grants (and checks)
|
|
16
|
+
* the wrong open-leg selector on the other generation's chains.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const selectors = useInstantTradeRequiredSelectors();
|
|
21
|
+
* grantDelegation.mutate({ account, delegatedSigner, selectors, expiryTimestamp });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useInstantTradeRequiredSelectors(parameters?: UseInstantTradeRequiredSelectorsParameters): UseInstantTradeRequiredSelectorsReturnType;
|
|
25
|
+
//# sourceMappingURL=use-instant-trade-required-selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-trade-required-selectors.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-instant-trade-required-selectors.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,EAC7C,MAAM,sBAAsB,CAAC;AAI9B,+DAA+D;AAC/D,MAAM,WAAW,0CAA2C,SAAQ,eAAe;IACjF,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,yFAAyF;AACzF,MAAM,MAAM,0CAA0C,GAClD,OAAO,gCAAgC,GACvC,OAAO,uCAAuC,CAAC;AAEnD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,GAAE,0CAA+C,GAC1D,0CAA0C,CAI5C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { getInstantTradeRequiredSelectors as n } from "@symmio/trading-core";
|
|
5
|
+
//#region src/instant-layer/use-instant-trade-required-selectors.ts
|
|
6
|
+
function r(r = {}) {
|
|
7
|
+
let i = t(r), a = e();
|
|
8
|
+
return n(i, { chainId: r.chainId ?? a });
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { r as useInstantTradeRequiredSelectors };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=use-instant-trade-required-selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-instant-trade-required-selectors.js","names":[],"sources":["../../src/instant-layer/use-instant-trade-required-selectors.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantTradeRequiredSelectors,\n type ConfigParameter,\n type INSTANT_TRADE_REQUIRED_SELECTORS,\n type LEGACY_INSTANT_TRADE_REQUIRED_SELECTORS,\n} from \"@symmio/trading-core\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/** Parameters for {@link useInstantTradeRequiredSelectors}. */\nexport interface UseInstantTradeRequiredSelectorsParameters extends ConfigParameter {\n /** Chain to resolve for; defaults to the connected chain. */\n chainId?: number;\n}\n\n/** Return type of {@link useInstantTradeRequiredSelectors}: the chain's selector set. */\nexport type UseInstantTradeRequiredSelectorsReturnType =\n | typeof INSTANT_TRADE_REQUIRED_SELECTORS\n | typeof LEGACY_INSTANT_TRADE_REQUIRED_SELECTORS;\n\n/**\n * The session-key delegation selector set for the connected (or given) chain,\n * resolved by its `contractsVersion` — `sendQuote` on a perps-core v0.8.6\n * chain, the legacy `sendQuoteWithAffiliateAndData` on v0.8.5.\n *\n * Use this instead of hardcoding `INSTANT_TRADE_REQUIRED_SELECTORS` in any flow\n * that can point at more than one chain: a hardcoded set grants (and checks)\n * the wrong open-leg selector on the other generation's chains.\n *\n * @example\n * ```tsx\n * const selectors = useInstantTradeRequiredSelectors();\n * grantDelegation.mutate({ account, delegatedSigner, selectors, expiryTimestamp });\n * ```\n */\nexport function useInstantTradeRequiredSelectors(\n parameters: UseInstantTradeRequiredSelectorsParameters = {},\n): UseInstantTradeRequiredSelectorsReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n return getInstantTradeRequiredSelectors(config, { chainId: parameters.chainId ?? chainId });\n}\n"],"mappings":";;;;;AAqCA,SAAgB,EACd,IAAyD,CAAC,GACd;CAC5C,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB;CACjC,OAAO,EAAiC,GAAQ,EAAE,SAAS,EAAW,WAAW,EAAQ,CAAC;AAC5F"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ConfigParameter, InstantCloseReturnType, PrepareLimitCloseParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/** Parameters for {@link useLimitCloseAuto}. */
|
|
5
|
+
export type UseLimitCloseAutoParameters = ConfigParameter;
|
|
6
|
+
/** Return type of {@link useLimitCloseAuto}. */
|
|
7
|
+
export type UseLimitCloseAutoReturnType = UseMutationResult<InstantCloseReturnType, SymmioRequestError, PrepareLimitCloseParameters>;
|
|
8
|
+
/**
|
|
9
|
+
* Submit a **LIMIT close** request (majors / rasa) via the `limitCloseAuto`
|
|
10
|
+
* action.
|
|
11
|
+
*
|
|
12
|
+
* Accepts the minimal close intent plus the user's resting `price`; the SDK
|
|
13
|
+
* resolves market metadata, clamps the quantity, signs it with
|
|
14
|
+
* `orderType = LIMIT`, and posts it to the solver, which writes a **pending
|
|
15
|
+
* close** resting at that price. Throws `UNSUPPORTED_BY_SOLVER` when the
|
|
16
|
+
* resolved solver has no limit-order support — gate the UI with
|
|
17
|
+
* `useSupportsLimitOrder`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { mutateAsync } = useLimitCloseAuto();
|
|
22
|
+
* await mutateAsync({
|
|
23
|
+
* partyA, from,
|
|
24
|
+
* market: { id: 1 }, positionType: PositionType.LONG,
|
|
25
|
+
* quoteId: 42n, quantityToClose: "0.5", price: "64000",
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useLimitCloseAuto(parameters?: UseLimitCloseAutoParameters): UseLimitCloseAutoReturnType;
|
|
30
|
+
//# sourceMappingURL=use-limit-close-auto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-limit-close-auto.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-limit-close-auto.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EACjC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,gDAAgD;AAChD,MAAM,MAAM,2BAA2B,GAAG,eAAe,CAAC;AAE1D,gDAAgD;AAChD,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CACzD,sBAAsB,EACtB,kBAAkB,EAClB,2BAA2B,CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,GAAE,2BAAgC,GAAG,2BAA2B,CAyB3G"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
+
import { invalidateAccountBalances as i } from "../utils/invalidate-account-balances.js";
|
|
7
|
+
import { getInstantClosesQueryKey as a, limitCloseAutoMutationOptions as o } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as s, useQueryClient as c } from "@tanstack/react-query";
|
|
9
|
+
//#region src/instant-layer/use-limit-close-auto.ts
|
|
10
|
+
function l(l = {}) {
|
|
11
|
+
let u = t(l), d = e(), f = c(), p = o(u);
|
|
12
|
+
return s({
|
|
13
|
+
mutationKey: p.mutationKey,
|
|
14
|
+
mutationFn: async (e) => {
|
|
15
|
+
try {
|
|
16
|
+
return await p.mutationFn({
|
|
17
|
+
...e,
|
|
18
|
+
chainId: e.chainId ?? d
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
throw n(e);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
onSuccess: (e, t) => {
|
|
25
|
+
let n = u.getChainConfigKey(t.chainId ?? d);
|
|
26
|
+
f.invalidateQueries({ predicate: r(a, { configKey: n }) }), i(f, { configKey: n });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { l as useLimitCloseAuto };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=use-limit-close-auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-limit-close-auto.js","names":[],"sources":["../../src/instant-layer/use-limit-close-auto.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantClosesQueryKey,\n limitCloseAutoMutationOptions,\n type ConfigParameter,\n type InstantCloseReturnType,\n type PrepareLimitCloseParameters,\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 { invalidateAccountBalances, predicateMatch } from \"../utils\";\n\n/** Parameters for {@link useLimitCloseAuto}. */\nexport type UseLimitCloseAutoParameters = ConfigParameter;\n\n/** Return type of {@link useLimitCloseAuto}. */\nexport type UseLimitCloseAutoReturnType = UseMutationResult<\n InstantCloseReturnType,\n SymmioRequestError,\n PrepareLimitCloseParameters\n>;\n\n/**\n * Submit a **LIMIT close** request (majors / rasa) via the `limitCloseAuto`\n * action.\n *\n * Accepts the minimal close intent plus the user's resting `price`; the SDK\n * resolves market metadata, clamps the quantity, signs it with\n * `orderType = LIMIT`, and posts it to the solver, which writes a **pending\n * close** resting at that price. Throws `UNSUPPORTED_BY_SOLVER` when the\n * resolved solver has no limit-order support — gate the UI with\n * `useSupportsLimitOrder`.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useLimitCloseAuto();\n * await mutateAsync({\n * partyA, from,\n * market: { id: 1 }, positionType: PositionType.LONG,\n * quoteId: 42n, quantityToClose: \"0.5\", price: \"64000\",\n * });\n * ```\n */\nexport function useLimitCloseAuto(parameters: UseLimitCloseAutoParameters = {}): UseLimitCloseAutoReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = limitCloseAutoMutationOptions(config);\n\n return useMutation<InstantCloseReturnType, SymmioRequestError, PrepareLimitCloseParameters>({\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 // The accepted limit close lands in the hedger's instant-closes feed before\n // it anchors on-chain — invalidate that feed so the resting close surfaces\n // without waiting for a poll.\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantClosesQueryKey, { configKey }) });\n /** A fill releases locked margin and realizes PnL — every balance read on this chain is now suspect. */\n invalidateAccountBalances(queryClient, { configKey });\n },\n });\n}\n"],"mappings":";;;;;;;;;AA+CA,SAAgB,EAAkB,IAA0C,CAAC,GAAgC;CAC3G,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA8B,CAAM;CAEjD,OAAO,EAAqF;EAC1F,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;GAIjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GAGvE,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAA0B,EAAE,aAAU,CAAC,EAAE,CAAC,GAEzG,EAA0B,GAAa,EAAE,aAAU,CAAC;EACtD;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ConfigParameter, InstantOpenReturnType, PrepareLimitOpenParameters } from '@symmio/trading-core';
|
|
2
|
+
import { UseMutationResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/** Parameters for {@link useLimitOpenAuto}. */
|
|
5
|
+
export type UseLimitOpenAutoParameters = ConfigParameter;
|
|
6
|
+
/** Return type of {@link useLimitOpenAuto}. */
|
|
7
|
+
export type UseLimitOpenAutoReturnType = UseMutationResult<InstantOpenReturnType, SymmioRequestError, PrepareLimitOpenParameters>;
|
|
8
|
+
/**
|
|
9
|
+
* Place a LIMIT open (majors / rasa) via the `limitOpenAuto` action.
|
|
10
|
+
*
|
|
11
|
+
* Accepts the minimal trade intent plus the user's resting `price`; the SDK
|
|
12
|
+
* resolves market metadata, locked params, and fee rates, sizes the order, signs
|
|
13
|
+
* it, and posts it to the solver, which writes a **pending** on-chain quote. The
|
|
14
|
+
* order then appears in the on-chain pending list (`getPartyAPendingQuotes`),
|
|
15
|
+
* which this hook invalidates on success. Throws `UNSUPPORTED_BY_SOLVER` when the
|
|
16
|
+
* resolved solver has no limit-order support — gate the UI with
|
|
17
|
+
* `useSupportsLimitOrder`.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { mutateAsync } = useLimitOpenAuto();
|
|
22
|
+
* await mutateAsync({
|
|
23
|
+
* subAccountAddress, from,
|
|
24
|
+
* market: { id: 1 }, positionType: "LONG",
|
|
25
|
+
* initialMargin: "100", leverage: 5, price: "64000",
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useLimitOpenAuto(parameters?: UseLimitOpenAutoParameters): UseLimitOpenAutoReturnType;
|
|
30
|
+
//# sourceMappingURL=use-limit-open-auto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-limit-open-auto.d.ts","sourceRoot":"","sources":["../../src/instant-layer/use-limit-open-auto.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAKzE,+CAA+C;AAC/C,MAAM,MAAM,0BAA0B,GAAG,eAAe,CAAC;AAEzD,+CAA+C;AAC/C,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CACxD,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,GAAE,0BAA+B,GAAG,0BAA0B,CA0BxG"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 { predicateMatch as r } from "../utils/predicate-match.js";
|
|
6
|
+
import { invalidateAccountBalances as i } from "../utils/invalidate-account-balances.js";
|
|
7
|
+
import { getInstantOpensQueryKey as a, limitOpenAutoMutationOptions as o } from "@symmio/trading-core";
|
|
8
|
+
import { useMutation as s, useQueryClient as c } from "@tanstack/react-query";
|
|
9
|
+
//#region src/instant-layer/use-limit-open-auto.ts
|
|
10
|
+
function l(l = {}) {
|
|
11
|
+
let u = t(l), d = e(), f = c(), p = o(u);
|
|
12
|
+
return s({
|
|
13
|
+
mutationKey: p.mutationKey,
|
|
14
|
+
mutationFn: async (e) => {
|
|
15
|
+
try {
|
|
16
|
+
return await p.mutationFn({
|
|
17
|
+
...e,
|
|
18
|
+
chainId: e.chainId ?? d
|
|
19
|
+
});
|
|
20
|
+
} catch (e) {
|
|
21
|
+
throw n(e);
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
onSuccess: (e, t) => {
|
|
25
|
+
let n = u.getChainConfigKey(t.chainId ?? d);
|
|
26
|
+
f.invalidateQueries({ predicate: r(a, { configKey: n }) }), i(f, { configKey: n });
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { l as useLimitOpenAuto };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=use-limit-open-auto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-limit-open-auto.js","names":[],"sources":["../../src/instant-layer/use-limit-open-auto.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInstantOpensQueryKey,\n limitOpenAutoMutationOptions,\n type ConfigParameter,\n type InstantOpenReturnType,\n type PrepareLimitOpenParameters,\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 { invalidateAccountBalances, predicateMatch } from \"../utils\";\n\n/** Parameters for {@link useLimitOpenAuto}. */\nexport type UseLimitOpenAutoParameters = ConfigParameter;\n\n/** Return type of {@link useLimitOpenAuto}. */\nexport type UseLimitOpenAutoReturnType = UseMutationResult<\n InstantOpenReturnType,\n SymmioRequestError,\n PrepareLimitOpenParameters\n>;\n\n/**\n * Place a LIMIT open (majors / rasa) via the `limitOpenAuto` action.\n *\n * Accepts the minimal trade intent plus the user's resting `price`; the SDK\n * resolves market metadata, locked params, and fee rates, sizes the order, signs\n * it, and posts it to the solver, which writes a **pending** on-chain quote. The\n * order then appears in the on-chain pending list (`getPartyAPendingQuotes`),\n * which this hook invalidates on success. Throws `UNSUPPORTED_BY_SOLVER` when the\n * resolved solver has no limit-order support — gate the UI with\n * `useSupportsLimitOrder`.\n *\n * @example\n * ```tsx\n * const { mutateAsync } = useLimitOpenAuto();\n * await mutateAsync({\n * subAccountAddress, from,\n * market: { id: 1 }, positionType: \"LONG\",\n * initialMargin: \"100\", leverage: 5, price: \"64000\",\n * });\n * ```\n */\nexport function useLimitOpenAuto(parameters: UseLimitOpenAutoParameters = {}): UseLimitOpenAutoReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = limitOpenAutoMutationOptions(config);\n\n return useMutation<InstantOpenReturnType, SymmioRequestError, PrepareLimitOpenParameters>({\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 // The hedger lists the accepted limit order in its instant-open feed before\n // it anchors on-chain — invalidate that feed so `useLimitOrders` shows the\n // off-chain row instantly; the on-chain read then flips it to on-chain via\n // the anchor notification.\n const configKey = config.getChainConfigKey(variables.chainId ?? chainId);\n void queryClient.invalidateQueries({ predicate: predicateMatch(getInstantOpensQueryKey, { configKey }) });\n /** The open locks margin and charges a fee — every balance read on this chain is now suspect. */\n invalidateAccountBalances(queryClient, { configKey });\n },\n });\n}\n"],"mappings":";;;;;;;;;AA+CA,SAAgB,EAAiB,IAAyC,CAAC,GAA+B;CACxG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAc,EAAe,GAC7B,IAAO,EAA6B,CAAM;CAEhD,OAAO,EAAmF;EACxF,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;GAKjC,IAAM,IAAY,EAAO,kBAAkB,EAAU,WAAW,CAAO;GAGvE,AAFA,EAAiB,kBAAkB,EAAE,WAAW,EAAe,GAAyB,EAAE,aAAU,CAAC,EAAE,CAAC,GAExG,EAA0B,GAAa,EAAE,aAAU,CAAC;EACtD;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inventory/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ConfigParameter, GetInventoryTvlHistoryOptions, GetInventoryTvlHistoryReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/** Parameters for {@link useInventoryTvlHistory}: the core query options plus an optional `config`. */
|
|
5
|
+
export type UseInventoryTvlHistoryParameters = GetInventoryTvlHistoryOptions & ConfigParameter;
|
|
6
|
+
/** Return type of {@link useInventoryTvlHistory}: one TVL point per snapshot. */
|
|
7
|
+
export type UseInventoryTvlHistoryReturnType = UseQueryResult<GetInventoryTvlHistoryReturnType, SymmioRequestError>;
|
|
8
|
+
/**
|
|
9
|
+
* Read one market's custodial TVL over time from the connected chain's inventory
|
|
10
|
+
* service — the series behind a pool page's TVL chart.
|
|
11
|
+
*
|
|
12
|
+
* The per-market twin of {@link useInventoryTvl}, which reports the whole
|
|
13
|
+
* custodial system as a single figure. Each point's `tvl` is a `bigint` at
|
|
14
|
+
* `INVENTORY_VALUE_DECIMALS` (18) and `timestamp` is unix **seconds**.
|
|
15
|
+
*
|
|
16
|
+
* `symbolAddress` gates the query: until it is a non-empty string the hook stays
|
|
17
|
+
* idle (`enabled: false`), so it can be mounted before a pool is picked. The
|
|
18
|
+
* endpoint is not deployed on every environment — treat an error as "no chart",
|
|
19
|
+
* not a broken page. Errors are normalized to {@link SymmioRequestError}.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* const { data: history } = useInventoryTvlHistory({ symbolAddress: pool.contractAddress });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function useInventoryTvlHistory(parameters: UseInventoryTvlHistoryParameters): UseInventoryTvlHistoryReturnType;
|
|
27
|
+
//# sourceMappingURL=use-inventory-tvl-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-inventory-tvl-history.d.ts","sourceRoot":"","sources":["../../src/inventory/use-inventory-tvl-history.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACtC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,uGAAuG;AACvG,MAAM,MAAM,gCAAgC,GAAG,6BAA6B,GAAG,eAAe,CAAC;AAE/F,iFAAiF;AACjF,MAAM,MAAM,gCAAgC,GAAG,cAAc,CAAC,gCAAgC,EAAE,kBAAkB,CAAC,CAAC;AAEpH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,gCAAgC,GAAG,gCAAgC,CAmBrH"}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 { getInventoryTvlHistoryQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/inventory/use-inventory-tvl-history.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
|
+
enabled: (a.query?.enabled ?? !0) && a.symbolAddress.length > 0,
|
|
16
|
+
queryFn: async () => {
|
|
17
|
+
try {
|
|
18
|
+
return await c.queryFn();
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw n(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { a as useInventoryTvlHistory };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=use-inventory-tvl-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-inventory-tvl-history.js","names":[],"sources":["../../src/inventory/use-inventory-tvl-history.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInventoryTvlHistoryQueryOptions,\n type ConfigParameter,\n type GetInventoryTvlHistoryOptions,\n type GetInventoryTvlHistoryReturnType,\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 useInventoryTvlHistory}: the core query options plus an optional `config`. */\nexport type UseInventoryTvlHistoryParameters = GetInventoryTvlHistoryOptions & ConfigParameter;\n\n/** Return type of {@link useInventoryTvlHistory}: one TVL point per snapshot. */\nexport type UseInventoryTvlHistoryReturnType = UseQueryResult<GetInventoryTvlHistoryReturnType, SymmioRequestError>;\n\n/**\n * Read one market's custodial TVL over time from the connected chain's inventory\n * service — the series behind a pool page's TVL chart.\n *\n * The per-market twin of {@link useInventoryTvl}, which reports the whole\n * custodial system as a single figure. Each point's `tvl` is a `bigint` at\n * `INVENTORY_VALUE_DECIMALS` (18) and `timestamp` is unix **seconds**.\n *\n * `symbolAddress` gates the query: until it is a non-empty string the hook stays\n * idle (`enabled: false`), so it can be mounted before a pool is picked. The\n * endpoint is not deployed on every environment — treat an error as \"no chart\",\n * not a broken page. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: history } = useInventoryTvlHistory({ symbolAddress: pool.contractAddress });\n * ```\n */\nexport function useInventoryTvlHistory(parameters: UseInventoryTvlHistoryParameters): UseInventoryTvlHistoryReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getInventoryTvlHistoryQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n enabled: (parameters.query?.enabled ?? true) && parameters.symbolAddress.length > 0,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseInventoryTvlHistoryReturnType;\n}\n"],"mappings":";;;;;;;AAsCA,SAAgB,EAAuB,GAAgF;CACrH,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAmC,GAAQ;EACzD,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,UAAU,EAAW,OAAO,WAAW,OAAS,EAAW,cAAc,SAAS;EAClF,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,23 @@
|
|
|
1
|
+
import { ConfigParameter, GetInventoryTvlOptions, GetInventoryTvlReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/** Parameters for {@link useInventoryTvl}: the core query options plus an optional `config`. */
|
|
5
|
+
export type UseInventoryTvlParameters = GetInventoryTvlOptions & ConfigParameter;
|
|
6
|
+
/** Return type of {@link useInventoryTvl}: aggregate TVL as an 18-decimal `bigint`. */
|
|
7
|
+
export type UseInventoryTvlReturnType = UseQueryResult<GetInventoryTvlReturnType, SymmioRequestError>;
|
|
8
|
+
/**
|
|
9
|
+
* Read the system-wide custodial TVL from the connected chain's inventory
|
|
10
|
+
* service — the headline TVL figure on a pools page.
|
|
11
|
+
*
|
|
12
|
+
* Returned as a `bigint` at `INVENTORY_VALUE_DECIMALS` (18); format with
|
|
13
|
+
* `formatUnits`. This is **not** the sum of the pool catalogue's per-pool `tvl`
|
|
14
|
+
* values — the catalogue covers listed markets, this covers the whole custodial
|
|
15
|
+
* system. Errors are normalized to {@link SymmioRequestError}.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const { data: tvl } = useInventoryTvl();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useInventoryTvl(parameters?: UseInventoryTvlParameters): UseInventoryTvlReturnType;
|
|
23
|
+
//# sourceMappingURL=use-inventory-tvl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-inventory-tvl.d.ts","sourceRoot":"","sources":["../../src/inventory/use-inventory-tvl.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE,gGAAgG;AAChG,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,GAAG,eAAe,CAAC;AAEjF,uFAAuF;AACvF,MAAM,MAAM,yBAAyB,GAAG,cAAc,CAAC,yBAAyB,EAAE,kBAAkB,CAAC,CAAC;AAEtG;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,UAAU,GAAE,yBAA8B,GAAG,yBAAyB,CAkBrG"}
|
|
@@ -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 { getInventoryTvlQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/inventory/use-inventory-tvl.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 useInventoryTvl };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-inventory-tvl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-inventory-tvl.js","names":[],"sources":["../../src/inventory/use-inventory-tvl.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getInventoryTvlQueryOptions,\n type ConfigParameter,\n type GetInventoryTvlOptions,\n type GetInventoryTvlReturnType,\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 useInventoryTvl}: the core query options plus an optional `config`. */\nexport type UseInventoryTvlParameters = GetInventoryTvlOptions & ConfigParameter;\n\n/** Return type of {@link useInventoryTvl}: aggregate TVL as an 18-decimal `bigint`. */\nexport type UseInventoryTvlReturnType = UseQueryResult<GetInventoryTvlReturnType, SymmioRequestError>;\n\n/**\n * Read the system-wide custodial TVL from the connected chain's inventory\n * service — the headline TVL figure on a pools page.\n *\n * Returned as a `bigint` at `INVENTORY_VALUE_DECIMALS` (18); format with\n * `formatUnits`. This is **not** the sum of the pool catalogue's per-pool `tvl`\n * values — the catalogue covers listed markets, this covers the whole custodial\n * system. Errors are normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: tvl } = useInventoryTvl();\n * ```\n */\nexport function useInventoryTvl(parameters: UseInventoryTvlParameters = {}): UseInventoryTvlReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getInventoryTvlQueryOptions(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 UseInventoryTvlReturnType;\n}\n"],"mappings":";;;;;;;AAkCA,SAAgB,EAAgB,IAAwC,CAAC,GAA8B;CACrG,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA4B,GAAQ;EAClD,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"}
|
package/dist/margin/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/margin/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/margin/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AccountBalanceInfo, ConfigParameter, MarginRiskMetrics } from '@symmio/trading-core';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useAccountMarginRisk}.
|
|
6
|
+
*/
|
|
7
|
+
export interface UseAccountMarginRiskParameters extends ConfigParameter {
|
|
8
|
+
/** Account (sub-account or Virtual Account) the metrics describe. Idle until set. */
|
|
9
|
+
account?: Address;
|
|
10
|
+
/**
|
|
11
|
+
* **Signed** unrealized PnL of this **whole** account, wei (positive = in
|
|
12
|
+
* profit). Feed it from `aggregateGroupUpnl` when the account's positions are
|
|
13
|
+
* one group, or from a Muon attestation. Leaving it out reports the account as
|
|
14
|
+
* if it were flat.
|
|
15
|
+
* @default 0n
|
|
16
|
+
*/
|
|
17
|
+
upnl?: bigint;
|
|
18
|
+
/**
|
|
19
|
+
* Refetch the balance when an open/close settles on-chain, so the figures do
|
|
20
|
+
* not lag a just-settled trade.
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
live?: boolean;
|
|
24
|
+
/** Optional override; defaults to the connected chain. */
|
|
25
|
+
chainId?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Return type of {@link useAccountMarginRisk}.
|
|
29
|
+
*/
|
|
30
|
+
export interface UseAccountMarginRiskReturnType {
|
|
31
|
+
/** The account's margin & risk figures; `undefined` until the balance read resolves. */
|
|
32
|
+
metrics?: MarginRiskMetrics;
|
|
33
|
+
/** The raw `balanceInfoOfPartyA` fields the metrics were computed from. */
|
|
34
|
+
balanceInfo?: AccountBalanceInfo;
|
|
35
|
+
/** `true` while the underlying balance query is loading. */
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
/** Normalized request error, when one occurred. */
|
|
38
|
+
error: SymmioRequestError | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Margin and liquidation-risk state of one account: reads its
|
|
42
|
+
* `balanceInfoOfPartyA` and folds it with the account's unrealized PnL through
|
|
43
|
+
* core's pure {@link calculateMarginRisk}.
|
|
44
|
+
*
|
|
45
|
+
* All arithmetic lives in core; this hook only wires the read to the fold and
|
|
46
|
+
* memoizes the result, so the returned object is referentially stable while the
|
|
47
|
+
* balance and `upnl` are unchanged.
|
|
48
|
+
*
|
|
49
|
+
* **Pass the uPnL of this account's whole book.** `equity = allocatedBalance +
|
|
50
|
+
* upnl`, so feeding the uPnL of a subset (one group of a multi-group account)
|
|
51
|
+
* understates equity and everything derived from it.
|
|
52
|
+
*
|
|
53
|
+
* For a merged position, prefer `useQuoteGroupMarginRisk` — it resolves the
|
|
54
|
+
* group's Virtual Account and folds the group uPnL for you. Reach for this hook
|
|
55
|
+
* directly for an account-level panel, or to fan out over a group that spans
|
|
56
|
+
* several accounts.
|
|
57
|
+
*
|
|
58
|
+
* @param parameters - The account and its uPnL, plus optional chain/config overrides.
|
|
59
|
+
* @returns The account's metrics, the raw balance fields, and query state.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```tsx
|
|
63
|
+
* const { metrics, isLoading } = useAccountMarginRisk({ account, upnl });
|
|
64
|
+
* if (metrics?.isLiquidatable) return <LiquidationWarning />;
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function useAccountMarginRisk(parameters?: UseAccountMarginRiskParameters): UseAccountMarginRiskReturnType;
|
|
68
|
+
//# sourceMappingURL=use-account-margin-risk.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-margin-risk.d.ts","sourceRoot":"","sources":["../../src/margin/use-account-margin-risk.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,8BAA+B,SAAQ,eAAe;IACrE,qFAAqF;IACrF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C,wFAAwF;IACxF,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,4DAA4D;IAC5D,SAAS,EAAE,OAAO,CAAC;IACnB,mDAAmD;IACnD,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,GAAE,8BAAmC,GAAG,8BAA8B,CAepH"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useAccountBalanceInfo as e } from "../account-layer/use-account-balance-info.js";
|
|
3
|
+
import { calculateMarginRisk as t } from "@symmio/trading-core";
|
|
4
|
+
import { useMemo as n } from "react";
|
|
5
|
+
//#region src/margin/use-account-margin-risk.ts
|
|
6
|
+
function r(r = {}) {
|
|
7
|
+
let { account: i, upnl: a = 0n, live: o = !0, chainId: s, config: c } = r, l = e({
|
|
8
|
+
account: i,
|
|
9
|
+
live: o,
|
|
10
|
+
chainId: s,
|
|
11
|
+
config: c
|
|
12
|
+
}), u = l.data, d = n(() => u ? t({
|
|
13
|
+
...u,
|
|
14
|
+
upnl: a
|
|
15
|
+
}) : void 0, [u, a]);
|
|
16
|
+
return n(() => ({
|
|
17
|
+
metrics: d,
|
|
18
|
+
balanceInfo: u,
|
|
19
|
+
isLoading: l.isLoading,
|
|
20
|
+
error: l.error
|
|
21
|
+
}), [
|
|
22
|
+
d,
|
|
23
|
+
u,
|
|
24
|
+
l.isLoading,
|
|
25
|
+
l.error
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { r as useAccountMarginRisk };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=use-account-margin-risk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-account-margin-risk.js","names":[],"sources":["../../src/margin/use-account-margin-risk.ts"],"sourcesContent":["\"use client\";\n\nimport {\n calculateMarginRisk,\n type AccountBalanceInfo,\n type ConfigParameter,\n type MarginRiskMetrics,\n} from \"@symmio/trading-core\";\nimport { useMemo } from \"react\";\nimport type { Address } from \"viem\";\nimport { useAccountBalanceInfo } from \"../account-layer/use-account-balance-info\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\n\n/**\n * Parameters for {@link useAccountMarginRisk}.\n */\nexport interface UseAccountMarginRiskParameters extends ConfigParameter {\n /** Account (sub-account or Virtual Account) the metrics describe. Idle until set. */\n account?: Address;\n /**\n * **Signed** unrealized PnL of this **whole** account, wei (positive = in\n * profit). Feed it from `aggregateGroupUpnl` when the account's positions are\n * one group, or from a Muon attestation. Leaving it out reports the account as\n * if it were flat.\n * @default 0n\n */\n upnl?: bigint;\n /**\n * Refetch the balance when an open/close settles on-chain, so the figures do\n * not lag a just-settled trade.\n * @default true\n */\n live?: boolean;\n /** Optional override; defaults to the connected chain. */\n chainId?: number;\n}\n\n/**\n * Return type of {@link useAccountMarginRisk}.\n */\nexport interface UseAccountMarginRiskReturnType {\n /** The account's margin & risk figures; `undefined` until the balance read resolves. */\n metrics?: MarginRiskMetrics;\n /** The raw `balanceInfoOfPartyA` fields the metrics were computed from. */\n balanceInfo?: AccountBalanceInfo;\n /** `true` while the underlying balance query is loading. */\n isLoading: boolean;\n /** Normalized request error, when one occurred. */\n error: SymmioRequestError | null;\n}\n\n/**\n * Margin and liquidation-risk state of one account: reads its\n * `balanceInfoOfPartyA` and folds it with the account's unrealized PnL through\n * core's pure {@link calculateMarginRisk}.\n *\n * All arithmetic lives in core; this hook only wires the read to the fold and\n * memoizes the result, so the returned object is referentially stable while the\n * balance and `upnl` are unchanged.\n *\n * **Pass the uPnL of this account's whole book.** `equity = allocatedBalance +\n * upnl`, so feeding the uPnL of a subset (one group of a multi-group account)\n * understates equity and everything derived from it.\n *\n * For a merged position, prefer `useQuoteGroupMarginRisk` — it resolves the\n * group's Virtual Account and folds the group uPnL for you. Reach for this hook\n * directly for an account-level panel, or to fan out over a group that spans\n * several accounts.\n *\n * @param parameters - The account and its uPnL, plus optional chain/config overrides.\n * @returns The account's metrics, the raw balance fields, and query state.\n *\n * @example\n * ```tsx\n * const { metrics, isLoading } = useAccountMarginRisk({ account, upnl });\n * if (metrics?.isLiquidatable) return <LiquidationWarning />;\n * ```\n */\nexport function useAccountMarginRisk(parameters: UseAccountMarginRiskParameters = {}): UseAccountMarginRiskReturnType {\n const { account, upnl = 0n, live = true, chainId, config } = parameters;\n\n const balanceQuery = useAccountBalanceInfo({ account, live, chainId, config });\n const balanceInfo = balanceQuery.data;\n\n const metrics = useMemo(\n () => (balanceInfo ? calculateMarginRisk({ ...balanceInfo, upnl }) : undefined),\n [balanceInfo, upnl],\n );\n\n return useMemo(\n () => ({ metrics, balanceInfo, isLoading: balanceQuery.isLoading, error: balanceQuery.error }),\n [metrics, balanceInfo, balanceQuery.isLoading, balanceQuery.error],\n );\n}\n"],"mappings":";;;;;AA8EA,SAAgB,EAAqB,IAA6C,CAAC,GAAmC;CACpH,IAAM,EAAE,YAAS,UAAO,IAAI,UAAO,IAAM,YAAS,cAAW,GAEvD,IAAe,EAAsB;EAAE;EAAS;EAAM;EAAS;CAAO,CAAC,GACvE,IAAc,EAAa,MAE3B,IAAU,QACP,IAAc,EAAoB;EAAE,GAAG;EAAa;CAAK,CAAC,IAAI,KAAA,GACrE,CAAC,GAAa,CAAI,CACpB;CAEA,OAAO,SACE;EAAE;EAAS;EAAa,WAAW,EAAa;EAAW,OAAO,EAAa;CAAM,IAC5F;EAAC;EAAS;EAAa,EAAa;EAAW,EAAa;CAAK,CACnE;AACF"}
|