0

I wonder how to freeze token account with update authority. (I don't have freeze authority. The MasterEdition has freeze authority, I think. I know that only freeze authority can freeze token account, but how can I use master edition account?) This is my code.

export const freezeAccount = async (nftMintAccount : PublicKey, tokenAccount : PublicKey) => {
  const tokenAccountOwner = loadWalletKey(keyfile_tokenAccountOwner);
  const authority = loadWalletKey(keyfile);
  const token = new Token(solConnection, nftMintAccount, TOKEN_PROGRAM_ID, authority);
  let result = await token.freezeAccount(tokenAccount, tokenAccountOwner, []);
}
  • authority: nftMintAccount's update authority keypair (nftMintAccount's mint & freeze authority is MasterEdition now. but how can I use it to freeze account?)
  • tokenAccountOwner: owner of tokenAccount
  • tokenAccount: nftMintAccount's tokenAccount which is owned by tokenAccountOwner

The result says:

    Program log: Instruction: FreezeAccount
    Program log: Error: owner does not match

but I checked authority and tokenAccountOwner several times. They were sure. but what's the matter? whose owner dismatches? Please help me.

Phoon Anan
  • 49
  • 1
  • 7

1 Answers1

0

Only the freeze authority on a token mint can freeze accounts, and no one else. In your example, you are creating a Token instance with your wallet as the authority, which will fail, since your wallet is not the correct authority.

To do this properly, you need the private key of the mint's freeze authority. If you can't get access to it, you can ask the freeze authority to freeze your account for you. But you would then need to ask them to unfreeze it for you as well.

More documentation at https://spl.solana.com/token#freezing-accounts

Jon C
  • 7,019
  • 10
  • 17
  • Hi, @jon, I know that only freeze authority can freeze token account. But in my case, my NFT mint is Master Edition and its freeze authority is Master Edition Account. How can I freeze token account? – Phoon Anan Nov 16 '21 at 02:06
  • The Master Edition Account needs to freeze it for you in that case, you cannot do it yourself. – Jon C Nov 16 '21 at 11:43
  • Hi, @Jon Cinque, yours answer is not enough for my question. Please kindly tell me how Master Edition freezes that token account. My wallet key created that NFT and also it is update authority of that NFT. But freeze authority is Master Edition PDA. I want to freeze token account. Then as you said, couldn't I freeze token account? I think you are wrong. I want exact answer. – Phoon Anan Nov 16 '21 at 16:40
  • If the freeze authority is the Master Edition PDA, then only the Master Edition PDA can freeze the token account. Just going from the token program, this is not possible. If the Master Edition program has a way to freeze your account through them, then maybe it's possible! I don't know enough about how the Master Edition program works. Apologies if my answers weren't exact enough. – Jon C Nov 16 '21 at 22:50
  • have you been able to figure this out, we're trying to achieve the same but unable to. – Fahad Bilal Jul 17 '22 at 01:49