@picon-finance/dlmm-sdk
v1.0.0
Published
Typescript SDK for interacting with the Picon DLMM protocol
Readme
@picon-finance/dlmm-sdk
TypeScript SDK for the Picon DLMM protocol on Solana, built on @solana/kit.
Install
npm install @picon-finance/dlmm-sdkUsage
Every action returns an unsigned TransactionMessage — sign and send it with @solana/kit. Actions default to mainnet; pass a programAddress to target another cluster.
import { createSolanaRpc, signTransactionMessageWithSigners, sendAndConfirmTransactionFactory } from "@solana/kit";
import { createPool, swap, quote, getPool, DEVNET_PROGRAM_ADDRESS } from "@picon-finance/dlmm-sdk";
const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
// Read
const pool = await getPool(rpc, poolAddress);
// Quote, then build the matching swap transaction
const { quoteOutput, swap: buildSwap } = await quote(rpc, {
pool: poolAddress,
xToY: true,
amountIn: 1_000_000n,
slippageToleranceBps: 50,
});
const swapMessage = await buildSwap(userSigner);
// Write — target devnet by passing programAddress
const createPoolMessage = await createPool(
rpc,
{ authority, binStep, feeRate, protocolShare, activeBinId, tokenMintX, tokenMintY, tokenProgramX, tokenProgramY },
DEVNET_PROGRAM_ADDRESS,
);
// Sign and send however you normally do with @solana/kit
const signed = await signTransactionMessageWithSigners(swapMessage);MAINNET_PROGRAM_ADDRESS and DEVNET_PROGRAM_ADDRESS are both exported for convenience; omitting programAddress defaults to mainnet.
License
MIT
