From 37676a5f442779e6155f79f675c8a5679dfb31dc Mon Sep 17 00:00:00 2001 From: Bayological <6872903+bayological@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:02:32 +0000 Subject: [PATCH] Release 2.3.3 (#172) --- package.json | 2 +- src/features/swap/SwapForm.tsx | 2 +- src/features/swap/useSwapQuote.ts | 2 +- src/utils/amount.ts | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 5def85c..4f15f72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mento-protocol/mento-web", - "version": "2.3.2", + "version": "2.3.3", "description": "A simple DApp for Celo Mento exchanges", "keywords": [ "Celo", diff --git a/src/features/swap/SwapForm.tsx b/src/features/swap/SwapForm.tsx index 3da54fd..370ce6d 100644 --- a/src/features/swap/SwapForm.tsx +++ b/src/features/swap/SwapForm.tsx @@ -332,7 +332,7 @@ function SubmitButton() { const showLongError = typeof error === 'string' && error?.length > 50 return ( -
+
{showLongError ? (
{error}
) : null} diff --git a/src/features/swap/useSwapQuote.ts b/src/features/swap/useSwapQuote.ts index 5510006..f6842ba 100644 --- a/src/features/swap/useSwapQuote.ts +++ b/src/features/swap/useSwapQuote.ts @@ -48,7 +48,7 @@ export function useSwapQuote( quoteWei = (await mento.getAmountIn(fromTokenAddr, toTokenAddr, amountWeiBN)).toString() } - const quote = fromWei(quoteWei, quoteDecimals).toString() + const quote = fromWei(quoteWei, quoteDecimals) const rateIn = calcExchangeRate(amountWei, amountDecimals, quoteWei, quoteDecimals) const rate = isSwapIn ? rateIn : invertExchangeRate(rateIn) diff --git a/src/utils/amount.ts b/src/utils/amount.ts index b5eb359..f3a98d6 100644 --- a/src/utils/amount.ts +++ b/src/utils/amount.ts @@ -11,11 +11,11 @@ export type NumberT = BigNumber.Value export function fromWei( value: NumberT | null | undefined, decimals = STANDARD_TOKEN_DECIMALS -): number { - if (!value) return 0 +): string { + if (!value) return '0' const valueString = value.toString().trim() const flooredValue = new BigNumber(valueString).toFixed(0, BigNumber.ROUND_FLOOR) - return parseFloat(formatUnits(flooredValue, decimals)) + return formatUnits(flooredValue, decimals) } // Similar to fromWei above but rounds to set number of decimals