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
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.