From f218e6386fbdd9194ae6669b7cff42b5d7bc6560 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Fri, 3 Nov 2023 11:40:57 +0700 Subject: [PATCH 1/2] hotfix: crash page when creating pool --- src/state/swap/hooks.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/state/swap/hooks.ts b/src/state/swap/hooks.ts index a4f1dd3306..64b57bbc20 100644 --- a/src/state/swap/hooks.ts +++ b/src/state/swap/hooks.ts @@ -157,6 +157,8 @@ export function tryParseAmount( const typedValueParsed = parseFraction(value) .multiply(scaleDecimals ? 10 ** currency.decimals : 1) .toFixed(0) + + if (typedValueParsed === '0') return undefined const result = CurrencyAmount.fromRawAmount(currency, typedValueParsed) return result } catch (error) { From f1fdd51e285cc0f8f0fccb9849f9a14cda89e991 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Fri, 3 Nov 2023 13:23:04 +0700 Subject: [PATCH 2/2] add kyberswap-ui clientId --- src/components/SwapForm/hooks/useBuildRoute.tsx | 2 +- src/constants/index.ts | 2 +- src/services/route/index.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/SwapForm/hooks/useBuildRoute.tsx b/src/components/SwapForm/hooks/useBuildRoute.tsx index 5bb65c84f3..4dcf21405e 100644 --- a/src/components/SwapForm/hooks/useBuildRoute.tsx +++ b/src/components/SwapForm/hooks/useBuildRoute.tsx @@ -61,7 +61,7 @@ const useBuildRoute = (args: Args) => { slippageTolerance: slippage, sender: account, recipient: to || account, - source: clientId || 'kyberswap', + source: clientId || 'kyberswap-ui', skipSimulateTx: false, permit, } diff --git a/src/constants/index.ts b/src/constants/index.ts index fa340712f7..de1867f189 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -131,7 +131,7 @@ export const CAMPAIGN_LEADERBOARD_ITEM_PER_PAGE = 10 export const CAMPAIGN_YOUR_TRANSACTIONS_ITEM_PER_PAGE = 10000 export const ELASTIC_BASE_FEE_UNIT = 100_000 -export const KYBERSWAP_SOURCE = '{"source":"kyberswap"}' +export const KYBERSWAP_SOURCE = '{"source":"kyberswap-ui"}' export const SWR_KEYS = { getGrantProgramLeaderBoard: (id: number | string) => `${CAMPAIGN_BASE_URL}/api/v1/competitions/${id}/leaderboard`, diff --git a/src/services/route/index.ts b/src/services/route/index.ts index 8984d75c5b..cece92496c 100644 --- a/src/services/route/index.ts +++ b/src/services/route/index.ts @@ -24,7 +24,7 @@ const routeApi = createApi({ params, authentication, headers: { - 'x-client-id': clientId || 'kyberswap', + 'x-client-id': clientId || 'kyberswap-ui', }, }), }), @@ -39,7 +39,7 @@ const routeApi = createApi({ signal, authentication, headers: { - 'x-client-id': payload.source || 'kyberswap', + 'x-client-id': payload.source || 'kyberswap-ui', }, }), }),