UNPKG

@gala-chain/launchpad-mcp-server

Version:

MCP server for Gala Launchpad - 102 tools (pool management, event watchers, GSwap DEX trading, price history, token creation, wallet management, DEX pool discovery, liquidity positions, token locks, locked token queries, composite pool data, cross-chain b

395 lines 15.8 kB
"use strict"; /** * Bridge Prompts (Slash Commands) * * Cross-chain bridging commands for GalaChain ↔ Ethereum and GalaChain ↔ Solana */ Object.defineProperty(exports, "__esModule", { value: true }); exports.bridgePrompts = exports.solanaAllBalancesPrompt = exports.ethereumAllBalancesPrompt = exports.solanaNativeBalancePrompt = exports.solanaTokenBalancePrompt = exports.ethereumNativeBalancePrompt = exports.ethereumTokenBalancePrompt = exports.bridgeStatusPrompt = exports.bridgeInPrompt = exports.bridgeOutPrompt = exports.estimateBridgeFeePrompt = exports.supportedBridgeTokensPrompt = void 0; const mcpToolNames_js_1 = require("../constants/mcpToolNames.js"); const validation_js_1 = require("../utils/validation.js"); const handlerHelpers_js_1 = require("./utils/handlerHelpers.js"); const textTemplates_js_1 = require("./utils/textTemplates.js"); /** * Get Supported Bridge Tokens - List all tokens supported for cross-chain bridging */ exports.supportedBridgeTokensPrompt = { name: 'galachain-launchpad:bridge-tokens', description: 'List all tokens supported for cross-chain bridging', arguments: [ { name: 'chain', description: 'Filter by chain: Ethereum or Solana (optional)', required: false, }, ], handler: (args) => { const chainFilter = args.chain; return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'List supported bridge tokens and chains.', parameters: chainFilter ? { chain: `Chain Filter: ${chainFilter}` } : {}, toolName: mcpToolNames_js_1.MCP_TOOLS.GET_SUPPORTED_BRIDGE_TOKENS, actionDescription: chainFilter ? `fetch supported tokens filtered by chain="${chainFilter}"` : 'fetch all supported tokens', displayFormat: 'Display tokens with symbols, decimals, and supported chains.', })); }, }; /** * Estimate Bridge Fee - Estimate fees for bridging tokens to Ethereum or Solana */ exports.estimateBridgeFeePrompt = { name: 'galachain-launchpad:bridge-fee', description: 'Estimate fees for bridging tokens to Ethereum or Solana', arguments: [ { name: 'tokenSymbol', description: 'Token symbol (e.g., GALA, GWETH, GUSDC)', required: true, }, { name: 'destinationChain', description: 'Destination: Ethereum or Solana', required: true, }, { name: 'amount', description: 'Amount to bridge (optional, for more accurate estimate)', required: false, }, ], handler: (args) => { const parameters = { token: `Token: ${args.tokenSymbol}`, destination: `Destination: ${args.destinationChain}`, }; if (args.amount) { (0, validation_js_1.validateNumericAmount)(args.amount, 'amount'); parameters.amount = `Amount: ${args.amount}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Estimate bridge fees.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.ESTIMATE_BRIDGE_FEE, actionDescription: 'estimate the bridge fee', displayFormat: 'Display total fee, gas fee, and bridge fee breakdown.', })); }, }; /** * Bridge Out - Bridge tokens from GalaChain to Ethereum or Solana */ exports.bridgeOutPrompt = { name: 'galachain-launchpad:bridge-out', description: 'Bridge tokens from GalaChain to Ethereum or Solana', arguments: [ { name: 'tokenSymbol', description: 'Token symbol (e.g., GALA, GWETH)', required: true, }, { name: 'amount', description: 'Amount to bridge', required: true, }, { name: 'destinationChain', description: 'Destination: Ethereum or Solana', required: true, }, { name: 'recipientAddress', description: 'Recipient address on destination chain', required: true, }, ], handler: (args) => { (0, validation_js_1.validateNumericAmount)(args.amount, 'amount'); // Note: Address validation skipped - backend validates format based on destinationChain // (Ethereum: 0x... format, Solana: base58 format) return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Bridge tokens from GalaChain to external chain.', parameters: { token: `Token: ${args.tokenSymbol}`, amount: `Amount: ${args.amount}`, destination: `Destination: ${args.destinationChain}`, recipient: `Recipient: ${args.recipientAddress}`, }, toolName: mcpToolNames_js_1.MCP_TOOLS.BRIDGE_OUT, actionDescription: 'execute the bridge out transaction', displayFormat: 'Display transaction hash and status. Note: Bridge operations may take several minutes.', })); }, }; /** * Bridge In - Bridge tokens from Ethereum or Solana to GalaChain */ exports.bridgeInPrompt = { name: 'galachain-launchpad:bridge-in', description: 'Bridge tokens from Ethereum or Solana to GalaChain', arguments: [ { name: 'tokenSymbol', description: 'Token symbol (e.g., GALA, GWETH)', required: true, }, { name: 'amount', description: 'Amount to bridge', required: true, }, { name: 'sourceChain', description: 'Source chain: Ethereum or Solana', required: true, }, ], handler: (args) => { (0, validation_js_1.validateNumericAmount)(args.amount, 'amount'); return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Bridge tokens from external chain to GalaChain.', parameters: { token: `Token: ${args.tokenSymbol}`, amount: `Amount: ${args.amount}`, source: `Source: ${args.sourceChain}`, }, toolName: mcpToolNames_js_1.MCP_TOOLS.BRIDGE_IN, actionDescription: 'execute the bridge in transaction', displayFormat: 'Display transaction hash and status. Note: Bridge operations may take several minutes.', })); }, }; /** * Get Bridge Status - Check the status of a bridge transaction */ exports.bridgeStatusPrompt = { name: 'galachain-launchpad:bridge-status', description: 'Check the status of a bridge transaction', arguments: [ { name: 'transactionHash', description: 'Transaction hash from bridge operation', required: true, }, { name: 'chainHint', description: 'Chain hint for faster lookup: Ethereum or Solana (optional)', required: false, }, ], handler: (args) => { const parameters = { txHash: `Transaction: ${args.transactionHash}`, }; if (args.chainHint) { parameters.chain = `Chain Hint: ${args.chainHint}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Check bridge transaction status.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.GET_BRIDGE_STATUS, actionDescription: 'fetch the bridge status', displayFormat: 'Display status code, description, and completion state.', })); }, }; // ============================================================================ // SINGLE TOKEN BALANCE PROMPTS (Fast - 1 RPC call each) // ============================================================================ /** * Fetch Ethereum Token Balance - Get single ERC-20 token balance */ exports.ethereumTokenBalancePrompt = { name: 'galachain-launchpad:eth-token-balance', description: 'Get single ERC-20 token balance on Ethereum (GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC)', arguments: [ { name: 'symbol', description: 'Token symbol (GALA, GWETH, GUSDC, GUSDT, GWTRX, or GWBTC)', required: true, }, { name: 'address', description: 'Ethereum address (0x format). Defaults to configured wallet.', required: false, }, ], handler: (args) => { const parameters = { symbol: `Token: ${args.symbol}`, }; if (args.address) { parameters.address = `Address: ${args.address}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Fetch single ERC-20 token balance on Ethereum.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.FETCH_ETHEREUM_WALLET_TOKEN_BALANCE, actionDescription: 'fetch single Ethereum token balance', displayFormat: 'Display token symbol, balance amount, decimals, and contract address.', })); }, }; /** * Fetch Ethereum Native Balance - Get native ETH balance only */ exports.ethereumNativeBalancePrompt = { name: 'galachain-launchpad:eth-native-balance', description: 'Get native ETH balance on Ethereum', arguments: [ { name: 'address', description: 'Ethereum address (0x format). Defaults to configured wallet.', required: false, }, ], handler: (args) => { const parameters = {}; if (args.address) { parameters.address = `Address: ${args.address}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Fetch native ETH balance on Ethereum.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.FETCH_ETHEREUM_WALLET_NATIVE_BALANCE, actionDescription: 'fetch native ETH balance', displayFormat: 'Display ETH balance with symbol, amount, and decimals.', })); }, }; /** * Fetch Solana Token Balance - Get single SPL token balance */ exports.solanaTokenBalancePrompt = { name: 'galachain-launchpad:sol-token-balance', description: 'Get single SPL token balance on Solana (GALA or GSOL)', arguments: [ { name: 'symbol', description: 'Token symbol (GALA or GSOL)', required: true, }, { name: 'address', description: 'Solana address (base58 format). Defaults to configured wallet.', required: false, }, ], handler: (args) => { const parameters = { symbol: `Token: ${args.symbol}`, }; if (args.address) { parameters.address = `Address: ${args.address}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Fetch single SPL token balance on Solana.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.FETCH_SOLANA_WALLET_TOKEN_BALANCE, actionDescription: 'fetch single Solana token balance', displayFormat: 'Display token symbol, balance amount, decimals, and mint address.', })); }, }; /** * Fetch Solana Native Balance - Get native SOL balance only */ exports.solanaNativeBalancePrompt = { name: 'galachain-launchpad:sol-native-balance', description: 'Get native SOL balance on Solana', arguments: [ { name: 'address', description: 'Solana address (base58 format). Defaults to configured wallet.', required: false, }, ], handler: (args) => { const parameters = {}; if (args.address) { parameters.address = `Address: ${args.address}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Fetch native SOL balance on Solana.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.FETCH_SOLANA_WALLET_NATIVE_BALANCE, actionDescription: 'fetch native SOL balance', displayFormat: 'Display SOL balance with symbol, amount, and decimals.', })); }, }; // ============================================================================ // ALL TOKENS BALANCE PROMPTS (Complete portfolio view - multiple RPC calls) // ============================================================================ /** * Fetch All Ethereum Wallet Balances - Get all supported token balances on Ethereum */ exports.ethereumAllBalancesPrompt = { name: 'galachain-launchpad:eth-all-balances', description: 'Get ALL supported token balances on Ethereum (ETH + GALA, GWETH, GUSDC, GUSDT, GWTRX, GWBTC)', arguments: [ { name: 'address', description: 'Ethereum address (0x format). Defaults to configured wallet.', required: false, }, ], handler: (args) => { const parameters = {}; if (args.address) { parameters.address = `Address: ${args.address}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Fetch all supported token balances on Ethereum.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.FETCH_ETHEREUM_WALLET_ALL_BALANCES, actionDescription: 'fetch all Ethereum wallet balances', displayFormat: 'Display native ETH and all supported ERC-20 token balances with symbols, amounts, and decimals.', })); }, }; /** * Fetch All Solana Wallet Balances - Get all supported token balances on Solana */ exports.solanaAllBalancesPrompt = { name: 'galachain-launchpad:sol-all-balances', description: 'Get ALL supported token balances on Solana (SOL + GALA, GSOL)', arguments: [ { name: 'address', description: 'Solana address (base58 format). Defaults to configured wallet.', required: false, }, ], handler: (args) => { const parameters = {}; if (args.address) { parameters.address = `Address: ${args.address}`; } return (0, handlerHelpers_js_1.createPromptResponse)((0, textTemplates_js_1.createSimpleOperationText)({ operation: 'Fetch all supported token balances on Solana.', parameters, toolName: mcpToolNames_js_1.MCP_TOOLS.FETCH_SOLANA_WALLET_ALL_BALANCES, actionDescription: 'fetch all Solana wallet balances', displayFormat: 'Display native SOL and all supported SPL token balances with symbols, amounts, and decimals.', })); }, }; exports.bridgePrompts = [ exports.supportedBridgeTokensPrompt, exports.estimateBridgeFeePrompt, exports.bridgeOutPrompt, exports.bridgeInPrompt, exports.bridgeStatusPrompt, // Single token (fast - 1 RPC call) exports.ethereumTokenBalancePrompt, exports.ethereumNativeBalancePrompt, exports.solanaTokenBalancePrompt, exports.solanaNativeBalancePrompt, // All tokens (complete portfolio) exports.ethereumAllBalancesPrompt, exports.solanaAllBalancesPrompt, ]; //# sourceMappingURL=bridge.js.map