From 2b30a1b250b89fcb21bf1323e002bc32c590ddd8 Mon Sep 17 00:00:00 2001 From: Joe C Date: Tue, 14 Nov 2023 10:59:29 +0000 Subject: [PATCH] [token js]: transfer-hook: align key pushing flow with Rust helpers This PR modifes the ordering of pushing account metas to an instruction to align exactly with the Rust interface's `offchain` helper. Closes #5686 --- token/js/src/extensions/transferHook/instructions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/token/js/src/extensions/transferHook/instructions.ts b/token/js/src/extensions/transferHook/instructions.ts index 0b722178975..9484a3053c0 100644 --- a/token/js/src/extensions/transferHook/instructions.ts +++ b/token/js/src/extensions/transferHook/instructions.ts @@ -172,7 +172,6 @@ export async function addExtraAccountsToInstruction( const extraAccountMetas = getExtraAccountMetas(extraAccountsInfo); const accountMetas = instruction.keys; - accountMetas.push({ pubkey: extraAccountsAccount, isSigner: false, isWritable: false }); for (const extraAccountMeta of extraAccountMetas) { const accountMetaUnchecked = await resolveExtraAccountMeta( @@ -186,6 +185,7 @@ export async function addExtraAccountsToInstruction( accountMetas.push(accountMeta); } accountMetas.push({ pubkey: transferHook.programId, isSigner: false, isWritable: false }); + accountMetas.push({ pubkey: extraAccountsAccount, isSigner: false, isWritable: false }); return new TransactionInstruction({ keys: accountMetas, programId, data: instruction.data }); }