Skip to content

Commit

Permalink
temp: test swap quote
Browse files Browse the repository at this point in the history
  • Loading branch information
00xSam committed Jan 2, 2025
1 parent 7254fd1 commit 15586fb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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/(ilm|sdk|position_managed_by_operator|decode|single_bin).test.ts'",
"unit-test": "jest src/test/calculate_distribution.test.ts",
"example": "dotenv -e .env npx ts-node src/example.ts",
"testing": "dotenv -e .env npx ts-node src/examples/test.ts",
"start-server": "npx tsc && node dist/src/server/index.js"
},
"devDependencies": {
Expand Down
19 changes: 19 additions & 0 deletions ts-client/src/examples/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Connection, PublicKey } from "@solana/web3.js";
import { DLMM } from "../dlmm";
import { BN } from "bn.js";

(async function main() {
const lbPair = await DLMM.create(
new Connection(process.env.RPC || "https://mainnet-beta.solana.com"),
new PublicKey("GactypRe52H43kdR3FjmgWQXxDgmhr9o3L4vdAXCTyZ8")
);
const binArrays = await lbPair.getBinArrayForSwap(false, 6);
const { endPrice } = lbPair.swapQuote(
new BN(300_000 * 10 ** 6),
false,
new BN(0),
binArrays,
true
);
console.log("🚀 ~ main ~ endPrice:", endPrice.toString());
})();

0 comments on commit 15586fb

Please sign in to comment.