0

it creates a token, the transaction is executed. But in the end the token does not appear in the wallet, why? What have I done wrong?

    wallet,
    connection,
    name,
    symbol,
    decimals,
    metadata,
    sellerFeeBasisPoints,
  }: {
    wallet: Wallet;
    connection: Connection;
    name: string;
    symbol: string;
    decimals: number;
    metadata: string;
    sellerFeeBasisPoints: number;
  }): Promise<string> =>{
    enqueueSnackbar("initialize umi", { variant: "info" });
    const umi = createUmi(connection.rpcEndpoint);
    umi.use(mplTokenMetadata());
    umi.use(walletAdapterIdentity(wallet.adapter));
    const mint = generateSigner(umi);

    try {
      const result = await createV1(umi, {
        mint,
        name,
        symbol,
        decimals,
        uri: metadata,
        sellerFeeBasisPoints: percentAmount(sellerFeeBasisPoints), // Add sellerFeeBasisPoints with a value of 0
      }).sendAndConfirm(umi);

      console.log("Transaction hash: " + bs58.encode(result.signature));
  
      console.log("Mint: " + mint.publicKey);
      console.log("Signature: " + bs58.encode(result.signature));
      if (result.signature) {
        enqueueSnackbar("Token created", { variant: "success" });
      }
      return mint.publicKey;
    } catch (error) {
      enqueueSnackbar("Error creating Token: " + error, { variant: "error" });
      console.log(error);
      return "Error creating Token: " + error;
    }
  }; ```
1
  • 2
    You are creating the token and it's overall metadata, but this does not actually mint tokens (create a balance) or transfer them to a token account (transfer a balance). You are missing two more steps: 1. you need to create a token account for this token's mint address in the current wallet 2. you need to mint a balance of this token to that token account, or to the authority wallet and then transfer it to that account
    – Wagg
    Mar 21 at 4:08

1 Answer 1

0

you can use QuickNode to understand how to mint tokens, transfer tokens, withdraw tokens, and handle transfer fees/taxes of the token using the Solana and SPL Token library.

https://www.quicknode.com/guides/solana-development/spl-tokens/token-2022/overview

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.