index/functions/createLaunchpadSDK.md
createLaunchpadSDK(
options?):LaunchpadSDK
Creates a fully configured LaunchpadSDK instance with smart defaults
This factory function simplifies SDK initialization by:
- Auto-detecting wallet input format (private key, mnemonic, or Wallet instance)
- Providing smart environment-based defaults
- Handling wallet creation automatically
launchpad sdk
Parameters
| Parameter | Type | Description |
|---|---|---|
options? | {[key: string]: unknown; config?: Partial<LaunchpadSDKConfig>; env?: GalaChainEnv; wallet?: string | Wallet; } | Configuration options |
options.config? | Partial<LaunchpadSDKConfig> | Additional SDK configuration options |
options.env? | GalaChainEnv | Environment preset ('prod' or 'stage') for automatic URL configuration |
options.wallet? | string | Wallet | Wallet input (private key string, mnemonic string, or Wallet instance) |
launchpad sdk config gala chain env
Returns
Fully configured LaunchpadSDK instance
launchpad sdk
Example
import { createLaunchpadSDK } from '@gala-chain/launchpad-sdk';
// Generate new random wallet and create SDK with stage environment
const sdk = createLaunchpadSDK();
// From private key with environment
const sdkFromPk = createLaunchpadSDK({
wallet: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12',
env: 'prod'
});
// From mnemonic with config
const sdkFromMnemonic = createLaunchpadSDK({
wallet: 'word1 word2 word3 word4 word5 word6 word7 word8 word9 word10 word11 word12',
env: 'stage',
config: {
debug: true,
timeout: 60000
}
});
// With URL overrides
const sdkWithOverrides = createLaunchpadSDK({
wallet: process.env.PRIVATE_KEY,
env: 'prod',
config: {
gatewayBaseUrl: 'https://custom-gateway.example.com'
}
});
// Ready to use immediately
const balance = await sdk.user.getGalaBalance({ walletAddress: sdk.getAddress() });