@velora-dex/widget 0.8.3-dev.1 → 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/web3/ConnectExternalProvider/AutoconnectExternal.d.ts.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/AutoconnectExternal.js +23 -22
- package/dist/components/web3/ConnectExternalProvider/AutoconnectExternal.js.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/constants.d.ts +2 -1
- package/dist/components/web3/ConnectExternalProvider/constants.d.ts.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/constants.js +2 -2
- package/dist/components/web3/ConnectExternalProvider/constants.js.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/safeProviderWrapper.d.ts.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/safeProviderWrapper.js +4 -1
- package/dist/components/web3/ConnectExternalProvider/safeProviderWrapper.js.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/utils.d.ts.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/utils.js +1 -1
- package/dist/components/web3/ConnectExternalProvider/utils.js.map +1 -1
- package/dist/components/web3/ConnectExternalProvider/walletConnectProviderWrapper.d.ts +5 -0
- package/dist/components/web3/ConnectExternalProvider/walletConnectProviderWrapper.d.ts.map +1 -0
- package/dist/components/web3/ConnectExternalProvider/walletConnectProviderWrapper.js +22 -0
- package/dist/components/web3/ConnectExternalProvider/walletConnectProviderWrapper.js.map +1 -0
- 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 +9 -9
- 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/Dialog/SelectTokenDialog/TokenListBody/TokenCloud/tokens.d.ts.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/TokenCloud/tokens.js +10 -10
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/TokenCloud/tokens.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/TradeError/utils.js +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/configurator/Configurator.d.ts.map +1 -1
- package/dist/core/LimitOrderButton.d.ts.map +1 -1
- package/dist/core/LimitOrderButton.js +5 -4
- package/dist/core/LimitOrderButton.js.map +1 -1
- package/dist/core/OtcOrderButton.d.ts.map +1 -1
- package/dist/core/OtcOrderButton.js +6 -5
- package/dist/core/OtcOrderButton.js.map +1 -1
- package/dist/core/TradeFlowScreenButton.d.ts +3 -3
- package/dist/core/TradeFlowScreenButton.d.ts.map +1 -1
- package/dist/core/TradeFlowScreenButton.js +24 -24
- 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 +1 -0
- package/dist/core/button/hooks/useWidgetButtonExtraProps.d.ts.map +1 -1
- package/dist/core/button/hooks/useWidgetButtonExtraProps.js +127 -99
- package/dist/core/button/hooks/useWidgetButtonExtraProps.js.map +1 -1
- package/dist/core/index.js +5 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/inputs/hooks/useTokenFromInputProps.js +1 -1
- package/dist/core/inputs/hooks/useTokenFromInputProps.js.map +1 -1
- 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/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 +1 -1
- package/dist/core/limit/useLimitTokenFromInputProps.js +1 -1
- package/dist/core/limit/useLimitTokenFromInputProps.js.map +1 -1
- package/dist/core/limit/useLimitTokenToInputProps.js.map +1 -1
- package/dist/core/otc/state/selectedTokenActionsAtom.d.ts.map +1 -1
- package/dist/core/otc/state/selectedTokenActionsAtom.js +2 -2
- package/dist/core/otc/state/selectedTokenActionsAtom.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/state/widgetEventsAtom.d.ts.map +1 -1
- package/dist/core/state/widgetEventsAtom.js +21 -11
- package/dist/core/state/widgetEventsAtom.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/importToken.d.ts +14 -0
- package/dist/events/types/importToken.d.ts.map +1 -0
- package/dist/events/types/index.d.ts +4 -1
- package/dist/events/types/index.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/batch/useSendBatchTx.d.ts.map +1 -1
- package/dist/hooks/batch/useSendBatchTx.js +31 -32
- package/dist/hooks/batch/useSendBatchTx.js.map +1 -1
- package/dist/hooks/swap/prices/delta/bridge/useSelectedBridgePrice.d.ts +3 -3
- 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 -6
- package/dist/hooks/swap/prices/delta/bridge/utils.d.ts.map +1 -1
- 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 +5 -5
- 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/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 +2 -2
- 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 +5 -5
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.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/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 -5
- package/dist/hooks/swap/prices/delta/mutations/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/utils.js +2 -2
- 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 +19 -19
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/utils.d.ts +23 -68
- package/dist/hooks/swap/prices/delta/orders/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/utils.js +22 -169
- 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 +17 -17
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js +1 -1
- 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 -61
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.d.ts +1 -1
- package/dist/hooks/swap/prices/types.d.ts +2 -2
- 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/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 -4
- 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 +5 -5
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.d.ts.map +1 -1
- 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 +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 +209 -209
- 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.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 +236 -236
- 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 +5 -21
- package/dist/hooks/useSDK.d.ts.map +1 -1
- package/dist/hooks/useSDK.js +47 -77
- 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/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/queryClient.js +2 -2
- package/dist/lib/queryClient.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 +27 -16
- package/dist/lib/utils/twap.js.map +1 -1
- package/dist/tokens/state/addImportedTokenAtom.d.ts +2 -0
- package/dist/tokens/state/addImportedTokenAtom.d.ts.map +1 -1
- package/dist/tokens/state/addImportedTokenAtom.js +47 -31
- package/dist/tokens/state/addImportedTokenAtom.js.map +1 -1
- package/package.json +2 -2
- 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
- package/dist/lib/utils/scaleFactor.js +0 -13
- package/dist/lib/utils/scaleFactor.js.map +0 -1
|
@@ -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,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AC,KAAK,GAAG,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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AGpD,SAAgBiB,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<DeltaOr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AAS,KAPMI,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,11 +1,11 @@
|
|
|
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 =
|
|
7
|
-
type DeltaQueryResult<TData =
|
|
8
|
-
type DeltaPriceQueryInput<TData =
|
|
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;
|
|
@@ -20,42 +20,42 @@ export type DeltaPriceQueryKey = readonly [
|
|
|
20
20
|
destChainId?: number;
|
|
21
21
|
}
|
|
22
22
|
];
|
|
23
|
-
export declare function useDeltaPriceQuery<TData =
|
|
23
|
+
export declare function useDeltaPriceQuery<TData = DeltaV2.DeltaPrice>({ priceParams: _priceParams, query, chainId, timeout, destChainId, }: DeltaPriceQueryInput<TData>): {
|
|
24
24
|
result: DeltaQueryResult<TData>;
|
|
25
25
|
queryKey: DeltaPriceQueryKey;
|
|
26
26
|
};
|
|
27
|
-
export declare function isDeltaPrice(price: OptimalRate |
|
|
28
|
-
export declare function isBridgePrice(price:
|
|
27
|
+
export declare function isDeltaPrice(price: OptimalRate | DeltaV2.DeltaPrice): price is DeltaV2.DeltaPrice;
|
|
28
|
+
export declare function isBridgePrice(price: DeltaV2.DeltaPrice): boolean;
|
|
29
29
|
type GetDeltaPriceQueryForPriceInput = {
|
|
30
|
-
price:
|
|
30
|
+
price: DeltaV2.DeltaPrice;
|
|
31
31
|
chainId: number;
|
|
32
32
|
};
|
|
33
|
-
type DeltaPriceQuery = Query<
|
|
33
|
+
type DeltaPriceQuery = Query<DeltaV2.DeltaPrice, Error, DeltaV2.DeltaPrice, DeltaPriceQueryKey>;
|
|
34
34
|
type GetDeltaPriceQueryForPrice = (input: GetDeltaPriceQueryForPriceInput) => DeltaPriceQuery | undefined;
|
|
35
35
|
export declare function useDeltaPriceQueryForPrice(): GetDeltaPriceQueryForPrice;
|
|
36
36
|
type SubscribeToDeltaPriceInput = {
|
|
37
37
|
queryKey: DeltaPriceQueryKey;
|
|
38
|
-
onData?: (data:
|
|
38
|
+
onData?: (data: DeltaV2.DeltaPrice) => void;
|
|
39
39
|
onError?: (error: Error) => void;
|
|
40
40
|
};
|
|
41
41
|
type SubscribeToDeltaPriceResult = (input: SubscribeToDeltaPriceInput) => () => void;
|
|
42
42
|
export declare function useSubscribeToDeltaPrice(): SubscribeToDeltaPriceResult;
|
|
43
|
-
export declare function getLastDeltaPrice(queryClient: QueryClient):
|
|
43
|
+
export declare function getLastDeltaPrice(queryClient: QueryClient): DeltaV2.DeltaPrice | undefined;
|
|
44
44
|
export declare function isLastDeltaPriceQueryInError(queryClient: QueryClient): boolean;
|
|
45
|
-
export declare function isDataDeltaPriceV2(price: unknown): price is
|
|
45
|
+
export declare function isDataDeltaPriceV2(price: unknown): price is DeltaV2.DeltaPrice;
|
|
46
46
|
export declare function useDeltaPriceQueryKey({ priceParams, chainId, destChainId, }: Pick<DeltaPriceQueryInput, "priceParams" | "chainId"> & {
|
|
47
47
|
destChainId?: number;
|
|
48
48
|
}): {
|
|
49
49
|
queryKey: DeltaPriceQueryKey;
|
|
50
50
|
sanitizedPriceParams: {
|
|
51
51
|
amount: string;
|
|
52
|
-
side?: ("
|
|
52
|
+
side?: ("SELL" | "BUY") | undefined;
|
|
53
|
+
beneficiary?: string | undefined;
|
|
53
54
|
partner?: string | undefined;
|
|
54
|
-
excludeAgents?: string[] | undefined;
|
|
55
|
-
includeAgents?: string[] | undefined;
|
|
56
55
|
userAddress?: string | undefined;
|
|
56
|
+
includeAgents?: string[] | undefined;
|
|
57
|
+
excludeAgents?: string[] | undefined;
|
|
57
58
|
degenMode?: boolean | undefined;
|
|
58
|
-
beneficiary?: string | undefined;
|
|
59
59
|
partnerFeeBps?: number | undefined;
|
|
60
60
|
srcToken: string;
|
|
61
61
|
destToken?: string | 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,OA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,wBAAgB,0BAA0B,IAAI,0BAA0B,CAuBvE;AAED,KAAK,0BAA0B,GAAG;IAChC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC,CAAC;AAEF,KAAK,2BAA2B,GAAG,CACjC,KAAK,EAAE,0BAA0B,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"}
|
|
@@ -19,7 +19,7 @@ function u(r) {
|
|
|
19
19
|
let { queryKey: v, sanitizedPriceParams: b } = y(_), x;
|
|
20
20
|
i[6] !== b || i[7] !== h || i[8] !== p ? (x = (e) => {
|
|
21
21
|
let { signal: t } = e;
|
|
22
|
-
return s(d(b), "destToken is required"), h.
|
|
22
|
+
return s(d(b), "destToken is required"), h.getDeltaPrice(b, {
|
|
23
23
|
signal: t,
|
|
24
24
|
timeout: p
|
|
25
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeltaPriceQuery.js","names":["useDeltaV2SDK","Query","QueryClient","QueryObserver","useQuery","useQueryClient","UseQueryOptions","UseQueryResult","useDebouncedValue","DeltaPriceV2","DeltaPriceV2Params","DParams","OptimalRate","assert","MarkOptional","useMemo","PRICE_FETCH_TIMEOUT_MS","RequiredDeltaPriceParams","Omit","DeltaPriceQueryParams","DeltaQueryParams","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","getDeltaPriceV2","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 {\n DeltaPriceV2,\n DeltaPriceV2Params 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// destChainId is passed separately to keep the query key stable\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 = DeltaPriceV2> = Omit<\n UseQueryOptions<DeltaPriceV2, Error, TData, DeltaPriceQueryKey>,\n \"queryKey\" | \"queryFn\"\n>;\ntype DeltaQueryResult<TData = DeltaPriceV2> = UseQueryResult<TData, Error>;\n\ntype DeltaPriceQueryInput<TData = DeltaPriceV2> = {\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 = DeltaPriceV2>({\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<DeltaPriceV2, Error, TData, DeltaPriceQueryKey>({\n queryKey,\n queryFn: ({ signal }) => {\n assert(isPriceParamsValid(sanitizedPriceParams), \"destToken is required\");\n const price = sdk.getDeltaPriceV2(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 | DeltaPriceV2\n): price is DeltaPriceV2 {\n return \"route\" in price;\n}\n\nexport function isBridgePrice(price: DeltaPriceV2): boolean {\n return price.route.bridge !== null;\n}\n\ntype GetDeltaPriceQueryForPriceInput = {\n price: DeltaPriceV2;\n chainId: number;\n};\n\ntype DeltaPriceQuery = Query<\n DeltaPriceV2,\n Error,\n DeltaPriceV2,\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<DeltaPriceV2, Error, DeltaPriceV2>({\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: DeltaPriceV2) => 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 DeltaPriceV2,\n Error,\n DeltaPriceV2,\n DeltaPriceV2,\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<DeltaPriceV2, Error, DeltaPriceV2> | undefined {\n return queryClient\n .getQueryCache()\n .find<DeltaPriceV2, Error, DeltaPriceV2>({\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): DeltaPriceV2 | 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 DeltaPriceV2 {\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":";;;;;;;;AAyCA,IAAa+B,IAA2B;AAUxC,SAAOE,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAAkD,EAAAV,aAAAW,GAAAV,UAAAC,YAAAC,SAAAS,GAAAR,mBAAAI,GAIvDL,IAAAS,MAAAC,KAAAA,IAAAvB,IAAAsB,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,EAA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jC,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;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
|
+
{"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;EAAC,IAAA,EAAAC,cAAAD;EAQL,OAPHtC,EACEwC,EAAmBL,EAAqB,EACxC,wBACD,EACaL,EAAGY,cAAeP,GAAsB;GAAAI;GAAArB;GAGrD,CACMuB;IACRjB,EAAA,KAAAW,GAAAX,EAAA,KAAAM,GAAAN,EAAA,KAAAN,GAAAM,EAAA,KAAAa,KAA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QD,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,EA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B,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 } 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,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,KAAK,CAAC;IACvC,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IACnD,gBAAgB,CAAC,EAAE,CA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
|
|
@@ -1,112 +1,122 @@
|
|
|
1
1
|
import { getLogger as e, useLogger as t } from "../../../../../core/logger.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { assert as g } from "ts-essentials";
|
|
2
|
+
import { useDeltaV2SDK as n } from "../../../../useSDK.js";
|
|
3
|
+
import { DeltaOrderFailedError as r } from "./errors.js";
|
|
4
|
+
import { c as i } from "react-compiler-runtime";
|
|
5
|
+
import { useLayoutEffect as a, useMemo as o, useRef as s } from "react";
|
|
6
|
+
import { QueryObserver as c, useQuery as l, useQueryClient as u } from "@tanstack/react-query";
|
|
7
|
+
import { assert as d } from "ts-essentials";
|
|
9
8
|
//#region src/hooks/swap/prices/delta/queries/useWatchDeltaOrder.ts
|
|
10
|
-
var
|
|
9
|
+
var f = new Set([
|
|
10
|
+
"COMPLETED",
|
|
11
|
+
"FAILED",
|
|
12
|
+
"EXPIRED",
|
|
13
|
+
"CANCELLED",
|
|
14
|
+
"REFUNDED"
|
|
15
|
+
]), p = new Set([
|
|
16
|
+
"FAILED",
|
|
17
|
+
"EXPIRED",
|
|
18
|
+
"CANCELLED",
|
|
19
|
+
"REFUNDED"
|
|
20
|
+
]), m = (e) => f.has(e.status), h = (e) => e.status === "COMPLETED", g = (e) => p.has(e.status), _ = "single_delta_auction";
|
|
11
21
|
function v({ orderId: e } = {}) {
|
|
12
22
|
return [_, e];
|
|
13
23
|
}
|
|
14
24
|
var y = 3e3, b = 6e4;
|
|
15
|
-
function x({ orderId: t, enabled: n = !0, refetchInterval:
|
|
16
|
-
let
|
|
25
|
+
function x({ orderId: t, enabled: n = !0, refetchInterval: r = y, select: i, getAuction: a, onUpdatedAuction: o, onAuctionSuccess: s, onAuctionFailure: c }) {
|
|
26
|
+
let l = (e) => "doneState" in e && typeof e.doneState == "boolean";
|
|
17
27
|
return {
|
|
18
28
|
queryKey: v({ orderId: t }),
|
|
19
|
-
queryFn: ({ signal: e }) => (
|
|
29
|
+
queryFn: ({ signal: e }) => (d(t, "orderId is required"), a(t, { signal: e })),
|
|
20
30
|
meta: { doneState: !1 },
|
|
21
31
|
refetchInterval: (t) => {
|
|
22
|
-
let n = t.state.data,
|
|
23
|
-
if (
|
|
24
|
-
if (n &&
|
|
25
|
-
if (
|
|
26
|
-
if (
|
|
32
|
+
let n = t.state.data, i = t.options.meta, a = !!i && l(i);
|
|
33
|
+
if (a && i.doneState) return e("DeltaAuctionPollingQueryOptions").log("Shortcut return for refetchInterval"), !1;
|
|
34
|
+
if (n && o?.(n), n && m(n)) {
|
|
35
|
+
if (h(n)) return s?.(n), a && (i.doneState = !0), !1;
|
|
36
|
+
if (g(n)) return c?.(n), a && (i.doneState = !0), !1;
|
|
27
37
|
}
|
|
28
|
-
return
|
|
38
|
+
return r;
|
|
29
39
|
},
|
|
30
40
|
enabled: !!t && n,
|
|
31
|
-
select:
|
|
41
|
+
select: i
|
|
32
42
|
};
|
|
33
43
|
}
|
|
34
|
-
function S({ orderId: e, enabled: t = !0, refetchInterval: r, select: i, onAuctionSuccess:
|
|
35
|
-
let { sdk:
|
|
36
|
-
onAuctionSuccess:
|
|
37
|
-
onAuctionFailure:
|
|
38
|
-
onUpdatedAuction:
|
|
44
|
+
function S({ orderId: e, enabled: t = !0, refetchInterval: r, select: i, onAuctionSuccess: c, onAuctionFailure: u, onUpdatedAuction: d }) {
|
|
45
|
+
let { sdk: f } = n({ chainId: 1 }), p = s({
|
|
46
|
+
onAuctionSuccess: c,
|
|
47
|
+
onAuctionFailure: u,
|
|
48
|
+
onUpdatedAuction: d
|
|
39
49
|
});
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
onAuctionSuccess:
|
|
43
|
-
onAuctionFailure:
|
|
44
|
-
onUpdatedAuction:
|
|
50
|
+
return a(() => {
|
|
51
|
+
p.current = {
|
|
52
|
+
onAuctionSuccess: c,
|
|
53
|
+
onAuctionFailure: u,
|
|
54
|
+
onUpdatedAuction: d
|
|
45
55
|
};
|
|
46
56
|
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
]),
|
|
57
|
+
c,
|
|
58
|
+
u,
|
|
59
|
+
d
|
|
60
|
+
]), l(o(() => x({
|
|
51
61
|
orderId: e,
|
|
52
62
|
enabled: t,
|
|
53
63
|
refetchInterval: r,
|
|
54
64
|
select: i,
|
|
55
|
-
getAuction:
|
|
56
|
-
onUpdatedAuction:
|
|
57
|
-
onAuctionSuccess:
|
|
58
|
-
onAuctionFailure:
|
|
65
|
+
getAuction: f.getDeltaOrderById,
|
|
66
|
+
onUpdatedAuction: p.current.onUpdatedAuction,
|
|
67
|
+
onAuctionSuccess: p.current.onAuctionSuccess,
|
|
68
|
+
onAuctionFailure: p.current.onAuctionFailure
|
|
59
69
|
}), [
|
|
60
70
|
e,
|
|
61
71
|
t,
|
|
62
72
|
r,
|
|
63
73
|
i,
|
|
64
|
-
|
|
74
|
+
f.getDeltaOrderById
|
|
65
75
|
]));
|
|
66
76
|
}
|
|
67
77
|
function C(e) {
|
|
68
|
-
let
|
|
69
|
-
|
|
70
|
-
let { onAuctionSuccess:
|
|
71
|
-
|
|
72
|
-
let { sdk:
|
|
73
|
-
return
|
|
74
|
-
let { orderId: t, signal: n } = e,
|
|
78
|
+
let a = i(10), o;
|
|
79
|
+
a[0] === e ? o = a[1] : (o = e === void 0 ? {} : e, a[0] = e, a[1] = o);
|
|
80
|
+
let { onAuctionSuccess: s, onAuctionFailure: l, refetchInterval: d } = o, f = u(), p = t("EnsureDeltaOrderExecuted"), _;
|
|
81
|
+
a[2] === Symbol.for("react.memo_cache_sentinel") ? (_ = { chainId: 1 }, a[2] = _) : _ = a[2];
|
|
82
|
+
let { sdk: y } = n(_), S;
|
|
83
|
+
return a[3] !== p || a[4] !== l || a[5] !== s || a[6] !== f || a[7] !== d || a[8] !== y.getDeltaOrderById ? (S = async (e) => {
|
|
84
|
+
let { orderId: t, signal: n } = e, i = v({ orderId: t }), a = new c(f, x({
|
|
75
85
|
orderId: t,
|
|
76
86
|
enabled: !0,
|
|
77
|
-
refetchInterval:
|
|
78
|
-
getAuction:
|
|
87
|
+
refetchInterval: d,
|
|
88
|
+
getAuction: y.getDeltaOrderById
|
|
79
89
|
}));
|
|
80
|
-
return new Promise((e,
|
|
81
|
-
let
|
|
82
|
-
|
|
90
|
+
return new Promise((e, o) => {
|
|
91
|
+
let c = setTimeout(() => {
|
|
92
|
+
p.log("QueryObserver", i, "timeout"), u(), o(/* @__PURE__ */ Error(`Order ${t} not found`));
|
|
83
93
|
}, b + 1e3);
|
|
84
94
|
n?.addEventListener("abort", () => {
|
|
85
|
-
|
|
95
|
+
c && clearTimeout(c), u(), o(/* @__PURE__ */ Error(`Order execution aborted: ${n.reason}`));
|
|
86
96
|
});
|
|
87
|
-
let
|
|
97
|
+
let u = a.subscribe((t) => {
|
|
88
98
|
let n = () => {
|
|
89
|
-
|
|
99
|
+
p.log("QueryObserver", i, "cleanup"), u();
|
|
90
100
|
};
|
|
91
|
-
|
|
92
|
-
let
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
95
|
-
|
|
101
|
+
p.log("QueryObserver", i, t);
|
|
102
|
+
let a = t.data;
|
|
103
|
+
if (a && c !== null && (clearTimeout(c), c = null), a && m(a)) {
|
|
104
|
+
if (h(a)) {
|
|
105
|
+
s?.(a), n(), e(a);
|
|
96
106
|
return;
|
|
97
107
|
}
|
|
98
|
-
if (
|
|
99
|
-
|
|
108
|
+
if (g(a)) {
|
|
109
|
+
l?.(a), n(), o(new r({ order: a }));
|
|
100
110
|
return;
|
|
101
111
|
}
|
|
102
112
|
}
|
|
103
113
|
if (t.error) {
|
|
104
|
-
n(),
|
|
114
|
+
n(), o(t.error);
|
|
105
115
|
return;
|
|
106
116
|
}
|
|
107
117
|
});
|
|
108
118
|
});
|
|
109
|
-
},
|
|
119
|
+
}, a[3] = p, a[4] = l, a[5] = s, a[6] = f, a[7] = d, a[8] = y.getDeltaOrderById, a[9] = S) : S = a[9], S;
|
|
110
120
|
}
|
|
111
121
|
//#endregion
|
|
112
122
|
export { v as deltaAuctionPollingQueryKey, C as useEnsureDeltaOrderExecuted, S as useWatchDeltaAuction };
|