Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wjthieme committed Nov 1, 2024
1 parent 1c3aacf commit 9b87d02
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 226 deletions.
19 changes: 5 additions & 14 deletions ts-sdk/whirlpool/tests/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
openFullRangePositionInstructions,
increaseLiquidityInstructions,
} from "../src/increaseLiquidity";
import {
sendTransaction,
rpc,
} from "./utils/mockRpc";
import { sendTransaction, rpc } from "./utils/mockRpc";
import { SPLASH_POOL_TICK_SPACING } from "../src/config";
import { swapInstructions } from "../src/swap";
import type { Address } from "@solana/web3.js";
Expand All @@ -19,9 +16,7 @@ import {
decreaseLiquidityInstructions,
closePositionInstructions,
} from "../src/decreaseLiquidity";
import {
fetchToken,
} from "@solana-program/token";
import { fetchToken } from "@solana-program/token";
import {
fetchPosition,
fetchWhirlpool,
Expand All @@ -39,7 +34,8 @@ describe("e2e", () => {
beforeAll(async () => {
const mint1 = await setupMint({ decimals: 9 });
const mint2 = await setupMint({ decimals: 6 });
[mintA, mintB] = Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1];
[mintA, mintB] =
Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1];
ataA = await setupAta(mintA, { amount: 500e9 });
ataB = await setupAta(mintB, { amount: 500e9 });
});
Expand All @@ -64,12 +60,7 @@ describe("e2e", () => {

const testInitConcentratedLiquidityPool = async () => {
const { instructions: createPoolInstructions, poolAddress } =
await createConcentratedLiquidityPoolInstructions(
rpc,
mintA,
mintB,
128,
);
await createConcentratedLiquidityPoolInstructions(rpc, mintA, mintB, 128);
await sendTransaction(createPoolInstructions);

const pool = await fetchWhirlpool(rpc, poolAddress);
Expand Down
23 changes: 18 additions & 5 deletions ts-sdk/whirlpool/tests/pool.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import { describe, it, beforeAll } from "vitest";
import { fetchConcentratedLiquidityPool, fetchSplashPool, fetchWhirlpoolsForTokenPair } from "../src/pool";
import {
fetchConcentratedLiquidityPool,
fetchSplashPool,
fetchWhirlpoolsForTokenPair,
} from "../src/pool";
import { rpc } from "./utils/mockRpc";
import assert from "assert";
import { SPLASH_POOL_TICK_SPACING, WHIRLPOOLS_CONFIG_ADDRESS } from "../src/config";
import { Address } from "@solana/web3.js";
import {
SPLASH_POOL_TICK_SPACING,
WHIRLPOOLS_CONFIG_ADDRESS,
} from "../src/config";
import type { Address } from "@solana/web3.js";
import { setupMint } from "./utils/token";
import { setupWhirlpool } from "./utils/program";
import { getWhirlpoolAddress } from "@orca-so/whirlpools-client";
Expand All @@ -18,9 +25,15 @@ describe("Fetch Pool", () => {
beforeAll(async () => {
const mint1 = await setupMint();
const mint2 = await setupMint();
[mintA, mintB] = Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1];
[mintA, mintB] =
Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1];
concentratedPool = await setupWhirlpool(mintA, mintB, 64);
defaultPool = await getWhirlpoolAddress(WHIRLPOOLS_CONFIG_ADDRESS, mintA, mintB, 128).then(x => x[0]);
defaultPool = await getWhirlpoolAddress(
WHIRLPOOLS_CONFIG_ADDRESS,
mintA,
mintB,
128,
).then((x) => x[0]);
splashPool = await setupWhirlpool(mintA, mintB, SPLASH_POOL_TICK_SPACING);
});

Expand Down
20 changes: 12 additions & 8 deletions ts-sdk/whirlpool/tests/position.test.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
import { Address, generateKeyPairSigner } from "@solana/web3.js";
import type { Address} from "@solana/web3.js";
import { generateKeyPairSigner } from "@solana/web3.js";
import { assert, beforeAll, describe, it } from "vitest";
import { setupAta, setupMint } from "./utils/token";
import { setupPosition, setupPositionBundle, setupTEPosition, setupWhirlpool } from "./utils/program";
import {
setupPosition,
setupPositionBundle,
setupTEPosition,
setupWhirlpool,
} from "./utils/program";
import { SPLASH_POOL_TICK_SPACING } from "../src/config";
import { fetchPositionsForOwner } from "../src/position";
import { rpc, signer } from "./utils/mockRpc";

describe("Fetch Position", () => {
let mintA: Address;
let mintB: Address;
let ataA: Address;
let ataB: Address;
let pool: Address;
let splashPool: Address;

beforeAll(async () => {
const mint1 = await setupMint();
const mint2 = await setupMint();
[mintA, mintB] = Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1];
ataA = await setupAta(mintA);
ataB = await setupAta(mintB);
[mintA, mintB] =
Buffer.from(mint1) < Buffer.from(mint2) ? [mint1, mint2] : [mint2, mint1];
await setupAta(mintA, { amount: 500e9 });
await setupAta(mintB, { amount: 500e9 });
pool = await setupWhirlpool(mintA, mintB, 128);
splashPool = await setupWhirlpool(mintA, mintB, SPLASH_POOL_TICK_SPACING);
await setupPosition(pool);
Expand All @@ -41,5 +46,4 @@ describe("Fetch Position", () => {
const positions = await fetchPositionsForOwner(rpc, other.address);
assert.strictEqual(positions.length, 0);
});

});
Loading

0 comments on commit 9b87d02

Please sign in to comment.