This shows how to get the metadata, is on the token creator github.
const getMetadata = useCallback(
async (form) => {
const tokenMint = form.tokenAddress; // Your token mint address
const metadataPDA = await findMetadataPda(new PublicKey(tokenMint)); // You can use findMetadataPda method to get the PDA for token mint where metadata is stored
console.log(metadataPDA.toBase58());
const metadataAccount = await connection.getAccountInfo(metadataPDA); // Get the account info from the PDA
console.log(metadataAccount);
const [metadata, _] = await Metadata.deserialize(metadataAccount.data); // Deserialize the metadata from PDA account
console.log(metadata); // Here you have the details
let logoRes = await fetch(metadata.data.uri);
let logoJson = await logoRes.json();
let { image } = logoJson;
setTokenMetadata({ tokenMetadata, ...metadata.data });
setLogo(image);
setLoaded(true);
setTokenAddress('')
},
[tokenAddress]
);
The full source code is here: https://github.com/jacobcreech/Token-Creator/blob/master/src/components/GetMetadata.tsx