I have been able to create custom tokens using custom wallets generated using web3.Keypair.generate(), but how do I now cap the supply of these tokens or remove the minting authority of these SPL tokens?
I have been able to create custom tokens using custom wallets generated using web3.Keypair.generate(), but how do I now cap the supply of these tokens or remove the minting authority of these SPL tokens?
To prevent any more minting, you'll need set the minting authority to None. In JS, you can simply set the newAuthority to null during your call to setAuthority with authorityType = MintTokens in [1]
Expanding on Jon Cinque's answer
import { Connection, clusterApiUrl, Keypair, PublicKey } from '@solana/web3.js'
import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token'
import * as bs58 from 'bs58';
(async () => {
const connection = new Connection(clusterApiUrl('mainnet-beta'))
const bytes = bs58.decode(process.env.PRIVATE_KEY)
const account = Keypair.fromSecretKey(bytes)
const tokenMint = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v')
const token = new Token(connection, tokenMint, TOKEN_PROGRAM_ID, account)
await token.setAuthority(tokenMint, null, 'MintTokens', account.publicKey, [account])
})()