Skip to content

Commit

Permalink
Replace BN.toBuffer with BN.toArrayLike (solana-labs#6226)
Browse files Browse the repository at this point in the history
replace BN.toBuffer with BN.toArrayLike

BN.toBuffer is not available in the browser. Replaced with .toArrayLike which provides the same functionality and works consistently both in nodejs and browser.
  • Loading branch information
kagren authored Feb 6, 2024
1 parent 4cfd8df commit 3bd6e3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stake-pool/js/src/utils/program-address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export async function findTransientStakeProgramAddress(
TRANSIENT_STAKE_SEED_PREFIX,
voteAccountAddress.toBuffer(),
stakePoolAddress.toBuffer(),
seed.toBuffer('le', 8),
seed.toArrayLike(Buffer, 'le', 8),
],
programId,
);
Expand All @@ -66,7 +66,7 @@ export async function findEphemeralStakeProgramAddress(
seed: BN,
) {
const [publicKey] = await PublicKey.findProgramAddress(
[EPHEMERAL_STAKE_SEED_PREFIX, stakePoolAddress.toBuffer(), seed.toBuffer('le', 8)],
[EPHEMERAL_STAKE_SEED_PREFIX, stakePoolAddress.toBuffer(), seed.toArrayLike(Buffer, 'le', 8)],
programId,
);
return publicKey;
Expand Down

0 comments on commit 3bd6e3b

Please sign in to comment.