Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

token-js: renamed getExtraAccountMetaAccount to getExtraAccountMetaAddress #5186

Merged
merged 3 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading