Skip to content

Commit

Permalink
fix: ts test
Browse files Browse the repository at this point in the history
  • Loading branch information
codewithgun committed Jan 7, 2025
1 parent 983270b commit 83c2a05
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 64 deletions.
Binary file modified artifacts/dynamic_position_migration_test/lb_clmm.so
Binary file not shown.
1 change: 1 addition & 0 deletions ts-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"test": "jest 'src/test/(sdk|token_2022).test.ts'",
"debug": "jest src/test/sdk_token2022.test.ts",
"unit-test": "jest src/test/calculate_distribution.test.ts",
"dynamic-position-migration-test": "jest src/test/migrate_to_dynamic_position.test.ts",
"example": "dotenv -e .env npx ts-node src/example.ts",
"start-server": "npx tsc && node dist/src/server/index.js"
},
Expand Down
52 changes: 2 additions & 50 deletions ts-client/src/dlmm/idl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2413,17 +2413,7 @@ export type LbClmm = {
"isSigner": false
},
{
"name": "binArrayLower",
"isMut": true,
"isSigner": false
},
{
"name": "binArrayUpper",
"isMut": true,
"isSigner": false
},
{
"name": "owner",
"name": "sender",
"isMut": true,
"isSigner": true
},
Expand Down Expand Up @@ -5008,20 +4998,6 @@ export type LbClmm = {
],
"type": "u32"
},
{
"name": "minBinId",
"docs": [
"Min bin id supported by the pool based on the configured bin step."
],
"type": "i32"
},
{
"name": "maxBinId",
"docs": [
"Max bin id supported by the pool based on the configured bin step."
],
"type": "i32"
},
{
"name": "protocolShare",
"docs": [
Expand Down Expand Up @@ -9561,17 +9537,7 @@ export const IDL: LbClmm = {
"isSigner": false
},
{
"name": "binArrayLower",
"isMut": true,
"isSigner": false
},
{
"name": "binArrayUpper",
"isMut": true,
"isSigner": false
},
{
"name": "owner",
"name": "sender",
"isMut": true,
"isSigner": true
},
Expand Down Expand Up @@ -12156,20 +12122,6 @@ export const IDL: LbClmm = {
],
"type": "u32"
},
{
"name": "minBinId",
"docs": [
"Min bin id supported by the pool based on the configured bin step."
],
"type": "i32"
},
{
"name": "maxBinId",
"docs": [
"Max bin id supported by the pool based on the configured bin step."
],
"type": "i32"
},
{
"name": "protocolShare",
"docs": [
Expand Down
4 changes: 1 addition & 3 deletions ts-client/src/dlmm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3582,10 +3582,8 @@ export class DLMM {
.accounts({
positionV2,
positionV3,
binArrayLower: lowerBinArray,
binArrayUpper: upperBinArray,
sender: feePayer,
lbPair: this.pubkey,
owner: positionState.owner,
systemProgram: SystemProgram.programId,
rentReceiver: positionState.owner,
})
Expand Down
3 changes: 2 additions & 1 deletion ts-client/src/test/migrate_to_dynamic_position.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import { IPosition, wrapPosition } from "../dlmm/helpers/positions";
import { PositionInfo, PositionVersion } from "../dlmm/types";

// 1. Dump the account: target/debug/cli download-user-pool-files --wallet-key <wallet key> --override-wallet-key bossj3JvwiNK7pvjr149DqdtJxf2gdygbcmEPTkb2F1 --pool-key 6StaAqeVjKUPTgMLmcLmdpmUjoYHRcZ6uViLdWNdUghM --output-path $(readlink -f ./artifacts/jlp-hubsol-6StaAqeVjKUPTgMLmcLmdpmUjoYHRcZ6uViLdWNdUghM)
// 2. Run local validator: solana-test-validator --bpf-program LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo ./artifacts/lb_clmm.so --account-dir ./artifacts/jlp-hubsol-6StaAqeVjKUPTgMLmcLmdpmUjoYHRcZ6uViLdWNdUghM --reset
// 2. Run local validator: solana-test-validator --bpf-program LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo ./artifacts/dynamic_position_migration_test/lb_clmm.so --account-dir ./artifacts/jlp-hubsol-6StaAqeVjKUPTgMLmcLmdpmUjoYHRcZ6uViLdWNdUghM --reset
// 3. pnpm dynamic-position-migration-test
const poolKey = new PublicKey("6StaAqeVjKUPTgMLmcLmdpmUjoYHRcZ6uViLdWNdUghM");

const keypairBuffer = fs.readFileSync(
Expand Down
14 changes: 4 additions & 10 deletions ts-client/src/test/sdk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ describe("SDK test", () => {
reductionFactor: 5000,
variableFeeControl: 40000,
protocolShare: 0,
maxBinId: 43690,
minBinId: -43690,
maxVolatilityAccumulator: 350000,
})
.accounts({
Expand Down Expand Up @@ -260,8 +258,6 @@ describe("SDK test", () => {
reductionFactor: 5000,
variableFeeControl: 40000,
protocolShare: 0,
maxBinId: 43690,
minBinId: -43690,
maxVolatilityAccumulator: 350000,
})
.accounts({
Expand Down Expand Up @@ -890,13 +886,11 @@ describe("SDK test", () => {
});

it("fetch all preset parameter", async () => {
const { presetParameter, presetParameter2 } =
await DLMM.getAllPresetParameters(connection, {
cluster: "localhost",
});
const { presetParameter } = await DLMM.getAllPresetParameters(connection, {
cluster: "localhost",
});

const length = presetParameter.length + presetParameter2.length;
expect(length).toBeGreaterThan(0);
expect(presetParameter.length).toBeGreaterThan(0);
});

it("create LB pair with bitmap extension", async () => {
Expand Down

0 comments on commit 83c2a05

Please sign in to comment.