UNPKG

@gala-chain/launchpad-sdk

Version:

TypeScript SDK for Gala Launchpad Backend API - Production-ready DeFi token launchpad integration with wallet-based authentication, GalaChain trading, and comprehensive user operations. 100% tested (22/22 endpoints working).

85 lines 2.93 kB
/** * Launchpad SDK factory functions * * Provides convenient factory functions for creating configured SDK instances * with smart defaults and automatic wallet handling. */ import { Wallet } from 'ethers'; import { LaunchpadSDK, LaunchpadSDKConfig } from '../LaunchpadSDK'; import { Environment } from '../types/common'; /** * 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 * * @param options Configuration options * @param options.wallet Wallet input (private key string, mnemonic string, or Wallet instance) * @param options.env Environment preset ('PROD' or 'STAGE') for automatic URL configuration * @param options.config Additional SDK configuration options * @returns Fully configured LaunchpadSDK instance * * @example * ```typescript * 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: { * galaChainBaseUrl: 'https://custom-gateway.example.com' * } * }); * * // Ready to use immediately * const balance = await sdk.user.getGalaBalance({ walletAddress: sdk.getAddress() }); * ``` */ export declare function createLaunchpadSDK(options?: { wallet?: string | Wallet; env?: Environment; config?: Partial<LaunchpadSDKConfig>; }): LaunchpadSDK; /** * Quick start SDK with test configuration * * Creates SDK instance optimized for testing and development. * Uses test-friendly defaults and enables debug mode. * * @param walletInput Optional wallet input (generates random if not provided) * @param env Optional environment (defaults to STAGE for testing) * @returns LaunchpadSDK configured for testing * * @example * ```typescript * // Quick test SDK with STAGE environment * const testSdk = createTestLaunchpadSDK(); * * // With specific wallet and environment * const testSdkWithWallet = createTestLaunchpadSDK('0x1234...', 'PROD'); * ``` */ export declare function createTestLaunchpadSDK(walletInput?: string, env?: Environment): LaunchpadSDK; //# sourceMappingURL=sdk.d.ts.map