3

I know it is possible to change the mint authority using solana-spl as shown here. How can I achieve the same thing using TypeScript/JS?

1 Answer 1

5

You can use setAuthority from @solana/spl-token and select AuthorityType.MintTokens

https://solana-labs.github.io/solana-program-library/token/js/modules.html#setAuthority

For example, something like this:

  const transactionSignature = await setAuthority(
    connection,
    payer,
    tokenMint,
    payer.publicKey, // current authority goes here (must also be signer)
    AuthorityType.MintTokens,
    newMintAuthority.publickey // new authority goes here
  )

You can also use createSetAuthorityInstruction if you want to just create the instruction and add then to a transaction.

https://solana-labs.github.io/solana-program-library/token/js/modules.html#createSetAuthorityInstruction

1
  • Hi John, I am attempting to change the mintAuthority from the current mintAddress to null. However, during the execution, I encountered a "signature verification failed" error. const transactionSignature = await setAuthority( connection, //connection userWallet, // wallet Address mintPubkey, //tokenMintAddress mintPubkey, // current authority goes here (must also be signer) AuthorityType.MintTokens, null )
    – Maidi
    Jan 3 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.