Skip to content

Commit

Permalink
hotfix: crash page when creating pool (#2361)
Browse files Browse the repository at this point in the history
* hotfix: crash page when creating pool

* add kyberswap-ui clientId
  • Loading branch information
viet-nv authored Nov 3, 2023
1 parent d9456db commit 14c3770
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/SwapForm/hooks/useBuildRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
4 changes: 2 additions & 2 deletions src/services/route/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const routeApi = createApi({
params,
authentication,
headers: {
'x-client-id': clientId || 'kyberswap',
'x-client-id': clientId || 'kyberswap-ui',
},
}),
}),
Expand All @@ -39,7 +39,7 @@ const routeApi = createApi({
signal,
authentication,
headers: {
'x-client-id': payload.source || 'kyberswap',
'x-client-id': payload.source || 'kyberswap-ui',
},
}),
}),
Expand Down
2 changes: 2 additions & 0 deletions src/state/swap/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ export function tryParseAmount<T extends Currency>(
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) {
Expand Down

0 comments on commit 14c3770

Please sign in to comment.