Skip to main content

Class: AgentConfig

Gala Launchpad SDK 9.0.0-rc.5


Gala Launchpad SDK 9.0.0-rc.5 / index / AgentConfig

Class: AgentConfig

Defined in: packages/launchpad-sdk/dist/utils/agent-config.d.ts:85

Agent configuration utility class

Constructors​

Constructor​

new AgentConfig(): AgentConfig

Defined in: packages/launchpad-sdk/dist/utils/agent-config.d.ts:87

Returns​

AgentConfig

Methods​

getRecommendedConfig()​

static getRecommendedConfig(environment, useCase?): AgentSDKConfig

Defined in: packages/launchpad-sdk/dist/utils/agent-config.d.ts:258

Generate environment-specific configuration recommendations

Provides tailored configuration suggestions based on intended use:

  • Production (prod): Conservative timeouts, minimal logging
  • Stage (stage): Debug enabled, longer timeouts

Parameters​

environment​

GalaChainEnv

Target environment

useCase?​

"trading" | "creation" | "monitoring" | "general"

Specific use case (trading, creation, monitoring)

Returns​

AgentSDKConfig

Recommended configuration object

Since​

1.0.0

Example​

Get prod trading config

const config = AgentConfig.getRecommendedConfig('prod', 'trading');
const { sdk } = await AgentConfig.quickSetup(config);

multiWalletSetup()​

static multiWalletSetup(wallets, environment?): Promise<Record<string, LaunchpadSDK>>

Defined in: packages/launchpad-sdk/dist/utils/agent-config.d.ts:288

Create configuration for multi-wallet scenarios

Helps agents manage multiple wallets for different purposes:

  • Trading wallet with moderate balance
  • Creation wallet with high balance
  • Monitoring wallet (read-only)

Parameters​

wallets​

Record<string, string>

Map of wallet names to private keys

environment?​

GalaChainEnv

Target environment

Returns​

Promise<Record<string, LaunchpadSDK>>

Map of configured SDK instances

Since​

1.0.0

Example​

Multi-wallet setup

const wallets = {
trader: process.env.TRADER_WALLET,
creator: process.env.CREATOR_WALLET,
monitor: 'generate' // Read-only operations
};

const sdks = await AgentConfig.multiWalletSetup(wallets, 'prod');

// Use appropriate wallet for each operation
await sdks.trader.trade.buyTokens(...);
await sdks.creator.launchpad.createSale(...);
const pools = await sdks.monitor.launchpad.fetchPools(...);

quickSetup()​

static quickSetup(config?): Promise<{ config: LaunchpadSDKConfig; sdk: LaunchpadSDK; validation?: SetupValidation; wallet: AgentWallet; }>

Defined in: packages/launchpad-sdk/dist/utils/agent-config.d.ts:126

Quick setup with intelligent defaults for AI agents

This method provides the fastest path to a working SDK instance by:

  • Auto-detecting environment from LAUNCHPAD_ENV or ENVIRONMENT
  • Using PRIVATE_KEY env var or generating new wallet
  • Setting appropriate timeouts and debug levels
  • Validating the setup automatically

Parameters​

config?​

AgentSDKConfig

Optional configuration overrides

Returns​

Promise<{ config: LaunchpadSDKConfig; sdk: LaunchpadSDK; validation?: SetupValidation; wallet: AgentWallet; }>

Promise resolving to SDK instance and configuration details

Since​

1.0.0

Examples​

Quick start for any environment

const { sdk, wallet, config } = await AgentConfig.quickSetup();
console.log('Ready to trade with address:', sdk.getAddress());

Production setup with existing wallet

const { sdk } = await AgentConfig.quickSetup({
environment: 'prod',
privateKey: process.env.PRODUCTION_WALLET_KEY,
agentId: 'trading-bot-v1'
});

Development with auto-generated wallet

const { sdk, wallet } = await AgentConfig.quickSetup({
environment: 'stage',
privateKey: 'generate',
debug: true
});
console.log('Save this key:', wallet.privateKey);

readOnlySetup()​

static readOnlySetup(config?): Promise<{ config: LaunchpadSDKConfig; sdk: LaunchpadSDK; }>

Defined in: packages/launchpad-sdk/dist/utils/agent-config.d.ts:200

Read-only setup for data querying and monitoring

Creates an SDK instance in read-only mode without wallet authentication. Perfect for agents that only need to fetch data, monitor pools, or analyze prices without performing transactions.

Benefits:

  • No wallet required - safer for data-only operations
  • Skips balance validation - faster setup
  • Full access to all fetch/query methods
  • Cannot perform signing operations (buy, sell, transfer, etc.)

Parameters​

config?​

Partial<AgentSDKConfig>

Optional configuration overrides

Returns​

Promise<{ config: LaunchpadSDKConfig; sdk: LaunchpadSDK; }>

Promise resolving to read-only SDK instance

Since​

3.23.0

Examples​

Monitor token prices (read-only)

const { sdk } = await AgentConfig.readOnlySetup({
environment: 'prod',
debug: false
});

// Fetch data - these work fine
const pools = await sdk.fetchPools();
const price = await sdk.fetchTokenPrice('anime');

// This will throw - wallet required for signing
try {
await sdk.buyTokens('anime', '100', 'native', 0.05);
} catch (error) {
console.log('Expected error:', error.message); // Wallet required
}

Price analysis and monitoring bot

const { sdk } = await AgentConfig.readOnlySetup({
environment: 'prod',
timeout: 20000, // Faster timeout for read-only ops
debug: false,
agentId: 'price-monitor-v1'
});

// Continuous monitoring loop
while (true) {
const prices = await sdk.fetchTokenPrice('mytoken');
console.log('Current price:', prices.price);
await new Promise(resolve => setTimeout(resolve, 5000));
}

Load pool data for analysis

const { sdk } = await AgentConfig.readOnlySetup({
environment: 'prod'
});

// Analyze distribution without needing authentication
const distribution = await sdk.fetchTokenDistribution('mytoken');
const topHolders = distribution.holders
.sort((a, b) => parseFloat(b.balance) - parseFloat(a.balance))
.slice(0, 10);

console.log('Top 10 holders:', topHolders);

validateSetup()​

static validateSetup(sdk, wallet?): Promise<SetupValidation>

Defined in: packages/launchpad-sdk/dist/utils/agent-config.d.ts:239

Comprehensive setup validation for AI agents

Performs thorough checks to ensure the SDK is ready for agent operations:

  • Network connectivity
  • Wallet authentication
  • Balance availability
  • API endpoint accessibility
  • Trading capabilities

Parameters​

sdk​

LaunchpadSDK

Initialized SDK instance

wallet?​

AgentWallet

Optional wallet for additional checks

Returns​

Promise<SetupValidation>

Validation result with capabilities and issues

Since​

1.0.0

Examples​

Validate existing setup

const status = await AgentConfig.validateSetup(sdk);
if (!status.ready) {
console.error('Issues found:', status.issues);
// Handle setup problems before proceeding
}

Check specific capabilities

const status = await AgentConfig.validateSetup(sdk);
if (status.capabilities.canTrade) {
console.log('Trading operations available');
}
if (status.capabilities.canCreateTokens) {
console.log('Token creation available');
}