diff --git a/src/components/transactions/Swap/actions/DebtSwap/DebtSwapActionsViaParaswap.tsx b/src/components/transactions/Swap/actions/DebtSwap/DebtSwapActionsViaParaswap.tsx index 6c60b968dc..89faa2a671 100644 --- a/src/components/transactions/Swap/actions/DebtSwap/DebtSwapActionsViaParaswap.tsx +++ b/src/components/transactions/Swap/actions/DebtSwap/DebtSwapActionsViaParaswap.tsx @@ -103,10 +103,6 @@ export const DebtSwapActionsViaParaswap = ({ throw new Error('No swap rate found'); } - if (!signatureParams) { - throw new Error('Signature params not found'); - } - const inferredKind = state.swapRate.optimalRateData.side === 'SELL' ? 'sell' : 'buy'; // CallData for ParaswapRoute, which is inversed to the actual swap (dest -> src) @@ -133,11 +129,15 @@ export const DebtSwapActionsViaParaswap = ({ isMaxSelected: state.isMaxSelected, txCalldata: swapCallData, augustus: augustus, - signatureParams: { - signature: signatureParams.signature, - deadline: signatureParams.deadline, - amount: signatureParams.amount, - }, + ...(signatureParams != undefined + ? { + signatureParams: { + signature: signatureParams.signature, + deadline: signatureParams.deadline, + amount: signatureParams.amount, + }, + } + : {}), isWrongNetwork: state.isWrongNetwork, }); diff --git a/src/components/transactions/Swap/errors/SwapErrors.tsx b/src/components/transactions/Swap/errors/SwapErrors.tsx index bb7069c02f..6a08f7825c 100644 --- a/src/components/transactions/Swap/errors/SwapErrors.tsx +++ b/src/components/transactions/Swap/errors/SwapErrors.tsx @@ -2,7 +2,7 @@ import React, { Dispatch, useEffect } from 'react'; import { useModalContext } from '../../../../hooks/useModal'; import { TrackAnalyticsHandlers } from '../analytics/useTrackAnalytics'; -import { SwapError, SwapParams, SwapState } from '../types'; +import { SwapError, SwapParams, SwapState, SwapType } from '../types'; import { ActionsBlockedReason, isProtocolSwapState } from '../types/state.types'; import { errorToConsole } from './shared/console.helpers'; import { @@ -108,7 +108,11 @@ export const SwapErrors = ({ ); } - if (isProtocolSwapState(state) && hasInsufficientLiquidity(state)) { + if ( + isProtocolSwapState(state) && + hasInsufficientLiquidity(state) && + state.swapType !== SwapType.RepayWithCollateral + ) { return ( { - if (!isProtocolSwapState(state)) return false; + if (!isProtocolSwapState(state) || state.swapType === SwapType.RepayWithCollateral) return false; const reserve = state.isInvertedSwap ? state.sourceReserve?.reserve : state.destinationReserve?.reserve; diff --git a/src/components/transactions/Swap/hooks/useSwapQuote.ts b/src/components/transactions/Swap/hooks/useSwapQuote.ts index c102f63a0a..e2f8015745 100644 --- a/src/components/transactions/Swap/hooks/useSwapQuote.ts +++ b/src/components/transactions/Swap/hooks/useSwapQuote.ts @@ -439,7 +439,6 @@ const useMultiProviderSwapQuoteQuery = ({ })(), retry: 0, throwOnError: false, - refetchOnWindowFocus: (query) => (query.state.error ? false : true), refetchInterval: (() => { const isInsufficientBalance = hasInsufficientBalance(state); const isFlashloanDisabled = hasFlashLoanDisabled(state);