import { Keypair } from '@solana/web3.js';
// Create token creation transaction
const { tx, tokenKeypair } = await wendev.createTokenCreationTransaction(
wallet.publicKey,
{
metadata: {
name: 'My Token',
symbol: 'MTK',
image: 'https://example.com/token-image.png',
description: 'My awesome token',
socials: {
twitter: 'https://twitter.com/mytoken',
telegram: 'https://t.me/mytoken',
website: 'https://mytoken.com',
},
},
}
);
console.log('Token Mint:', tokenKeypair.publicKey.toBase58());
// Sign and send
tx.feePayer = wallet.publicKey;
tx.recentBlockhash = (await connection.getLatestBlockhash()).blockhash;
tx.sign(wallet, tokenKeypair); // Must sign with both wallet and token keypair
const signature = await connection.sendRawTransaction(tx.serialize());
await connection.confirmTransaction(signature);
console.log('Token created! Signature:', signature);