@gala-chain/launchpad-sdk

中文文档
10.0.0发布于 2026/11/10MITTypeScriptESM + CJS近 30 天下载 6002

TypeScript SDK for the Gala Launchpad backend: launchpad tokens, pools, bonding-curve trades and quotes, token creation, holders, charts, users, API keys, bans, moderation, overseers, flags, reactions, messages, notifications, streaming and stream chat, W

原始使用文档
文档目录8 节
  1. Install
  2. Configure
  3. Launchpad writes
  4. Token writes
  5. GSwap DEX
  6. Prices
  7. Hosts
  8. Further reading

@gala-chain/launchpad-sdk

The SDK signs with @gala-chain/api and ethers; it does not depend on @gala-chain/connect.

The TypeScript SDK for Gala Launchpad exposes the 10.0 facade API (current package release: 10.0.0). It provides read APIs for launchpad data, typed launchpad submissions and gateway-backed token transactions. The DEX is a separate SDK, @gala-chain/gswap-sdk (this package has no DEX client and does not depend on it), and the gateway-generic pieces (signers, wallet helpers and providers, React hooks, and bridge services) are provided by @gala-chain/gala-core-sdk. See MIGRATING-TO-10.0.md for moving from 9.x, and MIGRATING-TO-9.0.md for the earlier 9.0 migration.

The 10.0 API groups service methods under sdk.launchpad (writes and trades), sdk.tokens (token and pool reads), sdk.streaming, sdk.messages, sdk.moderation, sdk.admin, and sdk.account. Lifecycle and identity methods remain on LaunchpadSDK. Generic GalaChain bridge, wrap, balance, transfer, lock, and NFT-collection operations are available from @gala-chain/gala-core-sdk.

Install

pnpm add @gala-chain/launchpad-sdk @gala-chain/gala-core-sdk @gala-chain/api axios bignumber.js ethers socket.io-client zod

The latest dist-tag gets 10.0.0 (9.x has no facades; see MIGRATING-TO-10.0.md). Pin the exact versions in an app build.

@gala-chain/gala-core-sdk and the others are peer dependencies: install them next to this package. An app that bridges or wraps tokens installs the bridge's own peers (ethers, @solana/web3.js, @solana/spl-token) and hands the bridge module to the SDK: new LaunchpadSDK({ ..., bridge: () => import('@gala-chain/gala-core-sdk/bridge') }) (loaded at the first bridge or wrap call). This package never loads that module or Solana itself, so an app that does not bridge bundles and installs neither; without the loader the bridge and wrap methods throw a ConfigurationError naming the bridge option.

For the DEX, install @gala-chain/gswap-sdk 2.0 next to this package: pnpm add @gala-chain/gswap-sdk.

Configure

import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';

const sdk = createLaunchpadSDK({ env: 'stage' });

const pools = await sdk.tokens.fetchPools({ pageSize: 10 });
console.log(pools);

Environment is 'prod' | 'stage'. The SDK defaults to prod; it does not infer an environment from a custom baseUrl. Use gatewayBaseUrl for the chain gateway override.

Launchpad writes

Launchpad buys, sells, and sale creation are submitted to the bundler. The result exposes bundleId, uniqueKey, and wait():

const submission = await sdk.launchpad.buyWithNative({
  vaultAddress: 'client|example-token',
  quantity: '1',
  expectedAmount: '1',
});

const result = await submission.wait();
console.log(submission.bundleId, result);

The SDK signs each write with the dtoOperation of its call (asset-channel_basic-asset_Launchpad:BuyWithNative for the example above). The chain refuses a signed DTO without it, or with another call's, and it is part of what is signed, so it is set before signing and nothing can add it afterwards. You set nothing yourself; a DTO you sign on your own needs gala-core-sdk's withDtoOperation.

Token writes

