@bagsfm/bags-sdk

中文文档
1.4.4发布于 2026/08/24MITTypeScriptCommonJS近 30 天下载 2588

TypeScript SDK for Bags

原始使用文档
文档目录11 节
  1. Installation
  2. Usage
  3. API Reference
  4. BagsSDK
  5. Services
  6. Exported Utilities
  7. Exported Constants
  8. Requirements
  9. Development
  10. License
  11. Support

@bagsfm/bags-sdk

npm version npm downloads license TypeScript Solana

A TypeScript SDK for interacting with the Bags Public API - Solana token launch and management platform.

For detailed API documentation, guides, and examples, visit docs.bags.fm.

Installation

npm install @bagsfm/bags-sdk

Usage

import { BagsSDK } from '@bagsfm/bags-sdk';
import { Connection, PublicKey } from '@solana/web3.js';

// Initialize the SDK
const connection = new Connection('https://mainnet.helius-rpc.com/?api-key=your-helius-api-key'); // Or any other RPC provider
const sdk = new BagsSDK('your-bags-api-key', connection, 'processed');

// Query token creators
const tokenMint = new PublicKey('your-token-mint-address');
const creators = await sdk.state.getTokenCreators(tokenMint);
console.log('Token creators:', creators);

// Get a swap quote
const quote = await sdk.trade.getQuote({
  inputMint: 'So11111111111111111111111111111111111111112',
  outputMint: 'your-token-mint-address',
  amount: 1_000_000_000, // 1 SOL in lamports
  slippageMode: 'dynamic',
});
console.log('Swap quote:', quote);

// Claim fees
const claimable = await sdk.fee.getAllClaimablePositions(walletPublicKey);
console.log('Claimable positions:', claimable);

API Reference

BagsSDK

The main SDK class that provides access to all services.

Constructor

new BagsSDK(apiKey: string, connection: Connection, commitment?: Commitment)

Parameters:

  • apiKey: Your Bags API key
  • connection: Solana web3.js Connection instance
  • commitment: (optional) Transaction commitment level (default: 'processed')

Services

ServicePropertyDescription
API Clientsdk.bagsApiClientLow-level HTTP client for direct Bags API calls
Token Launchsdk.tokenLaunchCreate token launches and upload token metadata
Statesdk.stateQuery token creators, lifetime fees, leaderboards, launch wallets, and claim stats
Configsdk.configCreate and manage fee-share configurations and lookup tables
Feessdk.feeList claimable fee positions and build claim transactions
Partnersdk.partnerRead/create partner configs and claim partner fees
Tradesdk.tradeGet swap quotes and build swap transactions
Solanasdk.solanaSubmit Jito bundles, check bundle statuses, and query Jito tip fees
Fee Share Adminsdk.feeShareAdminTransfer admin roles, list admin mints, and update fee-share configs
Dexscreenersdk.dexscreenerCheck order availability, create orders, and submit payments for Dexscreener listings
Authsdk.authFetch the API key owner's user profile
Robinhoodsdk.robinhoodList Robinhood Chain claimable positions and build unsigned claim transactions

Exported Utilities

The SDK also exports helper functions and types you can import directly:

import {
  sleep,
  chunkArray,
  signAndSendTransaction,
  sendBundleAndConfirm,
  createTipTransaction,
  serializeVersionedTransaction,
  prepareImageForFormData,
  detectImageInputType,
  sortKeys,
} from '@bagsfm/bags-sdk';

Exported Constants

Common program IDs and addresses are available as named exports:

import {
  BAGS_FEE_SHARE_V1_PROGRAM_ID,
  BAGS_FEE_SHARE_V2_PROGRAM_ID,
  METEORA_DBC_PROGRAM_ID,
  METEORA_DAMM_V2_PROGRAM_ID,
  BAGS_GLOBAL_LUT,
  WRAPPED_SOL_MINT,
  JITO_TIP_ACCOUNTS,
} from '@bagsfm/bags-sdk';

Requirements

  • Node.js >= 18.0.0
  • A Bags API key (get one at https://dev.bags.fm)
  • A Solana RPC provider (we recommend Helius - they offer a free tier)

Development

# Install dependencies
npm install

# Build the project
npm run build

# Watch mode for development
npm run dev

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

# Lint source files
npm run lint

# Lint and auto-fix
npm run lint:fix

# Format source files
npm run format

# Check formatting
npm run format:check

# Clean build artifacts
npm run clean

License

MIT

Support

For issues and questions, please visit our GitHub Issues.

版本与发布记录

@bagsfm/bags-sdk 共发布 37 个版本,首次发布于 2025/08/07;过去 12 个月发布了 24 个版本。

版本发布日期距今
1.4.4latest2026/08/242 个月前
1.4.32026/08/232 个月前
1.4.22026/08/073 个月前
1.4.12026/07/123 个月前
1.4.02026/07/064 个月前
1.3.92026/06/184 个月前

其他发布通道:beta → 1.0.7-beta.2。

关于 @bagsfm/bags-sdk 的常见问题

@bagsfm/bags-sdk 是什么?

TypeScript SDK for Bags

如何安装 @bagsfm/bags-sdk?

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

@bagsfm/bags-sdk 支持 TypeScript 吗?

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

@bagsfm/bags-sdk 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bagsfm/bags-sdk 需要什么版本的 Node.js?

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

@bagsfm/bags-sdk 可以商用吗?

@bagsfm/bags-sdk 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bagsfm/bags-sdk 的下载量有多少?

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

@bagsfm/bags-sdk 还在维护吗?

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