Transfer Hook with Extra Account Meta:
Error: Transaction 4o2A5fF1PNZBCLs6UmXMuv31Jdnwmvtt1MHg9Vn61xKmkBEpsYSCqZdnTiS7bE6kC9vwo4XudQNtJTrWCUZFxfgh failed ({"err":{"InstructionError":[1,{"Custom":6002}]}})
at sendAndConfirmTransaction (node_modules/@solana/web3.js/src/utils/send-and-confirm-transaction.ts:92:11)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Note that this demo is different from the others as it uses manually adds all the extra accounts required by the transfer hook instruction:
transferInstruction.keys.push(
{
pubkey: extraAccountMetaListPDA,
isSigner: false,
isWritable: false,
},
{
pubkey: vestingAccount,
isSigner: false,
isWritable: true,
},
{
pubkey: programId,
isSigner: false,
isWritable: false,
},
);
const transaction = new Transaction().add(
createAssociatedTokenAccountIdempotentInstruction(
wallet.publicKey,
destinationTokenAccount,
recipient.publicKey,
mint.publicKey,
TOKEN_2022_PROGRAM_ID,
ASSOCIATED_TOKEN_PROGRAM_ID,
),
transferInstruction,
);