Token transfers, burns, locks and unlocks go straight to the GalaChain gateway (signed and sent by @gala-chain/gala-core-sdk's GatewayWrites) and report the chain transaction id and block from the gateway's x-transaction-id and x-block-number headers. They are made as the SDK's wallet, or, for an SDK configured with { signer, walletAddress }, as that identity (an eth| account or a client| alias):

const { transactionId, blockNumber } = await sdk.tokens.transferToken({
  to: 'eth|9876543210987654321098765432109876543210',
  tokenId: 'GALA|Unit|none|none', // or tokenName: 'anime' for a launchpad token
  amount: '1', // whole tokens, sent as written
});

const locked = await sdk.tokens.lockTokens({ tokens: [{ tokenName: 'anime', amount: '100' }] });
console.log(locked.transactionId, locked.blockNumber);

To send to a client| recipient, or to write without a launchpad SDK, use GatewayWrites from @gala-chain/gala-core-sdk directly.

Never place a private key in source control. For a write-capable SDK, provide a signer through the supported wallet configuration.

GSwap DEX

DEX calls use @gala-chain/gswap-sdk's GSwap client. An app that trades on both builds both clients from the same key (sdk.dex is gone, and so are fetchAllDexSeasons, fetchCurrentDexSeason, fetchDexLeaderboardBySeasonId, fetchCurrentDexLeaderboard, fetchDexAggregatedVolumeSummary and onDexPoolCreation: they are gSwap.leaderboard.*, gSwap.market.getVolumeSummary() and gSwap.pools.watchNewPools()):

import BigNumber from 'bignumber.js';
import { PrivateKeySigner } from '@gala-chain/gala-core-sdk';
import { GSwap } from '@gala-chain/gswap-sdk';

const gSwap = new GSwap({
  env: 'stage',
  signer: new PrivateKeySigner(process.env.PRIVATE_KEY!),
  walletAddress: sdk.getAddress(), // the launchpad SDK built with the same key
});

const quote = await gSwap.quoting.quoteExactInput(
  'GALA|Unit|none|none',
  'GUSDC|Unit|none|none',
  '100',
);

const swap = await gSwap.swaps.swap(
  'GALA|Unit|none|none',
  'GUSDC|Unit|none|none',
  quote.feeTier,
  // The least you accept: a swap is applied seconds after the quote, so a bound equal to the quote
  // is rejected whenever the price moves in between.
  { exactIn: '100', amountOutMinimum: new BigNumber(quote.amountOut).multipliedBy('0.99').toFixed() },
);
// The swap is queued (swap.mode === 'queued'); confirm() resolves the applied trade
// or throws the chain's rejection.
const applied = await swap.confirm();
console.log(applied.transactionId, applied.result);

Use gSwap.pools, gSwap.positions, gSwap.symbols, gSwap.assets, gSwap.market and gSwap.leaderboard for pool discovery, liquidity, token identifiers, user assets, prices and volume, and the trading competition. DEX reads are unsigned; state-changing DEX calls require the client's signer. Runnable DEX demos and guides live in packages/gswap-sdk/examples/demos.

Prices

sdk.tokens.fetchTokenPrice({ tokenName }) prices a launchpad token (the bonding curve, or the swap backend once graduated). It takes tokenName only: fetchGalaPrice, fetchTokenPrice({ tokenId }), fetchPriceHistory and fetchAllPriceHistory are gone. Prices and price series for any token by class key are gswap-sdk's gSwap.market.getPrice(tokenId) and gSwap.market.getPriceSeries(key, timeframe); sdk.tokens.resolveTokenClassKey(name) gives a launchpad token's key. The MCP tools of the same names still work.

Hosts

env: 'stage' selects the Gala staging backends for launchpad reads and DEX reads, and gateway-testnet.galachain.com for gateway operations. Production host values are selected by env: 'prod'; baseUrl overrides the launchpad host.

Further reading

版本与发布记录

@gala-chain/launchpad-sdk 共发布 290 个版本,首次发布于 2025/09/25;过去 12 个月发布了 171 个版本。

版本发布日期距今
10.0.0latest2026/11/106 天前
10.0.0-beta.82026/11/078 天前
10.0.0-beta.72026/11/078 天前
10.0.0-beta.62026/11/079 天前
10.0.0-beta.52026/11/079 天前
10.0.0-beta.42026/11/0610 天前

其他发布通道:beta → 8.1.0。

关于 @gala-chain/launchpad-sdk 的常见问题

@gala-chain/launchpad-sdk 是什么?

TypeScript SDK for the Gala Launchpad backend: launchpad tokens, pools, bonding-curve trades and quotes, token creation, holders, charts, users, API keys, bans, moderation, overseers, flags, reactions, messages, notifications, streaming and stream chat, W

如何安装 @gala-chain/launchpad-sdk?

在项目目录运行 npm install @gala-chain/launchpad-sdk,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:zod(^4.3.6)、axios(^1.20.0)、ethers(^6.16.0)、bignumber.js(^11.1.5)、@gala-chain/api(^3.3.0)、socket.io-client(^4.8.3)、@gala-chain/gala-core-sdk(>=1.2.0 <2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@gala-chain/launchpad-sdk 支持 TypeScript 吗?

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

@gala-chain/launchpad-sdk 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@gala-chain/launchpad-sdk 需要什么版本的 Node.js?

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

@gala-chain/launchpad-sdk 可以商用吗?

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

@gala-chain/launchpad-sdk 的下载量有多少?

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

@gala-chain/launchpad-sdk 还在维护吗?

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