@velora-dex/widget 0.6.0 → 0.6.1-dev.2
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/assets/two-dots.js +32 -0
- package/dist/assets/two-dots.js.map +1 -0
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +1 -0
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/widget/AppHeader/Activities/hooks.d.ts.map +1 -1
- package/dist/components/widget/AppHeader/Activities/hooks.js +54 -54
- 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 +27 -27
- package/dist/components/widget/AppHeader/Activities/utils.js.map +1 -1
- package/dist/components/widget/AppHeader/TradeModeSwitcher.d.ts.map +1 -1
- package/dist/components/widget/AppHeader/TradeModeSwitcher.js +2 -1
- package/dist/components/widget/AppHeader/TradeModeSwitcher.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/SelectTokenDialog.d.ts.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/SelectTokenDialog.js +153 -149
- package/dist/components/widget/Dialog/SelectTokenDialog/SelectTokenDialog.js.map +1 -1
- package/dist/components/widget/Dialog/SelectTokenDialog/TokenListBody/AcrossTokenList.d.ts +1 -1
- 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/Drawer/state/useDrawerControls.d.ts +1 -1
- package/dist/components/widget/Drawer/state/useDrawerControls.d.ts.map +1 -1
- package/dist/components/widget/Drawer/state/useDrawerControls.js.map +1 -1
- package/dist/components/widget/Duration/Duration.d.ts +1 -1
- package/dist/components/widget/Duration/Duration.d.ts.map +1 -1
- package/dist/components/widget/Duration/Duration.js +2 -4
- package/dist/components/widget/Duration/Duration.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/LimitOrderDetails.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/LimitOrderDetails.js +56 -57
- package/dist/components/widget/LimitOrderItem/LimitOrderDetails/LimitOrderDetails.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.d.ts +7 -8
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.js +59 -65
- package/dist/components/widget/LimitOrderItem/LimitOrderListItem.js.map +1 -1
- package/dist/components/widget/LimitOrderItem/types.d.ts +3 -2
- package/dist/components/widget/LimitOrderItem/types.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/utils.d.ts +2 -2
- package/dist/components/widget/LimitOrderItem/utils.d.ts.map +1 -1
- package/dist/components/widget/LimitOrderItem/utils.js +22 -19
- package/dist/components/widget/LimitOrderItem/utils.js.map +1 -1
- package/dist/components/widget/NumberInput/NumberInput.d.ts +19 -0
- package/dist/components/widget/NumberInput/NumberInput.d.ts.map +1 -0
- package/dist/components/widget/NumberInput/NumberInput.js +104 -0
- package/dist/components/widget/NumberInput/NumberInput.js.map +1 -0
- package/dist/components/widget/NumberInput/assets/arrow-down.js +20 -0
- package/dist/components/widget/NumberInput/assets/arrow-down.js.map +1 -0
- package/dist/components/widget/NumberInput/assets/arrow-up.js +20 -0
- package/dist/components/widget/NumberInput/assets/arrow-up.js.map +1 -0
- package/dist/components/widget/OtcOrderItem/utils.d.ts.map +1 -1
- package/dist/components/widget/OtcOrderItem/utils.js +4 -2
- package/dist/components/widget/OtcOrderItem/utils.js.map +1 -1
- package/dist/components/widget/ReceiverAddress/state/subscriptions.d.ts.map +1 -1
- package/dist/components/widget/ReceiverAddress/state/subscriptions.js +34 -30
- package/dist/components/widget/ReceiverAddress/state/subscriptions.js.map +1 -1
- package/dist/components/widget/SwapRate/SwapRate.d.ts +2 -9
- package/dist/components/widget/SwapRate/SwapRate.d.ts.map +1 -1
- package/dist/components/widget/SwapRate/SwapRate.js +22 -18
- package/dist/components/widget/SwapRate/SwapRate.js.map +1 -1
- package/dist/components/widget/SwapRate/types.d.ts +13 -0
- package/dist/components/widget/SwapRate/types.d.ts.map +1 -0
- package/dist/components/widget/SwapRateWithPriceImpactRow/SwapRateWithPriceImpactRow.d.ts +7 -0
- package/dist/components/widget/SwapRateWithPriceImpactRow/SwapRateWithPriceImpactRow.d.ts.map +1 -0
- package/dist/components/widget/SwapRateWithPriceImpactRow/SwapRateWithPriceImpactRow.js +50 -0
- package/dist/components/widget/SwapRateWithPriceImpactRow/SwapRateWithPriceImpactRow.js.map +1 -0
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.js +91 -99
- package/dist/components/widget/TradeOverview/DeltaOrderTradeOverview.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.js +12 -26
- package/dist/components/widget/TradeOverview/TradeComplete/TradeCompleteHeader.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/constants.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/constants.js +2 -1
- package/dist/components/widget/TradeOverview/TradeComplete/constants.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/useTradeCompleteDetails.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/useTradeCompleteDetails.js +77 -55
- package/dist/components/widget/TradeOverview/TradeComplete/useTradeCompleteDetails.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/utils.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/TradeComplete/utils.js +80 -63
- package/dist/components/widget/TradeOverview/TradeComplete/utils.js.map +1 -1
- package/dist/components/widget/TradeOverview/TradeOverviewScreen.d.ts +7 -2
- package/dist/components/widget/TradeOverview/TradeOverviewScreen.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/TradeOverviewScreen.js +20 -15
- package/dist/components/widget/TradeOverview/TradeOverviewScreen.js.map +1 -1
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.d.ts +15 -0
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.d.ts.map +1 -0
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.js +112 -0
- package/dist/components/widget/TradeOverview/TwapOrderTradeOverview.js.map +1 -0
- package/dist/components/widget/TradeOverview/steps.d.ts +37 -4
- package/dist/components/widget/TradeOverview/steps.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/steps.js +17 -5
- package/dist/components/widget/TradeOverview/steps.js.map +1 -1
- package/dist/components/widget/TradeOverview/tradeFlowContext.d.ts +4 -2
- package/dist/components/widget/TradeOverview/tradeFlowContext.d.ts.map +1 -1
- package/dist/components/widget/TradeOverview/tradeFlowContext.js +1 -1
- package/dist/components/widget/TradeOverview/tradeFlowContext.js.map +1 -1
- package/dist/components/widget/Twap/CustomDurationDrawer.d.ts +7 -0
- package/dist/components/widget/Twap/CustomDurationDrawer.d.ts.map +1 -0
- package/dist/components/widget/Twap/CustomDurationDrawer.js +150 -0
- package/dist/components/widget/Twap/CustomDurationDrawer.js.map +1 -0
- package/dist/components/widget/Twap/OrderDuration.d.ts +11 -0
- package/dist/components/widget/Twap/OrderDuration.d.ts.map +1 -0
- package/dist/components/widget/Twap/OrderDuration.js +92 -0
- package/dist/components/widget/Twap/OrderDuration.js.map +1 -0
- package/dist/components/widget/Twap/OrderSplit.d.ts +2 -0
- package/dist/components/widget/Twap/OrderSplit.d.ts.map +1 -0
- package/dist/components/widget/Twap/OrderSplit.js +40 -0
- package/dist/components/widget/Twap/OrderSplit.js.map +1 -0
- package/dist/components/widget/Twap/RateProtection.d.ts +2 -0
- package/dist/components/widget/Twap/RateProtection.d.ts.map +1 -0
- package/dist/components/widget/Twap/RateProtection.js +42 -0
- package/dist/components/widget/Twap/RateProtection.js.map +1 -0
- package/dist/components/widget/Twap/TwapDetailWithTooltip.d.ts +3 -0
- package/dist/components/widget/Twap/TwapDetailWithTooltip.d.ts.map +1 -0
- package/dist/components/widget/Twap/TwapDetailWithTooltip.js +21 -0
- package/dist/components/widget/Twap/TwapDetailWithTooltip.js.map +1 -0
- package/dist/configurator/Configurator.d.ts.map +1 -1
- package/dist/configurator/components/FormPropsInputs.d.ts.map +1 -1
- package/dist/configurator/components/TradeModesSelector.d.ts.map +1 -1
- package/dist/core/TradeFlowScreenButton.d.ts +5 -0
- package/dist/core/TradeFlowScreenButton.d.ts.map +1 -1
- package/dist/core/TradeFlowScreenButton.js +25 -1
- package/dist/core/TradeFlowScreenButton.js.map +1 -1
- package/dist/core/TwapDetails.d.ts +2 -0
- package/dist/core/TwapDetails.d.ts.map +1 -0
- package/dist/core/TwapDetails.js +15 -0
- package/dist/core/TwapDetails.js.map +1 -0
- package/dist/core/Warnings.d.ts +2 -1
- package/dist/core/Warnings.d.ts.map +1 -1
- package/dist/core/Warnings.js +143 -92
- package/dist/core/Warnings.js.map +1 -1
- package/dist/core/across/isCrosschainPossible.d.ts +1 -1
- package/dist/core/across/isCrosschainPossible.d.ts.map +1 -1
- package/dist/core/across/isCrosschainPossible.js +1 -1
- package/dist/core/across/isCrosschainPossible.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 +110 -77
- package/dist/core/button/hooks/useWidgetButtonExtraProps.js.map +1 -1
- package/dist/core/constants.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +377 -283
- package/dist/core/index.js.map +1 -1
- package/dist/core/inputs/hooks/types.d.ts +1 -1
- package/dist/core/inputs/hooks/types.d.ts.map +1 -1
- package/dist/core/inputs/hooks/useTokenFromInputProps.js +7 -7
- package/dist/core/inputs/hooks/useTokenToInputProps.d.ts.map +1 -1
- package/dist/core/inputs/hooks/useTokenToInputProps.js +108 -124
- package/dist/core/inputs/hooks/useTokenToInputProps.js.map +1 -1
- package/dist/core/inputs/hooks/useWarningMessage.d.ts +10 -0
- package/dist/core/inputs/hooks/useWarningMessage.d.ts.map +1 -0
- package/dist/core/inputs/hooks/useWarningMessage.js +30 -0
- package/dist/core/inputs/hooks/useWarningMessage.js.map +1 -0
- package/dist/core/inputs/state/common.d.ts +4 -0
- package/dist/core/inputs/state/common.d.ts.map +1 -1
- package/dist/core/inputs/state/common.js +96 -55
- package/dist/core/inputs/state/common.js.map +1 -1
- package/dist/core/inputs/state/setTokenByAddressAtom.d.ts.map +1 -1
- package/dist/core/inputs/state/setTokenByAddressAtom.js +77 -79
- 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.map +1 -1
- package/dist/core/limit/useLimitRate.js +0 -2
- package/dist/core/limit/useLimitRate.js.map +1 -1
- package/dist/core/limit/useLimitTokenFromInputProps.js +41 -41
- package/dist/core/limit/useLimitTokenToInputProps.js +45 -45
- package/dist/core/limit/useLimitTokenToInputProps.js.map +1 -1
- package/dist/core/otc/useOtcTokenFromInputProps.js +39 -39
- package/dist/core/otc/useOtcTokenToInputProps.js +4 -4
- package/dist/core/state/chainToAtom.d.ts +2 -0
- package/dist/core/state/chainToAtom.d.ts.map +1 -1
- package/dist/core/state/chainToAtom.js +39 -18
- package/dist/core/state/chainToAtom.js.map +1 -1
- package/dist/core/state/configAtom.js +2 -2
- package/dist/core/state/configAtom.js.map +1 -1
- package/dist/core/state/configEffectAtom.d.ts.map +1 -1
- package/dist/core/state/configEffectAtom.js +18 -19
- package/dist/core/state/configEffectAtom.js.map +1 -1
- package/dist/core/state/tradeModeAtom.d.ts +1 -1
- package/dist/core/state/tradeModeAtom.d.ts.map +1 -1
- package/dist/core/state/tradeModeAtom.js.map +1 -1
- package/dist/core/state/widgetEventsAtom.d.ts.map +1 -1
- package/dist/core/state/widgetEventsAtom.js +49 -31
- package/dist/core/state/widgetEventsAtom.js.map +1 -1
- package/dist/core/swapDetails/priceImpact.d.ts +2 -2
- package/dist/core/swapDetails/priceImpact.d.ts.map +1 -1
- package/dist/core/swapDetails/priceImpact.js.map +1 -1
- package/dist/core/swapDetails/types.d.ts +4 -0
- package/dist/core/swapDetails/types.d.ts.map +1 -0
- package/dist/core/swapDetails/useSwapDetailsListProps.d.ts.map +1 -1
- package/dist/core/swapDetails/useSwapDetailsListProps.js +78 -106
- package/dist/core/swapDetails/useSwapDetailsListProps.js.map +1 -1
- package/dist/core/twap/state/constants.d.ts +26 -0
- package/dist/core/twap/state/constants.d.ts.map +1 -0
- package/dist/core/twap/state/constants.js +23 -0
- package/dist/core/twap/state/constants.js.map +1 -0
- package/dist/core/twap/state/currentTwapInputAtom.d.ts +4 -0
- package/dist/core/twap/state/currentTwapInputAtom.d.ts.map +1 -0
- package/dist/core/twap/state/currentTwapInputAtom.js +7 -0
- package/dist/core/twap/state/currentTwapInputAtom.js.map +1 -0
- package/dist/core/twap/state/isCrosschainAtom.d.ts +3 -0
- package/dist/core/twap/state/isCrosschainAtom.d.ts.map +1 -0
- package/dist/core/twap/state/isCrosschainAtom.js +12 -0
- package/dist/core/twap/state/isCrosschainAtom.js.map +1 -0
- package/dist/core/twap/state/selectedTokenActionsAtom.d.ts +13 -0
- package/dist/core/twap/state/selectedTokenActionsAtom.d.ts.map +1 -0
- package/dist/core/twap/state/selectedTokenActionsAtom.js +114 -0
- package/dist/core/twap/state/selectedTokenActionsAtom.js.map +1 -0
- package/dist/core/twap/state/twapInputAmountAtom.d.ts +9 -0
- package/dist/core/twap/state/twapInputAmountAtom.d.ts.map +1 -0
- package/dist/core/twap/state/twapInputAmountAtom.js +15 -0
- package/dist/core/twap/state/twapInputAmountAtom.js.map +1 -0
- package/dist/core/twap/state/twapParamsAtom.d.ts +25 -0
- package/dist/core/twap/state/twapParamsAtom.d.ts.map +1 -0
- package/dist/core/twap/state/twapParamsAtom.js +19 -0
- package/dist/core/twap/state/twapParamsAtom.js.map +1 -0
- package/dist/core/twap/state/twapReceiverAddressAtom.d.ts +5 -0
- package/dist/core/twap/state/twapReceiverAddressAtom.d.ts.map +1 -0
- package/dist/core/twap/state/twapReceiverAddressAtom.js +8 -0
- package/dist/core/twap/state/twapReceiverAddressAtom.js.map +1 -0
- package/dist/core/twap/state/twapSideAtom.d.ts +4 -0
- package/dist/core/twap/state/twapSideAtom.d.ts.map +1 -0
- package/dist/core/twap/state/twapSideAtom.js +14 -0
- package/dist/core/twap/state/twapSideAtom.js.map +1 -0
- package/dist/core/twap/state/twapTokenAtoms.d.ts +10 -0
- package/dist/core/twap/state/twapTokenAtoms.d.ts.map +1 -0
- package/dist/core/twap/state/twapTokenAtoms.js +10 -0
- package/dist/core/twap/state/twapTokenAtoms.js.map +1 -0
- package/dist/core/twap/twapDetails/minimumReceiveable.d.ts +12 -0
- package/dist/core/twap/twapDetails/minimumReceiveable.d.ts.map +1 -0
- package/dist/core/twap/twapDetails/minimumReceiveable.js +33 -0
- package/dist/core/twap/twapDetails/minimumReceiveable.js.map +1 -0
- package/dist/core/twap/useTwapDetailsListProps.d.ts +3 -0
- package/dist/core/twap/useTwapDetailsListProps.d.ts.map +1 -0
- package/dist/core/twap/useTwapDetailsListProps.js +81 -0
- package/dist/core/twap/useTwapDetailsListProps.js.map +1 -0
- package/dist/core/twap/useTwapTokenFromInputProps.d.ts +9 -0
- package/dist/core/twap/useTwapTokenFromInputProps.d.ts.map +1 -0
- package/dist/core/twap/useTwapTokenFromInputProps.js +165 -0
- package/dist/core/twap/useTwapTokenFromInputProps.js.map +1 -0
- package/dist/core/twap/useTwapTokenSwitcherProps.d.ts +3 -0
- package/dist/core/twap/useTwapTokenSwitcherProps.d.ts.map +1 -0
- package/dist/core/twap/useTwapTokenSwitcherProps.js +19 -0
- package/dist/core/twap/useTwapTokenSwitcherProps.js.map +1 -0
- package/dist/core/twap/useTwapTokenToInputProps.d.ts +10 -0
- package/dist/core/twap/useTwapTokenToInputProps.d.ts.map +1 -0
- package/dist/core/twap/useTwapTokenToInputProps.js +114 -0
- package/dist/core/twap/useTwapTokenToInputProps.js.map +1 -0
- package/dist/events/effects/formInput.d.ts +3 -0
- package/dist/events/effects/formInput.d.ts.map +1 -1
- package/dist/events/effects/formInput.js +16 -9
- package/dist/events/effects/formInput.js.map +1 -1
- package/dist/events/getters/twap.d.ts +6 -0
- package/dist/events/getters/twap.d.ts.map +1 -0
- package/dist/events/getters/twap.js +57 -0
- package/dist/events/getters/twap.js.map +1 -0
- package/dist/events/getters/widgetState.d.ts.map +1 -1
- package/dist/events/getters/widgetState.js +9 -7
- package/dist/events/getters/widgetState.js.map +1 -1
- package/dist/events/hooks/useActivateEffects.d.ts.map +1 -1
- package/dist/events/hooks/useActivateEffects.js +4 -4
- package/dist/events/hooks/useActivateEffects.js.map +1 -1
- package/dist/events/types/common.d.ts +8 -0
- package/dist/events/types/common.d.ts.map +1 -1
- package/dist/events/types/formInput.d.ts +11 -2
- package/dist/events/types/formInput.d.ts.map +1 -1
- package/dist/events/types/index.d.ts +4 -1
- package/dist/events/types/index.d.ts.map +1 -1
- package/dist/events/types/limit.d.ts +2 -2
- package/dist/events/types/limit.d.ts.map +1 -1
- package/dist/events/types/swap.d.ts +3 -2
- package/dist/events/types/swap.d.ts.map +1 -1
- package/dist/events/types/twap.d.ts +26 -0
- package/dist/events/types/twap.d.ts.map +1 -0
- package/dist/hooks/batch/useSendBatchTx.d.ts +1 -1
- package/dist/hooks/batch/useSendBatchTx.d.ts.map +1 -1
- package/dist/hooks/batch/useSendBatchTx.js.map +1 -1
- package/dist/hooks/permit/utils/deadlines.d.ts +0 -3
- package/dist/hooks/permit/utils/deadlines.d.ts.map +1 -1
- package/dist/hooks/permit/utils/deadlines.js +5 -12
- package/dist/hooks/permit/utils/deadlines.js.map +1 -1
- package/dist/hooks/swap/prices/constants.d.ts +1 -0
- package/dist/hooks/swap/prices/constants.d.ts.map +1 -1
- package/dist/hooks/swap/prices/constants.js +2 -1
- package/dist/hooks/swap/prices/constants.js.map +1 -1
- package/dist/hooks/swap/prices/delta/bridge/utils.js +9 -12
- package/dist/hooks/swap/prices/delta/bridge/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreatePreSignableTwapOrder.d.ts +19 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreatePreSignableTwapOrder.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreatePreSignableTwapOrder.js +42 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreatePreSignableTwapOrder.js.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.d.ts +37 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.js +77 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useCreateTwapOrder.js.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useDepositAndSubmitTwapOrder.d.ts +69 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useDepositAndSubmitTwapOrder.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useDepositAndSubmitTwapOrder.js +121 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useDepositAndSubmitTwapOrder.js.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.d.ts +15 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.js +42 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePostTwapOrder.js.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePreSignAndSubmitTwapOrder.d.ts +60 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePreSignAndSubmitTwapOrder.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePreSignAndSubmitTwapOrder.js +135 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/usePreSignAndSubmitTwapOrder.js.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useTwapOrderToPost.d.ts +18 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useTwapOrderToPost.d.ts.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useTwapOrderToPost.js +39 -0
- package/dist/hooks/swap/prices/delta/mutations/twap/useTwapOrderToPost.js.map +1 -0
- package/dist/hooks/swap/prices/delta/mutations/types.d.ts +12 -1
- package/dist/hooks/swap/prices/delta/mutations/types.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrders.d.ts +2 -5
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrders.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelDeltaOrders.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.d.ts +2 -3
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.js +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCancelOrWithdrawAndCancelDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.d.ts +6 -6
- package/dist/hooks/swap/prices/delta/mutations/useCreateDeltaOrder.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.d.ts +3 -3
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.js +16 -22
- package/dist/hooks/swap/prices/delta/mutations/usePostDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.d.ts +4 -4
- package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.js +81 -78
- package/dist/hooks/swap/prices/delta/mutations/useWithdrawAndCancelDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/utils.d.ts +17 -6
- package/dist/hooks/swap/prices/delta/mutations/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/mutations/utils.js +34 -12
- package/dist/hooks/swap/prices/delta/mutations/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/types.d.ts +22 -46
- 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/types.d.ts +6 -5
- package/dist/hooks/swap/prices/delta/orders/unposted/types.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.d.ts +67 -1
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.js +32 -22
- package/dist/hooks/swap/prices/delta/orders/unposted/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/utils.d.ts +45 -16
- package/dist/hooks/swap/prices/delta/orders/utils.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/orders/utils.js +121 -21
- package/dist/hooks/swap/prices/delta/orders/utils.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/bridgeInfosLoadedAtom.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/types.d.ts +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/types.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/useBridgeInfo.d.ts +0 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/useBridgeInfo.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/bridgeInfo/useBridgeInfo.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/errors.d.ts +10 -2
- package/dist/hooks/swap/prices/delta/queries/errors.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/errors.js +9 -5
- package/dist/hooks/swap/prices/delta/queries/errors.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrders.d.ts +5 -6
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrders.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaOrders.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.d.ts +6 -6
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js +62 -61
- package/dist/hooks/swap/prices/delta/queries/useDeltaPriceQuery.js.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.d.ts +15 -19
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.js +63 -72
- package/dist/hooks/swap/prices/delta/queries/useWatchDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.d.ts.map +1 -1
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.js +56 -55
- package/dist/hooks/swap/prices/market/queries/useMarketPriceQuery.js.map +1 -1
- package/dist/hooks/swap/prices/market/queries/useSpenderAndContracts.d.ts.map +1 -1
- package/dist/hooks/swap/prices/market/queries/useSpenderAndContracts.js.map +1 -1
- package/dist/hooks/swap/prices/usePricesParams.d.ts.map +1 -1
- package/dist/hooks/swap/prices/usePricesParams.js +9 -10
- package/dist/hooks/swap/prices/usePricesParams.js.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.d.ts +3 -0
- package/dist/hooks/swap/prices/useSwapPrices.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useSwapPrices.js +115 -112
- package/dist/hooks/swap/prices/useSwapPrices.js.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.d.ts +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.d.ts.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromPrice.js.map +1 -1
- package/dist/hooks/swap/prices/useTokenInputsFromTwapPrice.d.ts +16 -0
- package/dist/hooks/swap/prices/useTokenInputsFromTwapPrice.d.ts.map +1 -0
- package/dist/hooks/swap/prices/useTokenInputsFromTwapPrice.js +31 -0
- package/dist/hooks/swap/prices/useTokenInputsFromTwapPrice.js.map +1 -0
- package/dist/hooks/swap/prices/useTwapPrices.d.ts +45 -0
- package/dist/hooks/swap/prices/useTwapPrices.d.ts.map +1 -0
- package/dist/hooks/swap/prices/useTwapPrices.js +98 -0
- package/dist/hooks/swap/prices/useTwapPrices.js.map +1 -0
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.d.ts +48 -0
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.d.ts.map +1 -0
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.js +55 -0
- package/dist/hooks/swap/tradeFlow/common/factory/depositAndSubmitOrderFactory.js.map +1 -0
- package/dist/hooks/swap/tradeFlow/common/factory/preSignAndSubmitOrderFactory.d.ts +50 -0
- package/dist/hooks/swap/tradeFlow/common/factory/preSignAndSubmitOrderFactory.d.ts.map +1 -0
- package/dist/hooks/swap/tradeFlow/common/factory/preSignAndSubmitOrderFactory.js +59 -0
- package/dist/hooks/swap/tradeFlow/common/factory/preSignAndSubmitOrderFactory.js.map +1 -0
- package/dist/hooks/swap/tradeFlow/common/types.d.ts +4 -2
- package/dist/hooks/swap/tradeFlow/common/types.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useApproveOrPermit.d.ts +2 -0
- package/dist/hooks/swap/tradeFlow/common/useApproveOrPermit.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useApproveOrPermit.js +14 -13
- package/dist/hooks/swap/tradeFlow/common/useApproveOrPermit.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useDepositAndSubmitDeltaOrder.d.ts +6 -6
- package/dist/hooks/swap/tradeFlow/common/useDepositAndSubmitDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useDepositAndSubmitDeltaOrder.js +114 -126
- package/dist/hooks/swap/tradeFlow/common/useDepositAndSubmitDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/usePreSignAndSubmitDeltaOrder.d.ts +7 -7
- package/dist/hooks/swap/tradeFlow/common/usePreSignAndSubmitDeltaOrder.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/usePreSignAndSubmitDeltaOrder.js +132 -143
- package/dist/hooks/swap/tradeFlow/common/usePreSignAndSubmitDeltaOrder.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useSignPermit1Or2.d.ts +2 -1
- package/dist/hooks/swap/tradeFlow/common/useSignPermit1Or2.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/useSignPermit1Or2.js +91 -91
- package/dist/hooks/swap/tradeFlow/common/useSignPermit1Or2.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/utils.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/common/utils.js +1 -1
- package/dist/hooks/swap/tradeFlow/common/utils.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts +8 -9
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js +129 -134
- package/dist/hooks/swap/tradeFlow/useDeltaFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.d.ts +6 -7
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.d.ts.map +1 -1
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.js +181 -178
- package/dist/hooks/swap/tradeFlow/useLimitOrderFlow.js.map +1 -1
- package/dist/hooks/swap/tradeFlow/useTwapFlow.d.ts +91 -0
- package/dist/hooks/swap/tradeFlow/useTwapFlow.d.ts.map +1 -0
- package/dist/hooks/swap/tradeFlow/useTwapFlow.js +368 -0
- package/dist/hooks/swap/tradeFlow/useTwapFlow.js.map +1 -0
- package/dist/hooks/swap/tradeFlow/useTwapSwapStep.d.ts +25 -0
- package/dist/hooks/swap/tradeFlow/useTwapSwapStep.d.ts.map +1 -0
- package/dist/hooks/swap/tradeFlow/useTwapSwapStep.js +84 -0
- package/dist/hooks/swap/tradeFlow/useTwapSwapStep.js.map +1 -0
- package/dist/hooks/tokens/balances/useIsLimitOrderInsufficientBalance.js +1 -1
- package/dist/hooks/tokens/prices/queries.js +12 -12
- package/dist/hooks/tokens/useAllTokensWithFilter.d.ts +1 -1
- 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 +1 -1
- package/dist/hooks/tokens/useTokensFromAcross.d.ts.map +1 -1
- package/dist/hooks/tokens/useTokensFromAcross.js.map +1 -1
- package/dist/hooks/useBridgeInfo.d.ts +1 -1
- package/dist/hooks/useBridgeInfo.d.ts.map +1 -1
- package/dist/hooks/useBridgeInfo.js.map +1 -1
- package/dist/hooks/useIsCrosschainPossible.d.ts +1 -1
- package/dist/hooks/useIsCrosschainPossible.d.ts.map +1 -1
- package/dist/hooks/useIsCrosschainPossible.js.map +1 -1
- package/dist/hooks/useSDK.d.ts +4 -4
- package/dist/hooks/useSDK.d.ts.map +1 -1
- package/dist/hooks/useSDK.js +30 -30
- package/dist/hooks/useSDK.js.map +1 -1
- package/dist/hooks/useSelectableDestChains.d.ts +1 -1
- package/dist/hooks/useSelectableDestChains.d.ts.map +1 -1
- package/dist/hooks/useSelectableDestChains.js.map +1 -1
- package/dist/hooks/useSlippage.d.ts.map +1 -1
- package/dist/hooks/useSlippage.js +14 -13
- package/dist/hooks/useSlippage.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/constants/delta.d.ts.map +1 -1
- package/dist/lib/constants/delta.js +1 -1
- package/dist/lib/constants/delta.js.map +1 -1
- package/dist/lib/constants/time.d.ts +2 -0
- package/dist/lib/constants/time.d.ts.map +1 -1
- package/dist/lib/constants/time.js +2 -2
- package/dist/lib/constants/time.js.map +1 -1
- package/dist/lib/queryClient.js +1 -1
- package/dist/lib/queryClient.js.map +1 -1
- package/dist/lib/tradeMode.d.ts +9 -1
- package/dist/lib/tradeMode.d.ts.map +1 -1
- package/dist/lib/tradeMode.js +9 -4
- package/dist/lib/tradeMode.js.map +1 -1
- package/dist/lib/utils/delta.d.ts +10 -0
- package/dist/lib/utils/delta.d.ts.map +1 -1
- package/dist/lib/utils/delta.js +31 -18
- package/dist/lib/utils/delta.js.map +1 -1
- package/dist/lib/utils/index.d.ts +22 -0
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +27 -15
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/scaleFactor.d.ts +3 -0
- package/dist/lib/utils/scaleFactor.d.ts.map +1 -0
- package/dist/lib/utils/scaleFactor.js +13 -0
- package/dist/lib/utils/scaleFactor.js.map +1 -0
- package/dist/lib/utils/time.d.ts +2 -0
- package/dist/lib/utils/time.d.ts.map +1 -1
- package/dist/lib/utils/time.js +7 -1
- package/dist/lib/utils/time.js.map +1 -1
- package/dist/lib/utils/toasts.d.ts +3 -4
- 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 +24 -0
- package/dist/lib/utils/twap.d.ts.map +1 -0
- package/dist/lib/utils/twap.js +34 -0
- package/dist/lib/utils/twap.js.map +1 -0
- package/dist/lib/web3/privy/config.js +1 -1
- package/dist/lib/web3/privy/config.js.map +1 -1
- package/dist/lib/web3/wagmi/config.js +1 -1
- package/dist/lib/web3/wagmi/config.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/tokens/defaultTokens.js.map +1 -1
- package/dist/transactions/types.d.ts +4 -4
- package/dist/transactions/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/hooks/swap/prices/delta/queries/utils.d.ts +0 -4
- package/dist/hooks/swap/prices/delta/queries/utils.d.ts.map +0 -1
- package/dist/hooks/swap/prices/delta/queries/utils.js +0 -15
- package/dist/hooks/swap/prices/delta/queries/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBridgeInfo.js","names":["useDeltaSDK","useQuery","bridgeInfoQueryKey","defaultInputParams","BridgeInfoQueryInput","BridgeInfoQueryKeyType","BridgeInfoQueryResult","BridgeInfoReturn","
|
|
1
|
+
{"version":3,"file":"useBridgeInfo.js","names":["useDeltaSDK","useQuery","bridgeInfoQueryKey","defaultInputParams","BridgeInfoQueryInput","BridgeInfoQueryKeyType","BridgeInfoQueryResult","BridgeInfoReturn","useBridgeInfoQuery","t0","$","_c","t1","undefined","query","input","t2","t3","Symbol","for","chainId","sdk","t4","t5","t6","signal","bridgeInfo","getBridgeInfo","enabled","t7","queryKey","queryFn","staleTime","Infinity","gcTime"],"sources":["../../../../../../../src/hooks/swap/prices/delta/queries/bridgeInfo/useBridgeInfo.ts"],"sourcesContent":["import { useDeltaSDK } from \"@/hooks/useSDK\";\nimport { useQuery } from \"@tanstack/react-query\";\nimport { bridgeInfoQueryKey, defaultInputParams } from \"./common\";\nimport type {\n BridgeInfoQueryInput,\n BridgeInfoQueryKeyType,\n BridgeInfoQueryResult,\n BridgeInfoReturn,\n} from \"./types\";\n\n\nexport function useBridgeInfoQuery<TData = BridgeInfoReturn>({\n query,\n input = defaultInputParams,\n}: BridgeInfoQueryInput<TData> = {}): BridgeInfoQueryResult<TData> {\n const { sdk } = useDeltaSDK({ chainId: 1 }); // chain doesn't matter for bridge info\n\n return useQuery<BridgeInfoReturn, Error, TData, BridgeInfoQueryKeyType>({\n queryKey: bridgeInfoQueryKey(input),\n queryFn: ({ signal }) => {\n const bridgeInfo = sdk.getBridgeInfo(input, { signal });\n return bridgeInfo;\n },\n // never changes during App session\n staleTime: Infinity,\n gcTime: Infinity,\n ...query,\n enabled: query?.enabled ?? true,\n });\n}\n"],"mappings":";;;;;AAWA,SAAOQ,EAAAC,GAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAAAC;AAAA,CAAAF,EAAA,OAAAD,IAG4BG,IAAAF,EAAA,MAH0BE,IAAAH,MAAAI,KAAAA,IAAA,EAG1B,GAH0BJ,GAG1BC,EAAA,KAAAD,GAAAC,EAAA,KAAAE;CAH0B,IAAA,EAAAE,UAAAC,OAAAC,MAAAJ,GAE3DG,IAAAC,MAAAH,KAAAA,IAAAV,IAAAa,GAA0BC;AAAA,CAAAP,EAAA,OAAAQ,OAAAC,IAAA,4BAAA,IAEEF,IAAA,EAAAG,SAAW,GAAG,EAAAV,EAAA,KAAAO,KAAAA,IAAAP,EAAA;CAA1C,IAAA,EAAAW,WAAgBrB,EAAYiB,EAAe,EAACK;AAAA,CAAAZ,EAAA,OAAAK,IAGPO,IAAAZ,EAAA,MAAzBY,IAAApB,EAAmBa,EAAM,EAAAL,EAAA,KAAAK,GAAAL,EAAA,KAAAY;CAAA,IAAAC;AAAA,CAAAb,EAAA,OAAAK,KAAAL,EAAA,OAAAW,KAC1BE,KAAAC,MAAA;EAAC,IAAA,EAAAC,cAAAD;AACgD,SAArCH,EAAGM,cAAeZ,GAAO,EAAAU,WAAU,CAAC;IAExDf,EAAA,KAAAK,GAAAL,EAAA,KAAAW,GAAAX,EAAA,KAAAa,KAAAA,IAAAb,EAAA;CAKQ,IAAAc,IAAAV,GAAKc,WAAL,IAAsBC;AAChC,QADgCnB,EAAA,OAAAI,KAAAJ,EAAA,OAAAY,KAAAZ,EAAA,QAAAa,KAAAb,EAAA,QAAAc,KAVuCK,IAAA;EAAAC,UAC5DR;EAAyBS,SAC1BR;EAGRS,WAEUC;EAAQC,QACXD;EAAQ,GACbnB;EAAKc,SACCJ;EACV,EAAAd,EAAA,KAAAI,GAAAJ,EAAA,KAAAY,GAAAZ,EAAA,MAAAa,GAAAb,EAAA,MAAAc,GAAAd,EAAA,MAAAmB,KAAAA,IAAAnB,EAAA,KAXMT,EAAiE4B,EAWtE"}
|
|
@@ -7,6 +7,14 @@ export declare class DeltaOrderFailedError extends Error {
|
|
|
7
7
|
});
|
|
8
8
|
}
|
|
9
9
|
export declare function isDeltaOrderFailedError(error: unknown): error is DeltaOrderFailedError;
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
/**
|
|
11
|
+
* API error shapes (e.errorType returned as e.message in SDK):
|
|
12
|
+
* - { "errorType": "MaxImpactReached", "details": "Max price impact reached. Impact: 97.81%" }
|
|
13
|
+
* - { "errorType": "NoUSDPriceForToken", "details": "No USD price available for token 0x6eed..." }
|
|
14
|
+
* - { "errorType": "NoAvailablePrices", "details": "No available prices found" }
|
|
15
|
+
* - { "errorType": "UnsupportedToken", "details": "Token 0xc4d4... is not supported" }
|
|
16
|
+
* - { "errorType": "NoAvailableBridgeOptions", "details": "No available bridge options" }
|
|
17
|
+
*/
|
|
18
|
+
export type DeltaPriceErrorType = "MaxImpactReached" | "NoUSDPriceForToken" | "NoAvailablePrices" | "UnsupportedToken" | "NoAvailableBridgeOptions";
|
|
19
|
+
export declare function getDeltaPriceErrorType(error: unknown): DeltaPriceErrorType | null;
|
|
12
20
|
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAgB,KAAK,EAAE,kBAAkB,CAAC;gBAEvB,EACjB,OAAO,EACP,KAAK,GACN,EAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,kBAAkB,CAAC;KAC3B;CAWF;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAEhC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAgB,KAAK,EAAE,kBAAkB,CAAC;gBAEvB,EACjB,OAAO,EACP,KAAK,GACN,EAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,kBAAkB,CAAC;KAC3B;CAWF;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,qBAAqB,CAEhC;AAID;;;;;;;GAOG;AACH,MAAM,MAAM,mBAAmB,GAC3B,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,kBAAkB,GAClB,0BAA0B,CAAC;AAU/B,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,GACb,mBAAmB,GAAG,IAAI,CAM5B"}
|
|
@@ -8,13 +8,17 @@ var e = class e extends Error {
|
|
|
8
8
|
function t(t) {
|
|
9
9
|
return t instanceof e;
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
var n = new Set([
|
|
12
|
+
"MaxImpactReached",
|
|
13
|
+
"NoUSDPriceForToken",
|
|
14
|
+
"NoAvailablePrices",
|
|
15
|
+
"UnsupportedToken",
|
|
16
|
+
"NoAvailableBridgeOptions"
|
|
17
|
+
]);
|
|
14
18
|
function r(e) {
|
|
15
|
-
return e instanceof Error
|
|
19
|
+
return e instanceof Error && n.has(e.message) ? e.message : null;
|
|
16
20
|
}
|
|
17
21
|
//#endregion
|
|
18
|
-
export { e as DeltaOrderFailedError,
|
|
22
|
+
export { e as DeltaOrderFailedError, r as getDeltaPriceErrorType, t as isDeltaOrderFailedError };
|
|
19
23
|
|
|
20
24
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","names":["FailedDeltaAuction","DeltaOrderFailedError","Error","order","constructor","message","name","captureStackTrace","isDeltaOrderFailedError","error","
|
|
1
|
+
{"version":3,"file":"errors.js","names":["FailedDeltaAuction","DeltaOrderFailedError","Error","order","constructor","message","name","captureStackTrace","isDeltaOrderFailedError","error","DeltaPriceErrorType","DELTA_PRICE_ERROR_TYPES","Set","getDeltaPriceErrorType","has"],"sources":["../../../../../../src/hooks/swap/prices/delta/queries/errors.ts"],"sourcesContent":["import type { FailedDeltaAuction } from \"../orders/types\";\n\nexport class DeltaOrderFailedError extends Error {\n public readonly order: FailedDeltaAuction;\n\n public constructor({\n message,\n order,\n }: {\n message?: string;\n order: FailedDeltaAuction;\n }) {\n super(message);\n this.name = this.constructor.name;\n this.message = message || \"DeltaOrderFailed\";\n this.order = order;\n\n // Capture stack trace, excluding the constructor call\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, DeltaOrderFailedError);\n }\n }\n}\n\nexport function isDeltaOrderFailedError(\n error: unknown\n): error is DeltaOrderFailedError {\n return error instanceof DeltaOrderFailedError;\n}\n\n// ------------------------------ DeltaPrice/BridgePrice errors ------------------------------\n\n/**\n * API error shapes (e.errorType returned as e.message in SDK):\n * - { \"errorType\": \"MaxImpactReached\", \"details\": \"Max price impact reached. Impact: 97.81%\" }\n * - { \"errorType\": \"NoUSDPriceForToken\", \"details\": \"No USD price available for token 0x6eed...\" }\n * - { \"errorType\": \"NoAvailablePrices\", \"details\": \"No available prices found\" }\n * - { \"errorType\": \"UnsupportedToken\", \"details\": \"Token 0xc4d4... is not supported\" }\n * - { \"errorType\": \"NoAvailableBridgeOptions\", \"details\": \"No available bridge options\" }\n */\nexport type DeltaPriceErrorType =\n | \"MaxImpactReached\"\n | \"NoUSDPriceForToken\"\n | \"NoAvailablePrices\"\n | \"UnsupportedToken\"\n | \"NoAvailableBridgeOptions\";\n\nconst DELTA_PRICE_ERROR_TYPES = new Set<string>([\n \"MaxImpactReached\",\n \"NoUSDPriceForToken\",\n \"NoAvailablePrices\",\n \"UnsupportedToken\",\n \"NoAvailableBridgeOptions\",\n] satisfies DeltaPriceErrorType[]);\n\nexport function getDeltaPriceErrorType(\n error: unknown\n): DeltaPriceErrorType | null {\n if (!(error instanceof Error)) return null;\n if (DELTA_PRICE_ERROR_TYPES.has(error.message)) {\n return error.message as DeltaPriceErrorType;\n }\n return null;\n}\n"],"mappings":";AAEA,IAAaC,IAAb,MAAaA,UAA8BC,MAAM;CAC/C;CAEA,YAAmB,EACjBG,YACAF,YAIC;AAOD,EANA,MAAME,EAAQ,EACd,KAAKC,OAAO,KAAKF,YAAYE,MAC7B,KAAKD,UAAUA,KAAW,oBAC1B,KAAKF,QAAQA,GAGTD,MAAMK,qBACRL,MAAMK,kBAAkB,MAAMN,EAAsB;;;AAK1D,SAAgBO,EACdC,GACgC;AAChC,QAAOA,aAAiBR;;AAoB1B,IAAMU,IAA0B,IAAIC,IAAY;CAC9C;CACA;CACA;CACA;CACA;CACD,CAAiC;AAElC,SAAgBC,EACdJ,GAC4B;AAK5B,QAJMA,aAAiBP,SACnBS,EAAwBG,IAAIL,EAAMJ,QAAQ,GACrCI,EAAMJ,UAER"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { QueryClient, UseQueryOptions, UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import {
|
|
2
|
+
import { DeltaAuction, GetDeltaOrdersFunctions } from '@velora-dex/sdk';
|
|
3
3
|
import { MarkOptional } from 'ts-essentials';
|
|
4
|
-
export type SubmittedDeltaOrderFromAPI = DeltaOrderApiResponse;
|
|
5
|
-
export type { DeltaOrderFromAPI };
|
|
6
4
|
type DeltaOrderByHashParams = string;
|
|
7
|
-
type DeltaOrderByHashReturn =
|
|
5
|
+
type DeltaOrderByHashReturn = DeltaAuction;
|
|
8
6
|
type DeltaOrderByHashQueryParams<TData = DeltaOrderByHashReturn> = Omit<UseQueryOptions<DeltaOrderByHashReturn, Error, TData, DeltaOrderByHashQueryKey>, "queryKey" | "queryFn">;
|
|
9
7
|
type DeltaOrderByHashQueryResult<TData = DeltaOrderByHashReturn> = UseQueryResult<TData, Error>;
|
|
10
8
|
type DeltaOrderByHashQueryInput<TData = DeltaOrderByHashReturn> = {
|
|
@@ -16,7 +14,7 @@ type DeltaOrderByHashQueryKey = [
|
|
|
16
14
|
orderParams: DeltaOrderByHashParams
|
|
17
15
|
];
|
|
18
16
|
type DeltaOrderByIdParams = string;
|
|
19
|
-
type DeltaOrderByIdReturn =
|
|
17
|
+
type DeltaOrderByIdReturn = DeltaAuction;
|
|
20
18
|
type DeltaOrderByIdQueryParams<TData = DeltaOrderByIdReturn> = Omit<UseQueryOptions<DeltaOrderByIdReturn, Error, TData, DeltaOrderByIdQueryKey>, "queryKey" | "queryFn">;
|
|
21
19
|
type DeltaOrderByIdQueryResult<TData = DeltaOrderByIdReturn> = UseQueryResult<TData, Error>;
|
|
22
20
|
type DeltaOrderByIdQueryInput<TData = DeltaOrderByIdReturn> = {
|
|
@@ -48,9 +46,10 @@ export declare function useDeltaOrderByHashQuery<TData = DeltaOrderByHashReturn>
|
|
|
48
46
|
export declare function ensureDeltaOrderByHashFactory({ queryClient, sdk, }: {
|
|
49
47
|
queryClient?: QueryClient;
|
|
50
48
|
sdk: GetDeltaOrdersFunctions;
|
|
51
|
-
}): (orderHash: string) => Promise<
|
|
49
|
+
}): (orderHash: string) => Promise<DeltaOrderByHashReturn>;
|
|
52
50
|
export declare function useDeltaOrderByIdQuery<TData = DeltaOrderByIdReturn>({ orderParams, query, }: DeltaOrderByIdQueryInput<TData>): DeltaOrderByIdQueryResult<TData>;
|
|
53
51
|
export declare function useDeltaOrdersQuery<TData = DeltaOrdersReturn>({ orderParams, query, }: DeltaOrdersQueryInput<TData>): DeltaOrdersQueryResult<TData>;
|
|
54
52
|
export declare function useUserDeltaOrdersQuery<TData = DeltaOrdersReturn>({ orderParams: _orderParams, query, }: UserDeltaOrdersQueryInput<TData>): DeltaOrdersQueryResult<TData>;
|
|
55
53
|
export declare function deltaOrdersQueryKey({ userAddress, ...orderParams }: MarkOptional<DeltaOrdersParams, "userAddress">): DeltaOrdersQueryKey;
|
|
54
|
+
export {};
|
|
56
55
|
//# sourceMappingURL=useDeltaOrders.d.ts.map
|
|
@@ -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,
|
|
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,EAC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CAAC,CAiBxE;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,WAA0B,EAC1B,GAAG,GACJ,EAAE;IACD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,GAAG,EAAE,uBAAuB,CAAC;CAC9B,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAczD;AAMD,wBAAgB,sBAAsB,CAAC,KAAK,GAAG,oBAAoB,EAAE,EACnE,WAAW,EACX,KAAK,GACN,EAAE,wBAAwB,CAAC,KAAK,CAAC,GAAG,yBAAyB,CAAC,KAAK,CAAC,CAYpE;AAMD,wBAAgB,mBAAmB,CAAC,KAAK,GAAG,iBAAiB,EAAE,EAC7D,WAAW,EACX,KAAK,GACN,EAAE,qBAAqB,CAAC,KAAK,CAAC,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAa9D;AAED,wBAAgB,uBAAuB,CAAC,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDeltaOrders.js","names":["useDeltaSDK","queryClient","_queryClient","assertProp","QueryClient","useQuery","UseQueryOptions","UseQueryResult","DeltaOrderApiResponse","GetDeltaOrdersFunctions","DeltaOrderFromAPI","MarkOptional","useAccount","SubmittedDeltaOrderFromAPI","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 {\n DeltaOrderApiResponse,\n GetDeltaOrdersFunctions,\n DeltaOrderFromAPI,\n} from \"@velora-dex/sdk\";\nimport type { MarkOptional } from \"ts-essentials\";\nimport { useAccount } from \"wagmi\";\n\nexport type SubmittedDeltaOrderFromAPI = DeltaOrderApiResponse;\nexport type { DeltaOrderFromAPI };\n\n// ============================================================================\n// Types for getDeltaOrderByHash\n// ============================================================================\n\ntype DeltaOrderByHashParams = string; // orderHash\ntype DeltaOrderByHashReturn = DeltaOrderFromAPI;\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 = DeltaOrderFromAPI;\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<DeltaOrderFromAPI> {\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":";;;;;;;AAkHA,IAAM0B,IAAgC;AAwBtC,SAAgBqC,EAA8B,EAC5C9D,aAAAA,IAAcC,GACdkD,UAIoD;AAapD,QAZiB,OAAO7B,MACftB,EAAYiE,gBAKjB;EACAL,UAAU,CAACnC,GAA+BH,EAAU;EACpDuC,UAAU,EAAEN,gBAAaJ,EAAIM,oBAAoBnC,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AAA+B,SAAAC,MAA6BjE,GAAY,EAACoC;AAAA,CAAAF,EAAA,OAAA6B,KAAA7B,EAAA,OAAA+B,KAEtB7B,IAAA;EAAA,GACf2B;EAAYF,aACFI;EACd,EAAA/B,EAAA,KAAA6B,GAAA7B,EAAA,KAAA+B,GAAA/B,EAAA,KAAAE,KAAAA,IAAAF,EAAA;CAHD,IAAAnB,IAAoBqB,GAGlBK;AAE+C,QAF/CP,EAAA,OAAAnB,KAAAmB,EAAA,OAAAtB,KAEyB6B,IAAA;EAAA1B;EAAAH;EAAsB,EAAAsB,EAAA,KAAAnB,GAAAmB,EAAA,KAAAtB,GAAAsB,EAAA,KAAAO,KAAAA,IAAAP,EAAA,IAA1CuB,EAAoBhB,EAAuB;;AAGpD,SAAgBiB,EAAoB,EAClCG,gBACA,GAAG9C,KACmE;AACtE,QAAO,CACL,qBACA;EACE,GAAGA;EACH8C,aAAaA,GAAaK,aAAY;EACvC,CACF"}
|
|
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;AAazD,QAZiB,OAAO7B,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;AAAA,CAAAF,EAAA,OAAAG,OAAAC,IAAA,4BAAA,IACDF,IAAA,EAAAG,SAAW,GAAG,EAAAL,EAAA,KAAAE,KAAAA,IAAAF,EAAA;CAA1C,IAAA,EAAAM,WAAgBlD,EAAY8C,EAAe,EAACK;AAAA,CAAAP,EAAA,OAAAnB,IAGA0B,IAAAP,EAAA,MAAhCO,IAAAiB,EAAoB3C,EAAY,EAAAmB,EAAA,KAAAnB,GAA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,IAAAP,EAAA,IAA1CuB,EAAoBhB,EAAuB;;AAGpD,SAAgBiB,EAAoB,EAClCG,gBACA,GAAG9C,KACmE;AACtE,QAAO,CACL,qBACA;EACE,GAAGA;EACH8C,aAAaA,GAAaK,aAAY;EACvC,CACF"}
|
|
@@ -2,11 +2,11 @@ import { Query, QueryClient, UseQueryOptions, UseQueryResult } from '@tanstack/r
|
|
|
2
2
|
import { DeltaPrice, BridgePrice, DeltaPriceParams as DParams, OptimalRate } from '@velora-dex/sdk';
|
|
3
3
|
import { MarkOptional } from 'ts-essentials';
|
|
4
4
|
type RequiredDeltaPriceParams = Omit<DParams, "destChainId">;
|
|
5
|
-
type
|
|
5
|
+
export type DeltaPriceQueryParams = MarkOptional<RequiredDeltaPriceParams, "destToken" | "destDecimals">;
|
|
6
6
|
type DeltaQueryParams<TData = DeltaPrice | BridgePrice> = Omit<UseQueryOptions<DeltaPrice | BridgePrice, Error, TData, DeltaPriceQueryKey>, "queryKey" | "queryFn">;
|
|
7
7
|
type DeltaQueryResult<TData = DeltaPrice> = UseQueryResult<TData, Error>;
|
|
8
8
|
type DeltaPriceQueryInput<TData = DeltaPrice> = {
|
|
9
|
-
priceParams:
|
|
9
|
+
priceParams: DeltaPriceQueryParams;
|
|
10
10
|
query?: DeltaQueryParams<TData>;
|
|
11
11
|
chainId: number;
|
|
12
12
|
timeout?: number;
|
|
@@ -15,7 +15,7 @@ export declare const DeltaPriceQueryKeyPrefix = "swap/prices/delta";
|
|
|
15
15
|
export type DeltaPriceQueryKey = readonly [
|
|
16
16
|
base: typeof DeltaPriceQueryKeyPrefix,
|
|
17
17
|
chainId: number,
|
|
18
|
-
priceParams:
|
|
18
|
+
priceParams: DeltaPriceQueryParams & {
|
|
19
19
|
destChainId?: number;
|
|
20
20
|
}
|
|
21
21
|
];
|
|
@@ -67,17 +67,17 @@ export declare function useDeltaPriceQueryKey({ priceParams, chainId, destChainI
|
|
|
67
67
|
sanitizedPriceParams: {
|
|
68
68
|
amount: string;
|
|
69
69
|
side?: ("SELL" | "BUY") | undefined;
|
|
70
|
+
userAddress?: string | undefined;
|
|
70
71
|
partner?: string | undefined;
|
|
71
72
|
excludeAgents?: string[] | undefined;
|
|
72
73
|
includeAgents?: string[] | undefined;
|
|
73
|
-
userAddress?: string | undefined;
|
|
74
74
|
degenMode?: boolean | undefined;
|
|
75
|
+
beneficiary?: string | undefined;
|
|
75
76
|
srcToken: string;
|
|
76
77
|
destToken?: string | undefined;
|
|
77
|
-
|
|
78
|
+
partnerFeeBps?: number | undefined;
|
|
78
79
|
srcDecimals: number;
|
|
79
80
|
destDecimals?: number | undefined;
|
|
80
|
-
partnerFeeBps?: number | undefined;
|
|
81
81
|
maxImpact?: number | undefined;
|
|
82
82
|
maxUSDImpact?: number | undefined;
|
|
83
83
|
includeBridges?: 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,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,IAAI,OAAO,EAC3B,WAAW,EACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
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,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,IAAI,OAAO,EAC3B,WAAW,EACZ,MAAM,iBAAiB,CAAC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C,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;AAgBD,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,WAAW,GACvB,UAAU,GAAG,WAAW,GAAG,SAAS,CAItC;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,WAAW,GACvB,OAAO,CAIT;AAED,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,UAAU,GAAG,WAAW,CAUnC;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,89 +1,90 @@
|
|
|
1
1
|
import { useDeltaSDK as e } from "../../../../useSDK.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { PRICE_FETCH_TIMEOUT_MS as t } from "../../constants.js";
|
|
3
|
+
import { c as n } from "react-compiler-runtime";
|
|
4
|
+
import { useMemo as r } from "react";
|
|
5
|
+
import { QueryObserver as i, useQuery as a, useQueryClient as o } from "@tanstack/react-query";
|
|
6
|
+
import { assert as s } from "ts-essentials";
|
|
7
|
+
import { useDebouncedValue as c } from "@tanstack/react-pacer/debouncer";
|
|
7
8
|
//#region src/hooks/swap/prices/delta/queries/useDeltaPriceQuery.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let { sdk:
|
|
13
|
-
|
|
14
|
-
priceParams:
|
|
15
|
-
chainId:
|
|
16
|
-
destChainId:
|
|
17
|
-
},
|
|
18
|
-
let { queryKey:
|
|
19
|
-
|
|
9
|
+
var l = "swap/prices/delta";
|
|
10
|
+
function u(r) {
|
|
11
|
+
let i = n(21), { priceParams: o, query: c, chainId: l, timeout: u, destChainId: f } = r, p = u === void 0 ? t : u, m;
|
|
12
|
+
i[0] === l ? m = i[1] : (m = { chainId: l }, i[0] = l, i[1] = m);
|
|
13
|
+
let { sdk: h } = e(m), g = c?.enabled ?? !0, _;
|
|
14
|
+
i[2] !== o || i[3] !== l || i[4] !== f ? (_ = {
|
|
15
|
+
priceParams: o,
|
|
16
|
+
chainId: l,
|
|
17
|
+
destChainId: f
|
|
18
|
+
}, i[2] = o, i[3] = l, i[4] = f, i[5] = _) : _ = i[5];
|
|
19
|
+
let { queryKey: v, sanitizedPriceParams: b } = y(_), x;
|
|
20
|
+
i[6] !== b || i[7] !== h || i[8] !== p ? (x = (e) => {
|
|
20
21
|
let { signal: t } = e;
|
|
21
|
-
return
|
|
22
|
+
return s(d(b), "destToken is required"), h.getDeltaPrice(b, {
|
|
22
23
|
signal: t,
|
|
23
|
-
timeout:
|
|
24
|
+
timeout: p
|
|
24
25
|
});
|
|
25
|
-
},
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
queryKey:
|
|
31
|
-
queryFn:
|
|
32
|
-
...
|
|
33
|
-
enabled:
|
|
34
|
-
},
|
|
35
|
-
let
|
|
36
|
-
return
|
|
37
|
-
result:
|
|
38
|
-
queryKey:
|
|
39
|
-
},
|
|
26
|
+
}, i[6] = b, i[7] = h, i[8] = p, i[9] = x) : x = i[9];
|
|
27
|
+
let S;
|
|
28
|
+
i[10] !== g || i[11] !== b ? (S = g && d(b), i[10] = g, i[11] = b, i[12] = S) : S = i[12];
|
|
29
|
+
let C;
|
|
30
|
+
i[13] !== c || i[14] !== v || i[15] !== x || i[16] !== S ? (C = {
|
|
31
|
+
queryKey: v,
|
|
32
|
+
queryFn: x,
|
|
33
|
+
...c,
|
|
34
|
+
enabled: S
|
|
35
|
+
}, i[13] = c, i[14] = v, i[15] = x, i[16] = S, i[17] = C) : C = i[17];
|
|
36
|
+
let w = a(C), T;
|
|
37
|
+
return i[18] !== v || i[19] !== w ? (T = {
|
|
38
|
+
result: w,
|
|
39
|
+
queryKey: v
|
|
40
|
+
}, i[18] = v, i[19] = w, i[20] = T) : T = i[20], T;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function d(e) {
|
|
42
43
|
return !!e.destToken && e.destDecimals !== void 0 && Number(e.amount) > 0;
|
|
43
44
|
}
|
|
44
|
-
function
|
|
45
|
+
function f(e) {
|
|
45
46
|
return "bridge" in e;
|
|
46
47
|
}
|
|
47
|
-
function
|
|
48
|
+
function p(e) {
|
|
48
49
|
return e.bridge.destinationChainId !== 0;
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
-
let e =
|
|
52
|
-
return e[0] ===
|
|
53
|
-
let { queryKey:
|
|
54
|
-
return new
|
|
55
|
-
queryKey:
|
|
51
|
+
function m() {
|
|
52
|
+
let e = n(2), t = o(), r;
|
|
53
|
+
return e[0] === t ? r = e[1] : (r = (e) => {
|
|
54
|
+
let { queryKey: n, onData: r, onError: a } = e;
|
|
55
|
+
return new i(t, {
|
|
56
|
+
queryKey: n,
|
|
56
57
|
enabled: !1
|
|
57
58
|
}).subscribe((e) => {
|
|
58
59
|
if (e.error) {
|
|
59
60
|
a?.(e.error);
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
e.data &&
|
|
63
|
+
e.data && r?.(e.data);
|
|
63
64
|
});
|
|
64
|
-
}, e[0] =
|
|
65
|
+
}, e[0] = t, e[1] = r), r;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function h(e) {
|
|
67
68
|
return e.getQueryCache().find({
|
|
68
|
-
queryKey: [
|
|
69
|
+
queryKey: [l],
|
|
69
70
|
exact: !1,
|
|
70
71
|
type: "active"
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
|
-
function h(e) {
|
|
74
|
-
return m(e)?.state.data;
|
|
75
|
-
}
|
|
76
74
|
function g(e) {
|
|
77
|
-
return
|
|
75
|
+
return h(e)?.state.data;
|
|
78
76
|
}
|
|
79
77
|
function _(e) {
|
|
78
|
+
return !!h(e)?.state.error;
|
|
79
|
+
}
|
|
80
|
+
function v(e) {
|
|
80
81
|
return typeof e == "object" && !!e && "bridge" in e && "srcToken" in e && "destToken" in e && "srcAmount" in e && "destAmount" in e;
|
|
81
82
|
}
|
|
82
|
-
function
|
|
83
|
+
function y({ priceParams: e, chainId: t, destChainId: n }) {
|
|
83
84
|
"use no memo";
|
|
84
|
-
let [i] =
|
|
85
|
-
return
|
|
86
|
-
let
|
|
85
|
+
let [i] = c(e.amount, { wait: 500 });
|
|
86
|
+
return r(() => {
|
|
87
|
+
let r = {
|
|
87
88
|
amount: i,
|
|
88
89
|
srcToken: e.srcToken,
|
|
89
90
|
destToken: e.destToken,
|
|
@@ -99,17 +100,17 @@ function v({ priceParams: e, chainId: t, destChainId: r }) {
|
|
|
99
100
|
includeBridges: e.includeBridges,
|
|
100
101
|
excludeBridges: e.excludeBridges,
|
|
101
102
|
allowBridgeAndSwap: e.allowBridgeAndSwap,
|
|
102
|
-
destChainId:
|
|
103
|
+
destChainId: n,
|
|
103
104
|
maxImpact: e.maxImpact,
|
|
104
105
|
degenMode: e.degenMode
|
|
105
106
|
};
|
|
106
107
|
return {
|
|
107
108
|
queryKey: [
|
|
108
|
-
|
|
109
|
+
l,
|
|
109
110
|
t,
|
|
110
|
-
|
|
111
|
+
r
|
|
111
112
|
],
|
|
112
|
-
sanitizedPriceParams:
|
|
113
|
+
sanitizedPriceParams: r
|
|
113
114
|
};
|
|
114
115
|
}, [
|
|
115
116
|
e.beneficiary,
|
|
@@ -130,10 +131,10 @@ function v({ priceParams: e, chainId: t, destChainId: r }) {
|
|
|
130
131
|
e.degenMode,
|
|
131
132
|
t,
|
|
132
133
|
i,
|
|
133
|
-
|
|
134
|
+
n
|
|
134
135
|
]);
|
|
135
136
|
}
|
|
136
137
|
//#endregion
|
|
137
|
-
export {
|
|
138
|
+
export { l as DeltaPriceQueryKeyPrefix, g as getLastDeltaPrice, p as isBridgePrice, v as isDataDeltaOrBridgePrice, f as isDeltaPrice, _ as isLastDeltaPriceQueryInError, u as useDeltaPriceQuery, m as useSubscribeToDeltaPrice };
|
|
138
139
|
|
|
139
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","RequiredDeltaPriceParams","Omit","DeltaQueryParams","Error","TData","DeltaPriceQueryKey","DeltaQueryResult","DeltaPriceQueryInput","priceParams","query","chainId","timeout","DeltaPriceQueryKeyPrefix","base","destChainId","useDeltaPriceQuery","result","queryKey","t0","$","_c","_priceParams","t1","sdk","queryEnabled","enabled","t2","sanitizedPriceParams","useDeltaPriceQueryKey","t3","t4","signal","isPriceParamsValid","price","getDeltaPrice","t5","queryFn","t6","destToken","destDecimals","undefined","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\";\n\n// overload is easier with input.destChainId\ntype RequiredDeltaPriceParams = Omit<DParams, \"destChainId\">;\ntype DeltaPriceParams = 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: DeltaPriceParams;\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: DeltaPriceParams & {\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,\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: DeltaPriceParams\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: DeltaPriceParams & {\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,IAAa6B,IAA2B;AAgDxC,SAAOG,EAAAG,GAAA;CAAA,IAAAC,IAAAC,EAAA,GAAA,EAA8D,EAAAZ,aAAAa,GAAAZ,UAAAC,YAAAC,YAAAG,mBAAAI,GAQpEI;AAAA,CAAAH,EAAA,OAAAT,IAIwCY,IAAAH,EAAA,MAAXG,IAAA,EAAAZ,YAAW,EAAAS,EAAA,KAAAT,GAAAS,EAAA,KAAAG;CAAvC,IAAA,EAAAC,WAAgBxC,EAAYuC,EAAY,EAExCE,IAAqBf,GAAKgB,WAAL,IAAuBC;AAAA,CAAAP,EAAA,OAAAE,KAAAF,EAAA,OAAAT,KAAAS,EAAA,OAAAL,KAEqBY,IAAA;EAAAlB,aAClDa;EAAYX;EAAAI;EAG1B,EAAAK,EAAA,KAAAE,GAAAF,EAAA,KAAAT,GAAAS,EAAA,KAAAL,GAAAK,EAAA,KAAAO,KAAAA,IAAAP,EAAA;CAJD,IAAA,EAAAF,aAAAU,4BAA2CC,EAAsBF,EAI/D,EAACG;AAAA,CAAAV,EAAA,OAAAQ,KAAAR,EAAA,OAAAI,KAAAJ,EAAA,OAAAR,KASQkB,KAAAC,MAAA;EAAC,IAAA,EAAAC,cAAAD;AAKL,SAJHjC,EA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AClBC,eAAe5E,EAAY4E;GAC3BC,eAAe7E,EAAY6E;GAC3BC,gBAAgB9E,EAAY8E;GAC5BC,gBAAgB/E,EAAY+E;GAC5BC,oBAAoBhF,EAAYgF;GACnB1E;GACb2E,WAAWjF,EAAYiF;GACvBC,WAAWlF,EAAYkF;GACxB;AAQD,SAAO;GAAEzE,UAN4B;IACnCL;IACAF;IACAiB;IACD;GAEkBA;GAAsB;IACxC;EACDnB,EAAYwE;EACZxE,EAAY+B;EACZ/B,EAAY8B;EACZ9B,EAAY6E;EACZ7E,EAAY4E;EACZ5E,EAAY8E;EACZ9E,EAAY+E;EACZ/E,EAAYyE;EACZzE,EAAY0E;EACZ1E,EAAY2E;EACZ3E,EAAYsE;EACZtE,EAAYqE;EACZrE,EAAYuE;EACZvE,EAAYgF;EACZhF,EAAYiF;EACZjF,EAAYkF;EACZhF;EACAiE;EACA7D;EACD,CAAC"}
|
|
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;AAAA,CAAAL,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;AAAA,CAAAT,E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EACpCtB,gBACAE,YACAI,kBAGC;AACD;CAGA,IAAM,CAAC8D,KAAmBvF,EAAkBmB,EAAYmC,QAAQ,EAC9DkC,MAAM,KACP,CAAC;AAEF,QAAOhF,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;AAQD,SAAO;GAAE1E,UAN4B;IACnCL;IACAF;IACAmB;IACD;GAEkBA;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,9 +1,7 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
|
-
import { MarkOptional } from 'ts-essentials';
|
|
3
|
-
import { DeltaOrderFromAPI } from './useDeltaOrders';
|
|
4
2
|
import { BridgedDepositResponse } from '../bridge/types';
|
|
5
|
-
import { DeltaAuction } from '@velora-dex/sdk';
|
|
6
3
|
import { ExecutedDeltaAuction, FailedDeltaAuction } from '../orders/types';
|
|
4
|
+
import { DeltaAuction } from '@velora-dex/sdk';
|
|
7
5
|
declare const SINGLE_DELTA_AUCTION_QUERY_KEY_PREFIX = "single_delta_auction";
|
|
8
6
|
type SingleDeltaAuctionQueryKey = [
|
|
9
7
|
base: typeof SINGLE_DELTA_AUCTION_QUERY_KEY_PREFIX,
|
|
@@ -12,36 +10,34 @@ type SingleDeltaAuctionQueryKey = [
|
|
|
12
10
|
export declare function deltaAuctionPollingQueryKey({ orderId, }?: {
|
|
13
11
|
orderId?: string;
|
|
14
12
|
}): SingleDeltaAuctionQueryKey;
|
|
15
|
-
|
|
16
|
-
type UseWatchDeltaAuctionQueryInput<TData = MaybeVeloraDeltaAuction> = {
|
|
13
|
+
type UseWatchDeltaAuctionQueryInput<TData = DeltaAuction> = {
|
|
17
14
|
orderId?: string;
|
|
18
15
|
enabled?: boolean;
|
|
19
|
-
|
|
16
|
+
refetchInterval?: number;
|
|
17
|
+
select?: (data: DeltaAuction) => TData;
|
|
20
18
|
onAuctionSuccess?: (auction: ExecutedDeltaAuction) => void;
|
|
21
19
|
onAuctionFailure?: (auction: FailedDeltaAuction) => void;
|
|
22
|
-
onUpdatedAuction?: (auction:
|
|
23
|
-
onTimeoutGettingOrder?: (auction: Pick<DeltaAuction, "id">) => void;
|
|
20
|
+
onUpdatedAuction?: (auction: DeltaAuction) => void;
|
|
24
21
|
};
|
|
25
|
-
export declare function useWatchDeltaAuction<TData =
|
|
26
|
-
type EnsureOrderExecutedFn = (options: {
|
|
22
|
+
export declare function useWatchDeltaAuction<TData = DeltaAuction>({ orderId, enabled, refetchInterval, select, onAuctionSuccess, onAuctionFailure, onUpdatedAuction, }: UseWatchDeltaAuctionQueryInput<TData>): UseQueryResult<TData>;
|
|
23
|
+
type EnsureOrderExecutedFn<TData extends DeltaAuction = DeltaAuction> = (options: {
|
|
27
24
|
orderId: string;
|
|
28
25
|
signal?: AbortSignal;
|
|
29
|
-
}) => Promise<
|
|
30
|
-
export declare function useEnsureDeltaOrderExecuted({ onAuctionSuccess, onAuctionFailure, }?: Pick<UseWatchDeltaAuctionQueryInput, "onAuctionSuccess" | "onAuctionFailure">): EnsureOrderExecutedFn
|
|
26
|
+
}) => Promise<TData>;
|
|
27
|
+
export declare function useEnsureDeltaOrderExecuted<TData extends DeltaAuction = DeltaAuction>({ onAuctionSuccess, onAuctionFailure, refetchInterval, }?: Pick<UseWatchDeltaAuctionQueryInput, "onAuctionSuccess" | "onAuctionFailure" | "refetchInterval">): EnsureOrderExecutedFn<TData>;
|
|
31
28
|
type UseWatchMultiDeltaAuctions = {
|
|
32
29
|
orderIds: string[];
|
|
33
30
|
enabled?: boolean;
|
|
34
31
|
onAuctionSuccess?: (auction: ExecutedDeltaAuction) => void;
|
|
35
32
|
onAuctionFailure?: (auction: FailedDeltaAuction) => void;
|
|
36
|
-
onUpdatedAuction?: (auction:
|
|
37
|
-
onTimeoutGettingOrder?: (auction: Pick<DeltaAuction, "id">) => void;
|
|
33
|
+
onUpdatedAuction?: (auction: DeltaAuction) => void;
|
|
38
34
|
};
|
|
39
|
-
export declare function useWatchMultiDeltaAuctions({ orderIds, enabled, onAuctionSuccess, onAuctionFailure, onUpdatedAuction,
|
|
35
|
+
export declare function useWatchMultiDeltaAuctions({ orderIds, enabled, onAuctionSuccess, onAuctionFailure, onUpdatedAuction, }: UseWatchMultiDeltaAuctions): UseQueryResult<DeltaAuction>[];
|
|
40
36
|
type MultiOrdersStatusCrossChainInput = {
|
|
41
|
-
orders:
|
|
42
|
-
onAuctionSuccess?: (order:
|
|
43
|
-
onAuctionFailure?: (order:
|
|
44
|
-
onUpdatedAuction?: (auction:
|
|
37
|
+
orders: DeltaAuction[];
|
|
38
|
+
onAuctionSuccess?: (order: DeltaAuction) => void;
|
|
39
|
+
onAuctionFailure?: (order: DeltaAuction) => void;
|
|
40
|
+
onUpdatedAuction?: (auction: DeltaAuction, bridgeResponse: BridgedDepositResponse) => void;
|
|
45
41
|
};
|
|
46
42
|
export declare function useWatchMultiOrdersStatusCrossChain({ orders, onAuctionSuccess, onAuctionFailure, onUpdatedAuction, }: MultiOrdersStatusCrossChainInput): UseQueryResult<BridgedDepositResponse>[];
|
|
47
43
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWatchDeltaOrder.d.ts","sourceRoot":"","sources":["../../../../../../src/hooks/swap/prices/delta/queries/useWatchDeltaOrder.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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;AAS/B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAS9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIpD,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;AAiHD,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,oBAAoB,KAAK,IAAI,CAAC;IAC3D,gBAAgB,CAAC,EAAE,CAAC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