@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
- Migrating to 9.0
- Changelog:
CHANGELOG.mdin the package root - API reference
- Examples
- gswap-sdk: the DEX SDK, with its own runnable demos