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

190 lines 8.17 kB
"use strict"; /** * Balance & Portfolio Tools */ Object.defineProperty(exports, "__esModule", { value: true }); exports.balanceTools = exports.updateProfileTool = exports.fetchProfileTool = exports.fetchTokensCreatedTool = exports.fetchTokensHeldTool = exports.fetchLockedTokensTool = exports.fetchTokenBalanceTool = exports.fetchGalaBalanceTool = void 0; const response_formatter_js_1 = require("../../utils/response-formatter.js"); const error_handler_js_1 = require("../../utils/error-handler.js"); const common_schemas_js_1 = require("../../schemas/common-schemas.js"); const default_values_js_1 = require("../../utils/default-values.js"); // 1. Fetch GALA Balance exports.fetchGalaBalanceTool = { name: 'gala_launchpad_fetch_gala_balance', description: 'Get GALA balance for a wallet', inputSchema: { type: 'object', properties: { address: { ...common_schemas_js_1.ADDRESS_SCHEMA, description: 'Wallet address (optional, defaults to SDK wallet)', }, }, }, handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => { const result = await sdk.fetchGalaBalance(args.address); return (0, response_formatter_js_1.formatSuccess)(result); }), }; // 2. Fetch Token Balance (Optimized Single-Token Lookup) exports.fetchTokenBalanceTool = { name: 'gala_launchpad_fetch_token_balance', description: 'Get token balance for a specific token. Automatically routes to the correct backend: GalaChain for standard tokens (GALA, GUSDC) or launchpad backend for launchpad tokens (anime, etc.).', inputSchema: { type: 'object', properties: { tokenName: common_schemas_js_1.TOKEN_NAME_SCHEMA, address: common_schemas_js_1.ADDRESS_SCHEMA, }, required: ['tokenName', 'address'], }, handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => { // SDK now handles routing: tokenId → GalaChain, tokenName → launchpad backend const result = await sdk.fetchTokenBalance({ tokenName: args.tokenName, address: args.address }); return (0, response_formatter_js_1.formatSuccess)(result); }), }; // 3. Fetch Locked Tokens (Lock Details Query) exports.fetchLockedTokensTool = { name: 'gala_launchpad_fetch_locked_tokens', description: 'Get locked token details including all active locks, lock authorities, and expiration times. Returns locked quantity, individual hold details with lockAuthority, expiration timestamps, and lock names. Accepts tokenName for convenience - automatically resolves to tokenId for GalaChain query.', inputSchema: { type: 'object', properties: { tokenName: common_schemas_js_1.TOKEN_NAME_SCHEMA, address: common_schemas_js_1.ADDRESS_SCHEMA, withExpired: { type: 'boolean', description: 'Include expired locks in results (default: false - excludes expired)', }, }, required: ['tokenName', 'address'], }, handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => { // Resolve tokenName to tokenId for GalaChain lock query const tokenClassKey = await sdk.resolveTokenClassKey(args.tokenName); const tokenId = `${tokenClassKey.collection}|${tokenClassKey.category}|${tokenClassKey.type}|${tokenClassKey.additionalKey}`; const result = await sdk.fetchLockedBalance({ tokenId, address: args.address, withExpired: args.withExpired ?? false, }); return (0, response_formatter_js_1.formatSuccess)(result); }), }; // 4. Fetch Tokens Held (with Filtering Support) exports.fetchTokensHeldTool = { name: 'gala_launchpad_fetch_tokens_held', description: 'Get tokens held by a wallet with optional filtering. Supports exact match (tokenName) and fuzzy search (search) for efficient backend filtering.', inputSchema: { type: 'object', properties: { address: common_schemas_js_1.ADDRESS_SCHEMA, page: common_schemas_js_1.PAGE_SCHEMA, limit: (0, common_schemas_js_1.createLimitSchema)('user', 20), tokenName: { ...common_schemas_js_1.TOKEN_NAME_SCHEMA, description: 'Optional token name (exact match filter)', }, search: common_schemas_js_1.SEARCH_SCHEMA, }, required: ['address'], }, handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => { const pagination = (0, default_values_js_1.applyOperationPaginationDefaults)(args, 'user'); const result = await sdk.fetchTokensHeld({ ...pagination, tokenName: args.tokenName, search: args.search, address: args.address, }); return (0, response_formatter_js_1.formatSuccess)(result); }), }; // 5. Fetch Tokens Created (with Filtering Support) exports.fetchTokensCreatedTool = { name: 'gala_launchpad_fetch_tokens_created', description: 'Get tokens created by a wallet with optional filtering. Supports exact match (tokenName) and fuzzy search (search) for efficient backend filtering.', inputSchema: { type: 'object', properties: { address: common_schemas_js_1.ADDRESS_SCHEMA, page: common_schemas_js_1.PAGE_SCHEMA, limit: (0, common_schemas_js_1.createLimitSchema)('user', 20), tokenName: { ...common_schemas_js_1.TOKEN_NAME_SCHEMA, description: 'Optional token name (exact match filter)', }, search: common_schemas_js_1.SEARCH_SCHEMA, }, required: ['address'], }, handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => { const pagination = (0, default_values_js_1.applyOperationPaginationDefaults)(args, 'user'); const result = await sdk.fetchTokensCreated({ ...pagination, tokenName: args.tokenName, search: args.search, address: args.address, }); return (0, response_formatter_js_1.formatSuccess)(result); }), }; // 6. Fetch Profile exports.fetchProfileTool = { name: 'gala_launchpad_fetch_profile', description: 'Get user profile data', inputSchema: { type: 'object', properties: { address: { ...common_schemas_js_1.ADDRESS_SCHEMA, description: 'Wallet address (optional, defaults to SDK wallet)', }, }, }, handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => { const result = await sdk.fetchProfile(args.address); return (0, response_formatter_js_1.formatSuccess)(result); }), }; // 7. Update Profile exports.updateProfileTool = { name: 'gala_launchpad_update_profile', description: 'Update user profile', inputSchema: { type: 'object', properties: { fullName: common_schemas_js_1.FULL_NAME_SCHEMA, profileImage: { type: 'string', description: 'Profile image URL or empty string', }, address: common_schemas_js_1.ADDRESS_SCHEMA, privateKey: common_schemas_js_1.PRIVATE_KEY_SCHEMA, }, required: ['fullName', 'profileImage', 'address'], }, handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => { await sdk.updateProfile({ fullName: args.fullName, profileImage: args.profileImage, address: args.address, privateKey: args.privateKey, }); return (0, response_formatter_js_1.formatBoolean)(true, 'Profile updated successfully'); }), }; exports.balanceTools = [ exports.fetchGalaBalanceTool, exports.fetchTokenBalanceTool, exports.fetchLockedTokensTool, exports.fetchTokensHeldTool, exports.fetchTokensCreatedTool, exports.fetchProfileTool, exports.updateProfileTool, ]; //# sourceMappingURL=index.js.map