pump-sdk-core
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-10-08
- Stars
- ★ 0
- Forks
- 0
02 资源文件 2
- 参考文档metadata.json421 B
- 参考文档verification.json1.1 KB
03 SKILL.md 正文
Pump SDK Core — Instruction Building & On-Chain Interaction
Build, extend, and maintain the core Pump SDK — an offline-first TypeScript SDK that constructs Solana TransactionInstructions for token creation, buying, selling, migration, and creator fee collection across three on-chain programs (Pump, PumpAMM, PumpFees) plus the Mayhem program.
Context
The SDK is published as @nirholas/pump-sdk (npm) and powers the Pump protocol — a Solana-based token launchpad with bonding curve pricing, automatic AMM migration after graduation, tiered fees, and creator fee sharing. The codebase uses Anchor for IDL-based instruction building and supports both Token (SPL) and Token-2022 token programs.
Key Files
src/sdk.ts—PumpSdkclass with all instruction builders and account decoderssrc/onlineSdk.ts—OnlinePumpSdkclass extending offline SDK with live RPC fetchessrc/index.ts— barrel re-export module defining the public API surfacesrc/state.ts— TypeScript interfaces for all on-chain account statesrc/pda.ts— Program Derived Address derivation for all programssrc/idl/pump.ts,src/idl/pump_amm.ts,src/idl/pump_fees.ts— Anchor IDL definitions
Architecture
- Offline SDK (
PumpSdk): Builds instructions without a live connection. Uses AnchorPrograminstances initialized with a dummy keypair and connection. Exported as a singletonPUMP_SDK. - Online SDK (
OnlinePumpSdk): WrapsPumpSdkwith a realConnectionfor fetching account state viagetMultipleAccountsInfo. Provides "BothPrograms" methods that aggregate data across bonding curve (Pump) and AMM (PumpAMM) programs. - Three program IDs:
PUMP_PROGRAM_ID,PUMP_AMM_PROGRAM_ID,PUMP_FEE_PROGRAM_ID, plusMAYHEM_PROGRAM_IDfor mayhem-mode tokens.
Instruction Builder Pattern
Every instruction method returns TransactionInstruction[] (not transactions), allowing callers to compose them into transactions freely. Methods follow a naming convention:
*Instruction— single instruction*Instructions— multiple instructions (e.g., ATA creation + buy)
Account Decoders
The SDK decodes raw AccountInfo<Buffer> into typed interfaces using the Anchor coder:
decodeGlobal,decodeBondingCurve,decodeFeeConfig,decodeSharingConfig, etc.- Nullable variants (e.g.,
decodeBondingCurveNullable) handle missing or undersized accounts gracefully.
Slippage Calculation
maxSolCost = solAmount + (solAmount × slippage × 10 / 1000)
minSolReceived = solAmount - (solAmount × slippage × 10 / 1000)
Patterns to Follow
- Always return
TransactionInstruction[]from instruction builders, never fullTransactionobjects - Use
getMultipleAccountsInfoto batch RPC calls (2–3 accounts per call) - Support both Token (SPL) and Token-2022 programs via
tokenProgramparameter - Handle account extension (
extendAccountInstruction) for bonding curves that need more space - Validate shareholder arrays: max 10 shareholders, shares must total 10,000 bps, no duplicates, no zero shares
- Use typed error classes from
src/errors.tsfor validation failures - Keep the offline SDK connection-free; all RPC calls belong in
OnlinePumpSdk
Common Pitfalls
- Circular dependency between
sdk.tsandonlineSdk.ts - Buy instruction passes
{ 0: true }as a flags argument — this is intentional, not a bug BONDING_CURVE_NEW_SIZE = 151— accounts may need extension before certain operationsBondingCurve.complete === truemeans the token has graduated to AMM — bonding curve operations will fail- The
createInstruction(v1) is deprecated in favor ofcreateV2Instruction(Token-2022)
04 同仓库更多 Skills
zkrouter
Self-hosted OpenAI-compatible LLM router — smart tier-based routing, ZK-stamped routing decisions, mode overrides, free OpenRouter at install via the Birth bot. Save 60-80% on inference costs by routing to the cheapest capable model across 12+ OpenRouter models.
zk
For custom ZK Solana programs and privacy-preserving applications to prevent double spending. Guide to integrate rent-free nullifier PDAs for double-spend prevention.
zk-omni-messaging
Zero-knowledge omnichain messaging between Robinhood Chain and Solana using CheshireZkOmniMessenger (msgType 4) with nullifier anti-replay and the zk-omni-relayer service.
zerion-wallet-data
Use when the user asks to check a wallet's portfolio, token balances, DeFi positions, PnL, transaction history, or NFTs. Provides interpreted on-chain data across 40+ EVM chains and Solana via x402 pay-per-request or API key — no raw RPC decoding needed.
youtube-clipper
YouTube 视频智能剪辑工具。下载视频和字幕,AI 分析生成精细章节(几分钟级别), 用户选择片段后自动剪辑、翻译字幕为中英双语、烧录字幕到视频,并生成总结文案。 使用场景:当用户需要剪辑 YouTube 视频、生成短视频片段、制作双语字幕版本时。 关键词:视频剪辑、YouTube、字幕翻译、双语字幕、视频下载、clip video
yield-optimization
Multi-chain yield optimization via yield.xyz (StakeKit). Discover 2,988+ yield opportunities across 75+ blockchains, build deposit/withdrawal transactions with shell scripts, and sign them with a MoonPay wallet. Use when the user wants to earn yield, find the best lending or staking rate, enter/exit a position, or check portfolio balances.