I just follow Mint Token (Lab) course this my code:
import { mintTo } from "@solana/spl-token";import { getExplorerLink, getKeypairFromEnvironment,} from "@solana-developers/helpers";import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";const connection = new Connection(clusterApiUrl("devnet"));// Our token has two decimal placesconst MINOR_UNITS_PER_MAJOR_UNITS = Math.pow(10, 2);const user = getKeypairFromEnvironment("SECRET_KEY_1");// Substitute in your token mint account from create-token-mint.tsconst tokenMintAccount = new PublicKey("GSb6soUDAfdxuehfgQTmkz98NFudCcgZqWBJnP2rzWbm");// Substitute in your own, or a friend's token account address, based on the previous step.// const recipientAssociatedTokenAccount = new PublicKey(// "RECIPIENT_TOKEN_ACCOUNT",// );const recipientAssociatedTokenAccount = user.publicKey;const transactionSignature = await mintTo( connection, user, tokenMintAccount, recipientAssociatedTokenAccount, user, 10 * MINOR_UNITS_PER_MAJOR_UNITS);const link = getExplorerLink("transaction", transactionSignature, "devnet");console.log(`✅ Success! Mint Token Transaction: ${link}`);
Output:
error: Simulation failed. Message: Transaction simulation failed: Error processing Instruction 0: invalid account data for instruction. Logs: ["Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]","Program log: Instruction: MintTo","Program log: Error: InvalidAccountData","Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1162 of 200000 compute units","Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: invalid account data for instruction"].