Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@stabbleorg/mclmm-sdk",
"version": "0.3.3",
"version": "0.5.1",
"description": "SDK for Stabble's margin-enabled concentrated liquidity market maker",
"main": "lib/index.js",
"module": "lib/index.mjs",
Expand Down
6 changes: 4 additions & 2 deletions sdk/src/__tests__/integration/swap-flow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ describe("Integration: Complete Swap Flow (v2)", () => {
params
);

expect(ix.programAddress).toBeDefined();
expect(ix.accounts).toBeDefined();
expect(ix.length).toBeGreaterThan(0);
const swapIx = ix[ix.length - 1];
expect(swapIx.programAddress).toBeDefined();
expect(swapIx.accounts).toBeDefined();
});

it("should handle quote with price validation enabled", async () => {
Expand Down
11 changes: 7 additions & 4 deletions sdk/src/__tests__/unit/swap-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,18 +326,21 @@ describe("SwapManager", () => {
);

expect(instruction).toBeDefined();
expect(instruction.programAddress).toBeDefined();
expect(instruction.accounts).toBeDefined();
expect(instruction.data).toBeDefined();
expect(instruction.length).toBeGreaterThan(0);
const swapIx = instruction[instruction.length - 1];
expect(swapIx.programAddress).toBeDefined();
expect(swapIx.accounts).toBeDefined();
expect(swapIx.data).toBeDefined();
});

it("should include all required accounts", async () => {
const instruction = await swapManager.buildSwapInstruction(
const instructions = await swapManager.buildSwapInstruction(
TEST_ADDRESSES.USDC_SOL_POOL as Address,
mockSigner,
mockSwapParams
);

const instruction = instructions[instructions.length - 1];
// Should have multiple accounts
expect(instruction.accounts).toBeDefined();
if (instruction.accounts) {
Expand Down
2 changes: 1 addition & 1 deletion sdk/src/clmm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class Clmm {
tradeFeeRate,
protocolFeeRate,
fundFeeRate,
});
}, { programAddress: this.programId });

return {
instruction,
Expand Down
4 changes: 2 additions & 2 deletions sdk/src/pool-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class PoolManager {
tokenProgram1: TOKEN_PROGRAM_ADDRESS,
sqrtPriceX64: BigInt(initialPriceX64.toString()),
openTime: BigInt(0),
});
}, { programAddress: this.programId });

return {
instructions: [instruction],
Expand Down Expand Up @@ -187,7 +187,7 @@ export class PoolManager {
tradeFeeRate,
protocolFeeRate,
fundFeeRate,
});
}, { programAddress: this.programId });

return {
instructions: [instruction],
Expand Down
10 changes: 5 additions & 5 deletions sdk/src/position-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class PositionManager {
amount1Max: amountMaxB,
withMetadata,
baseFlag: null,
});
}, { programAddress: this.programId });

return {
instructions: [instruction],
Expand Down Expand Up @@ -445,7 +445,7 @@ export class PositionManager {
amount1Max,
withMetadata,
baseFlag: base === "MintA" ? true : false, // true = MintA is base, false = MintB is base
});
}, { programAddress: this.programId });

const ixWithRemAccounts: Instruction = {
...instruction,
Expand Down Expand Up @@ -560,7 +560,7 @@ export class PositionManager {
amount0Max: amountMaxA,
amount1Max: amountMaxB,
baseFlag: null,
});
}, { programAddress: this.programId });

const ixWithRemAccounts: Instruction = {
...instruction,
Expand Down Expand Up @@ -701,7 +701,7 @@ export class PositionManager {
liquidity,
amount0Min: amountMinA,
amount1Min: amountMinB,
});
}, { programAddress: this.programId });

const ixWithRemAccounts: Instruction = {
...instruction,
Expand Down Expand Up @@ -781,7 +781,7 @@ export class PositionManager {
positionNftAccount,
personalPosition,
tokenProgram: TOKEN_2022_PROGRAM_ADDRESS,
});
}, { programAddress: this.programId });

return {
instructions: [instruction],
Expand Down
Loading