Skip to content

Commit

Permalink
fix:pretty
Browse files Browse the repository at this point in the history
  • Loading branch information
yanCode committed Dec 4, 2024
1 parent c8c64b0 commit 9684de3
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 53 deletions.
9 changes: 5 additions & 4 deletions tests/cfo/tests/utils/stake.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ const WHITELIST_SIZE = 10;

async function setupStakePool(mint, god) {
// Registry genesis.
const [_registrarSigner, _nonce] = anchor.web3.PublicKey.findProgramAddressSync(
[registrar.publicKey.toBuffer()],
registry.programId
);
const [_registrarSigner, _nonce] =
anchor.web3.PublicKey.findProgramAddressSync(
[registrar.publicKey.toBuffer()],
registry.programId
);
registrarSigner = _registrarSigner;
nonce = _nonce;
poolMint = await serumCmn.createMint(provider, registrarSigner);
Expand Down
34 changes: 16 additions & 18 deletions tests/ido-pool/tests/ido-pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,15 +293,14 @@ describe("ido-pool", () => {
secondUserUsdcAccount = await getTokenAccount(provider, secondUserUsdc);
assert.isTrue(secondUserUsdcAccount.amount.eq(secondDeposit));

const [secondUserRedeemable] =
anchor.web3.PublicKey.findProgramAddressSync(
[
secondUserKeypair.publicKey.toBuffer(),
Buffer.from(idoName),
Buffer.from("user_redeemable"),
],
program.programId
);
const [secondUserRedeemable] = anchor.web3.PublicKey.findProgramAddressSync(
[
secondUserKeypair.publicKey.toBuffer(),
Buffer.from(idoName),
Buffer.from("user_redeemable"),
],
program.programId
);

await program.rpc.exchangeUsdcForRedeemable(secondDeposit, {
accounts: {
Expand Down Expand Up @@ -483,15 +482,14 @@ describe("ido-pool", () => {
program.programId
);

const [secondUserRedeemable] =
anchor.web3.PublicKey.findProgramAddressSync(
[
secondUserKeypair.publicKey.toBuffer(),
Buffer.from(idoName),
Buffer.from("user_redeemable"),
],
program.programId
);
const [secondUserRedeemable] = anchor.web3.PublicKey.findProgramAddressSync(
[
secondUserKeypair.publicKey.toBuffer(),
Buffer.from(idoName),
Buffer.from("user_redeemable"),
],
program.programId
);

const [poolWatermelon] = anchor.web3.PublicKey.findProgramAddressSync(
[Buffer.from(idoName), Buffer.from("pool_watermelon")],
Expand Down
9 changes: 4 additions & 5 deletions tests/lockup/migrations/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,10 @@ async function registrarInit(
const rewardQ = anchor.web3.Keypair.generate();
const withdrawalTimelock = new anchor.BN(_withdrawalTimelock);
const stakeRate = new anchor.BN(_stakeRate);
const [registrarSigner, nonce] =
anchor.web3.PublicKey.findProgramAddressSync(
[registrar.publicKey.toBuffer()],
registry.programId
);
const [registrarSigner, nonce] = anchor.web3.PublicKey.findProgramAddressSync(
[registrar.publicKey.toBuffer()],
registry.programId
);
const poolMint = await serumCmn.createMint(
registry.provider,
registrarSigner
Expand Down
9 changes: 5 additions & 4 deletions tests/lockup/tests/lockup.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ describe("Lockup and Registry", () => {
let poolMint = null;

it("Creates registry genesis", async () => {
const [_registrarSigner, _nonce] = anchor.web3.PublicKey.findProgramAddressSync(
[registrar.publicKey.toBuffer()],
registry.programId
);
const [_registrarSigner, _nonce] =
anchor.web3.PublicKey.findProgramAddressSync(
[registrar.publicKey.toBuffer()],
registry.programId
);
registrarSigner = _registrarSigner;
nonce = _nonce;
poolMint = await serumCmn.createMint(provider, registrarSigner);
Expand Down
16 changes: 6 additions & 10 deletions tests/misc/tests/misc/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2514,17 +2514,13 @@ const miscTest = (
});

it("With bumps using find_program_address", async () => {
const firstPDA = (
anchor.web3.PublicKey.findProgramAddressSync(
[anchor.utils.bytes.utf8.encode("seed")],
ASSOCIATED_TOKEN_PROGRAM_ID
)
const firstPDA = anchor.web3.PublicKey.findProgramAddressSync(
[anchor.utils.bytes.utf8.encode("seed")],
ASSOCIATED_TOKEN_PROGRAM_ID
)[0];
const secondPDA = (
anchor.web3.PublicKey.findProgramAddressSync(
[anchor.utils.bytes.utf8.encode("seed")],
program.programId
)
const secondPDA = anchor.web3.PublicKey.findProgramAddressSync(
[anchor.utils.bytes.utf8.encode("seed")],
program.programId
)[0];

// random wrong address
Expand Down
9 changes: 5 additions & 4 deletions tests/multisig/tests/multisig.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ describe("multisig", () => {

it("Tests the multisig program", async () => {
const multisig = anchor.web3.Keypair.generate();
const [multisigSigner, nonce] = anchor.web3.PublicKey.findProgramAddressSync(
[multisig.publicKey.toBuffer()],
program.programId
);
const [multisigSigner, nonce] =
anchor.web3.PublicKey.findProgramAddressSync(
[multisig.publicKey.toBuffer()],
program.programId
);
const multisigSize = 200; // Big enough.

const ownerA = anchor.web3.Keypair.generate();
Expand Down
10 changes: 2 additions & 8 deletions tests/zero-copy/tests/zero-copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@ describe("zero-copy", () => {
});

const bar = PublicKey.findProgramAddressSync(
[
program.provider.wallet.publicKey.toBuffer(),
foo.publicKey.toBuffer(),
],
[program.provider.wallet.publicKey.toBuffer(), foo.publicKey.toBuffer()],
program.programId
)[0];
const barAccount = await program.account.bar.fetch(bar);
Expand All @@ -111,10 +108,7 @@ describe("zero-copy", () => {

it("Updates an associated zero copy account", async () => {
const bar = PublicKey.findProgramAddressSync(
[
program.provider.wallet.publicKey.toBuffer(),
foo.publicKey.toBuffer(),
],
[program.provider.wallet.publicKey.toBuffer(), foo.publicKey.toBuffer()],
program.programId
)[0];
await program.rpc.updateBar(new BN(99), {
Expand Down

0 comments on commit 9684de3

Please sign in to comment.