@velora-dex/widget 0.8.3 → 0.8.4-dev.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/components/widget/AppHeader/Activities/hooks.d.ts.map +1 -1
- package/dist/components/widget/AppHeader/Activities/hooks.js +51 -51
- package/dist/components/widget/AppHeader/Activities/hooks.js.map +1 -1
- package/dist/components/widget/AppHeader/Activities/utils.d.ts +3 -3
- package/dist/components/widget/AppHeader/Activities/utils.d.ts.map +1 -1
- package/dist/components/widget/AppHeader/Activities/utils.js +25 -26
- package/dist/components/widget/AppHeader/Activities/utils.js.map +1 -1
- package/dist/components/widget/BridgeList/hooks.d.ts +2 -2
- package/dist/components/widget/BridgeList/hooks.d.ts.map +1 -1
- package/dist/components/widget/BridgeList/hooks.js +78 -72
- package/dist/components/widget/BridgeList/hooks.js.map +1 -1
- package/dist/components/widget/BridgeSelectorExpandable/BridgeSelectorExpandable.d.ts +2 -2
- package/dist/components/widget/BridgeSelectorExpandable/BridgeSelectorExpandable.d.ts.map +1 -1
- package/dist/components/widget/BridgeSelectorExpandable/BridgeSelectorExpandable.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/SelectTokenDialog.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/AcrossTokenList.d.ts +2 -2
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/AcrossTokenList.d.ts.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/AcrossTokenList.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/LimitOrderDetails.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/LimitOrderDetails.js +18 -22
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/LimitOrderDetails.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/utils.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/utils.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.d.ts +6 -3
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.js +58 -54
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/constants.d.ts +1 -1
- package/dist/components/widget/LimitOrderItem/constants.js +1 -1
- package/dist/components/widget/LimitOrderItem/constants.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/types.d.ts +2 -2
- package/dist/components/widget/LimitOrderItem/types.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/utils.d.ts +2 -4
- package/dist/components/widget/LimitOrderItem/utils.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/utils.js +1 -4
- package/dist/components/widget/LimitOrderItem/utils.js.map +1 -1
- package/dist/components/widget/OtcOrderItem/OtcOrderDetails/OtcOrderDetails.js +9 -9
- package/dist/components/widget/OtcOrderItem/OtcOrderListItem.js +15 -10
- package/dist/components/widget/OtcOrderItem/OtcOrderListItem.js.map +1 -1
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.d.ts +2 -2
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.js +86 -86
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/useTradeCompleteDetails.js +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/useTradeCompleteDetails.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/utils.js +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/utils.js.map +1 -1
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.d.ts +2 -2
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.js +83 -83
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.js.map +1 -1
- package/dist/components/widget/TradeOverview/utils/useSwapAmountsWithSlippage.d.ts +4 -1
- package/dist/components/widget/TradeOverview/utils/useSwapAmountsWithSlippage.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/utils/useSwapAmountsWithSlippage.js +1 -1
- package/dist/components/widget/TradeOverview/utils/useSwapAmountsWithSlippage.js.map +1 -1
- package/dist/core/LimitOrderButton.d.ts.map +1 -1
- package/dist/core/LimitOrderButton.js +47 -53
- package/dist/core/LimitOrderButton.js.map +1 -1
- package/dist/core/TradeFlowScreenButton.d.ts +3 -4
- package/dist/core/TradeFlowScreenButton.d.ts.map +1 -1
- package/dist/core/TradeFlowScreenButton.js.map +1 -1
- package/dist/core/Updaters.js +1 -1
- package/dist/core/Updaters.js.map +1 -1
- package/dist/core/across/isCrosschainPossible.d.ts +2 -2
- package/dist/core/across/isCrosschainPossible.d.ts.map +1 -1
- package/dist/core/across/isCrosschainPossible.js.map +1 -1
- package/dist/core/across/utils.d.ts +4 -4
- package/dist/core/across/utils.d.ts.map +1 -1
- package/dist/core/across/utils.js +25 -15
- package/dist/core/across/utils.js.map +1 -1
- package/dist/core/button/hooks/useWidgetButtonExtraProps.d.ts.map +1 -1
- package/dist/core/button/hooks/useWidgetButtonExtraProps.js +1 -4
- package/dist/core/button/hooks/useWidgetButtonExtraProps.js.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/inputs/hooks/useTokenFromInputProps.d.ts.map +1 -1
- package/dist/core/inputs/hooks/useTokenFromInputProps.js +3 -3
- package/dist/core/inputs/hooks/useTokenFromInputProps.js.map +1 -1
- package/dist/core/inputs/hooks/useTokenToInputProps.d.ts.map +1 -1
- package/dist/core/inputs/hooks/useTokenToInputProps.js +2 -2
- package/dist/core/inputs/hooks/useTokenToInputProps.js.map +1 -1
- package/dist/core/inputs/hooks/useWarningMessage.d.ts +2 -2
- package/dist/core/inputs/hooks/useWarningMessage.d.ts.map +1 -1
- package/dist/core/inputs/hooks/useWarningMessage.js.map +1 -1
- package/dist/core/inputs/hooks/utils.d.ts.map +1 -1
- package/dist/core/inputs/hooks/utils.js +7 -5
- package/dist/core/inputs/hooks/utils.js.map +1 -1
- package/dist/core/inputs/state/setTokenByAddressAtom.js +1 -1
- package/dist/core/inputs/state/setTokenByAddressAtom.js.map +1 -1
- package/dist/core/limit/state/utils.d.ts +1 -1
- package/dist/core/limit/useLimitRate.d.ts +2 -3
- package/dist/core/limit/useLimitRate.d.ts.map +1 -1
- package/dist/core/limit/useLimitRate.js +54 -110
- package/dist/core/limit/useLimitRate.js.map +1 -1
- package/dist/core/limit/useLimitTokenFromInputProps.js +1 -1
- package/dist/core/limit/useLimitTokenFromInputProps.js.map +1 -1
- package/dist/core/limit/useLimitTokenToInputProps.d.ts.map +1 -1
- package/dist/core/limit/useLimitTokenToInputProps.js +1 -4
- package/dist/core/limit/useLimitTokenToInputProps.js.map +1 -1
- package/dist/core/state/configEffectAtom.js +1 -1
- package/dist/core/state/configEffectAtom.js.map +1 -1
- package/dist/core/state/getSelectableDestChains.d.ts +2 -2
- package/dist/core/state/getSelectableDestChains.d.ts.map +1 -1
- package/dist/core/state/getSelectableDestChains.js.map +1 -1
- package/dist/core/swapDetails/fees.d.ts.map +1 -1
- package/dist/core/swapDetails/fees.js +16 -11
- package/dist/core/swapDetails/fees.js.map +1 -1
- package/dist/core/swapDetails/maxToPay.d.ts.map +1 -1
- package/dist/core/swapDetails/maxToPay.js +18 -17
- package/dist/core/swapDetails/maxToPay.js.map +1 -1
- package/dist/core/twap/twapDetails/minimumReceiveable.d.ts +2 -2
- package/dist/core/twap/twapDetails/minimumReceiveable.d.ts.map +1 -1
- package/dist/core/twap/twapDetails/minimumReceiveable.js.map +1 -1
- package/dist/core/twap/useTwapTokenFromInputProps.js +3 -3
- package/dist/core/twap/useTwapTokenFromInputProps.js.map +1 -1
- package/dist/events/hooks/useOnPriceUpdates.js.map +1 -1
- package/dist/events/types/cancelOrder.d.ts +2 -2
- package/dist/events/types/cancelOrder.d.ts.map +1 -1
- package/dist/events/types/priceChange.d.ts +2 -2
- package/dist/events/types/priceChange.d.ts.map +1 -1
- package/dist/events/types/swap.d.ts +3 -3
- package/dist/events/types/swap.d.ts.map +1 -1
- package/dist/events/types/twap.d.ts +2 -2
- package/dist/events/types/twap.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/bridge/useSelectedBridgePrice.d.ts +3 -4
- package/dist/hooks/swap/prices/delta/bridge/useSelectedBridgePrice.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/bridge/useSelectedBridgePrice.js.map +1 -1
- package/dist/hooks/swap/prices/delta/bridge/utils.d.ts +6 -3
- package/dist/hooks/swap/prices/delta/bridge/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/bridge/utils.js +20 -17
- package/dist/hooks/swap/prices/delta/bridge/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.js +6 -6
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/useDepositAndSubmitTwapOrder.js +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/useDepositAndSubmitTwapOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.js +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/usePreSignAndSubmitTwapOrder.js +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/usePreSignAndSubmitTwapOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/useTwapOrderToPost.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/useTwapOrderToPost.js +27 -28
- package/dist/hooks/swap/prices/delta/mutations/twap/useTwapOrderToPost.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/types.d.ts +3 -3
- package/dist/hooks/swap/prices/delta/mutations/types.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrders.js +3 -3
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrders.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrdersEvents.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrdersEvents.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrdersEvents.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.js +85 -84
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.js +4 -4
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useDeltaOrderToPost.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useDeltaOrderToPost.js +27 -28
- package/dist/hooks/swap/prices/delta/mutations/useDeltaOrderToPost.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.js +2 -2
- package/dist/hooks/swap/prices/delta/mutations/useIsDeltaOrderCancellable.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.js +1 -1
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useSendDepositPreSignDeltaOrderTx.js +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useSendDepositPreSignDeltaOrderTx.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.js +2 -2
- package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/utils.d.ts +5 -6
- package/dist/hooks/swap/prices/delta/mutations/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/utils.js +5 -5
- package/dist/hooks/swap/prices/delta/mutations/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/types.d.ts +8 -28
- package/dist/hooks/swap/prices/delta/orders/types.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/unposted/index.d.ts +2 -2
- package/dist/hooks/swap/prices/delta/orders/unposted/index.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/unposted/index.js.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.d.ts +31 -42
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.js +18 -18
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/utils.d.ts +19 -49
- package/dist/hooks/swap/prices/delta/orders/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/utils.js +23 -58
- package/dist/hooks/swap/prices/delta/orders/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeProtocols/useBridgeProtocols.js +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeProtocols/useBridgeProtocols.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/bridgeRoutesLoadedAtom.d.ts +2 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/bridgeRoutesLoadedAtom.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/{bridgeInfo/bridgeInfosLoadedAtom.js → bridgeRoutes/bridgeRoutesLoadedAtom.js} +4 -4
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/bridgeRoutesLoadedAtom.js.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/common.d.ts +6 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/common.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/common.js +9 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/common.js.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/getBridgeRoutesQueryData.d.ts +3 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/getBridgeRoutesQueryData.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/getBridgeRoutesQueryData.js +11 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/getBridgeRoutesQueryData.js.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/types.d.ts +19 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/types.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/useBridgeRoutes.d.ts +3 -0
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/useBridgeRoutes.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/{bridgeInfo/useBridgeInfo.js → bridgeRoutes/useBridgeRoutes.js} +6 -6
- package/dist/hooks/swap/prices/delta/queries/bridgeRoutes/useBridgeRoutes.js.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/errors.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/{useDeltaLimitOrderRequiredBalance.d.ts → useDeltaOrderRequiredBalance.d.ts} +10 -10
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrderRequiredBalance.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/{useDeltaLimitOrderRequiredBalance.js → useDeltaOrderRequiredBalance.js} +5 -5
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrderRequiredBalance.js.map +1 -0
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrders.d.ts +6 -6
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrders.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrders.js +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrders.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.d.ts +19 -36
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js +5 -5
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.js +1 -1
- package/dist/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.d.ts +14 -22
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.js +71 -62
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/factory.d.ts.map +1 -1
- package/dist/hooks/swap/prices/factory.js +1 -1
- package/dist/hooks/swap/prices/factory.js.map +1 -1
- package/dist/hooks/swap/prices/types.d.ts +2 -3
- package/dist/hooks/swap/prices/types.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.d.ts +3 -3
- package/dist/hooks/swap/prices/useSwapPrices.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.js +108 -111
- package/dist/hooks/swap/prices/useSwapPrices.js.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.js +3 -3
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.js.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromTwapPrice.d.ts +2 -2
- package/dist/hooks/swap/prices/useTokenInputsFromTwapPrice.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromTwapPrice.js.map +1 -1
- package/dist/hooks/swap/prices/useTwapPrices.d.ts +4 -5
- package/dist/hooks/swap/prices/useTwapPrices.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useTwapPrices.js +70 -73
- package/dist/hooks/swap/prices/useTwapPrices.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.d.ts +12 -19
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.js +6 -6
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/factory/preSignAndSubmitOrderFactory.d.ts +4 -4
- package/dist/hooks/swap/tradeFlow/common/factory/preSignAndSubmitOrderFactory.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/factory/preSignAndSubmitOrderFactory.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useDepositAndSubmitDeltaOrder.js +1 -1
- package/dist/hooks/swap/tradeFlow/common/useDepositAndSubmitDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/usePreSignAndSubmitDeltaOrder.js +1 -1
- package/dist/hooks/swap/tradeFlow/common/usePreSignAndSubmitDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useRequiredAllowanceForOrders.js +1 -1
- package/dist/hooks/swap/tradeFlow/common/useRequiredAllowanceForOrders.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts +5 -5
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js +222 -227
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaSwapStep.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.d.ts +2 -2
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.js +159 -196
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useTwapFlow.d.ts +5 -5
- package/dist/hooks/swap/tradeFlow/useTwapFlow.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useTwapFlow.js +221 -233
- package/dist/hooks/swap/tradeFlow/useTwapFlow.js.map +1 -1
- package/dist/hooks/tokens/balances/useIsLimitOrderInsufficientBalance.js +1 -1
- package/dist/hooks/tokens/balances/useIsLimitOrderInsufficientBalance.js.map +1 -1
- package/dist/hooks/tokens/useAllTokensWithFilter.d.ts +2 -2
- package/dist/hooks/tokens/useAllTokensWithFilter.d.ts.map +1 -1
- package/dist/hooks/tokens/useAllTokensWithFilter.js.map +1 -1
- package/dist/hooks/tokens/useTokensFromAcross.d.ts +2 -2
- package/dist/hooks/tokens/useTokensFromAcross.d.ts.map +1 -1
- package/dist/hooks/tokens/useTokensFromAcross.js +7 -10
- package/dist/hooks/tokens/useTokensFromAcross.js.map +1 -1
- package/dist/hooks/useAvailableCrosses.d.ts +3 -3
- package/dist/hooks/useAvailableCrosses.d.ts.map +1 -1
- package/dist/hooks/useAvailableCrosses.js +18 -17
- package/dist/hooks/useAvailableCrosses.js.map +1 -1
- package/dist/hooks/useBridgeRoutes.d.ts +6 -0
- package/dist/hooks/useBridgeRoutes.d.ts.map +1 -0
- package/dist/hooks/{useBridgeInfo.js → useBridgeRoutes.js} +4 -4
- package/dist/hooks/useBridgeRoutes.js.map +1 -0
- package/dist/hooks/useIsCrosschainPossible.d.ts +2 -2
- package/dist/hooks/useIsCrosschainPossible.d.ts.map +1 -1
- package/dist/hooks/useIsCrosschainPossible.js +15 -13
- package/dist/hooks/useIsCrosschainPossible.js.map +1 -1
- package/dist/hooks/useSDK.d.ts +11 -11
- package/dist/hooks/useSDK.d.ts.map +1 -1
- package/dist/hooks/useSDK.js +42 -42
- package/dist/hooks/useSDK.js.map +1 -1
- package/dist/hooks/useSelectableDestChains.d.ts +2 -2
- package/dist/hooks/useSelectableDestChains.d.ts.map +1 -1
- package/dist/hooks/useSelectableDestChains.js.map +1 -1
- package/dist/lib/queryClient.js +3 -3
- package/dist/lib/queryClient.js.map +1 -1
- package/dist/lib/utils/price.d.ts +5 -2
- package/dist/lib/utils/price.d.ts.map +1 -1
- package/dist/lib/utils/price.js +8 -5
- package/dist/lib/utils/price.js.map +1 -1
- package/dist/lib/utils/toasts.d.ts +3 -3
- package/dist/lib/utils/toasts.d.ts.map +1 -1
- package/dist/lib/utils/toasts.js.map +1 -1
- package/dist/lib/utils/twap.d.ts +19 -4
- package/dist/lib/utils/twap.d.ts.map +1 -1
- package/dist/lib/utils/twap.js +29 -18
- package/dist/lib/utils/twap.js.map +1 -1
- package/package.json +2 -2
- package/dist/hooks/swap/prices/delta/bridge/const.d.ts +0 -8
- package/dist/hooks/swap/prices/delta/bridge/const.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/bridge/const.js +0 -13
- package/dist/hooks/swap/prices/delta/bridge/const.js.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/bridgeInfosLoadedAtom.d.ts +0 -2
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/bridgeInfosLoadedAtom.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/bridgeInfosLoadedAtom.js.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/common.d.ts +0 -6
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/common.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/common.js +0 -9
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/common.js.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/getBridgeInfoQueryData.d.ts +0 -4
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/getBridgeInfoQueryData.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/getBridgeInfoQueryData.js +0 -11
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/getBridgeInfoQueryData.js.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/types.d.ts +0 -19
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/types.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/useBridgeInfo.d.ts +0 -3
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/useBridgeInfo.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/useBridgeInfo.js.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaLimitOrderRequiredBalance.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaLimitOrderRequiredBalance.js.map +0 -1
- package/dist/hooks/useBridgeInfo.d.ts +0 -7
- package/dist/hooks/useBridgeInfo.d.ts.map +0 -1
- package/dist/hooks/useBridgeInfo.js.map +0 -1
|
@@ -2,14 +2,14 @@ import { MarkRequired } from 'ts-essentials';
|
|
|
2
2
|
import { UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
4
|
import { SupportedChainId } from '../../../../../lib/web3/wagmi/types';
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type
|
|
5
|
+
type DeltaOrderRequiredBalanceReturn = Record<string, string>;
|
|
6
|
+
type DeltaOrderRequiredBalanceQueryParams<TData = DeltaOrderRequiredBalanceReturn> = Omit<UseQueryOptions<DeltaOrderRequiredBalanceReturn, Error, TData, DeltaOrderRequiredBalanceQueryKey>, "queryKey" | "queryFn">;
|
|
7
|
+
type DeltaOrderRequiredBalanceQueryResult<TData = DeltaOrderRequiredBalanceReturn> = UseQueryResult<TData, Error>;
|
|
8
|
+
type DeltaOrderRequiredBalanceQueryInput<TData = DeltaOrderRequiredBalanceReturn> = {
|
|
9
9
|
tokenAddress?: string;
|
|
10
|
-
query?:
|
|
10
|
+
query?: DeltaOrderRequiredBalanceQueryParams<TData>;
|
|
11
11
|
};
|
|
12
|
-
type
|
|
12
|
+
type DeltaOrderRequiredBalanceQueryKey = [
|
|
13
13
|
base: "delta/getRequiredBalance",
|
|
14
14
|
{
|
|
15
15
|
chainId: number;
|
|
@@ -17,12 +17,12 @@ type DeltaLimitOrderRequiredBalanceQueryKey = [
|
|
|
17
17
|
tokenAddress?: string;
|
|
18
18
|
}
|
|
19
19
|
];
|
|
20
|
-
export declare function
|
|
21
|
-
export declare function
|
|
20
|
+
export declare function useDeltaOrderRequiredBalance<TData = DeltaOrderRequiredBalanceReturn>({ tokenAddress, query, }: DeltaOrderRequiredBalanceQueryInput<TData>): DeltaOrderRequiredBalanceQueryResult<TData>;
|
|
21
|
+
export declare function deltaOrderRequiredBalanceQueryKey({ chainId, account, tokenAddress, }: {
|
|
22
22
|
chainId: SupportedChainId;
|
|
23
23
|
account?: Address;
|
|
24
24
|
tokenAddress?: string;
|
|
25
|
-
}):
|
|
25
|
+
}): DeltaOrderRequiredBalanceQueryKey;
|
|
26
26
|
type DeltaOrderRequiredAllowanceInput = {
|
|
27
27
|
tokenAddress?: string;
|
|
28
28
|
amount?: string | bigint;
|
|
@@ -40,4 +40,4 @@ export declare function useDeltaOrderRequiredAllowance({ tokenAddress, amount, e
|
|
|
40
40
|
};
|
|
41
41
|
export declare function useDeltaOrderRequiredAllowance({ tokenAddress, amount, enabled, }: DeltaOrderRequiredAllowanceInput): DeltaOrderRequiredAllowanceResult;
|
|
42
42
|
export {};
|
|
43
|
-
//# sourceMappingURL=
|
|
43
|
+
//# sourceMappingURL=useDeltaOrderRequiredBalance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeltaOrderRequiredBalance.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaOrderRequiredBalance.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAO/D,KAAK,+BAA+B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9D,KAAK,oCAAoC,CACvC,KAAK,GAAG,+BAA+B,IACrC,IAAI,CACN,eAAe,CACb,+BAA+B,EAC/B,KAAK,EACL,KAAK,EACL,iCAAiC,CAClC,EACD,UAAU,GAAG,SAAS,CACvB,CAAC;AACF,KAAK,oCAAoC,CACvC,KAAK,GAAG,+BAA+B,IACrC,cAAc,C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AE,gCAAgC,GAAG;IACpC,MAAM,EAAE,SAAS,CAAC;CACnB,GAAG,iCAAiC,GAAG;IAAE,iBAAiB,EAAE,SAAS,CAAA;CAAE,CAAC;AACzE,wBAAgB,8BAA8B,CAAC,EAC7C,YAAY,EACZ,MAAM,EACN,OAAO,GACR,EAAE,gCAAgC,GAAG,iCAAiC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDeltaV2SDK as e } from "../../../../useSDK.js";
|
|
2
2
|
import { LONG_STALE_TIME_FOR_REACTIVENESS as t } from "../../../../../lib/constants/time.js";
|
|
3
3
|
import { useMinViemClient as n } from "../../../../useMinViemClient.js";
|
|
4
4
|
import { c as r } from "react-compiler-runtime";
|
|
@@ -6,7 +6,7 @@ import { useQuery as i } from "@tanstack/react-query";
|
|
|
6
6
|
import { assert as a } from "ts-essentials";
|
|
7
7
|
import { isAddress as o } from "viem";
|
|
8
8
|
import { useAccount as s, useChainId as c } from "wagmi";
|
|
9
|
-
//#region src/hooks/swap/prices/delta/queries/
|
|
9
|
+
//#region src/hooks/swap/prices/delta/queries/useDeltaOrderRequiredBalance.ts
|
|
10
10
|
function l(t) {
|
|
11
11
|
let l = r(26), { tokenAddress: d, query: f } = t, p = c(), { address: m } = s(), h;
|
|
12
12
|
l[0] !== m || l[1] !== p ? (h = {
|
|
@@ -28,7 +28,7 @@ function l(t) {
|
|
|
28
28
|
let b;
|
|
29
29
|
l[11] !== m || l[12] !== v || l[13] !== d ? (b = (e) => {
|
|
30
30
|
let { signal: t } = e;
|
|
31
|
-
return a(v, "SDK not initialized"), a(m, "account is required"), v.
|
|
31
|
+
return a(v, "SDK not initialized"), a(m, "account is required"), v.getRequiredBalanceForDeltaOrders({
|
|
32
32
|
userAddress: m,
|
|
33
33
|
tokenAddress: d
|
|
34
34
|
}, { signal: t });
|
|
@@ -72,6 +72,6 @@ function d({ tokenAddress: e, amount: n, enabled: r }) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
75
|
-
export { u as
|
|
75
|
+
export { u as deltaOrderRequiredBalanceQueryKey, d as useDeltaOrderRequiredAllowance, l as useDeltaOrderRequiredBalance };
|
|
76
76
|
|
|
77
|
-
//# sourceMappingURL=
|
|
77
|
+
//# sourceMappingURL=useDeltaOrderRequiredBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeltaOrderRequiredBalance.js","names":["useDeltaV2SDK","assert","MarkRequired","useAccount","useChainId","useMinViemClient","useQuery","UseQueryOptions","UseQueryResult","isAddress","Address","SupportedChainId","LONG_STALE_TIME_FOR_REACTIVENESS","DeltaOrderRequiredBalanceReturn","Record","DeltaOrderRequiredBalanceQueryParams","Omit","Error","TData","DeltaOrderRequiredBalanceQueryKey","DeltaOrderRequiredBalanceQueryResult","DeltaOrderRequiredBalanceQueryInput","tokenAddress","query","base","chainId","account","useDeltaOrderRequiredBalance","t0","$","_c","address","t1","minClient","t2","client","sdk","t3","deltaOrderRequiredBalanceQueryKey","t4","t5","signal","getRequiredBalanceForDeltaOrders","userAddress","enabled","t6","queryKey","queryFn","toLowerCase","const","DeltaOrderRequiredAllowanceInput","amount","DeltaOrderRequiredAllowanceResult","combinedAllowance","isLoading","useDeltaOrderRequiredAllowance","data","balanceRequiredForCurrentOrders","staleTime","select","balanceRequired","BigInt","undefined"],"sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaOrderRequiredBalance.ts"],"sourcesContent":["import { useDeltaV2SDK } from \"@/hooks/useSDK\";\nimport { assert, type MarkRequired } from \"ts-essentials\";\nimport { useAccount, useChainId } from \"wagmi\";\nimport { useMinViemClient } from \"@/hooks/useMinViemClient\";\nimport {\n useQuery,\n type UseQueryOptions,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\n\nimport { isAddress, type Address } from \"viem\";\nimport type { SupportedChainId } from \"@/lib/web3/wagmi/types\";\nimport { LONG_STALE_TIME_FOR_REACTIVENESS } from \"@/lib/constants/time\";\n\n// ============================================================================\n// Types for getRequiredBalanceForDeltaOrders\n// ============================================================================\n\ntype DeltaOrderRequiredBalanceReturn = Record<string, string>;\n\ntype DeltaOrderRequiredBalanceQueryParams<\n TData = DeltaOrderRequiredBalanceReturn,\n> = Omit<\n UseQueryOptions<\n DeltaOrderRequiredBalanceReturn,\n Error,\n TData,\n DeltaOrderRequiredBalanceQueryKey\n >,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaOrderRequiredBalanceQueryResult<\n TData = DeltaOrderRequiredBalanceReturn,\n> = UseQueryResult<TData, Error>;\n\ntype DeltaOrderRequiredBalanceQueryInput<\n TData = DeltaOrderRequiredBalanceReturn,\n> = {\n tokenAddress?: string;\n query?: DeltaOrderRequiredBalanceQueryParams<TData>;\n};\n\ntype DeltaOrderRequiredBalanceQueryKey = [\n base: \"delta/getRequiredBalance\",\n { chainId: number; account?: Address; tokenAddress?: string },\n];\n\nexport function useDeltaOrderRequiredBalance<\n TData = DeltaOrderRequiredBalanceReturn,\n>({\n tokenAddress,\n query,\n}: DeltaOrderRequiredBalanceQueryInput<TData>): DeltaOrderRequiredBalanceQueryResult<TData> {\n const chainId = useChainId();\n const { address: account } = useAccount();\n const { minClient } = useMinViemClient({ chainId, account });\n\n const { sdk } = useDeltaV2SDK({\n chainId,\n client: minClient,\n account,\n });\n\n return useQuery<\n DeltaOrderRequiredBalanceReturn,\n Error,\n TData,\n DeltaOrderRequiredBalanceQueryKey\n >({\n queryKey: deltaOrderRequiredBalanceQueryKey({\n chainId,\n account,\n tokenAddress,\n }),\n queryFn: ({ signal }) => {\n assert(sdk, \"SDK not initialized\");\n assert(account, \"account is required\");\n\n return sdk.getRequiredBalanceForDeltaOrders(\n { userAddress: account, tokenAddress },\n { signal }\n );\n },\n ...query,\n enabled:\n !!(chainId && account && sdk) &&\n // either no specific token given\n (!tokenAddress ||\n // or a token with a valid address\n isAddress(tokenAddress)) &&\n (query?.enabled ?? true),\n });\n}\n\nexport function deltaOrderRequiredBalanceQueryKey({\n chainId,\n account,\n tokenAddress,\n}: {\n chainId: SupportedChainId;\n account?: Address;\n tokenAddress?: string;\n}): DeltaOrderRequiredBalanceQueryKey {\n return [\n \"delta/getRequiredBalance\",\n {\n chainId,\n account: account?.toLowerCase() as Address,\n tokenAddress: tokenAddress?.toLowerCase(),\n },\n ] as const;\n}\n\ntype DeltaOrderRequiredAllowanceInput = {\n tokenAddress?: string;\n amount?: string | bigint;\n enabled: boolean;\n};\n\ntype DeltaOrderRequiredAllowanceResult = {\n combinedAllowance?: bigint;\n isLoading: boolean;\n};\nexport function useDeltaOrderRequiredAllowance({\n tokenAddress,\n amount,\n enabled,\n}: MarkRequired<DeltaOrderRequiredAllowanceInput, \"amount\">): MarkRequired<\n DeltaOrderRequiredAllowanceResult,\n \"combinedAllowance\"\n>;\nexport function useDeltaOrderRequiredAllowance({\n tokenAddress,\n amount,\n enabled,\n}: DeltaOrderRequiredAllowanceInput & {\n amount: undefined;\n}): DeltaOrderRequiredAllowanceResult & { combinedAllowance: undefined };\nexport function useDeltaOrderRequiredAllowance({\n tokenAddress,\n amount,\n enabled,\n}: DeltaOrderRequiredAllowanceInput): DeltaOrderRequiredAllowanceResult;\nexport function useDeltaOrderRequiredAllowance({\n tokenAddress,\n amount,\n enabled,\n}: DeltaOrderRequiredAllowanceInput): DeltaOrderRequiredAllowanceResult {\n const { data: balanceRequiredForCurrentOrders, isLoading } =\n useDeltaOrderRequiredBalance({\n tokenAddress,\n query: {\n enabled: !!tokenAddress && enabled,\n staleTime: LONG_STALE_TIME_FOR_REACTIVENESS,\n select: (data) => {\n if (!tokenAddress) return 0n;\n\n const balanceRequired = data[tokenAddress.toLowerCase()];\n if (!balanceRequired) return 0n;\n return BigInt(balanceRequired);\n },\n },\n });\n\n if (!amount || !enabled || !balanceRequiredForCurrentOrders)\n // don't include current orders allowance if not enabled\n return {\n isLoading,\n combinedAllowance: amount !== undefined ? BigInt(amount) : undefined,\n };\n\n // amount required to cover allowance of current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AAO;IAE1B,IAAMsC,IAAkBJ,EAAKlC,EAAa0B,aAAa;IAEvD,OADKY,IACEC,OAAOD,EAAgB,GADD;;GAGjC;EACD,CAAC;CAYJ,OAVI,CAACT,KAAU,CAACP,KAAW,CAACa,IAEnB;EACLH;EACAD,mBAAmBF,MAAWW,KAAAA,IAA6BA,KAAAA,IAAjBD,OAAOV,EAAO;EACzD,GAKI;EACLE,mBAHwBQ,OAAOV,EAAO,GAAGM;EAIzCH;EACD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { QueryClient, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { DeltaV2 } from '@velora-dex/sdk';
|
|
3
3
|
import { MarkOptional } from 'ts-essentials';
|
|
4
4
|
type DeltaOrderByHashParams = string;
|
|
5
|
-
type DeltaOrderByHashReturn = DeltaAuction;
|
|
5
|
+
type DeltaOrderByHashReturn = DeltaV2.DeltaAuction;
|
|
6
6
|
type DeltaOrderByHashQueryParams<TData = DeltaOrderByHashReturn> = Omit<UseQueryOptions<DeltaOrderByHashReturn, Error, TData, DeltaOrderByHashQueryKey>, "queryKey" | "queryFn">;
|
|
7
7
|
type DeltaOrderByHashQueryResult<TData = DeltaOrderByHashReturn> = UseQueryResult<TData, Error>;
|
|
8
8
|
type DeltaOrderByHashQueryInput<TData = DeltaOrderByHashReturn> = {
|
|
@@ -14,7 +14,7 @@ type DeltaOrderByHashQueryKey = [
|
|
|
14
14
|
orderParams: DeltaOrderByHashParams
|
|
15
15
|
];
|
|
16
16
|
type DeltaOrderByIdParams = string;
|
|
17
|
-
type DeltaOrderByIdReturn = DeltaAuction;
|
|
17
|
+
type DeltaOrderByIdReturn = DeltaV2.DeltaAuction;
|
|
18
18
|
type DeltaOrderByIdQueryParams<TData = DeltaOrderByIdReturn> = Omit<UseQueryOptions<DeltaOrderByIdReturn, Error, TData, DeltaOrderByIdQueryKey>, "queryKey" | "queryFn">;
|
|
19
19
|
type DeltaOrderByIdQueryResult<TData = DeltaOrderByIdReturn> = UseQueryResult<TData, Error>;
|
|
20
20
|
type DeltaOrderByIdQueryInput<TData = DeltaOrderByIdReturn> = {
|
|
@@ -25,8 +25,8 @@ type DeltaOrderByIdQueryKey = [
|
|
|
25
25
|
base: "swap/delta/order-by-id",
|
|
26
26
|
orderParams: DeltaOrderByIdParams
|
|
27
27
|
];
|
|
28
|
-
type DeltaOrdersParams = Parameters<GetDeltaOrdersFunctions["getDeltaOrders"]>[0];
|
|
29
|
-
type DeltaOrdersReturn = Awaited<ReturnType<GetDeltaOrdersFunctions["getDeltaOrders"]>>;
|
|
28
|
+
type DeltaOrdersParams = Parameters<DeltaV2.GetDeltaOrdersFunctions["getDeltaOrders"]>[0];
|
|
29
|
+
type DeltaOrdersReturn = Awaited<ReturnType<DeltaV2.GetDeltaOrdersFunctions["getDeltaOrders"]>>;
|
|
30
30
|
type DeltaOrdersQueryParams<TData = DeltaOrdersReturn> = Omit<UseQueryOptions<DeltaOrdersReturn, Error, TData, DeltaOrdersQueryKey>, "queryKey" | "queryFn">;
|
|
31
31
|
type DeltaOrdersQueryResult<TData = DeltaOrdersReturn> = UseQueryResult<TData, Error>;
|
|
32
32
|
type DeltaOrdersQueryInput<TData = DeltaOrdersReturn> = {
|
|
@@ -45,7 +45,7 @@ declare const DELTA_ORDER_BY_HASH_QUERY_KEY = "swap/delta/order-by-hash";
|
|
|
45
45
|
export declare function useDeltaOrderByHashQuery<TData = DeltaOrderByHashReturn>({ orderHash, query, }: DeltaOrderByHashQueryInput<TData>): DeltaOrderByHashQueryResult<TData>;
|
|
46
46
|
export declare function ensureDeltaOrderByHashFactory({ queryClient, sdk, }: {
|
|
47
47
|
queryClient?: QueryClient;
|
|
48
|
-
sdk: GetDeltaOrdersFunctions;
|
|
48
|
+
sdk: DeltaV2.GetDeltaOrdersFunctions;
|
|
49
49
|
}): (orderHash: string) => Promise<DeltaOrderByHashReturn>;
|
|
50
50
|
export declare function useDeltaOrderByIdQuery<TData = DeltaOrderByIdReturn>({ orderParams, query, }: DeltaOrderByIdQueryInput<TData>): DeltaOrderByIdQueryResult<TData>;
|
|
51
51
|
export declare function useDeltaOrdersQuery<TData = DeltaOrdersReturn>({ orderParams, query, }: DeltaOrdersQueryInput<TData>): DeltaOrdersQueryResult<TData>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeltaOrders.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaOrders.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EAEX,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"useDeltaOrders.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaOrders.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EAEX,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAOlD,KAAK,sBAAsB,GAAG,MAAM,CAAC;AACrC,KAAK,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC;AAEnD,KAAK,2BAA2B,CAAC,KAAK,GAAG,sBAAsB,IAAI,IAAI,CACrE,eAAe,CACb,sBAAsB,EACtB,KAAK,EACL,KAAK,EACL,wBAAwB,CACzB,EACD,UAAU,GAAG,SAAS,CACvB,CAAC;AACF,KAAK,2BAA2B,CAAC,KAAK,GAAG,sBAAsB,IAC7D,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE/B,KAAK,0BAA0B,CAAC,KAAK,GAAG,sBAAsB,IAAI;IAChE,SAAS,EAAE,sBAAsB,CAAC;IAClC,KAAK,CAAC,EAAE,2BAA2B,CAAC,KAAK,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AG,iBAAiB,EAAE,EACjE,WAAW,EAAE,YAAY,EACzB,KAAK,GACN,EAAE,yBAAyB,CAAC,KAAK,CAAC,GAAG,sBAAsB,CAAC,KAAK,CAAC,CASlE;AAED,wBAAgB,mBAAmB,CAAC,EAClC,WAAW,EACX,GAAG,WAAW,EACf,EAAE,YAAY,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAAG,mBAAmB,CAQtE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assertProp as e } from "../../../../../lib/utils/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { useDeltaV2SDK as t } from "../../../../useSDK.js";
|
|
3
3
|
import { queryClient as n } from "../../../../../lib/queryClient.js";
|
|
4
4
|
import { c as r } from "react-compiler-runtime";
|
|
5
5
|
import { useQuery as i } from "@tanstack/react-query";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeltaOrders.js","names":["useDeltaSDK","queryClient","_queryClient","assertProp","QueryClient","useQuery","UseQueryOptions","UseQueryResult","DeltaAuction","GetDeltaOrdersFunctions","MarkOptional","useAccount","DeltaOrderByHashParams","DeltaOrderByHashReturn","DeltaOrderByHashQueryParams","Omit","Error","TData","DeltaOrderByHashQueryKey","DeltaOrderByHashQueryResult","DeltaOrderByHashQueryInput","orderHash","query","base","DELTA_ORDER_BY_HASH_QUERY_KEY","orderParams","DeltaOrderByIdParams","DeltaOrderByIdReturn","DeltaOrderByIdQueryParams","DeltaOrderByIdQueryKey","DeltaOrderByIdQueryResult","DeltaOrderByIdQueryInput","DeltaOrdersParams","Parameters","DeltaOrdersReturn","Awaited","ReturnType","DeltaOrdersQueryParams","DeltaOrdersQueryKey","DeltaOrdersQueryResult","DeltaOrdersQueryInput","UserDeltaOrdersQueryInput","useDeltaOrderByHashQuery","t0","$","_c","t1","Symbol","for","chainId","sdk","t2","t3","t4","signal","order","getDeltaOrderByHash","enabled","t5","queryKey","queryFn","ensureDeltaOrderByHashFactory","Promise","ensureFn","ensureQueryData","useDeltaOrderByIdQuery","getDeltaOrderById","useDeltaOrdersQuery","deltaOrdersQueryKey","orders","getDeltaOrders","userAddress","useUserDeltaOrdersQuery","_orderParams","address","account","toLowerCase","const"],"sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaOrders.ts"],"sourcesContent":["import { useDeltaSDK } from \"@/hooks/useSDK\";\nimport { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { assertProp } from \"@/lib/utils\";\nimport {\n QueryClient,\n useQuery,\n type UseQueryOptions,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport type { DeltaAuction, GetDeltaOrdersFunctions } from \"@velora-dex/sdk\";\nimport type { MarkOptional } from \"ts-essentials\";\nimport { useAccount } from \"wagmi\";\n\n// ============================================================================\n// Types for getDeltaOrderByHash\n// ============================================================================\n\ntype DeltaOrderByHashParams = string; // orderHash\ntype DeltaOrderByHashReturn = DeltaAuction;\n\ntype DeltaOrderByHashQueryParams<TData = DeltaOrderByHashReturn> = Omit<\n UseQueryOptions<\n DeltaOrderByHashReturn,\n Error,\n TData,\n DeltaOrderByHashQueryKey\n >,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaOrderByHashQueryResult<TData = DeltaOrderByHashReturn> =\n UseQueryResult<TData, Error>;\n\ntype DeltaOrderByHashQueryInput<TData = DeltaOrderByHashReturn> = {\n orderHash: DeltaOrderByHashParams;\n query?: DeltaOrderByHashQueryParams<TData>;\n};\n\ntype DeltaOrderByHashQueryKey = [\n base: typeof DELTA_ORDER_BY_HASH_QUERY_KEY,\n orderParams: DeltaOrderByHashParams,\n];\n\n// ============================================================================\n// Types for getDeltaOrderById\n// ============================================================================\n\ntype DeltaOrderByIdParams = string; // orderId\ntype DeltaOrderByIdReturn = DeltaAuction;\n\ntype DeltaOrderByIdQueryParams<TData = DeltaOrderByIdReturn> = Omit<\n UseQueryOptions<DeltaOrderByIdReturn, Error, TData, DeltaOrderByIdQueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaOrderByIdQueryResult<TData = DeltaOrderByIdReturn> = UseQueryResult<\n TData,\n Error\n>;\n\ntype DeltaOrderByIdQueryInput<TData = DeltaOrderByIdReturn> = {\n orderParams: DeltaOrderByIdParams;\n query?: DeltaOrderByIdQueryParams<TData>;\n};\n\ntype DeltaOrderByIdQueryKey = [\n base: \"swap/delta/order-by-id\",\n orderParams: DeltaOrderByIdParams,\n];\n\n// ============================================================================\n// Types for getDeltaOrders\n// ============================================================================\n\ntype DeltaOrdersParams = Parameters<\n GetDeltaOrdersFunctions[\"getDeltaOrders\"]\n>[0];\ntype DeltaOrdersReturn = Awaited<\n ReturnType<GetDeltaOrdersFunctions[\"getDeltaOrders\"]>\n>;\n\ntype DeltaOrdersQueryParams<TData = DeltaOrdersReturn> = Omit<\n UseQueryOptions<DeltaOrdersReturn, Error, TData, DeltaOrdersQueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaOrdersQueryResult<TData = DeltaOrdersReturn> = UseQueryResult<\n TData,\n Error\n>;\n\ntype DeltaOrdersQueryInput<TData = DeltaOrdersReturn> = {\n orderParams: MarkOptional<DeltaOrdersParams, \"userAddress\">;\n query?: DeltaOrdersQueryParams<TData>;\n};\n\ntype UserDeltaOrdersQueryInput<TData = DeltaOrdersReturn> = {\n orderParams: Omit<DeltaOrdersParams, \"userAddress\">;\n query?: DeltaOrdersQueryParams<TData>;\n};\n\ntype DeltaOrdersQueryKey = [\n base: \"swap/delta/orders\",\n orderParams: MarkOptional<DeltaOrdersParams, \"userAddress\">,\n];\n\n// ============================================================================\n// Hook for getDeltaOrderByHash\n// ============================================================================\n\nconst DELTA_ORDER_BY_HASH_QUERY_KEY = \"swap/delta/order-by-hash\";\n\nexport function useDeltaOrderByHashQuery<TData = DeltaOrderByHashReturn>({\n orderHash,\n query,\n}: DeltaOrderByHashQueryInput<TData>): DeltaOrderByHashQueryResult<TData> {\n const { sdk } = useDeltaSDK({ chainId: 1 }); // chain doesn't matter\n\n return useQuery<\n DeltaOrderByHashReturn,\n Error,\n TData,\n DeltaOrderByHashQueryKey\n >({\n queryKey: [DELTA_ORDER_BY_HASH_QUERY_KEY, orderHash],\n queryFn: ({ signal }) => {\n const order = sdk.getDeltaOrderByHash(orderHash, { signal });\n return order;\n },\n ...query,\n enabled: query?.enabled ?? true,\n });\n}\n\nexport function ensureDeltaOrderByHashFactory({\n queryClient = _queryClient,\n sdk,\n}: {\n queryClient?: QueryClient;\n sdk: GetDeltaOrdersFunctions;\n}): (orderHash: string) => Promise<DeltaOrderByHashReturn> {\n const ensureFn = async (orderHash: string) => {\n return queryClient.ensureQueryData<\n DeltaOrderByHashReturn,\n Error,\n DeltaOrderByHashReturn,\n DeltaOrderByHashQueryKey\n >({\n queryKey: [DELTA_ORDER_BY_HASH_QUERY_KEY, orderHash],\n queryFn: ({ signal }) => sdk.getDeltaOrderByHash(orderHash, { signal }),\n });\n };\n\n return ensureFn;\n}\n\n// ============================================================================\n// Hook for getDeltaOrderById\n// ============================================================================\n\nexport function useDeltaOrderByIdQuery<TData = DeltaOrderByIdReturn>({\n orderParams,\n query,\n}: DeltaOrderByIdQueryInput<TData>): DeltaOrderByIdQueryResult<TData> {\n const { sdk } = useDeltaSDK({ chainId: 1 }); // chain doesn't matter\n\n return useQuery<DeltaOrderByIdReturn, Error, TData, DeltaOrderByIdQueryKey>({\n queryKey: [\"swap/delta/order-by-id\", orderParams],\n queryFn: ({ signal }) => {\n const order = sdk.getDeltaOrderById(orderParams, { signal });\n return order;\n },\n ...query,\n enabled: query?.enabled ?? true,\n });\n}\n\n// ============================================================================\n// Hook for getDeltaOrders\n// ============================================================================\n\nexport function useDeltaOrdersQuery<TData = DeltaOrdersReturn>({\n orderParams,\n query,\n}: DeltaOrdersQueryInput<TData>): DeltaOrdersQueryResult<TData> {\n const { sdk } = useDeltaSDK({ chainId: 1 }); // chain doesn't matter\n\n return useQuery<DeltaOrdersReturn, Error, TData, DeltaOrdersQueryKey>({\n queryKey: deltaOrdersQueryKey(orderParams),\n queryFn: ({ signal }) => {\n assertProp(orderParams, \"userAddress\");\n const orders = sdk.getDeltaOrders(orderParams, { signal });\n return orders;\n },\n ...query,\n enabled: !!orderParams.userAddress && (query?.enabled ?? true),\n });\n}\n\nexport function useUserDeltaOrdersQuery<TData = DeltaOrdersReturn>({\n orderParams: _orderParams,\n query,\n}: UserDeltaOrdersQueryInput<TData>): DeltaOrdersQueryResult<TData> {\n const { address: account } = useAccount();\n\n const orderParams = {\n ..._orderParams,\n userAddress: account,\n };\n\n return useDeltaOrdersQuery({ orderParams, query });\n}\n\nexport function deltaOrdersQueryKey({\n userAddress,\n ...orderParams\n}: MarkOptional<DeltaOrdersParams, \"userAddress\">): DeltaOrdersQueryKey {\n return [\n \"swap/delta/orders\",\n {\n ...orderParams,\n userAddress: userAddress?.toLowerCase(),\n },\n ] as const;\n}\n"],"mappings":";;;;;;;AA2GA,IAAMwB,IAAgC;AAwBtC,SAAgBqC,EAA8B,EAC5C5D,aAAAA,IAAcC,GACdgD,UAIyD;CAazD,OAAOa,OAZiB1C,MACfpB,EAAY+D,gBAKjB;EACAL,UAAU,CAACnC,GAA+BH,EAAU;EACpDuC,UAAU,EAAEN,gBAAaJ,EAAIM,oBAAoBnC,GAAW,EAAEiC,WAAQ,CAAA;EACvE,CAAC;;AA+BN,SAAOa,EAAAxB,GAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAAwD,EAAApB,gBAAAH,aAAAqB,GAGhCG;CAAA,AAAAF,EAAA,OAAAG,OAAAC,IAAA,4BAAA,IACDF,IAAA,EAAAG,SAAW,GAAG,EAAAL,EAAA,KAAAE,KAAAA,IAAAF,EAAA;CAA1C,IAAA,EAAAM,WAAgBlD,EAAY8C,EAAe,EAACK;CAAA,AAAAP,EAAA,OAAAnB,IAGA0B,IAAAP,EAAA,MAAhCO,IAAAiB,EAAoB3C,EAAY,EAAAmB,EAAA,KAAAnB,GAAAmB,EAAA,KAAAO;CAAA,IAAAC;CAAA,AAAAR,EAAA,OAAA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iB,EAAoB,EAClCG,gBACA,GAAG9C,KACmE;CACtE,OAAO,CACL,qBACA;EACE,GAAGA;EACH8C,aAAaA,GAAaK,aAAY;EACvC,CACF"}
|
|
1
|
+
{"version":3,"file":"useDeltaOrders.js","names":["useDeltaV2SDK","queryClient","_queryClient","assertProp","QueryClient","useQuery","UseQueryOptions","UseQueryResult","DeltaV2","MarkOptional","useAccount","DeltaOrderByHashParams","DeltaOrderByHashReturn","DeltaAuction","DeltaOrderByHashQueryParams","Omit","Error","TData","DeltaOrderByHashQueryKey","DeltaOrderByHashQueryResult","DeltaOrderByHashQueryInput","orderHash","query","base","DELTA_ORDER_BY_HASH_QUERY_KEY","orderParams","DeltaOrderByIdParams","DeltaOrderByIdReturn","DeltaOrderByIdQueryParams","DeltaOrderByIdQueryKey","DeltaOrderByIdQueryResult","DeltaOrderByIdQueryInput","DeltaOrdersParams","Parameters","GetDeltaOrdersFunctions","DeltaOrdersReturn","Awaited","ReturnType","DeltaOrdersQueryParams","DeltaOrdersQueryKey","DeltaOrdersQueryResult","DeltaOrdersQueryInput","UserDeltaOrdersQueryInput","useDeltaOrderByHashQuery","t0","$","_c","t1","Symbol","for","chainId","sdk","t2","t3","t4","signal","getDeltaOrderByHash","enabled","t5","queryKey","queryFn","ensureDeltaOrderByHashFactory","Promise","ensureFn","ensureQueryData","useDeltaOrderByIdQuery","getDeltaOrderById","useDeltaOrdersQuery","deltaOrdersQueryKey","getDeltaOrders","userAddress","useUserDeltaOrdersQuery","_orderParams","address","account","toLowerCase","const"],"sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaOrders.ts"],"sourcesContent":["import { useDeltaV2SDK } from \"@/hooks/useSDK\";\nimport { queryClient as _queryClient } from \"@/lib/queryClient\";\nimport { assertProp } from \"@/lib/utils\";\nimport {\n QueryClient,\n useQuery,\n type UseQueryOptions,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport type { DeltaV2 } from \"@velora-dex/sdk\";\nimport type { MarkOptional } from \"ts-essentials\";\nimport { useAccount } from \"wagmi\";\n\n// ============================================================================\n// Types for getDeltaOrderByHash\n// ============================================================================\n\ntype DeltaOrderByHashParams = string; // orderHash\ntype DeltaOrderByHashReturn = DeltaV2.DeltaAuction;\n\ntype DeltaOrderByHashQueryParams<TData = DeltaOrderByHashReturn> = Omit<\n UseQueryOptions<\n DeltaOrderByHashReturn,\n Error,\n TData,\n DeltaOrderByHashQueryKey\n >,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaOrderByHashQueryResult<TData = DeltaOrderByHashReturn> =\n UseQueryResult<TData, Error>;\n\ntype DeltaOrderByHashQueryInput<TData = DeltaOrderByHashReturn> = {\n orderHash: DeltaOrderByHashParams;\n query?: DeltaOrderByHashQueryParams<TData>;\n};\n\ntype DeltaOrderByHashQueryKey = [\n base: typeof DELTA_ORDER_BY_HASH_QUERY_KEY,\n orderParams: DeltaOrderByHashParams,\n];\n\n// ============================================================================\n// Types for getDeltaOrderById\n// ============================================================================\n\ntype DeltaOrderByIdParams = string; // orderId\ntype DeltaOrderByIdReturn = DeltaV2.DeltaAuction;\n\ntype DeltaOrderByIdQueryParams<TData = DeltaOrderByIdReturn> = Omit<\n UseQueryOptions<DeltaOrderByIdReturn, Error, TData, DeltaOrderByIdQueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaOrderByIdQueryResult<TData = DeltaOrderByIdReturn> = UseQueryResult<\n TData,\n Error\n>;\n\ntype DeltaOrderByIdQueryInput<TData = DeltaOrderByIdReturn> = {\n orderParams: DeltaOrderByIdParams;\n query?: DeltaOrderByIdQueryParams<TData>;\n};\n\ntype DeltaOrderByIdQueryKey = [\n base: \"swap/delta/order-by-id\",\n orderParams: DeltaOrderByIdParams,\n];\n\n// ============================================================================\n// Types for getDeltaOrders\n// ============================================================================\n\ntype DeltaOrdersParams = Parameters<\n DeltaV2.GetDeltaOrdersFunctions[\"getDeltaOrders\"]\n>[0];\ntype DeltaOrdersReturn = Awaited<\n ReturnType<DeltaV2.GetDeltaOrdersFunctions[\"getDeltaOrders\"]>\n>;\n\ntype DeltaOrdersQueryParams<TData = DeltaOrdersReturn> = Omit<\n UseQueryOptions<DeltaOrdersReturn, Error, TData, DeltaOrdersQueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaOrdersQueryResult<TData = DeltaOrdersReturn> = UseQueryResult<\n TData,\n Error\n>;\n\ntype DeltaOrdersQueryInput<TData = DeltaOrdersReturn> = {\n orderParams: MarkOptional<DeltaOrdersParams, \"userAddress\">;\n query?: DeltaOrdersQueryParams<TData>;\n};\n\ntype UserDeltaOrdersQueryInput<TData = DeltaOrdersReturn> = {\n orderParams: Omit<DeltaOrdersParams, \"userAddress\">;\n query?: DeltaOrdersQueryParams<TData>;\n};\n\ntype DeltaOrdersQueryKey = [\n base: \"swap/delta/orders\",\n orderParams: MarkOptional<DeltaOrdersParams, \"userAddress\">,\n];\n\n// ============================================================================\n// Hook for getDeltaOrderByHash\n// ============================================================================\n\nconst DELTA_ORDER_BY_HASH_QUERY_KEY = \"swap/delta/order-by-hash\";\n\nexport function useDeltaOrderByHashQuery<TData = DeltaOrderByHashReturn>({\n orderHash,\n query,\n}: DeltaOrderByHashQueryInput<TData>): DeltaOrderByHashQueryResult<TData> {\n const { sdk } = useDeltaV2SDK({ chainId: 1 }); // chain doesn't matter\n\n return useQuery<\n DeltaOrderByHashReturn,\n Error,\n TData,\n DeltaOrderByHashQueryKey\n >({\n queryKey: [DELTA_ORDER_BY_HASH_QUERY_KEY, orderHash],\n queryFn: ({ signal }) => sdk.getDeltaOrderByHash(orderHash, { signal }),\n ...query,\n enabled: query?.enabled ?? true,\n });\n}\n\nexport function ensureDeltaOrderByHashFactory({\n queryClient = _queryClient,\n sdk,\n}: {\n queryClient?: QueryClient;\n sdk: DeltaV2.GetDeltaOrdersFunctions;\n}): (orderHash: string) => Promise<DeltaOrderByHashReturn> {\n const ensureFn = async (orderHash: string) => {\n return queryClient.ensureQueryData<\n DeltaOrderByHashReturn,\n Error,\n DeltaOrderByHashReturn,\n DeltaOrderByHashQueryKey\n >({\n queryKey: [DELTA_ORDER_BY_HASH_QUERY_KEY, orderHash],\n queryFn: ({ signal }) => sdk.getDeltaOrderByHash(orderHash, { signal }),\n });\n };\n\n return ensureFn;\n}\n\n// ============================================================================\n// Hook for getDeltaOrderById\n// ============================================================================\n\nexport function useDeltaOrderByIdQuery<TData = DeltaOrderByIdReturn>({\n orderParams,\n query,\n}: DeltaOrderByIdQueryInput<TData>): DeltaOrderByIdQueryResult<TData> {\n const { sdk } = useDeltaV2SDK({ chainId: 1 }); // chain doesn't matter\n\n return useQuery<DeltaOrderByIdReturn, Error, TData, DeltaOrderByIdQueryKey>({\n queryKey: [\"swap/delta/order-by-id\", orderParams],\n queryFn: ({ signal }) => sdk.getDeltaOrderById(orderParams, { signal }),\n ...query,\n enabled: query?.enabled ?? true,\n });\n}\n\n// ============================================================================\n// Hook for getDeltaOrders\n// ============================================================================\n\nexport function useDeltaOrdersQuery<TData = DeltaOrdersReturn>({\n orderParams,\n query,\n}: DeltaOrdersQueryInput<TData>): DeltaOrdersQueryResult<TData> {\n const { sdk } = useDeltaV2SDK({ chainId: 1 }); // chain doesn't matter\n\n return useQuery<DeltaOrdersReturn, Error, TData, DeltaOrdersQueryKey>({\n queryKey: deltaOrdersQueryKey(orderParams),\n queryFn: ({ signal }) => {\n assertProp(orderParams, \"userAddress\");\n return sdk.getDeltaOrders(orderParams, { signal });\n },\n ...query,\n enabled: !!orderParams.userAddress && (query?.enabled ?? true),\n });\n}\n\nexport function useUserDeltaOrdersQuery<TData = DeltaOrdersReturn>({\n orderParams: _orderParams,\n query,\n}: UserDeltaOrdersQueryInput<TData>): DeltaOrdersQueryResult<TData> {\n const { address: account } = useAccount();\n\n const orderParams = {\n ..._orderParams,\n userAddress: account,\n };\n\n return useDeltaOrdersQuery({ orderParams, query });\n}\n\nexport function deltaOrdersQueryKey({\n userAddress,\n ...orderParams\n}: MarkOptional<DeltaOrdersParams, \"userAdd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IAAA;EAAAC,UAC1DP;EAAgCQ,SACjCP;EAGR,GACE/B;EAAKmC,SACCH;EACV,EAAAT,EAAA,KAAAvB,GAAAuB,EAAA,KAAAO,GAAAP,EAAA,KAAAQ,GAAAR,EAAA,KAAAS,GAAAT,EAAA,MAAAa,KAAAA,IAAAb,EAAA,KARMxC,EAA+DqD,EAQpE;;AAGJ,SAAOa,EAAA3B,GAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,EAA4D,EAAArB,aAAA+C,GAAAlD,aAAAsB,GAIjE,EAAA6B,SAAAC,MAA6BhE,GAAY,EAACqC;CAAA,AAAAF,EAAA,OAAA2B,KAAA3B,EAAA,OAAA6B,KAEtB3B,IAAA;EAAA,GACfyB;EAAYF,aACFI;EACd,EAAA7B,EAAA,KAAA2B,GAAA3B,EAAA,KAAA6B,GAAA7B,EAAA,KAAAE,KAAAA,IAAAF,EAAA;CAHD,IAAApB,IAAoBsB,GAGlBK;CAE+C,OAF/CP,EAAA,OAAApB,KAAAoB,EAAA,OAAAvB,KAEyB8B,IAAA;EAAA3B;EAAAH;EAAsB,EAAAuB,EAAA,KAAApB,GAAAoB,EAAA,KAAAvB,GAAAuB,EAAA,KAAAO,KAAAA,IAAAP,EAAA,IAA1CsB,EAAoBf,EAAuB;;AAGpD,SAAgBgB,EAAoB,EAClCE,gBACA,GAAG7C,KACmE;CACtE,OAAO,CACL,qBACA;EACE,GAAGA;EACH6C,aAAaA,GAAaK,aAAY;EACvC,CACF"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Query, QueryClient, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { DeltaV2, OptimalRate } from '@velora-dex/sdk';
|
|
3
3
|
import { MarkOptional } from 'ts-essentials';
|
|
4
|
-
type RequiredDeltaPriceParams = Omit<
|
|
4
|
+
type RequiredDeltaPriceParams = Omit<DeltaV2.DeltaPriceParams, "destChainId">;
|
|
5
5
|
export type DeltaPriceQueryParams = MarkOptional<RequiredDeltaPriceParams, "destToken" | "destDecimals">;
|
|
6
|
-
type DeltaQueryParams<TData = DeltaPrice
|
|
7
|
-
type DeltaQueryResult<TData = DeltaPrice> = UseQueryResult<TData, Error>;
|
|
8
|
-
type DeltaPriceQueryInput<TData = DeltaPrice> = {
|
|
6
|
+
type DeltaQueryParams<TData = DeltaV2.DeltaPrice> = Omit<UseQueryOptions<DeltaV2.DeltaPrice, Error, TData, DeltaPriceQueryKey>, "queryKey" | "queryFn">;
|
|
7
|
+
type DeltaQueryResult<TData = DeltaV2.DeltaPrice> = UseQueryResult<TData, Error>;
|
|
8
|
+
type DeltaPriceQueryInput<TData = DeltaV2.DeltaPrice> = {
|
|
9
9
|
priceParams: DeltaPriceQueryParams;
|
|
10
10
|
query?: DeltaQueryParams<TData>;
|
|
11
11
|
chainId: number;
|
|
12
12
|
timeout?: number;
|
|
13
|
+
destChainId?: number;
|
|
13
14
|
};
|
|
14
15
|
export declare const DeltaPriceQueryKeyPrefix = "swap/prices/delta";
|
|
15
16
|
export type DeltaPriceQueryKey = readonly [
|
|
@@ -19,47 +20,29 @@ export type DeltaPriceQueryKey = readonly [
|
|
|
19
20
|
destChainId?: number;
|
|
20
21
|
}
|
|
21
22
|
];
|
|
22
|
-
|
|
23
|
-
* 1. With destChainId: number -> returns BridgePrice
|
|
24
|
-
* 2. With destChainId?: undefined -> returns DeltaPrice
|
|
25
|
-
* 3. With destChainId?: number -> returns DeltaPrice | BridgePrice
|
|
26
|
-
*/
|
|
27
|
-
export declare function useDeltaPriceQuery<TData = BridgePrice>({ priceParams, query, chainId, timeout, }: DeltaPriceQueryInput<TData> & {
|
|
28
|
-
destChainId: number;
|
|
29
|
-
}): {
|
|
30
|
-
result: DeltaQueryResult<TData>;
|
|
31
|
-
queryKey: DeltaPriceQueryKey;
|
|
32
|
-
};
|
|
33
|
-
export declare function useDeltaPriceQuery<TData = DeltaPrice>({ priceParams, query, chainId, timeout, }: DeltaPriceQueryInput<TData> & {
|
|
34
|
-
destChainId?: undefined;
|
|
35
|
-
}): {
|
|
23
|
+
export declare function useDeltaPriceQuery<TData = DeltaV2.DeltaPrice>({ priceParams: _priceParams, query, chainId, timeout, destChainId, }: DeltaPriceQueryInput<TData>): {
|
|
36
24
|
result: DeltaQueryResult<TData>;
|
|
37
25
|
queryKey: DeltaPriceQueryKey;
|
|
38
26
|
};
|
|
39
|
-
export declare function
|
|
40
|
-
|
|
41
|
-
}): {
|
|
42
|
-
result: DeltaQueryResult<TData>;
|
|
43
|
-
queryKey: DeltaPriceQueryKey;
|
|
44
|
-
};
|
|
45
|
-
export declare function isDeltaPrice(price: OptimalRate | DeltaPrice): price is DeltaPrice;
|
|
46
|
-
export declare function isBridgePrice(price: DeltaPrice | BridgePrice): price is BridgePrice;
|
|
27
|
+
export declare function isDeltaPrice(price: OptimalRate | DeltaV2.DeltaPrice): price is DeltaV2.DeltaPrice;
|
|
28
|
+
export declare function isBridgePrice(price: DeltaV2.DeltaPrice): boolean;
|
|
47
29
|
type GetDeltaPriceQueryForPriceInput = {
|
|
48
|
-
price: DeltaPrice
|
|
30
|
+
price: DeltaV2.DeltaPrice;
|
|
49
31
|
chainId: number;
|
|
50
32
|
};
|
|
51
|
-
type
|
|
33
|
+
type DeltaPriceQuery = Query<DeltaV2.DeltaPrice, Error, DeltaV2.DeltaPrice, DeltaPriceQueryKey>;
|
|
34
|
+
type GetDeltaPriceQueryForPrice = (input: GetDeltaPriceQueryForPriceInput) => DeltaPriceQuery | undefined;
|
|
52
35
|
export declare function useDeltaPriceQueryForPrice(): GetDeltaPriceQueryForPrice;
|
|
53
36
|
type SubscribeToDeltaPriceInput = {
|
|
54
37
|
queryKey: DeltaPriceQueryKey;
|
|
55
|
-
onData?: (data: DeltaPrice
|
|
38
|
+
onData?: (data: DeltaV2.DeltaPrice) => void;
|
|
56
39
|
onError?: (error: Error) => void;
|
|
57
40
|
};
|
|
58
41
|
type SubscribeToDeltaPriceResult = (input: SubscribeToDeltaPriceInput) => () => void;
|
|
59
42
|
export declare function useSubscribeToDeltaPrice(): SubscribeToDeltaPriceResult;
|
|
60
|
-
export declare function getLastDeltaPrice(queryClient: QueryClient): DeltaPrice |
|
|
43
|
+
export declare function getLastDeltaPrice(queryClient: QueryClient): DeltaV2.DeltaPrice | undefined;
|
|
61
44
|
export declare function isLastDeltaPriceQueryInError(queryClient: QueryClient): boolean;
|
|
62
|
-
export declare function
|
|
45
|
+
export declare function isDataDeltaPriceV2(price: unknown): price is DeltaV2.DeltaPrice;
|
|
63
46
|
export declare function useDeltaPriceQueryKey({ priceParams, chainId, destChainId, }: Pick<DeltaPriceQueryInput, "priceParams" | "chainId"> & {
|
|
64
47
|
destChainId?: number;
|
|
65
48
|
}): {
|
|
@@ -67,15 +50,15 @@ export declare function useDeltaPriceQueryKey({ priceParams, chainId, destChainI
|
|
|
67
50
|
sanitizedPriceParams: {
|
|
68
51
|
amount: string;
|
|
69
52
|
side?: ("SELL" | "BUY") | undefined;
|
|
53
|
+
beneficiary?: string | undefined;
|
|
70
54
|
partner?: string | undefined;
|
|
71
|
-
excludeAgents?: string[] | undefined;
|
|
72
|
-
includeAgents?: string[] | undefined;
|
|
73
55
|
userAddress?: string | undefined;
|
|
56
|
+
includeAgents?: string[] | undefined;
|
|
57
|
+
excludeAgents?: string[] | undefined;
|
|
74
58
|
degenMode?: boolean | undefined;
|
|
75
|
-
|
|
59
|
+
partnerFeeBps?: number | undefined;
|
|
76
60
|
srcToken: string;
|
|
77
61
|
destToken?: string | undefined;
|
|
78
|
-
partnerFeeBps?: number | undefined;
|
|
79
62
|
srcDecimals: number;
|
|
80
63
|
destDecimals?: number | undefined;
|
|
81
64
|
maxImpact?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeltaPriceQuery.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaPriceQuery.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,WAAW,EAIX,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"useDeltaPriceQuery.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaPriceQuery.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,EACL,WAAW,EAIX,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AAK1D,KAAK,wBAAwB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAC9E,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAC9C,wBAAwB,EACxB,WAAW,GAAG,cAAc,CAC7B,CAAC;AAEF,KAAK,gBAAgB,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,IAAI,IAAI,CACtD,eAAe,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAkB,CAAC,EACrE,UAAU,GAAG,SAAS,CACvB,CAAC;AACF,KAAK,gBAAgB,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,IAAI,cAAc,CAChE,KAAK,EACL,KAAK,CACN,CAAC;AAEF,KAAK,oBAAoB,CAAC,KAAK,GAAG,OAAO,CAAC,UAAU,IAAI;IACtD,WAAW,EAAE,qBAAqB,CAAC;IACnC,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAE5D,MAAM,MAAM,kBAAkB,GAAG,SAAS;IACxC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,KAC9B,MAAM,IAAI,CAAC;AAGhB,wBAAgB,wBAAwB,IAAI,2BAA2B,CA2BtE;AAcD,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,GACvB,OAAO,CAAC,UAAU,GAAG,SAAS,CAIhC;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,WAAW,GACvB,OAAO,CAIT;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,OAAO,CAAC,UAAU,CAQ7B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,WAAW,EACX,OAAO,EACP,WAAW,GACZ,EAAE,IAAI,CAAC,oBAAoB,EAAE,aAAa,GAAG,SAAS,CAAC,GAAG;IACzD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;;;;;;;;;;;;;;;;;;;;;;sBAWmB,MAAM;;EAkDzB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDeltaV2SDK as e } from "../../../../useSDK.js";
|
|
2
2
|
import { PRICE_FETCH_TIMEOUT_MS as t } from "../../constants.js";
|
|
3
3
|
import { c as n } from "react-compiler-runtime";
|
|
4
4
|
import { useMemo as r } from "react";
|
|
@@ -43,10 +43,10 @@ function d(e) {
|
|
|
43
43
|
return !!e.destToken && e.destDecimals !== void 0 && Number(e.amount) > 0;
|
|
44
44
|
}
|
|
45
45
|
function f(e) {
|
|
46
|
-
return "
|
|
46
|
+
return "route" in e;
|
|
47
47
|
}
|
|
48
48
|
function p(e) {
|
|
49
|
-
return e.bridge
|
|
49
|
+
return e.route.bridge !== null;
|
|
50
50
|
}
|
|
51
51
|
function m() {
|
|
52
52
|
let e = n(2), t = o(), r;
|
|
@@ -78,7 +78,7 @@ function _(e) {
|
|
|
78
78
|
return !!h(e)?.state.error;
|
|
79
79
|
}
|
|
80
80
|
function v(e) {
|
|
81
|
-
return typeof e == "object" && !!e && "
|
|
81
|
+
return typeof e == "object" && !!e && "route" in e && "inputToken" in e && "outputToken" in e;
|
|
82
82
|
}
|
|
83
83
|
function y({ priceParams: e, chainId: t, destChainId: n }) {
|
|
84
84
|
"use no memo";
|
|
@@ -135,6 +135,6 @@ function y({ priceParams: e, chainId: t, destChainId: n }) {
|
|
|
135
135
|
]);
|
|
136
136
|
}
|
|
137
137
|
//#endregion
|
|
138
|
-
export { l as DeltaPriceQueryKeyPrefix, g as getLastDeltaPrice, p as isBridgePrice, v as
|
|
138
|
+
export { l as DeltaPriceQueryKeyPrefix, g as getLastDeltaPrice, p as isBridgePrice, v as isDataDeltaPriceV2, f as isDeltaPrice, _ as isLastDeltaPriceQueryInError, u as useDeltaPriceQuery, m as useSubscribeToDeltaPrice };
|
|
139
139
|
|
|
140
140
|
//# sourceMappingURL=useDeltaPriceQuery.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeltaPriceQuery.js","names":["useDeltaSDK","Query","QueryClient","QueryObserver","useQuery","useQueryClient","UseQueryOptions","UseQueryResult","useDebouncedValue","DeltaPrice","BridgePrice","DeltaPriceParams","DParams","OptimalRate","assert","MarkOptional","useMemo","PRICE_FETCH_TIMEOUT_MS","RequiredDeltaPriceParams","Omit","DeltaPriceQueryParams","DeltaQueryParams","Error","TData","DeltaPriceQueryKey","DeltaQueryResult","DeltaPriceQueryInput","priceParams","query","chainId","timeout","DeltaPriceQueryKeyPrefix","base","destChainId","useDeltaPriceQuery","result","queryKey","t0","$","_c","_priceParams","t1","undefined","t2","sdk","queryEnabled","enabled","t3","sanitizedPriceParams","useDeltaPriceQueryKey","t4","t5","signal","isPriceParamsValid","price","getDeltaPrice","t6","queryFn","t7","destToken","destDecimals","Number","amount","isDeltaPrice","isBridgePrice","bridge","destinationChainId","GetDeltaPriceQueryForPriceInput","DeltaPriceQuery","GetDeltaPriceQueryForPrice","input","useDeltaPriceQueryForPrice","queryClient","queryCache","getQueryCache","query_0","find","exact","predicate","state","data","SubscribeToDeltaPriceInput","onData","onError","error","SubscribeToDeltaPriceResult","useSubscribeToDeltaPrice","observer","subscribe","getLastDeltaPriceQuery","type","getLastDeltaPrice","isLastDeltaPriceQueryInError","isDataDeltaOrBridgePrice","Pick","debouncedAmount","wait","srcToken","srcDecimals","userAddress","beneficiary","partner","partnerFeeBps","side","includeAgents","excludeAgents","includeBridges","excludeBridges","allowBridgeAndSwap","maxImpact","degenMode"],"sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaPriceQuery.ts"],"sourcesContent":["import { useDeltaSDK } from \"@/hooks/useSDK\";\nimport {\n Query,\n QueryClient,\n QueryObserver,\n useQuery,\n useQueryClient,\n type UseQueryOptions,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport { useDebouncedValue } from \"@tanstack/react-pacer/debouncer\";\nimport type {\n DeltaPrice,\n BridgePrice,\n DeltaPriceParams as DParams,\n OptimalRate,\n} from \"@velora-dex/sdk\";\nimport { assert, type MarkOptional } from \"ts-essentials\";\nimport { useMemo } from \"react\";\nimport { PRICE_FETCH_TIMEOUT_MS } from \"../../constants\";\n\n// overload is easier with input.destChainId\ntype RequiredDeltaPriceParams = Omit<DParams, \"destChainId\">;\nexport type DeltaPriceQueryParams = MarkOptional<\n RequiredDeltaPriceParams,\n \"destToken\" | \"destDecimals\" // destToken is not available in SwapForm initially\n>;\n\ntype DeltaQueryParams<TData = DeltaPrice | BridgePrice> = Omit<\n UseQueryOptions<DeltaPrice | BridgePrice, Error, TData, DeltaPriceQueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaQueryResult<TData = DeltaPrice> = UseQueryResult<TData, Error>;\n\ntype DeltaPriceQueryInput<TData = DeltaPrice> = {\n priceParams: DeltaPriceQueryParams;\n query?: DeltaQueryParams<TData>;\n chainId: number;\n timeout?: number;\n};\n\nexport const DeltaPriceQueryKeyPrefix = \"swap/prices/delta\";\n\nexport type DeltaPriceQueryKey = readonly [\n base: typeof DeltaPriceQueryKeyPrefix,\n chainId: number,\n priceParams: DeltaPriceQueryParams & {\n destChainId?: number;\n },\n];\n\n/**\n * 1. With destChainId: number -> returns BridgePrice\n * 2. With destChainId?: undefined -> returns DeltaPrice\n * 3. With destChainId?: number -> returns DeltaPrice | BridgePrice\n */\nexport function useDeltaPriceQuery<TData = BridgePrice>({\n priceParams,\n query,\n chainId,\n timeout,\n}: DeltaPriceQueryInput<TData> & {\n destChainId: number;\n}): {\n result: DeltaQueryResult<TData>;\n queryKey: DeltaPriceQueryKey;\n};\nexport function useDeltaPriceQuery<TData = DeltaPrice>({\n priceParams,\n query,\n chainId,\n timeout,\n}: DeltaPriceQueryInput<TData> & {\n destChainId?: undefined;\n}): {\n result: DeltaQueryResult<TData>;\n queryKey: DeltaPriceQueryKey;\n};\nexport function useDeltaPriceQuery<TData = DeltaPrice | BridgePrice>({\n priceParams,\n query,\n chainId,\n timeout,\n}: DeltaPriceQueryInput<TData> & {\n destChainId?: number;\n}): {\n result: DeltaQueryResult<TData>;\n queryKey: DeltaPriceQueryKey;\n};\nexport function useDeltaPriceQuery<TData = DeltaPrice | BridgePrice>({\n priceParams: _priceParams,\n query,\n chainId,\n timeout = PRICE_FETCH_TIMEOUT_MS,\n destChainId,\n}: DeltaPriceQueryInput<TData> & {\n destChainId?: number;\n}): {\n result: DeltaQueryResult<TData>;\n queryKey: DeltaPriceQueryKey;\n} {\n const { sdk } = useDeltaSDK({ chainId });\n\n const queryEnabled = query?.enabled ?? true;\n\n const { queryKey, sanitizedPriceParams } = useDeltaPriceQueryKey({\n priceParams: _priceParams,\n chainId,\n destChainId,\n });\n\n const result = useQuery<\n DeltaPrice | BridgePrice,\n Error,\n TData,\n DeltaPriceQueryKey\n >({\n queryKey,\n queryFn: ({ signal }) => {\n assert(isPriceParamsValid(sanitizedPriceParams), \"destToken is required\");\n const price = sdk.getDeltaPrice(sanitizedPriceParams, {\n signal,\n timeout,\n });\n return price;\n },\n ...query,\n enabled: queryEnabled && isPriceParamsValid(sanitizedPriceParams),\n });\n\n return { result, queryKey };\n}\n\nfunction isPriceParamsValid(\n priceParams: DeltaPriceQueryParams\n): priceParams is RequiredDeltaPriceParams {\n return (\n !!priceParams.destToken &&\n priceParams.destDecimals !== undefined &&\n Number(priceParams.amount) > 0\n );\n}\n\nexport function isDeltaPrice(\n price: OptimalRate | DeltaPrice\n): price is DeltaPrice {\n return \"bridge\" in price;\n}\n\nexport function isBridgePrice(\n price: DeltaPrice | BridgePrice\n): price is BridgePrice {\n return price.bridge.destinationChainId !== 0;\n}\n\ntype GetDeltaPriceQueryForPriceInput = {\n price: DeltaPrice | BridgePrice;\n chainId: number;\n};\n\ntype DeltaPriceQuery = Query<\n DeltaPrice | BridgePrice,\n Error,\n DeltaPrice | BridgePrice,\n DeltaPriceQueryKey\n>;\n\ntype GetDeltaPriceQueryForPrice = (\n input: GetDeltaPriceQueryForPriceInput\n) =>\n | Query<\n DeltaPrice | BridgePrice,\n Error,\n DeltaPrice | BridgePrice,\n DeltaPriceQueryKey\n >\n | undefined;\n\n// get query for a given deltaPrice\nexport function useDeltaPriceQueryForPrice(): GetDeltaPriceQueryForPrice {\n const queryClient = useQueryClient();\n\n return ({ chainId, price }) => {\n const queryKey: [DeltaPriceQueryKey[0], DeltaPriceQueryKey[1]] = [\n DeltaPriceQueryKeyPrefix,\n chainId,\n ];\n const queryCache = queryClient.getQueryCache();\n const query = queryCache.find<\n DeltaPrice | BridgePrice,\n Error,\n DeltaPrice | BridgePrice\n >({\n queryKey,\n exact: false,\n predicate: (query) => {\n return query.state.data === price;\n },\n });\n\n return query as DeltaPriceQuery | undefined;\n };\n}\n\ntype SubscribeToDeltaPriceInput = {\n queryKey: DeltaPriceQueryKey;\n onData?: (data: DeltaPrice | BridgePrice) => void;\n onError?: (error: Error) => void;\n};\n\ntype SubscribeToDeltaPriceResult = (\n input: SubscribeToDeltaPriceInput\n) => () => void;\n\n// independently subscribe to a price query\nexport function useSubscribeToDeltaPrice(): SubscribeToDeltaPriceResult {\n const queryClient = useQueryClient();\n\n return ({ queryKey, onData, onError }) => {\n const observer = new QueryObserver<\n DeltaPrice | BridgePrice,\n Error,\n DeltaPrice | BridgePrice,\n DeltaPrice | BridgePrice,\n DeltaPriceQueryKey\n >(queryClient, {\n queryKey,\n // only receive updates from existing subscriptions\n enabled: false,\n });\n\n // return unsubscribe function\n return observer.subscribe((result) => {\n if (result.error) {\n onError?.(result.error);\n return;\n }\n if (result.data) {\n onData?.(result.data);\n }\n });\n };\n}\n\nfunction getLastDeltaPriceQuery(\n queryClient: QueryClient\n):\n | Query<DeltaPrice | BridgePrice, Error, DeltaPrice | BridgePrice>\n | undefined {\n return queryClient\n .getQueryCache()\n .find<DeltaPrice | BridgePrice, Error, DeltaPrice | BridgePrice>({\n queryKey: [DeltaPriceQueryKeyPrefix],\n exact: false,\n type: \"active\", // only the most recent query will be active\n });\n}\n\nexport function getLastDeltaPrice(\n queryClient: QueryClient\n): DeltaPrice | BridgePrice | undefined {\n const query = getLastDeltaPriceQuery(queryClient);\n\n return query?.state.data;\n}\n\nexport function isLastDeltaPriceQueryInError(\n queryClient: QueryClient\n): boolean {\n const query = getLastDeltaPriceQuery(queryClient);\n const error = query?.state.error;\n return !!error;\n}\n\nexport function isDataDeltaOrBridgePrice(\n price: unknown\n): price is DeltaPrice | BridgePrice {\n return (\n typeof price === \"object\" &&\n price !== null &&\n \"bridge\" in price &&\n \"srcToken\" in price &&\n \"destToken\" in price &&\n \"srcAmount\" in price &&\n \"destAmount\" in price\n );\n}\n\nexport function useDeltaPriceQueryKey({\n priceParams,\n chainId,\n destChainId,\n}: Pick<DeltaPriceQueryInput, \"priceParams\" | \"chainId\"> & {\n destChainId?: number;\n}) {\n \"use no memo\";\n\n // amount tends to change fast during input\n const [debouncedAmount] = useDebouncedValue(priceParams.amount, {\n wait: 500,\n });\n\n return useMemo(() => {\n // avoid passing unnecessary params to url?search and queryKey\n const sanitizedPriceParams: DeltaPriceQueryParams & {\n destChainId?: number;\n } = {\n amount: debouncedAmount,\n srcToken: priceParams.srcToken,\n destToken: priceParams.destToken,\n srcDecimals: priceParams.srcDecimals,\n destDecimals: priceParams.destDecimals,\n userAddress: priceParams.userAddress,\n beneficiary: priceParams.beneficiary,\n partner: priceParams.partner,\n partnerFeeBps: priceParams.partnerFeeBps,\n side: priceParams.side,\n includeAgents: priceParams.includeAgents,\n excludeAgents: priceParams.excludeAgents,\n includeBridges: priceParams.includeBridges,\n excludeBridges: priceParams.excludeBridges,\n allowBridgeAndSwap: priceParams.allowBridgeAndSwap,\n destChainId: destChainId,\n maxImpact: priceParams.maxImpact,\n degenMode: priceParams.degenMode,\n };\n\n const queryKey: DeltaPriceQueryKey = [\n DeltaPriceQueryKeyPrefix,\n chainId,\n sanitizedPriceParams,\n ];\n\n return { queryKey, sanitizedPriceParams };\n }, [\n priceParams.beneficiary,\n priceParams.destDecimals,\n priceParams.destToken,\n priceParams.excludeAgents,\n priceParams.includeAgents,\n priceParams.includeBridges,\n priceParams.excludeBridges,\n priceParams.partner,\n priceParams.partnerFeeBps,\n priceParams.side,\n priceParams.srcDecimals,\n priceParams.srcToken,\n priceParams.userAddress,\n priceParams.allowBridgeAndSwap,\n priceParams.maxImpact,\n priceParams.degenMode,\n chainId,\n debouncedAmount,\n destChainId,\n ]);\n}\n"],"mappings":";;;;;;;;AAyCA,IAAa+B,IAA2B;AAgDxC,SAAOG,EAAAG,GAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAA8D,EAAAZ,aAAAa,GAAAZ,UAAAC,YAAAC,SAAAW,GAAAR,mBAAAI,GAInEP,IAAAW,MAAAC,KAAAA,IAAAzB,IAAAwB,GAAgCE;CAAA,AAAAL,EAAA,OAAAT,IAQOc,IAAAL,EAAA,MAAXK,IAAA,EAAAd,YAAW,EAAAS,EAAA,KAAAT,GAAAS,EAAA,KAAAK;CAAvC,IAAA,EAAAC,WAAgB5C,EAAY2C,EAAY,EAExCE,IAAqBjB,GAAKkB,WAAL,IAAuBC;CAAA,AAAAT,EAAA,OAAAE,KAAAF,EAAA,OAAAT,KAAAS,EAAA,OAAAL,K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M,CAAC8D,KAAmBvF,EAAkBmB,EAAYmC,QAAQ,EAC9DkC,MAAM,KACP,CAAC;CAEF,OAAOhF,QAAc;EAEnB,IAAMgC,IAEF;GACFc,QAAQiC;GACRE,UAAUtE,EAAYsE;GACtBtC,WAAWhC,EAAYgC;GACvBuC,aAAavE,EAAYuE;GACzBtC,cAAcjC,EAAYiC;GAC1BuC,aAAaxE,EAAYwE;GACzBC,aAAazE,EAAYyE;GACzBC,SAAS1E,EAAY0E;GACrBC,eAAe3E,EAAY2E;GAC3BC,MAAM5E,EAAY4E;GAClBC,eAAe7E,EAAY6E;GAC3BC,eAAe9E,EAAY8E;GAC3BC,gBAAgB/E,EAAY+E;GAC5BC,gBAAgBhF,EAAYgF;GAC5BC,oBAAoBjF,EAAYiF;GACnB3E;GACb4E,WAAWlF,EAAYkF;GACvBC,WAAWnF,EAAYmF;GACxB;EAQD,OAAO;GAAE1E,UAAAA;IALPL;IACAF;IACAmB;IAGOZ;GAAUY;GAAsB;IACxC;EACDrB,EAAYyE;EACZzE,EAAYiC;EACZjC,EAAYgC;EACZhC,EAAY8E;EACZ9E,EAAY6E;EACZ7E,EAAY+E;EACZ/E,EAAYgF;EACZhF,EAAY0E;EACZ1E,EAAY2E;EACZ3E,EAAY4E;EACZ5E,EAAYuE;EACZvE,EAAYsE;EACZtE,EAAYwE;EACZxE,EAAYiF;EACZjF,EAAYkF;EACZlF,EAAYmF;EACZjF;EACAkE;EACA9D;EACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"useDeltaPriceQuery.js","names":["useDeltaV2SDK","Query","QueryClient","QueryObserver","useQuery","useQueryClient","UseQueryOptions","UseQueryResult","useDebouncedValue","DeltaV2","OptimalRate","assert","MarkOptional","useMemo","PRICE_FETCH_TIMEOUT_MS","RequiredDeltaPriceParams","Omit","DeltaPriceParams","DeltaPriceQueryParams","DeltaQueryParams","DeltaPrice","Error","TData","DeltaPriceQueryKey","DeltaQueryResult","DeltaPriceQueryInput","priceParams","query","chainId","timeout","destChainId","DeltaPriceQueryKeyPrefix","base","useDeltaPriceQuery","t0","$","_c","_priceParams","t1","undefined","t2","sdk","queryEnabled","enabled","t3","queryKey","sanitizedPriceParams","useDeltaPriceQueryKey","t4","t5","signal","isPriceParamsValid","price","getDeltaPrice","t6","queryFn","result","t7","destToken","destDecimals","Number","amount","isDeltaPrice","isBridgePrice","route","bridge","GetDeltaPriceQueryForPriceInput","DeltaPriceQuery","GetDeltaPriceQueryForPrice","input","useDeltaPriceQueryForPrice","queryClient","queryCache","getQueryCache","query_0","find","exact","predicate","state","data","SubscribeToDeltaPriceInput","onData","onError","error","SubscribeToDeltaPriceResult","useSubscribeToDeltaPrice","observer","subscribe","getLastDeltaPriceQuery","type","getLastDeltaPrice","isLastDeltaPriceQueryInError","isDataDeltaPriceV2","Pick","debouncedAmount","wait","srcToken","srcDecimals","userAddress","beneficiary","partner","partnerFeeBps","side","includeAgents","excludeAgents","includeBridges","excludeBridges","allowBridgeAndSwap","maxImpact","degenMode"],"sources":["../../../../../../src/hooks/swap/prices/delta/queries/useDeltaPriceQuery.ts"],"sourcesContent":["import { useDeltaV2SDK } from \"@/hooks/useSDK\";\nimport {\n Query,\n QueryClient,\n QueryObserver,\n useQuery,\n useQueryClient,\n type UseQueryOptions,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport { useDebouncedValue } from \"@tanstack/react-pacer/debouncer\";\nimport type { DeltaV2, OptimalRate } from \"@velora-dex/sdk\";\nimport { assert, type MarkOptional } from \"ts-essentials\";\nimport { useMemo } from \"react\";\nimport { PRICE_FETCH_TIMEOUT_MS } from \"../../constants\";\n\n// destChainId is passed separately to keep the query key stable\ntype RequiredDeltaPriceParams = Omit<DeltaV2.DeltaPriceParams, \"destChainId\">;\nexport type DeltaPriceQueryParams = MarkOptional<\n RequiredDeltaPriceParams,\n \"destToken\" | \"destDecimals\" // destToken is not available in SwapForm initially\n>;\n\ntype DeltaQueryParams<TData = DeltaV2.DeltaPrice> = Omit<\n UseQueryOptions<DeltaV2.DeltaPrice, Error, TData, DeltaPriceQueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaQueryResult<TData = DeltaV2.DeltaPrice> = UseQueryResult<\n TData,\n Error\n>;\n\ntype DeltaPriceQueryInput<TData = DeltaV2.DeltaPrice> = {\n priceParams: DeltaPriceQueryParams;\n query?: DeltaQueryParams<TData>;\n chainId: number;\n timeout?: number;\n destChainId?: number;\n};\n\nexport const DeltaPriceQueryKeyPrefix = \"swap/prices/delta\";\n\nexport type DeltaPriceQueryKey = readonly [\n base: typeof DeltaPriceQueryKeyPrefix,\n chainId: number,\n priceParams: DeltaPriceQueryParams & {\n destChainId?: number;\n },\n];\n\nexport function useDeltaPriceQuery<TData = DeltaV2.DeltaPrice>({\n priceParams: _priceParams,\n query,\n chainId,\n timeout = PRICE_FETCH_TIMEOUT_MS,\n destChainId,\n}: DeltaPriceQueryInput<TData>): {\n result: DeltaQueryResult<TData>;\n queryKey: DeltaPriceQueryKey;\n} {\n const { sdk } = useDeltaV2SDK({ chainId });\n\n const queryEnabled = query?.enabled ?? true;\n\n const { queryKey, sanitizedPriceParams } = useDeltaPriceQueryKey({\n priceParams: _priceParams,\n chainId,\n destChainId,\n });\n\n const result = useQuery<DeltaV2.DeltaPrice, Error, TData, DeltaPriceQueryKey>(\n {\n queryKey,\n queryFn: ({ signal }) => {\n assert(\n isPriceParamsValid(sanitizedPriceParams),\n \"destToken is required\"\n );\n const price = sdk.getDeltaPrice(sanitizedPriceParams, {\n signal,\n timeout,\n });\n return price;\n },\n ...query,\n enabled: queryEnabled && isPriceParamsValid(sanitizedPriceParams),\n }\n );\n\n return { result, queryKey };\n}\n\nfunction isPriceParamsValid(\n priceParams: DeltaPriceQueryParams\n): priceParams is RequiredDeltaPriceParams {\n return (\n !!priceParams.destToken &&\n priceParams.destDecimals !== undefined &&\n Number(priceParams.amount) > 0\n );\n}\n\nexport function isDeltaPrice(\n price: OptimalRate | DeltaV2.DeltaPrice\n): price is DeltaV2.DeltaPrice {\n return \"route\" in price;\n}\n\nexport function isBridgePrice(price: DeltaV2.DeltaPrice): boolean {\n return price.route.bridge !== null;\n}\n\ntype GetDeltaPriceQueryForPriceInput = {\n price: DeltaV2.DeltaPrice;\n chainId: number;\n};\n\ntype DeltaPriceQuery = Query<\n DeltaV2.DeltaPrice,\n Error,\n DeltaV2.DeltaPrice,\n DeltaPriceQueryKey\n>;\n\ntype GetDeltaPriceQueryForPrice = (\n input: GetDeltaPriceQueryForPriceInput\n) => DeltaPriceQuery | undefined;\n\n// get query for a given deltaPrice\nexport function useDeltaPriceQueryForPrice(): GetDeltaPriceQueryForPrice {\n const queryClient = useQueryClient();\n\n return ({ chainId, price }) => {\n const queryKey: [DeltaPriceQueryKey[0], DeltaPriceQueryKey[1]] = [\n DeltaPriceQueryKeyPrefix,\n chainId,\n ];\n const queryCache = queryClient.getQueryCache();\n const query = queryCache.find<\n DeltaV2.DeltaPrice,\n Error,\n DeltaV2.DeltaPrice\n >({\n queryKey,\n exact: false,\n predicate: (query) => {\n return query.state.data === price;\n },\n });\n\n return query as DeltaPriceQuery | undefined;\n };\n}\n\ntype SubscribeToDeltaPriceInput = {\n queryKey: DeltaPriceQueryKey;\n onData?: (data: DeltaV2.DeltaPrice) => void;\n onError?: (error: Error) => void;\n};\n\ntype SubscribeToDeltaPriceResult = (\n input: SubscribeToDeltaPriceInput\n) => () => void;\n\n// independently subscribe to a price query\nexport function useSubscribeToDeltaPrice(): SubscribeToDeltaPriceResult {\n const queryClient = useQueryClient();\n\n return ({ queryKey, onData, onError }) => {\n const observer = new QueryObserver<\n DeltaV2.DeltaPrice,\n Error,\n DeltaV2.DeltaPrice,\n DeltaV2.DeltaPrice,\n DeltaPriceQueryKey\n >(queryClient, {\n queryKey,\n // only receive updates from existing subscriptions\n enabled: false,\n });\n\n // return unsubscribe function\n return observer.subscribe((result) => {\n if (result.error) {\n onError?.(result.error);\n return;\n }\n if (result.data) {\n onData?.(result.data);\n }\n });\n };\n}\n\nfunction getLastDeltaPriceQuery(\n queryClient: QueryClient\n): Query<DeltaV2.DeltaPrice, Error, DeltaV2.DeltaPrice> | undefined {\n return queryClient\n .getQueryCache()\n .find<DeltaV2.DeltaPrice, Error, DeltaV2.DeltaPrice>({\n queryKey: [DeltaPriceQueryKeyPrefix],\n exact: false,\n type: \"active\", // only the most recent query will be active\n });\n}\n\nexport function getLastDeltaPrice(\n queryClient: QueryClient\n): DeltaV2.DeltaPrice | undefined {\n const query = getLastDeltaPriceQuery(queryClient);\n\n return query?.state.data;\n}\n\nexport function isLastDeltaPriceQueryInError(\n queryClient: QueryClient\n): boolean {\n const query = getLastDeltaPriceQuery(queryClient);\n const error = query?.state.error;\n return !!error;\n}\n\nexport function isDataDeltaPriceV2(\n price: unknown\n): price is DeltaV2.DeltaPrice {\n return (\n typeof price === \"object\" &&\n price !== null &&\n \"route\" in price &&\n \"inputToken\" in price &&\n \"outputToken\" in price\n );\n}\n\nexport function useDeltaPriceQueryKey({\n priceParams,\n chainId,\n destChainId,\n}: Pick<DeltaPriceQueryInput, \"priceParams\" | \"chainId\"> & {\n destChainId?: number;\n}) {\n \"use no memo\";\n\n // amount tends to change fast during input\n const [debouncedAmount] = useDebouncedValue(priceParams.amount, {\n wait: 500,\n });\n\n return useMemo(() => {\n // avoid passing unnecessary params to url?search and queryKey\n const sanitizedPriceParams: DeltaPriceQueryParams & {\n destChainId?: number;\n } = {\n amount: debouncedAmount,\n srcToken: priceParams.srcToken,\n destToken: priceParams.destToken,\n srcDecimals: priceParams.srcDecimals,\n destDecimals: priceParams.destDecimals,\n userAddress: priceParams.userAddress,\n beneficiary: priceParams.beneficiary,\n partner: priceParams.partner,\n partnerFeeBps: priceParams.partnerFeeBps,\n side: priceParams.side,\n includeAgents: priceParams.includeAgents,\n excludeAgents: priceParams.excludeAgents,\n includeBridges: priceParams.includeBridges,\n excludeBridges: priceParams.excludeBridges,\n allowBridgeAndSwap: priceParams.allowBridgeAndSwap,\n destChainId: destChainId,\n maxImpact: priceParams.maxImpact,\n degenMode: priceParams.degenMode,\n };\n\n const queryKey: DeltaPriceQueryKey = [\n DeltaPriceQueryKeyPrefix,\n chainId,\n sanitizedPriceParams,\n ];\n\n return { queryKey, sanitizedPriceParams };\n }, [\n priceParams.beneficiary,\n priceParams.destDecimals,\n priceParams.destToken,\n priceParams.excludeAgents,\n priceParams.includeAgents,\n priceParams.includeBridges,\n priceParams.excludeBridges,\n priceParams.partner,\n priceParams.partnerFeeBps,\n priceParams.side,\n priceParams.srcDecimals,\n priceParams.srcToken,\n priceParams.userAddress,\n priceParams.allowBridgeAndSwap,\n priceParams.maxImpact,\n priceParams.degenMode,\n chainId,\n debouncedAmount,\n destChainId,\n ]);\n}\n"],"mappings":";;;;;;;;AAwCA,IAAa+B,IAA2B;AAUxC,SAAOE,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAAwD,EAAAV,aAAAW,GAAAV,UAAAC,YAAAC,SAAAS,GAAAR,mBAAAI,GAI7DL,IAAAS,MAAAC,KAAAA,IAAAzB,IAAAwB,GAAgCE;CAAA,AAAAL,EAAA,OAAAP,IAMSY,IAAAL,EAAA,MAAXK,IAAA,EAAAZ,YAAW,EAAAO,EAAA,KAAAP,GAAAO,EAAA,KAAAK;CAAzC,IAAA,EAAAC,WAAgBzC,EAAcwC,EAAY,EAE1CE,IAAqBf,GAAKgB,WAAL,IAAuBC;CAAA,AAAAT,EAAA,OAAAE,KAAAF,EAAA,OAAAP,KAAAO,EAAA,OAAAL,KAEqBc,IAAA;EAAAlB,aAClDW;EAAYT;EAAAE;EAG1B,EAAAK,EAAA,KAAAE,GAAAF,EAAA,KAAAP,GAAAO,EAAA,KAAAL,GAAAK,EAAA,KAAAS,KAAAA,IAAAT,EAAA;CAJD,IAAA,EAAAU,aAAAC,4BAA2CC,EAAsBH,EAI/D,EAACI;CAAA,AAAAb,EAAA,OAAAW,KAAAX,EAAA,OAAAM,KAAAN,EAAA,OAAAN,KAKUmB,KAAAC,MAAA;EA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,MAAM5E,EAAY4E;GAClBC,eAAe7E,EAAY6E;GAC3BC,eAAe9E,EAAY8E;GAC3BC,gBAAgB/E,EAAY+E;GAC5BC,gBAAgBhF,EAAYgF;GAC5BC,oBAAoBjF,EAAYiF;GACnB7E;GACb8E,WAAWlF,EAAYkF;GACvBC,WAAWnF,EAAYmF;GACxB;EAQD,OAAO;GAAEhE,UAAAA;IALPd;IACAH;IACAkB;IAGOD;GAAUC;GAAsB;IACxC;EACDpB,EAAYyE;EACZzE,EAAYiC;EACZjC,EAAYgC;EACZhC,EAAY8E;EACZ9E,EAAY6E;EACZ7E,EAAY+E;EACZ/E,EAAYgF;EACZhF,EAAY0E;EACZ1E,EAAY2E;EACZ3E,EAAY4E;EACZ5E,EAAYuE;EACZvE,EAAYsE;EACZtE,EAAYwE;EACZxE,EAAYiF;EACZjF,EAAYkF;EACZlF,EAAYmF;EACZjF;EACAkE;EACAhE;EACD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useDeltaV2SDK as e } from "../../../../useSDK.js";
|
|
2
2
|
import { useGlobalDeltaEnabled as t } from "../../../../useGlobalDeltaEnabled.js";
|
|
3
3
|
import { c as n } from "react-compiler-runtime";
|
|
4
4
|
import { useQuery as r } from "@tanstack/react-query";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIsTokenSupportedInDelta.js","names":["useGlobalDeltaEnabled","
|
|
1
|
+
{"version":3,"file":"useIsTokenSupportedInDelta.js","names":["useGlobalDeltaEnabled","useDeltaV2SDK","useQuery","UseQueryOptions","UseQueryResult","assert","IsTokenSupportedInDeltaParams","IsTokenSupportedInDeltaReturn","IsTokenSupportedInDeltaQueryParams","Omit","Error","TData","IsTokenSupportedInDeltaQueryKey","IsTokenSupportedInDeltaQueryResult","IsTokenSupportedInDeltaQueryInput","token","query","chainId","base","useIsTokenSupportedInDeltaQuery","t0","$","_c","t1","sdk","enabledOnCurrentChain","t2","toLowerCase","t3","t4","t5","signal","isSupported","isTokenSupportedInDelta","enabled","t6","queryKey","queryFn","staleTime","Infinity","gcTime"],"sources":["../../../../../../src/hooks/swap/prices/delta/queries/useIsTokenSupportedInDelta.ts"],"sourcesContent":["import { useGlobalDeltaEnabled } from \"@/hooks/useGlobalDeltaEnabled\";\nimport { useDeltaV2SDK } from \"@/hooks/useSDK\";\nimport {\n useQuery,\n type UseQueryOptions,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport { assert } from \"ts-essentials\";\n\ntype IsTokenSupportedInDeltaParams = string | undefined; // token address\ntype IsTokenSupportedInDeltaReturn = boolean;\n\ntype IsTokenSupportedInDeltaQueryParams<TData = IsTokenSupportedInDeltaReturn> =\n Omit<\n UseQueryOptions<\n IsTokenSupportedInDeltaReturn,\n Error,\n TData,\n IsTokenSupportedInDeltaQueryKey\n >,\n \"queryKey\" | \"queryFn\"\n >;\ntype IsTokenSupportedInDeltaQueryResult<TData = IsTokenSupportedInDeltaReturn> =\n UseQueryResult<TData, Error>;\n\ntype IsTokenSupportedInDeltaQueryInput<TData = IsTokenSupportedInDeltaReturn> =\n {\n token: IsTokenSupportedInDeltaParams;\n query?: IsTokenSupportedInDeltaQueryParams<TData>;\n chainId: number;\n };\n\ntype IsTokenSupportedInDeltaQueryKey = [\n base: \"swap/delta/is-token-supported\",\n chainId: number,\n token: IsTokenSupportedInDeltaParams,\n];\n\nexport function useIsTokenSupportedInDeltaQuery<\n TData = IsTokenSupportedInDeltaReturn,\n>({\n token,\n query,\n chainId,\n}: IsTokenSupportedInDeltaQueryInput<TData>): IsTokenSupportedInDeltaQueryResult<TData> {\n const { sdk } = useDeltaV2SDK({ chainId });\n const { enabledOnCurrentChain } = useGlobalDeltaEnabled();\n\n return useQuery<\n IsTokenSupportedInDeltaReturn,\n Error,\n TData,\n IsTokenSupportedInDeltaQueryKey\n >({\n queryKey: [\"swap/delta/is-token-supported\", chainId, token?.toLowerCase()],\n queryFn: ({ signal }) => {\n assert(token, \"token is required\");\n const isSupported = sdk.isTokenSupportedInDelta(token, { signal });\n return isSupported;\n },\n // never changes during App session\n staleTime: Infinity,\n gcTime: Infinity,\n ...query,\n enabled: !!token && enabledOnCurrentChain && (query?.enabled ?? true),\n });\n}\n"],"mappings":";;;;;;AAsCA,SAAOmB,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAEL,EAAAP,UAAAC,UAAAC,eAAAG,GAIyCG;CAAA,AAAAF,EAAA,OAAAJ,IACAM,IAAAF,EAAA,MAAXE,IAAA,EAAAN,YAAW,EAAAI,EAAA,KAAAJ,GAAAI,EAAA,KAAAE;CAAzC,IAAA,EAAAC,WAAgBvB,EAAcsB,EAAY,EAC1C,EAAAE,6BAAkCzB,GAAuB,EAAC0B;CAAA,AAAAL,EAAA,OAAAN,IAQiBW,IAAAL,EAAA,MAApBK,IAAAX,GAAKY,aAAe,EAAAN,EAAA,KAAAN,GAAAM,EAAA,KAAAK;CAAA,IAAAE;CAAA,AAAAP,EAAA,OAAAJ,KAAAI,EAAA,OAAAK,KAA/DE,IAAA;EAAC;EAAiCX;EAASS;EAAqB,EAAAL,EAAA,KAAAJ,GAAAI,EAAA,KAAAK,GAAAL,EAAA,KAAAO,KAAAA,IAAAP,EAAA;CAAA,IAAAQ;CAAA,AAAAR,EAAA,OAAAG,KAAAH,EAAA,OAAAN,KACjEc,KAAAC,MAAA;EAAC,IAAA,EAAAC,cAAAD;EAE2D,OADnEzB,EAAOU,GAAO,oBAAoB,EACdS,EAAGS,wBAAyBlB,GAAO,EAAAgB,WAAU,CAC1DC;IACRX,EAAA,KAAAG,GAAAH,EAAA,KAAAN,GAAAM,EAAA,KAAAQ,KAAAA,IAAAR,EAAA;CAKQ,IAAAS,IAAA,CAAC,CAACf,KAAFU,MAAqCT,GAAKkB,WAAL,KAAuBC;CACtE,OADsEd,EAAA,QAAAL,KAAAK,EAAA,QAAAO,KAAAP,EAAA,QAAAQ,KAAAR,EAAA,QAAAS,KAXrEK,IAAA;EAAAC,UACUR;EAAgES,SACjER;EAIRS,WAEUC;EAAQC,QACXD;EAAQ,GACbvB;EAAKkB,SACCJ;EACV,EAAAT,EAAA,MAAAL,GAAAK,EAAA,MAAAO,GAAAP,EAAA,MAAAQ,GAAAR,EAAA,MAAAS,GAAAT,EAAA,MAAAc,KAAAA,IAAAd,EAAA,KAjBMnB,EAKLiC,EAYA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
3
|
-
import { ExecutedDeltaAuction, FailedDeltaAuction } from '../orders/types';
|
|
4
|
-
import { DeltaAuction, DeltaAuctionUnion } from '@velora-dex/sdk';
|
|
2
|
+
import { DeltaV2 } from '@velora-dex/sdk';
|
|
5
3
|
declare const SINGLE_DELTA_AUCTION_QUERY_KEY_PREFIX = "single_delta_auction";
|
|
6
4
|
type SingleDeltaAuctionQueryKey = [
|
|
7
5
|
base: typeof SINGLE_DELTA_AUCTION_QUERY_KEY_PREFIX,
|
|
@@ -10,35 +8,29 @@ type SingleDeltaAuctionQueryKey = [
|
|
|
10
8
|
export declare function deltaAuctionPollingQueryKey({ orderId, }?: {
|
|
11
9
|
orderId?: string;
|
|
12
10
|
}): SingleDeltaAuctionQueryKey;
|
|
13
|
-
type
|
|
11
|
+
type DeltaV2Order = DeltaV2.DeltaAuction;
|
|
12
|
+
type UseWatchDeltaAuctionQueryInput<TData = DeltaV2Order> = {
|
|
14
13
|
orderId?: string;
|
|
15
14
|
enabled?: boolean;
|
|
16
15
|
refetchInterval?: number;
|
|
17
|
-
select?: (data:
|
|
18
|
-
onAuctionSuccess?: (auction:
|
|
19
|
-
onAuctionFailure?: (auction:
|
|
20
|
-
onUpdatedAuction?: (auction:
|
|
16
|
+
select?: (data: DeltaV2Order) => TData;
|
|
17
|
+
onAuctionSuccess?: (auction: DeltaV2Order) => void;
|
|
18
|
+
onAuctionFailure?: (auction: DeltaV2Order) => void;
|
|
19
|
+
onUpdatedAuction?: (auction: DeltaV2Order) => void;
|
|
21
20
|
};
|
|
22
|
-
export declare function useWatchDeltaAuction<TData =
|
|
23
|
-
type EnsureOrderExecutedFn<TData extends
|
|
21
|
+
export declare function useWatchDeltaAuction<TData = DeltaV2Order>({ orderId, enabled, refetchInterval, select, onAuctionSuccess, onAuctionFailure, onUpdatedAuction, }: UseWatchDeltaAuctionQueryInput<TData>): UseQueryResult<TData>;
|
|
22
|
+
type EnsureOrderExecutedFn<TData extends DeltaV2Order = DeltaV2Order> = (options: {
|
|
24
23
|
orderId: string;
|
|
25
24
|
signal?: AbortSignal;
|
|
26
25
|
}) => Promise<TData>;
|
|
27
|
-
export declare function useEnsureDeltaOrderExecuted<TData extends
|
|
26
|
+
export declare function useEnsureDeltaOrderExecuted<TData extends DeltaV2Order = DeltaV2Order>({ onAuctionSuccess, onAuctionFailure, refetchInterval, }?: Pick<UseWatchDeltaAuctionQueryInput, "onAuctionSuccess" | "onAuctionFailure" | "refetchInterval">): EnsureOrderExecutedFn<TData>;
|
|
28
27
|
type UseWatchMultiDeltaAuctions = {
|
|
29
28
|
orderIds: string[];
|
|
30
29
|
enabled?: boolean;
|
|
31
|
-
onAuctionSuccess?: (auction:
|
|
32
|
-
onAuctionFailure?: (auction:
|
|
33
|
-
onUpdatedAuction?: (auction:
|
|
30
|
+
onAuctionSuccess?: (auction: DeltaV2Order) => void;
|
|
31
|
+
onAuctionFailure?: (auction: DeltaV2Order) => void;
|
|
32
|
+
onUpdatedAuction?: (auction: DeltaV2Order) => void;
|
|
34
33
|
};
|
|
35
|
-
export declare function useWatchMultiDeltaAuctions({ orderIds, enabled, onAuctionSuccess, onAuctionFailure, onUpdatedAuction, }: UseWatchMultiDeltaAuctions): UseQueryResult<
|
|
36
|
-
type MultiOrdersStatusCrossChainInput = {
|
|
37
|
-
orders: DeltaAuction[];
|
|
38
|
-
onAuctionSuccess?: (order: DeltaAuction) => void;
|
|
39
|
-
onAuctionFailure?: (order: DeltaAuction) => void;
|
|
40
|
-
onUpdatedAuction?: (auction: DeltaAuction, bridgeResponse: BridgedDepositResponse) => void;
|
|
41
|
-
};
|
|
42
|
-
export declare function useWatchMultiOrdersStatusCrossChain({ orders, onAuctionSuccess, onAuctionFailure, onUpdatedAuction, }: MultiOrdersStatusCrossChainInput): UseQueryResult<BridgedDepositResponse>[];
|
|
34
|
+
export declare function useWatchMultiDeltaAuctions({ orderIds, enabled, onAuctionSuccess, onAuctionFailure, onUpdatedAuction, }: UseWatchMultiDeltaAuctions): UseQueryResult<DeltaV2Order>[];
|
|
43
35
|
export {};
|
|
44
36
|
//# sourceMappingURL=useWatchDeltaOrder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWatchDeltaOrder.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useWatchDeltaOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useWatchDeltaOrder.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useWatchDeltaOrder.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAiB/C,QAAA,MAAM,qCAAqC,yBAAyB,CAAC;AACrE,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,OAAO,qCAAqC;IAClD,OAAO,CAAC,EAAE,MAAM;CACjB,CAAC;AAEF,wBAAgB,2BAA2B,CAAC,EAC1C,OAAO,GACR,GAAE;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;CACb,GAAG,0BAA0B,CAElC;AAED,KAAK,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;AA0GzC,KAAK,8BAA8B,CAAC,KAAK,GAAG,YAAY,IAAI;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,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