npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@solitary-cheng/co-pump-sdk

v1.3.12

Published

Community-enhanced Pumpfun SDK for Solana

Readme

Co-Pump SDK

npm version License: MIT

Community-enhanced Pumpfun SDK for Solana.

该社区版本对官方库进行了优化,修复了已知问题,并提供了完整的使用文档。

Features

  • 完整支持 Pump Buy 操作
  • 集成 Pump Swap 功能
  • 优化的性能和可靠性
  • 详细的使用示例和文档

Installation

npm install @solitary-cheng/co-pump-sdk

Usage

Pump Buy

购买代币时,您可以使用以下示例代码:

import * as web3 from '@solana/web3.js';
import { 
  PumpSdk, 
  getBuyTokenAmountFromSolAmount,
  getBuySolAmountFromTokenAmount,
  getSellSolAmountFromTokenAmount
} from "@solitary-cheng/co-pump-sdk";

// 初始化 SDK
const pumpSdk = new PumpSdk(RPC_CONNECTION);

// 获取全局参数
const global = await pumpSdk.fetchGlobal();

// 设置代币铸造地址
const mint = new web3.PublicKey(MINT_ADDRESS);

// 获取绑定曲线信息
const bondingCurve = await pumpSdk.fetchBondingCurve(mint);

// 设置订单金额(以 SOL 计算)
const orderAmount = new BN(1 * web3.LAMPORTS_PER_SOL);

// 计算可获得的代币数量
const orderAmountToken = getBuyTokenAmountFromSolAmount(
  global, 
  bondingCurve, 
  orderAmount, 
  false
);

// 创建购买指令
const ixs = await pumpSdk.buyInstructions(
  global, 
  null, 
  bondingCurve, 
  mint, 
  keypair.publicKey, 
  orderAmountToken, 
  orderAmount, 
  maxSlippage,
  bondingCurve.creator
);

Pump Swap

进行代币交换时,可参考以下代码:

import * as web3 from '@solana/web3.js';
import { poolPda, PumpAmmSdk, pumpPoolAuthorityPda } from "@pump-fun/pump-swap-sdk";

// 初始化 Swap SDK
const pumpAmmSdk = new PumpAmmSdk(RPC_CONNECTION);

// 设置代币铸造地址
const mint = new web3.PublicKey(MINT_ADDRESS);
const quoteMint = new web3.PublicKey(WRAPPED_SOL_ADDRESS);

// 获取池权限和池 ID
const poolAuthority = pumpPoolAuthorityPda(mint);
const id = poolPda(0, poolAuthority[0], mint, quoteMint);
const pool = id[0];

// 设置订单金额(以 SOL 计算)
const orderAmount = new BN(1 * web3.LAMPORTS_PER_SOL);

// 计算可交换的代币数量
const orderAmountToken = await pumpAmmSdk.swapAutocompleteBaseFromQuote(
  pool,
  orderAmount,
  maxSlippage,
  "quoteToBase"
);

// 创建交换指令
const ixs = await pumpAmmSdk.swapBaseInstructions(
  pool,
  orderAmountToken,
  maxSlippage,
  "quoteToBase",
  keypair.publicKey,
);

API 参考

请参考源代码中的类型定义和函数注释获取详细的 API 信息。

贡献指南

欢迎提交问题和改进建议!请通过 GitHub issues 或 pull requests 参与项目。

许可证

MIT


Powered by Rustradex.com