Skip to content

Commit fa3d5ba

Browse files
committed
Show 404 on invalid contract address in contract page
1 parent c1230e6 commit fa3d5ba

File tree

1 file changed

+5
-1
lines changed
  • apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]

1 file changed

+5
-1
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/layout.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DeprecatedAlert } from "components/shared/DeprecatedAlert";
55
import type { Metadata } from "next";
66
import { notFound } from "next/navigation";
77
import { getContractMetadata } from "thirdweb/extensions/common";
8-
import { isContractDeployed } from "thirdweb/utils";
8+
import { isAddress, isContractDeployed } from "thirdweb/utils";
99
import { resolveFunctionSelectors } from "../../../../../lib/selectors";
1010
import { shortenIfAddress } from "../../../../../utils/usedapp-external";
1111
import { ConfigureCustomChain } from "./ConfigureCustomChain";
@@ -22,6 +22,10 @@ export default async function Layout(props: {
2222
};
2323
children: React.ReactNode;
2424
}) {
25+
if (!isAddress(props.params.contractAddress)) {
26+
return notFound();
27+
}
28+
2529
const info = await getContractPageParamsInfo(props.params);
2630

2731
if (!info) {

0 commit comments

Comments
 (0)