diff --git a/package.json b/package.json index 7a6bf621..b61823cd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "start": "vite --host", "dev": "vite --host", - "build": "tsc && NODE_OPTIONS='--max-old-space-size=8192' vite build", + "build": "tsc && vite build", "preview": "vite preview", "prepare": "husky install" }, diff --git a/src/components/BalanceUI.tsx b/src/components/BalanceUI.tsx index 28bb0928..271f2f41 100644 --- a/src/components/BalanceUI.tsx +++ b/src/components/BalanceUI.tsx @@ -15,13 +15,17 @@ interface IProps { chain?: Chain isSecretToken?: boolean showBalanceLabel?: boolean + onBalanceClick?: any + showCurrencyEquiv?: boolean } export default function BalanceUI({ token, chain = chains['Secret Network'], isSecretToken = false, - showBalanceLabel = true + showBalanceLabel = true, + onBalanceClick = false, + showCurrencyEquiv = true }: IProps) { const { isConnected, @@ -88,7 +92,7 @@ export default function BalanceUI({ return ( <> -
+
{showBalanceLabel && {`Balance: `}} {/* Skeleton Loader */} @@ -99,7 +103,22 @@ export default function BalanceUI({ {balance !== null && balance !== ('viewingKeyError' as GetBalanceError) && balance !== ('GenericFetchError' as GetBalanceError) && - token.name && ( + token.name && + (onBalanceClick ? ( + onBalanceClick(Number(BigNumber(balance).dividedBy(`1e${token.decimals}`)))} // ADD + > + {` ${Number( + BigNumber(balance).dividedBy(`1e${token.decimals}`) + ).toLocaleString(undefined, { + maximumFractionDigits: token.decimals + })} + ${token.name == 'SCRT' && isSecretToken ? 's' : ''}${token.name} ${ + token.coingecko_id && currencyPriceString && showCurrencyEquiv ? ` (${currencyPriceString})` : '' + }`} + + ) : ( <> {` ${Number( BigNumber(balance).dividedBy(`1e${token.decimals}`) @@ -107,10 +126,10 @@ export default function BalanceUI({ maximumFractionDigits: token.decimals })} ${token.name == 'SCRT' && isSecretToken ? 's' : ''}${token.name} ${ - token.coingecko_id && currencyPriceString ? ` (${currencyPriceString})` : '' + token.coingecko_id && currencyPriceString && showCurrencyEquiv ? ` (${currencyPriceString})` : '' }`} - )} + ))} {balance === ('viewingKeyError' as GetBalanceError) && (