Skip to content

Commit

Permalink
Format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
catalinred committed Jun 11, 2024
1 parent a75d9d4 commit 12f447d
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions app/address/[address]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,10 @@ function AccountHeader({
isTokenInfoLoading: boolean;
}) {
interface State {
name: string,
image: string ,
}
const [tokenData, setTokenData] = React.useState<State>({image: "", name: ""});
name: string;
image: string;
}
const [tokenData, setTokenData] = React.useState<State>({ image: '', name: '' });
const mintInfo = useMintAccountInfo(address);

const parsedData = account?.data.parsed;
Expand All @@ -280,9 +280,12 @@ function AccountHeader({
let token: { logoURI?: string; name?: string } = {};
let unverified = false;

const metadataExtension = mintInfo?.extensions?.find(({ extension }: { extension: string }) => extension === 'tokenMetadata');
const metadataPointerExtension = mintInfo?.extensions?.find(({ extension }: { extension: string }) => extension === 'metadataPointer');

const metadataExtension = mintInfo?.extensions?.find(
({ extension }: { extension: string }) => extension === 'tokenMetadata'
);
const metadataPointerExtension = mintInfo?.extensions?.find(
({ extension }: { extension: string }) => extension === 'metadataPointer'
);

if (metadataPointerExtension && metadataExtension) {
const tokenMetadata = create(metadataExtension.state, TokenMetadata);
Expand All @@ -291,7 +294,7 @@ function AccountHeader({
(async () => {
// Avoid re-renders once tokenData has been set
if (!tokenData.name && !tokenData.image) {
const response = await fetch(tokenMetadata.uri);
const response = await fetch(tokenMetadata.uri);
setTokenData(await response.json());
}
})();
Expand All @@ -302,7 +305,7 @@ function AccountHeader({
token.name = tokenData?.name;
token.logoURI = tokenData?.image;
}
}
}
// Fall back to legacy token list when there is stub metadata (blank uri), updatable by default by the mint authority
else if (!parsedData?.nftData?.metadata.data.uri && tokenInfo) {
token = tokenInfo;
Expand Down

0 comments on commit 12f447d

Please sign in to comment.