Skip to content

Commit

Permalink
[token js]: transfer-hook: align key pushing flow with Rust helpers
Browse files Browse the repository at this point in the history
This PR modifes the ordering of pushing account metas to an instruction to align
exactly with the Rust interface's `offchain` helper.

Closes #5686
  • Loading branch information
buffalojoec authored Nov 14, 2023
1 parent 1b89c06 commit 2b30a1b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion token/js/src/extensions/transferHook/instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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 });
}
Expand Down

0 comments on commit 2b30a1b

Please sign in to comment.