Getting error:failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0xd
Code is:
import { Connection, Transaction, clusterApiUrl, sendAndConfirmTransaction,} from "@solana/web3.js";import { ExtensionType, TOKEN_2022_PROGRAM_ID, createAccount, createMint, createReallocateInstruction, createEnableRequiredMemoTransfersInstruction, createInitializeTransferFeeConfigInstruction,} from "@solana/spl-token";// Playground walletconst payer = pg.wallet.keypair;// Connection to devnet clusterconst connection = new Connection(clusterApiUrl("devnet"), "confirmed");// Transaction signature returned from sent transactionlet transactionSignature: string;// Authority that can mint new tokensconst mintAuthority = pg.wallet.publicKey;// Decimals for Mint Accountconst decimals = 2;// Create Mint Accountconst mint = await createMint( connection, payer, // Payer of the transaction and initialization fees mintAuthority, // Mint Authority null, // Optional Freeze Authority decimals, // Decimals of Mint undefined, // Optional keypair undefined, // Options for confirming the transaction TOKEN_2022_PROGRAM_ID // Token Extension Program ID);// Create Token Account for Playground walletconst tokenAccount = await createAccount( connection, payer, // Payer to create Token Account mint, // Mint Account address payer.publicKey, // Token Account owner undefined, // Optional keypair, default to Associated Token Account undefined, // Confirmation options TOKEN_2022_PROGRAM_ID // Token Extension Program ID);// Extensions to reallocate data forconst extensions = [ ExtensionType.MemoTransfer, ExtensionType.TransferFeeConfig,];// Instruction to reallocate Token Account dataconst reallocateInstruction = createReallocateInstruction( tokenAccount, // Token Account address payer.publicKey, // Payer to reallocate data extensions, // Extensions to reallocate payer.publicKey, // Token Account owner undefined, // Additional signers TOKEN_2022_PROGRAM_ID // Token Extension Program ID);// Instruction to initialize the MemoTransfer Extensionconst enableRequiredMemoTransfersInstruction = createEnableRequiredMemoTransfersInstruction( tokenAccount, // Token Account address payer.publicKey, // Token Account Owner undefined, // Additional signers TOKEN_2022_PROGRAM_ID // Token Extension Program ID );const feeBasisPoints = 100; // 1%const maxFee = BigInt(2 ** 228) - BigInt(1);// Instruction to initialize Mint Account dataconst initTransferFeeConfig = createInitializeTransferFeeConfigInstruction( mint, // Mint Account address payer.publicKey, // Authority to update fees payer.publicKey, // Authority to withdraw fees feeBasisPoints, // Basis points for transfer fee calculation maxFee, // Maximum fee per transfer TOKEN_2022_PROGRAM_ID // Token Extension Program ID);// Add instructions to new transactionconst transaction = new Transaction().add( reallocateInstruction, initTransferFeeConfig, enableRequiredMemoTransfersInstruction);// Send TransactointransactionSignature = await sendAndConfirmTransaction( connection, transaction, [payer]);console.log("\nReallocate:", `https://solana.fm/tx/${transactionSignature}?cluster=devnet-solana`);