@deepliquidity/sdk

中文文档
0.1.3发布于 2026/10/13(MIT AND Apache-2.0)TypeScriptES Module近 30 天下载 2304

TypeScript client for DEEP on Solana: deep-curve (launchpad bonding curve) and DeepSwap (deep-amm) PDAs, instruction builders, account and event decoders, and the programs IDLs.

原始使用文档
文档目录10 节
  1. Install
  2. Program ids
  3. Quick start: quote and build a curve buy
  4. Charging your own fee
  5. Quick start: swap on a DeepSwap pool
  6. Events
  7. IDLs
  8. Examples
  9. Licence
  10. Links

@deepliquidity/sdk

DEEP — Launch deeper.

App Integration guide API X @LaunchOnDL Telegram @LaunchOnDL

TypeScript client for DEEP on Solana: the deep-curve launchpad (bonding curves) and DeepSwap (the deep-amm constant-product AMM that graduated tokens move to). PDAs, instruction builders, account and event decoders, integer quotes that match the programs exactly, and the programs' Anchor IDLs.

Status. The programs run on mainnet and devnet, at the same program ids. Nothing in this package sends transactions by itself.

The full integration guide (account layouts with offsets, events, fee maths, error codes, compute budgets, differences from pump.fun and Raydium CPMM) is the integration guide and the "Integrate" section of the DEEP docs.

Install

npm install @deepliquidity/sdk @deepliquidity/curve-math @solana/web3.js

ESM only, with TypeScript declarations. Works in Node ≥ 22 and in browser bundles: the package imports Buffer from the buffer package and never relies on a global Buffer.

Program ids

import { DEEP_CURVE_PROGRAM_ID, DEEP_AMM_PROGRAM_ID } from "@deepliquidity/sdk";
// deep-curve 7czURwVLkQpcF1HVhhZU5GGzvPA8YniogZY1BhZHCDtA (mainnet and devnet)
// deep-amm   HCrCy6bzHhZ1b6bXwQAucEFkKXyzYMh3hgAR8UPrYSEP (mainnet and devnet)

Quick start: quote and build a curve buy

import { quoteBuyV1 } from "@deepliquidity/curve-math";
import { applySlippage, buyIx, curveFees, curvePda, decodeBondingCurve } from "@deepliquidity/sdk";
import { ComputeBudgetProgram, Connection, PublicKey, Transaction } from "@solana/web3.js";

const conn = new Connection("https://api.devnet.solana.com", "confirmed");
const mint = new PublicKey("<mint>");
const user = new PublicKey("<wallet>");

const curve = decodeBondingCurve((await conn.getAccountInfo(curvePda(mint)))!.data);
// the token's own terms: DEEP's buy and sell rate, its reward rate and reward model
const fees = curveFees(curve);
const q = quoteBuyV1(curve.state, 100_000_000n, fees); // 0.1 SOL in, fees included
const tx = new Transaction().add(
  ComputeBudgetProgram.setComputeUnitLimit({ units: 80_000 }),
  buyIx({
    user,
    mint,
    amount: 100_000_000n,
    minOut: applySlippage(q.tokensOut, 100), // 1% slippage floor
    deadline: BigInt(Math.floor(Date.now() / 1000) + 60),
  }),
);
// sign with the user's wallet and send

Charging your own fee

DEEP has no on-chain referral share. To charge an app fee, add a SOL transfer to your own wallet in the same transaction as the trade: quoteBuyWithIntegratorFee / quoteSellWithIntegratorFee give the amounts and breakdown, integratorFeeIx builds the transfer (0–10%, rounded up). Show the fee to the user; DEEP's own fees still apply. See the integration guide, "Charging your own fee".

Quick start: swap on a DeepSwap pool

import {
  cpmmDirection,
  cpmmReserves,
  cpmmSwapBaseInputIx,
  decodeCpmmAmmConfig,
  decodeCpmmPoolState,
  DEEP_AMM_PROGRAM_ID,
  graduationPoolPda,
  NATIVE_MINT,
  quoteCpmmSwapBaseInput,
} from "@deepliquidity/sdk";

