'Solana web3.js set mint and freeze authority null
Trying to set mint and freeze authority of my instruction to null but I get an error
TypeError: Cannot read property 'toBuffer' of null
at pubkeyToBuffer (/node_modules/@solana/spl-token/lib/index.cjs.js:73:39)
Here's the code
Token.createInitMintInstruction(
TOKEN_PROGRAM_ID, // program id
mint.publicKey, // mint
decimals, // decimals
null, // mint Authority
null, // freeze Authority
)
How can I do this? If possible without updating after creation.
Solution 1:[1]
Ok solved it by updating the authority after mint via another 2 instructions for each authority type. Strange nonetheless this apparently can't be done on initial mint instruction.
Token.createSetAuthorityInstruction(
TOKEN_PROGRAM_ID, // program id
account, // account
null, // new authority
'MintTokens', // type - 'FreezeAccount' for freeze authority
authority, // authority
[], // signers
)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
