Now i am using createCloseAccountInstruction
of @solana/spl-token
to close empty Token account .
My code working fine for TOKEN-PROGRAM .
But when i try to swith into TOKEN-2022 and call the createCloseAccountInstruction . it will told me
WalletSendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 2: custom program error: 0x23
Which means the transaction it build have problem ...
Here are how my code works :
const associatedAddress = new PublicKey(toClose);
const closeInstruction = await createCloseAccountInstruction(
associatedAddress,
publickey,
publickey,
[],
// TOKEN_PROGRAM_ID,
TOKEN_2022_PROGRAM_ID,
);
Tx.add(closeInstruction);
When i use it to burn with TOKEN_PROGRAM_ID
, it works fine .
But when i switch it into TOKEN_2022_PROGRAM_ID
, it failed ...