diff --git a/src/app/layout.tsx b/src/app/layout.tsx index ac1fbd7..d65ef54 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -17,7 +17,7 @@ export const metadata: Metadata = { export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - +
diff --git a/src/components/accountButton.tsx b/src/components/accountButton.tsx index 2d90349..4003800 100644 --- a/src/components/accountButton.tsx +++ b/src/components/accountButton.tsx @@ -1,5 +1,3 @@ -"use client"; - import DisconnectButton from "./disconnetButton"; import data from "../data/data.json"; import Image from "next/image"; @@ -22,6 +20,8 @@ export default function AccountButton() { activeSenderWallet, activeRecipientWallet, setSender, + activeSenderAccount, + sourceAssetBalance, setActiveSenderAccount, setActiveRecipientAccount, setActiveSenderWallet, @@ -29,7 +29,6 @@ export default function AccountButton() { } = useTransfer(); const [sourceAssetOptions, setSourceAssetOptions] = useState(defaultSourceAssetOptions); - const { sourceAssetBalance } = useTransfer(); const [subMenu, setSubMenu] = useState(false); const handleToggleSubMenu = useCallback(() => { setSubMenu((prev) => !prev); @@ -42,14 +41,14 @@ export default function AccountButton() { className="relative flex h-[36px] w-fit cursor-pointer items-center justify-center gap-[5px] rounded-[10px] bg-white px-[10px] duration-300 hover:shadow-lg" > -{sender && toShortAdrress(sender.address)}
+{address && toShortAdrress(address.toString())}
{subMenu && ({sender && toShortAdrress(sender.address)}
+{address && toShortAdrress(address.toString())}
Token
-{item.name}
-Sender
-Recipient
-Amount
+Token
- Balance: {formatBalance(sourceAssetBalance.amount, sourceAsset.decimals)} {sourceAsset.name} -
- )} - {requireLimit ? ( -- {`* Limit: ${formatBalance(assetLimit ?? BN_ZERO, sourceAsset?.decimals ?? 0)}, supply: ${formatBalance( - (assetSupply ?? BN_ZERO).add(transferAmount?.amount ?? BN_ZERO), - sourceAsset?.decimals ?? 0, - )}.`} -
- ) : requireMin ? ( -- {`* At least ${formatBalance(min ?? BN_ZERO, sourceAsset?.decimals ?? 0)} ${ - sourceAsset.symbol - } for tx fee.`} -
- ) : insufficient ? ( -* Insufficient.
- ) : null} -+ Balance: {formatBalance(sourceAssetBalance.amount, sourceAsset.decimals)} {sourceAsset.name} +
+ )} + {requireLimit ? ( ++ {`* Limit: ${formatBalance(assetLimit ?? BN_ZERO, sourceAsset?.decimals ?? 0)}, supply: ${formatBalance( + (assetSupply ?? BN_ZERO).add(transferAmount?.amount ?? BN_ZERO), + sourceAsset?.decimals ?? 0, + )}.`} +
+ ) : requireMin ? ( ++ {`* At least ${formatBalance(min ?? BN_ZERO, sourceAsset?.decimals ?? 0)} ${ + sourceAsset.symbol + } for tx fee.`} +
+ ) : insufficient ? ( +* Insufficient.
+ ) : null} + +Disconnect
diff --git a/src/components/header.tsx b/src/components/header.tsx index 6d800b2..38e5f1c 100644 --- a/src/components/header.tsx +++ b/src/components/header.tsx @@ -7,7 +7,7 @@ import data from "../data/data.json"; import WalletButton from "./walletButton"; import AccountButton from "./accountButton"; import ChainButton from "./chainButton"; -import { useAccount } from "wagmi"; +import { useAccount, useChainId } from "wagmi"; import { useTransfer } from "@/hooks"; import { parseCross } from "@/utils"; import { animated, useTrail } from "@react-spring/web"; @@ -15,6 +15,9 @@ import WalletSelectionModal from "./walletSelectionModal"; export default function Header() { const [connectModal, setConnectModal] = useState(false); + const { address: activeAddress } = useAccount(); + const chainId = useChainId(); + console.log("chainId", chainId); const handleClose = useCallback(() => { setConnectModal(false); @@ -45,7 +48,7 @@ export default function Header() {Transaction is being Processing
Success !
-You send 1,888 USDT
++ You send {formatBalance(transferAmount.amount, sourceAsset.decimals)} {sourceAsset.name} +