Skip to content

Commit 7e73c34

Browse files
committed
Dashboard: asset page header: hide zero-address, fix icon (#7514)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on improving the handling of wallet addresses and token fetching in the application. It enhances the rendering of wallet address components and modifies the fetching logic for token information, including error handling. ### Detailed summary - Updated rendering of the wallet address in `apps/dashboard/src/@/components/blocks/wallet-address.tsx` and `apps/nebula/src/@/components/blocks/wallet-address.tsx` to include `props.className` and added a `text-xs` class in the latter. - Enhanced the fetch request in `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_utils/fetch-coin-info.ts` by moving `clientId` to headers and added error logging for failed requests. - Modified the condition for rendering contract creator in `apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx` to check if `contractCreator` is not equal to `ZERO_ADDRESS`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved wallet address display to support external styling and smaller text size for the zero address. * **Bug Fixes** * Updated contract header to ensure the contract creator badge is not shown for zero addresses. * Enhanced error logging for token info fetching to aid in troubleshooting. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 4bd4efc commit 7e73c34

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

apps/dashboard/src/@/components/blocks/wallet-address.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ export function WalletAddress(props: {
5959

6060
// special case for zero address
6161
if (address === ZERO_ADDRESS) {
62-
return <span className="cursor-pointer font-mono">{shortenedAddress}</span>;
62+
return (
63+
<span className={cn("cursor-pointer font-mono", props.className)}>
64+
{shortenedAddress}
65+
</span>
66+
);
6367
}
6468

6569
return (

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/ContractHeader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ExternalLinkIcon, GlobeIcon, Settings2Icon } from "lucide-react";
22
import Link from "next/link";
33
import { useMemo } from "react";
4-
import type { ThirdwebContract } from "thirdweb";
4+
import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb";
55
import type { ChainMetadata } from "thirdweb/chains";
66
import { Img } from "@/components/blocks/Img";
77
import { Button } from "@/components/ui/button";
@@ -149,7 +149,7 @@ export function ContractHeaderUI(props: {
149149

150150
{/* bottom row */}
151151
<div className="flex flex-row flex-wrap items-center gap-2">
152-
{props.contractCreator && (
152+
{props.contractCreator && props.contractCreator !== ZERO_ADDRESS && (
153153
<ContractCreatorBadge
154154
clientContract={props.clientContract}
155155
contractCreator={props.contractCreator}

apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_utils/fetch-coin-info.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ export async function fetchTokenInfoFromBridge(params: {
77
}) {
88
try {
99
const res = await fetch(
10-
`https://bridge.${isProd ? "thirdweb.com" : "thirdweb-dev.com"}/v1/tokens?chainId=${params.chainId}&tokenAddress=${params.tokenAddress}&clientId=${params.clientId}`,
10+
`https://bridge.${isProd ? "thirdweb.com" : "thirdweb-dev.com"}/v1/tokens?chainId=${params.chainId}&tokenAddress=${params.tokenAddress}`,
11+
{
12+
headers: {
13+
"x-client-id": params.clientId,
14+
},
15+
},
1116
);
1217

1318
if (!res.ok) {
19+
console.error(
20+
`Failed to fetch token info from bridge: ${await res.text()}`,
21+
);
1422
return null;
1523
}
1624

apps/nebula/src/@/components/blocks/wallet-address.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ export function WalletAddress(props: {
5959

6060
// special case for zero address
6161
if (address === ZERO_ADDRESS) {
62-
return <span className="cursor-pointer font-mono">{shortenedAddress}</span>;
62+
return (
63+
<span className={cn("cursor-pointer font-mono text-xs", props.className)}>
64+
{shortenedAddress}
65+
</span>
66+
);
6367
}
6468

6569
return (

0 commit comments

Comments
 (0)