Skip to content

Commit

Permalink
token-js: renamed getExtraAccountMetaAccount to `getExtraAccountMet…
Browse files Browse the repository at this point in the history
…aAddress` (#5186)

* Renamed `getExtraAccountMetaAccount` to `getExtraAccountMetaAddress` for clarity

* Also renamed the function in the tests
  • Loading branch information
wjthieme committed Sep 1, 2023
1 parent eafe27f commit f1bff62
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions token/js/src/extensions/transferHook/instructions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { publicKey } from '@solana/buffer-layout-utils';
import { createTransferCheckedInstruction } from '../../instructions/transferChecked.js';
import { createTransferCheckedWithFeeInstruction } from '../transferFee/instructions.js';
import { getMint } from '../../state/mint.js';
import { getExtraAccountMetaAccount, getExtraAccountMetas, getTransferHook, resolveExtraAccountMeta } from './state.js';
import { getExtraAccountMetaAddress, getExtraAccountMetas, getTransferHook, resolveExtraAccountMeta } from './state.js';

export enum TransferHookInstruction {
Initialize = 0,
Expand Down Expand Up @@ -144,7 +144,7 @@ export async function addExtraAccountsToInstruction(
return instruction;
}

const extraAccountsAccount = getExtraAccountMetaAccount(transferHook.programId, mint);
const extraAccountsAccount = getExtraAccountMetaAddress(mint, transferHook.programId);
const extraAccountsInfo = await connection.getAccountInfo(extraAccountsAccount, commitment);
if (extraAccountsInfo == null) {
return instruction;
Expand Down
2 changes: 1 addition & 1 deletion token/js/src/extensions/transferHook/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export function getTransferHookAccount(account: Account): TransferHookAccount |
}
}

export function getExtraAccountMetaAccount(programId: PublicKey, mint: PublicKey): PublicKey {
export function getExtraAccountMetaAddress(mint: PublicKey, programId: PublicKey): PublicKey {
const seeds = [Buffer.from('extra-account-metas'), mint.toBuffer()];
return PublicKey.findProgramAddressSync(seeds, programId)[0];
}
Expand Down
4 changes: 2 additions & 2 deletions token/js/test/e2e-2022/transferHook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getAssociatedTokenAddressSync,
ASSOCIATED_TOKEN_PROGRAM_ID,
createMintToCheckedInstruction,
getExtraAccountMetaAccount,
getExtraAccountMetaAddress,
ExtraAccountMetaListLayout,
ExtraAccountMetaLayout,
transferCheckedWithTransferHook,
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('transferHook', () => {
beforeEach(async () => {
const mintKeypair = Keypair.generate();
mint = mintKeypair.publicKey;
pdaExtraAccountMeta = getExtraAccountMetaAccount(TRANSFER_HOOK_TEST_PROGRAM_ID, mint);
pdaExtraAccountMeta = getExtraAccountMetaAddress(mint, TRANSFER_HOOK_TEST_PROGRAM_ID);
payerAta = getAssociatedTokenAddressSync(
mint,
payer.publicKey,
Expand Down

0 comments on commit f1bff62

Please sign in to comment.