diff --git a/src/state/swap/hooks.ts b/src/state/swap/hooks.ts index fa0a2af..d15d5ad 100644 --- a/src/state/swap/hooks.ts +++ b/src/state/swap/hooks.ts @@ -186,6 +186,9 @@ export function useDerivedSwapInfo(): { const chainIdToUse = chainId ?? ChainId.MATIC; const parsedQuery = useParsedQueryString(); const swapType = parsedQuery ? parsedQuery.swapIndex : undefined; + const swapSlippage = parsedQuery?.slippage + ? (parsedQuery.slippage as string) + : undefined; const { independentField, @@ -282,7 +285,7 @@ export function useDerivedSwapInfo(): { stableCoins && stableCoins.length > 0 ? stableCoins.map((token) => token.address.toLowerCase()) : []; - if (!slippageManuallySet) { + if (!swapSlippage && !slippageManuallySet) { if ( inputCurrencyId && outputCurrencyId && @@ -300,6 +303,7 @@ export function useDerivedSwapInfo(): { setUserSlippageTolerance, chainIdToUse, slippageManuallySet, + swapSlippage, ]); return { diff --git a/src/state/swap/v3/hooks.ts b/src/state/swap/v3/hooks.ts index e55f191..0711eae 100644 --- a/src/state/swap/v3/hooks.ts +++ b/src/state/swap/v3/hooks.ts @@ -249,13 +249,17 @@ export function useDerivedSwapInfo(): { inputError = `Insufficient ${amountIn.currency.symbol} balance`; } + const parsedQs = useParsedQueryString(); + const swapSlippage = parsedQs.slippage + ? (parsedQs.slippage as string) + : undefined; useEffect(() => { const stableCoins = GlobalData.stableCoins[chainIdToUse]; const stableCoinAddresses = stableCoins && stableCoins.length > 0 ? stableCoins.map((token) => token.address.toLowerCase()) : []; - if (!slippageManuallySet) { + if (!swapSlippage && !slippageManuallySet) { if ( inputCurrencyId && outputCurrencyId && @@ -273,6 +277,7 @@ export function useDerivedSwapInfo(): { setUserSlippageTolerance, chainIdToUse, slippageManuallySet, + swapSlippage, ]); return {