1

I'm new to solana blockchain development and I was trying my hand at creating a custom token on the devnet but I've been stuck for about a week now. When I mint my token, the name and symbol as well as the amount all work perfectly however the image doesn't exist, instead it's a circle with my symbol in it. This is how I minted the token,

mint.ts file,

import { percentAmount, generateSigner, signerIdentity, createSignerFromKeypair } from "@metaplex-foundation/umi";
import { TokenStandard, createAndMint } from "@metaplex-foundation/mpl-token-metadata";
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
import { mplCandyMachine } from "@metaplex-foundation/mpl-candy-machine";

import "@solana/web3.js";

import secret from './guideSecret.json';

const umi = createUmi('https://api.devnet.solana.com');

const userWallet = umi.eddsa.createKeypairFromSecretKey(new Uint8Array(secret));
const userWalletSigner = createSignerFromKeypair(umi, userWallet);

const metadata = {
    name: "Dabby The Bear",
    symbol: "DTB",
    uri: "https://github.com/Oseij96/metadata/blob/main/metadata.json",
    image: "https://ipfs.io/ipfs/QmaB4U3v13jc33m6mJKsFs4ejXbVUfnZ7BPk2B2hxkExJz?filename=Dabby.jpg"
};

const mint = generateSigner(umi);
umi.use(signerIdentity(userWalletSigner));
umi.use(mplCandyMachine());

createAndMint(umi, {
    mint,
    authority: umi.identity,
    name: metadata.name,
    symbol: metadata.symbol,
    uri: metadata.uri,
    sellerFeeBasisPoints: percentAmount(0),
    decimals: 8,
    amount: 100000000000_000,
    tokenOwner: userWallet.publicKey,
    tokenStandard: TokenStandard.Fungible,
}).sendAndConfirm(umi).then(() => {
    console.log("Succesfully minted 1 million tokens", mint.publicKey);
}).catch((error) => {
    console.error("Error minting tokens:", error);
});

This is my metadata.json on github,

{
    "name": "Dabby The Bear",
    "symbol": "DTB",
    "description": "A learning token",
    "image": "https://ipfs.io/ipfs/QmaB4U3v13jc33m6mJKsFs4ejXbVUfnZ7BPk2B2hxkExJz?filename=Dabby.jpg"
}

Is there somewhere in my code where I've possibly made an error?

2
  • I see that you deployed to devnet. Can you provide the contract address of this token?
    – calsim113
    Jan 27 at 1:41
  • Where is the image not showing up? In a specific explorer or wallet? Also is your sample above the actual image URL coz it doesn't load for me neither?
    – sohrab
    Jan 31 at 5:20

0

This site is temporarily in read-only mode and not accepting new answers.

Browse other questions tagged .