I already succeed create token using spl-token, now how to add metadata?
const mint = Keypair.generate();
const ata = getAssociatedTokenAddressSync(
mint.publicKey,
wallet.publicKey!
);
const tx = new Transaction().add(
SystemProgram.createAccount({
fromPubkey: wallet.publicKey!,
newAccountPubkey: mint.publicKey,
space: MINT_SIZE,
lamports: await connection.getMinimumBalanceForRentExemption(MINT_SIZE),
programId: TOKEN_PROGRAM_ID,
}),
createInitializeMintInstruction(
mint.publicKey,
Number(formData.decimals),
wallet.publicKey!,
null
),
createAssociatedTokenAccountInstruction(
wallet.publicKey!,
ata,
wallet.publicKey!,
mint.publicKey
),
createMintToCheckedInstruction(
mint.publicKey,
ata,
wallet.publicKey!,
Number(formData.supply) * 10 ** Number(formData.decimals),
Number(formData.decimals)
),
);
const blockhash = (await connection.getLatestBlockhash()).blockhash;
tx.recentBlockhash = blockhash;
tx.feePayer = wallet.publicKey!;
tx.sign(mint);
const signedTx = awalt wallet.signTransaction(tx,connection);
await wallet.sendTransaction(signedTx);