diff --git a/packages/nextjs/components/blockexplorer/AddressStorageTab.tsx b/packages/nextjs/components/blockexplorer/AddressStorageTab.tsx index f9f4d4fe3..acc669123 100644 --- a/packages/nextjs/components/blockexplorer/AddressStorageTab.tsx +++ b/packages/nextjs/components/blockexplorer/AddressStorageTab.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from "react"; -import { createPublicClient, http, toHex } from "viem"; +import { Address, createPublicClient, http, toHex } from "viem"; import { hardhat } from "viem/chains"; const publicClient = createPublicClient({ @@ -7,7 +7,7 @@ const publicClient = createPublicClient({ transport: http(), }); -export const AddressStorageTab = ({ address }: { address: string }) => { +export const AddressStorageTab = ({ address }: { address: Address }) => { const [storage, setStorage] = useState([]); useEffect(() => { diff --git a/packages/nextjs/components/scaffold-eth/Address.tsx b/packages/nextjs/components/scaffold-eth/Address.tsx index 057d706bc..08c8453d3 100644 --- a/packages/nextjs/components/scaffold-eth/Address.tsx +++ b/packages/nextjs/components/scaffold-eth/Address.tsx @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import Link from "next/link"; import { CopyToClipboard } from "react-copy-to-clipboard"; -import { isAddress } from "viem"; +import { Address as AddressType, isAddress } from "viem"; import { hardhat } from "viem/chains"; import { useEnsAvatar, useEnsName } from "wagmi"; import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline"; @@ -10,7 +10,7 @@ import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; import { getBlockExplorerAddressLink } from "~~/utils/scaffold-eth"; type AddressProps = { - address?: string; + address?: AddressType; disableAddressLink?: boolean; format?: "short" | "long"; size?: "xs" | "sm" | "base" | "lg" | "xl" | "2xl" | "3xl"; diff --git a/packages/nextjs/components/scaffold-eth/Balance.tsx b/packages/nextjs/components/scaffold-eth/Balance.tsx index 66bc172e7..784603a88 100644 --- a/packages/nextjs/components/scaffold-eth/Balance.tsx +++ b/packages/nextjs/components/scaffold-eth/Balance.tsx @@ -1,8 +1,9 @@ +import { Address } from "viem"; import { useAccountBalance } from "~~/hooks/scaffold-eth"; import { useTargetNetwork } from "~~/hooks/scaffold-eth/useTargetNetwork"; type BalanceProps = { - address?: string; + address?: Address; className?: string; }; diff --git a/packages/nextjs/components/scaffold-eth/Contract/utilsDisplay.tsx b/packages/nextjs/components/scaffold-eth/Contract/utilsDisplay.tsx index 5fcf3103a..f5d212993 100644 --- a/packages/nextjs/components/scaffold-eth/Contract/utilsDisplay.tsx +++ b/packages/nextjs/components/scaffold-eth/Contract/utilsDisplay.tsx @@ -1,5 +1,5 @@ import { ReactElement } from "react"; -import { TransactionBase, TransactionReceipt, formatEther } from "viem"; +import { TransactionBase, TransactionReceipt, formatEther, isAddress } from "viem"; import { Address } from "~~/components/scaffold-eth"; import { replacer } from "~~/utils/scaffold-eth/common"; @@ -34,7 +34,7 @@ export const displayTxResult = ( } } - if (typeof displayContent === "string" && displayContent.indexOf("0x") === 0 && displayContent.length === 42) { + if (typeof displayContent === "string" && isAddress(displayContent)) { return asText ? displayContent :
; } diff --git a/packages/nextjs/components/scaffold-eth/Faucet.tsx b/packages/nextjs/components/scaffold-eth/Faucet.tsx index a21c9fa2e..3b070326a 100644 --- a/packages/nextjs/components/scaffold-eth/Faucet.tsx +++ b/packages/nextjs/components/scaffold-eth/Faucet.tsx @@ -110,7 +110,7 @@ export const Faucet = () => { setInputAddress(value)} + onChange={value => setInputAddress(value as AddressType)} /> setSendValue(value)} />