From 27a13791a979aba09fc64fae6c12f84b1ab8f01e Mon Sep 17 00:00:00 2001 From: viet-nv Date: Wed, 18 Sep 2024 16:04:34 +0700 Subject: [PATCH] fix: token symbol on url --- src/state/swap/hooks.ts | 3 ++- src/utils/string.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/state/swap/hooks.ts b/src/state/swap/hooks.ts index d84e28d0a8..383ce300c3 100644 --- a/src/state/swap/hooks.ts +++ b/src/state/swap/hooks.ts @@ -64,7 +64,7 @@ export function useSwapActionHandlers(): { navigate( `/${window.location.pathname.startsWith('/limit') ? 'limit' : 'swap'}/${ NETWORKS_INFO[chainId].route - }/${f}-to-${to}`, + }/${encodeURIComponent(f)}-to-${encodeURIComponent(to)}`, ) }, [fromCurrency, chainId, toCurrency, navigate, allTokens], @@ -275,6 +275,7 @@ export const useOutputCurrency = () => { }, [allTokens, toCurrency]) const outputCurrency = useCurrencyV2(token ? token.address : toCurrency) + return outputCurrency || undefined } diff --git a/src/utils/string.ts b/src/utils/string.ts index e782e1ec4e..b9dff753c2 100644 --- a/src/utils/string.ts +++ b/src/utils/string.ts @@ -18,7 +18,7 @@ export function convertToSlug(text: string) { } export const getSymbolSlug = (token: Currency | Token | undefined) => - token ? convertToSlug(token?.symbol || token?.wrapped?.symbol || '') : '' + token ? (token?.symbol || token?.wrapped?.symbol || '').toLowerCase() : '' export const queryStringToObject = (queryString: string) => { return parse(queryString.startsWith('?') ? queryString.substring(1) : queryString)