I did a lot of research on this subject but could not reach a conclusion. What I want to do is this; I list and display the NFTs in my user's wallet using a specific collectionKey (my own collectionKey). From here, the user will select an NFT and perform the freezing process. This may or may not be for a certain period of time. The user will select and confirm the freezing process and I will give him a special reward (like points) from my system. How do I do this? How can I find a library/framework code sample or how to do it for React?


2 Answers 2


in order to freeze the token account and thaw the token account you need to import this instructions createFreezeAccountInstruction and createThawAccountInstruction from @solana/spl-token

          tokenAccount,//Account to freeze
          mint,//Mint account
          payer.publicKey//Mint freeze authority

          tokenAccount,//Account to freeze
          mint,//Mint account
          payer.publicKey//Mint freeze authority


(async () => {
  const tokenAccount = new PublicKey('token id');
  try {
      let tx = new Transaction().add(
      //sign tx
      let txhash = await sendAndConfirmTransaction(connection, tx, [keypair]);
  } catch(e) {
      console.error(`Oops, something went wrong: ${e}`)
  • I think I wrote the code. However, I get the "Owner does not match" error. However, all the information I have given here is correct. Could there be another reason why I'm experiencing this?
    – exortek
    Commented Feb 23 at 15:27
  • MINT: EQTXXd12kB4QjNupxAJg9fhYVE2wMM9Rvc9EgPopsbN TOKEN_ACCOUNT: 9iYcdXhFh5jTj4PKZpWXhixbMNfZkfLJm9XWZso2jaXb OWNER: 47F47sC2NVyoMGYubT2VkMay3FSJaFbhnYNXew4iRWLu
    – exortek
    Commented Feb 23 at 15:27
  • These come dynamically. I use provider for Phantom wallet and Solana. The error I get in Phantom is as above. "Owner does not match"
    – exortek
    Commented Feb 23 at 15:29
  • From what i checked the mint is : EQTXXd12kB4QjNupxAJg9fhYVE2wMM9Rvc9EgPopsbN token acc: 9iYcdXhFh5jTj4PKZpWXhixbMNfZkfLJm9XWZso2jaXb Mint/freeze Auth: 47mvLdPJe5EEXGtksYw6fNErP5GzogjSq1u6LJCKe9yP Commented Feb 23 at 17:33
  • I shared the code I tried with you.
    – exortek
    Commented Feb 23 at 18:21

What's wrong?

'use client';
import { useConnection, useWallet } from '@solana/wallet-adapter-react';
import { PublicKey, Transaction } from '@solana/web3.js';
import { createFreezeAccountInstruction } from '@solana/spl-token';
import { WalletMultiButton } from '@solana/wallet-adapter-react-ui';

function Page() {
 const wallet = useWallet();
 const { connection } = useConnection();

 const freezeUserWalletNFT = async () => {
  const tx = new Transaction();
  const account = new PublicKey('9iYcdXhFh5jTj4PKZpWXhixbMNfZkfLJm9XWZso2jaXb');
  const mint = new PublicKey('EQTXXd12kB4QjNupxAJg9fhYVE2wMM9Rvc9EgPopsbN');
  const payer = wallet.publicKey;
  const authority = new PublicKey('47mvLdPJe5EEXGtksYw6fNErP5GzogjSq1u6LJCKe9yP');
  tx.add(createFreezeAccountInstruction(account, mint, authority));
  tx.recentBlockhash = (await connection.getLatestBlockhash('max')).blockhash;
  tx.feePayer = payer;
  const signature = await wallet.signTransaction(tx);
  const result = await connection.sendRawTransaction(signature.serialize());
  console.log('Transaction result:', result);

 return (
  <div className='w-full flex flex-col items-center justify-center py-12 gap-12'>
   <button onClick={freezeUserWalletNFT}>Freeze Wallet NFT</button>
   <WalletMultiButton>{wallet.connected ? wallet.publicKey?.toBase58() : <button onClick={wallet.connect}>Connect Wallet</button>}</WalletMultiButton>

export default Page;

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.