@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
205 lines (202 loc) • 8.62 kB
JavaScript
;
/**
* Token Creation Tools
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.creationTools = exports.fetchLaunchTokenFeeTool = exports.uploadProfileImageTool = exports.uploadTokenImageTool = exports.launchTokenTool = void 0;
const response_formatter_js_1 = require("../../utils/response-formatter.js");
const error_handler_js_1 = require("../../utils/error-handler.js");
const tool_factory_js_1 = require("../../utils/tool-factory.js");
const common_schemas_js_1 = require("../../schemas/common-schemas.js");
// 1. Launch Token
exports.launchTokenTool = {
name: 'gala_launchpad_launch_token',
description: `Create a new token on the launchpad.
WORKFLOW:
1. checkTokenName() → Verify name is available
2. checkTokenSymbol() → Verify symbol is available
3. launchToken() → Create token with validated name/symbol
4. getUrlByTokenName() → Get frontend URL for the new token
REQUIREMENT: At least one social URL (websiteUrl, twitterUrl, or telegramUrl) is required.
RETURNS: Transaction details including token name, symbol, creator address, and transaction ID`,
inputSchema: {
type: 'object',
properties: {
tokenName: common_schemas_js_1.TOKEN_NAME_SCHEMA,
tokenSymbol: common_schemas_js_1.TOKEN_SYMBOL_SCHEMA,
tokenDescription: common_schemas_js_1.TOKEN_DESCRIPTION_SCHEMA,
tokenImage: {
...common_schemas_js_1.URL_SCHEMA,
description: 'Token image URL',
},
preBuyQuantity: common_schemas_js_1.PRE_BUY_QUANTITY_SCHEMA,
websiteUrl: {
...common_schemas_js_1.URL_SCHEMA,
description: 'Website URL (optional)',
},
telegramUrl: {
...common_schemas_js_1.URL_SCHEMA,
description: 'Telegram channel URL (optional)',
},
twitterUrl: {
...common_schemas_js_1.URL_SCHEMA,
description: 'Twitter profile URL (optional)',
},
tokenCategory: {
type: 'string',
description: 'Token category (defaults to "Unit")',
},
tokenCollection: {
type: 'string',
description: 'Token collection (defaults to "Token")',
},
reverseBondingCurveConfiguration: {
type: 'object',
properties: {
minFeePortion: {
type: 'string',
pattern: '^\\d+(\\.\\d+)?$',
description: 'Minimum fee portion (decimal, >= 0.1, <= 0.5). Defaults to "0.1" if not provided.',
},
maxFeePortion: {
type: 'string',
pattern: '^\\d+(\\.\\d+)?$',
description: 'Maximum fee portion (decimal, >= minFee, <= 0.5). Defaults to "0.5" if not provided.',
},
},
description: 'Reverse bonding curve configuration (optional, defaults: minFee=0.1, maxFee=0.5). When provided: minFee >= 0.1, maxFee >= minFee, maxFee <= 0.5',
},
privateKey: common_schemas_js_1.PRIVATE_KEY_SCHEMA,
},
required: [
'tokenName',
'tokenSymbol',
'tokenDescription',
'tokenImage',
],
},
handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => {
const typedArgs = args;
const result = await sdk.launchToken(typedArgs);
return (0, response_formatter_js_1.formatSuccess)(result);
}),
};
// 2. Upload Token Image
exports.uploadTokenImageTool = {
name: 'gala_launchpad_upload_token_image',
description: 'Upload token image from filesystem (Node.js only)',
inputSchema: {
type: 'object',
properties: {
tokenName: {
...common_schemas_js_1.TOKEN_NAME_SCHEMA,
description: 'Token name (2-20 lowercase alphanumeric)',
},
imagePath: {
type: 'string',
description: 'Absolute file path to image file',
},
privateKey: common_schemas_js_1.PRIVATE_KEY_SCHEMA,
},
required: ['tokenName', 'imagePath'],
},
handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => {
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
const typedArgs = args;
const fileBuffer = await fs.readFile(typedArgs.imagePath);
const result = await sdk.uploadTokenImage({
tokenName: typedArgs.tokenName,
options: {
file: fileBuffer,
tokenName: typedArgs.tokenName,
},
privateKey: typedArgs.privateKey,
});
return (0, response_formatter_js_1.formatSuccess)(result);
}),
};
// 3. Upload Profile Image
exports.uploadProfileImageTool = {
name: 'gala_launchpad_upload_profile_image',
description: 'Upload profile image from filesystem (Node.js only)',
inputSchema: {
type: 'object',
properties: {
imagePath: {
type: 'string',
description: 'Absolute file path to image file',
},
address: {
...common_schemas_js_1.ADDRESS_SCHEMA,
description: 'Optional wallet address (defaults to authenticated user)',
},
privateKey: common_schemas_js_1.PRIVATE_KEY_SCHEMA,
},
required: ['imagePath'],
},
handler: (0, error_handler_js_1.withErrorHandling)(async (sdk, args) => {
const fs = await Promise.resolve().then(() => __importStar(require('fs/promises')));
const typedArgs = args;
const fileBuffer = await fs.readFile(typedArgs.imagePath);
const imageUrl = await sdk.uploadProfileImage({
file: fileBuffer,
address: typedArgs.address,
privateKey: typedArgs.privateKey,
});
// If no imageUrl returned but upload succeeded, provide helpful message
if (!imageUrl) {
return (0, response_formatter_js_1.formatSuccess)({
success: true,
message: 'Profile image uploaded successfully (image stored with wallet address)',
});
}
return (0, response_formatter_js_1.formatSuccess)({ success: true, imageUrl });
}),
};
// 4. Fetch Launch Token Fee (45% code reduction via factory pattern)
exports.fetchLaunchTokenFeeTool = (0, tool_factory_js_1.createNoParamTool)({
name: 'gala_launchpad_fetch_launch_token_fee',
description: 'Fetch the current GALA fee required to launch a new token on the launchpad. Returns a number (e.g., 0.001). This is a dynamic value that may change. Check this before launching a token to ensure sufficient balance.',
handler: (sdk) => sdk.fetchLaunchTokenFee(),
resultKey: 'feeAmount',
});
exports.creationTools = [
exports.launchTokenTool,
exports.uploadTokenImageTool,
exports.uploadProfileImageTool,
exports.fetchLaunchTokenFeeTool,
];
//# sourceMappingURL=index.js.map