Skip to content

Commit 48709b3

Browse files
author
adpthegreat
committed
feat:ran pnpm fix
1 parent d1d0a42 commit 48709b3

File tree

5 files changed

+104
-229
lines changed

5 files changed

+104
-229
lines changed

tokens/token-swap/poseidon/token_swap/migrations/deploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// single deploy script that's invoked from the CLI, injecting a provider
33
// configured from the workspace's Anchor.toml.
44

5-
const anchor = require("@coral-xyz/anchor");
5+
const anchor = require('@coral-xyz/anchor');
66

7-
module.exports = async function (provider) {
7+
module.exports = async (provider) => {
88
// Configure client to use the provider.
99
anchor.setProvider(provider);
1010

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
import * as anchor from "@coral-xyz/anchor";
2-
import type { Program } from "@coral-xyz/anchor";
3-
import { expect } from "chai";
4-
import type { TokenSwap } from "../target/types/token_swap";
5-
import { type TestValues, createValues, expectRevert } from "./utils";
6-
import { PublicKey } from "@solana/web3.js";
7-
import { startAnchor } from "solana-bankrun";
8-
import { BankrunProvider } from "anchor-bankrun";
9-
10-
const IDL = require("../target/idl/token_swap.json");
1+
import * as anchor from '@coral-xyz/anchor';
2+
import type { Program } from '@coral-xyz/anchor';
3+
import { PublicKey } from '@solana/web3.js';
4+
import { BankrunProvider } from 'anchor-bankrun';
5+
import { expect } from 'chai';
6+
import { startAnchor } from 'solana-bankrun';
7+
import type { TokenSwap } from '../target/types/token_swap';
8+
import { type TestValues, createValues, expectRevert } from './utils';
9+
10+
const IDL = require('../target/idl/token_swap.json');
1111
const PROGRAM_ID = new PublicKey(IDL.address);
1212

13-
describe("Create AMM", async () => {
13+
describe('Create AMM', async () => {
1414
// Configure the client to use the anchor-bankrun
15-
const context = await startAnchor(
16-
"",
17-
[{ name: "token_swap", programId: PROGRAM_ID }],
18-
[]
19-
);
15+
const context = await startAnchor('', [{ name: 'token_swap', programId: PROGRAM_ID }], []);
2016

2117
const provider = new BankrunProvider(context);
2218

@@ -32,38 +28,33 @@ describe("Create AMM", async () => {
3228
values = createValues();
3329
});
3430

35-
it("Creation", async () => {
31+
it('Creation', async () => {
3632
const id = new anchor.BN(values.id);
3733
const fee = values.fee;
3834
await program.methods
3935
.createAmm(id, fee)
40-
.accounts({
41-
payer:payer.publicKey,
36+
.accounts({
37+
payer: payer.publicKey,
4238
})
4339
.rpc();
4440

4541
const ammAccount = await program.account.amm.fetch(values.ammKey);
4642
expect(ammAccount.id.toString()).to.equal(values.id.toString());
47-
expect(ammAccount.admin.toString()).to.equal(
48-
values.admin.publicKey.toString()
49-
);
43+
expect(ammAccount.admin.toString()).to.equal(values.admin.publicKey.toString());
5044
expect(ammAccount.fee.toString()).to.equal(values.fee.toString());
5145
});
5246

53-
it("Invalid fee", async () => {
47+
it('Invalid fee', async () => {
5448
const id = new anchor.BN(values.id);
5549
values.fee = 10000;
5650

5751
await expectRevert(
5852
program.methods
59-
.createAmm(
60-
id,
61-
values.fee
62-
)
63-
.accounts({
64-
payer:payer.publicKey
53+
.createAmm(id, values.fee)
54+
.accounts({
55+
payer: payer.publicKey,
6556
})
66-
.rpc()
57+
.rpc(),
6758
);
6859
});
6960
});
Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,35 @@
1-
import * as anchor from "@coral-xyz/anchor";
2-
import type { Program } from "@coral-xyz/anchor";
3-
import { PublicKey } from "@solana/web3.js";
4-
import type { TokenSwap } from "../target/types/token_swap";
5-
import {
6-
type TestValues,
7-
createValues,
8-
expectRevert,
9-
mintingTokens,
10-
} from "./utils";
11-
import { startAnchor } from "solana-bankrun";
12-
import { BankrunProvider } from "anchor-bankrun";
1+
import * as anchor from '@coral-xyz/anchor';
2+
import type { Program } from '@coral-xyz/anchor';
3+
import { PublicKey } from '@solana/web3.js';
4+
import { BankrunProvider } from 'anchor-bankrun';
5+
import { startAnchor } from 'solana-bankrun';
6+
import type { TokenSwap } from '../target/types/token_swap';
7+
import { type TestValues, createValues, expectRevert, mintingTokens } from './utils';
138

14-
const IDL = require("../target/idl/token_swap.json");
9+
const IDL = require('../target/idl/token_swap.json');
1510
const PROGRAM_ID = new PublicKey(IDL.address);
1611

17-
describe("Create pool", async () => {
18-
const context = await startAnchor(
19-
"",
20-
[{ name: "token_swap", programId: PROGRAM_ID }],
21-
[]
22-
);
12+
describe('Create pool', async () => {
13+
const context = await startAnchor('', [{ name: 'token_swap', programId: PROGRAM_ID }], []);
2314

24-
const provider = new BankrunProvider(context);
15+
const provider = new BankrunProvider(context);
2516

26-
const connection = provider.connection;
17+
const connection = provider.connection;
2718

28-
const payer = provider.wallet as anchor.Wallet;
19+
const payer = provider.wallet as anchor.Wallet;
2920

30-
const program = new anchor.Program<TokenSwap>(IDL, provider);
21+
const program = new anchor.Program<TokenSwap>(IDL, provider);
3122

3223
let values: TestValues;
3324

3425
beforeEach(async () => {
3526
values = createValues();
36-
const id = new anchor.BN(values.id)
37-
const fee = values.fee
27+
const id = new anchor.BN(values.id);
28+
const fee = values.fee;
3829
await program.methods
3930
.createAmm(id, fee)
4031
.accounts({
41-
// admin: values.admin.publicKey
32+
// admin: values.admin.publicKey
4233
})
4334
.rpc();
4435

@@ -50,7 +41,7 @@ const connection = provider.connection;
5041
});
5142
});
5243

53-
it("Creation", async () => {
44+
it('Creation', async () => {
5445
const id = new anchor.BN(values.id);
5546
await program.methods
5647
.createPool(id)
@@ -67,28 +58,19 @@ const connection = provider.connection;
6758
.rpc({ skipPreflight: true });
6859
});
6960

70-
it("Invalid mints", async () => {
61+
it('Invalid mints', async () => {
7162
values = createValues({
7263
mintBKeypair: values.mintAKeypair,
7364
poolKey: PublicKey.findProgramAddressSync(
74-
[
75-
Buffer.alloc(values.id),
76-
values.mintAKeypair.publicKey.toBuffer(),
77-
values.mintBKeypair.publicKey.toBuffer(),
78-
],
79-
program.programId
65+
[Buffer.alloc(values.id), values.mintAKeypair.publicKey.toBuffer(), values.mintBKeypair.publicKey.toBuffer()],
66+
program.programId,
8067
)[0],
8168
poolAuthority: PublicKey.findProgramAddressSync(
82-
[
83-
Buffer.alloc(values.id),
84-
values.mintAKeypair.publicKey.toBuffer(),
85-
values.mintBKeypair.publicKey.toBuffer(),
86-
Buffer.from("authority"),
87-
],
88-
program.programId
69+
[Buffer.alloc(values.id), values.mintAKeypair.publicKey.toBuffer(), values.mintBKeypair.publicKey.toBuffer(), Buffer.from('authority')],
70+
program.programId,
8971
)[0],
9072
});
91-
const id = new anchor.BN(values.id);
73+
const id = new anchor.BN(values.id);
9274
await expectRevert(
9375
program.methods
9476
.createPool(id)
@@ -102,7 +84,7 @@ const connection = provider.connection;
10284
// poolAccountA: values.poolAccountA,
10385
// poolAccountB: values.poolAccountB,
10486
})
105-
.rpc()
87+
.rpc(),
10688
);
10789
});
10890
});

0 commit comments

Comments
 (0)