const poolId = graduationPoolPda(mint); // the pool a token graduated into
const pool = decodeCpmmPoolState((await conn.getAccountInfo(poolId))!.data);
const amm = decodeCpmmAmmConfig((await conn.getAccountInfo(pool.ammConfig))!.data);
const bal = async (k: PublicKey) => BigInt((await conn.getTokenAccountBalance(k)).value.amount);
const [r0, r1] = cpmmReserves(pool, await bal(pool.token0Vault), await bal(pool.token1Vault));
const { zeroForOne, creatorFeeOnInput } = cpmmDirection(pool, NATIVE_MINT);
const q = quoteCpmmSwapBaseInput({
  amountIn: 10_000_000n,
  inputReserve: zeroForOne ? r0 : r1,
  outputReserve: zeroForOne ? r1 : r0,
  config: amm,
  creatorFeeEnabled: pool.enableCreatorFee,
  creatorFeeOnInput,
});
const ix = cpmmSwapBaseInputIx({
  programId: DEEP_AMM_PROGRAM_ID,
  payer: user,
  poolId,
  pool,
  inputMint: NATIVE_MINT,
  amountIn: 10_000_000n,
  minimumAmountOut: (q.amountOut * 99n) / 100n,
}); // wrap SOL into the user's WSOL account first; see examples/deepswap-swap.ts

Events

import { parseEventsFromLogs, parseFeeEventsFromLogs, parseAmmSwapEvents } from "@deepliquidity/sdk";

conn.onLogs(DEEP_CURVE_PROGRAM_ID, (l) => {
  for (const { event } of parseEventsFromLogs(l.logs)) console.log(event.name, event);
});
conn.onLogs(DEEP_AMM_PROGRAM_ID, (l) => console.log(parseAmmSwapEvents(l.logs)));

parseEventsFromLogs only accepts Program data: lines emitted by the program itself (it tracks the invoke stack), so another program cannot spoof DEEP events.

IDLs

import curveIdl from "@deepliquidity/sdk/idl/deep_curve.json" with { type: "json" };
import ammIdl from "@deepliquidity/sdk/idl/deep_amm.json" with { type: "json" };

Anchor IDL spec 0.1.0. The SDK's decoders are tested field by field against these files, and the files against the live devnet accounts.

Examples

examples/ builds real transactions and simulates them on devnet (sigVerify: false): nothing is signed or sent, and no keypair is ever read. Pass --payer <public key> to choose whose account the simulation runs as.

filewhat it does
read-curve.tsConfig, curve state, price, progress, completion, graduation pool
watch-launches.tsonLogs on both programs; launches, trades, graduation, swaps
quote-and-buy.tsquote + buy, checks the TradeEvent against the quote
sell.tsquote + sell
deepswap-swap.tsDeepSwap swap_base_input with wrap/unwrap (buy, or round trip)
deepswap-liquidity.tsdeposit and withdraw with exact LP maths
claim-creator-fees.tscurve claim_creator_fees and DeepSwap creator-fee collection
npx tsx examples/read-curve.ts --rpc https://api.devnet.solana.com

Licence

MIT AND Apache-2.0: the cp-swap ports listed in NOTICE are Apache-2.0 (LICENSE-APACHE), everything else is MIT (LICENSE).

Website and app · Docs · Integration guide · GitHub · Blog · Status · X · Telegram

版本与发布记录

@deepliquidity/sdk 共发布 5 个版本,首次发布于 2026/10/09;过去 12 个月发布了 5 个版本。

版本发布日期距今
0.1.3latest2026/10/131 个月前
0.1.22026/10/131 个月前
0.1.12026/10/091 个月前
0.1.02026/10/091 个月前
0.0.0-stage2026/10/091 个月前

关于 @deepliquidity/sdk 的常见问题

@deepliquidity/sdk 是什么?

TypeScript client for DEEP on Solana: deep-curve (launchpad bonding curve) and DeepSwap (deep-amm) PDAs, instruction builders, account and event decoders, and the programs IDLs.

如何安装 @deepliquidity/sdk?

在项目目录运行 npm install @deepliquidity/sdk,或使用 pnpm add / yarn add / bun add。

@deepliquidity/sdk 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@deepliquidity/sdk 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@deepliquidity/sdk 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@deepliquidity/sdk 可以商用吗?

@deepliquidity/sdk 使用 (MIT AND Apache-2.0) 许可。声明的许可为 (MIT AND Apache-2.0),请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@deepliquidity/sdk 的下载量有多少?

根据 npm 官方下载统计,@deepliquidity/sdk 在 2026/10/12 – 2026/11/10 这 30 天内被下载 2,304 次,日均约 77 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@deepliquidity/sdk 还在维护吗?

最新版本 0.1.3 发布于 2026/10/13(1 个月前);至今共发布 5 个版本,其中过去 12 个月发布了 5 个;首次发布于 2026/10/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。