diff --git a/packages/ui/src/routes/dApp/ApproveAsset.tsx b/packages/ui/src/routes/dApp/ApproveAsset.tsx index b226a09a8..9ce36e931 100644 --- a/packages/ui/src/routes/dApp/ApproveAsset.tsx +++ b/packages/ui/src/routes/dApp/ApproveAsset.tsx @@ -37,7 +37,7 @@ import { } from "../../context/commTypes" import { TransactionFeeData } from "@block-wallet/background/controllers/erc-20/transactions/SignedTransaction" import { capitalize } from "../../util/capitalize" -import { formatName } from "../../util/formatAccount" +import { formatHash, formatName } from "../../util/formatAccount" import { formatRounded } from "../../util/formatRounded" import { formatUnits, getAddress, parseUnits } from "ethers/lib/utils" import { getAccountColor } from "../../util/getAccountColor" @@ -194,6 +194,7 @@ const ApproveAsset: FunctionComponent = ({ // Local state const [tokenName, setTokenName] = useState("") + const [tokenLogo, setTokenLogo] = useState("") const [isEditAllowancePage, setIsEditAllowancePage] = useState(false) const [isCustomSelected, setIsCustomSelected] = useState(false) const [customAllowance, setCustomAllowance] = useState("") @@ -239,7 +240,6 @@ const ApproveAsset: FunctionComponent = ({ const tokenAddress = params.to! const tokenDecimals = transaction.advancedData?.decimals! const defaultAllowance = transaction.advancedData?.allowance! - const networkName = capitalize(desc) const { status, isOpen, dispatch, texts, titles, closeDialog, gifs } = useTransactionWaitingDialog( @@ -309,6 +309,7 @@ const ApproveAsset: FunctionComponent = ({ searchTokenInAssetsList(tokenAddress) .then((token) => { setTokenName(token[0].symbol) + setTokenLogo(token[0].logo) }) .catch(() => { throw new Error("Failed to fetch token data") @@ -471,11 +472,13 @@ const ApproveAsset: FunctionComponent = ({ }) }} /> -
setIsEditAllowancePage(true)} - > - Set custom allowance +
+ setIsEditAllowancePage(true)} + > + Set custom allowance +
{!hasBalance && "Insufficient funds."} @@ -581,6 +584,7 @@ const ApproveAsset: FunctionComponent = ({ title={isEditAllowancePage ? "Edit allowance" : "Approval"} backButton={isEditAllowancePage} onBack={() => setIsEditAllowancePage(false)} + networkIndicator > {transactionCount > 1 && (
@@ -690,24 +694,46 @@ const ApproveAsset: FunctionComponent = ({ {formatName(account.name, 15)} - - {`${assetBalance} ${tokenName}`} - - - {formatRounded( - formatUnits( - balance || "0", - nativeToken.token.decimals - ) - )} - {` ${nativeToken.token.symbol}`} + + {formatHash(account.address)}
-
- - - {networkName} - +
+
+ + {`${formatName(assetBalance, 18)}`} + + {tokenName} +
+
+ + {formatName( + formatRounded( + formatUnits( + balance || "0", + nativeToken.token.decimals + ) + ), + 18 + )} + + {nativeToken.token.symbol} +