I am trying create an NFT mint, I know how to do it from CLI, but I need to do it from JS, I am looking at the code of @solana/spl-token package, but cannot find API analogous to
spl-token authorize <TOKEN_ID> mint --disable
Does anyone know how to do it?
You certainly can! Here's some code that doesn't compile to get you started:
import { Connection, PublicKey, Keypair } from '@solana/web3.js';
import { AuthorityType, setAuthority } from '@solana/spl-token';
const mint = new PublicKey("mint in base 58");
const payer = new Keypair(...);
const mintAuthority = new Keypair(...);
const connection = new Connection
await setAuthority(
connection,
payer,
mint,
mintAuthority,
AuthorityType.MintTokens,
null, // this sets the mint authority to null
);