@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 (9.0, a release candidate under the next dist-tag; latest is still 8.1.0). It provides read APIs for launchpad data, typed launchpad submissions and gateway-backed token transactions. Version 9.0 is launchpad-only: 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, the bridge) are @gala-chain/gala-core-sdk's. See MIGRATING-TO-9.0.md for every removed export and where it went.
Install
pnpm add @gala-chain/launchpad-sdk@next @gala-chain/gala-core-sdk@next @gala-chain/api axios bignumber.js ethers socket.io-client zod
An install without @next gets 8.1.0. 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 (also under next) next to this package: pnpm add @gala-chain/gswap-sdk@next.
Configure
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
const sdk = createLaunchpadSDK({ env: 'stage' });
const pools = await sdk.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);
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.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.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 { 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,
{ exactIn: '100', amountOutMinimum: quote.amountOut },
);
// 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.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.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