Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit aab92cf

Browse files
author
Joe C
authored
token-js: opt for PublicKey.equals (#6541)
1 parent 3136617 commit aab92cf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

token/js/src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const NATIVE_MINT_2022 = new PublicKey('9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N
1717

1818
/** Check that the token program provided is not `Tokenkeg...`, useful when using extensions */
1919
export function programSupportsExtensions(programId: PublicKey): boolean {
20-
if (programId === TOKEN_PROGRAM_ID) {
20+
if (programId.equals(TOKEN_PROGRAM_ID)) {
2121
return false;
2222
} else {
2323
return true;

token/js/src/extensions/transferHook/instructions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export function createUpdateTransferHookInstruction(
119119

120120
function deEscalateAccountMeta(accountMeta: AccountMeta, accountMetas: AccountMeta[]): AccountMeta {
121121
const maybeHighestPrivileges = accountMetas
122-
.filter((x) => x.pubkey === accountMeta.pubkey)
122+
.filter((x) => x.pubkey.equals(accountMeta.pubkey))
123123
.reduce<{ isSigner: boolean; isWritable: boolean } | undefined>((acc, x) => {
124124
if (!acc) return { isSigner: x.isSigner, isWritable: x.isWritable };
125125
return { isSigner: acc.isSigner || x.isSigner, isWritable: acc.isWritable || x.isWritable };
@@ -205,7 +205,7 @@ export async function addExtraAccountMetasForExecute(
205205
const validateStateData = getExtraAccountMetas(validateStateAccount);
206206

207207
// Check to make sure the provided keys are in the instruction
208-
if (![source, mint, destination, owner].every((key) => instruction.keys.some((meta) => meta.pubkey === key))) {
208+
if (![source, mint, destination, owner].every((key) => instruction.keys.some((meta) => meta.pubkey.equals(key)))) {
209209
throw new Error('Missing required account in instruction');
210210
}
211211

0 commit comments

Comments
 (0)