list_famous_contracts
Retrieve a list of notable smart contracts on the Neo N3 blockchain for either mainnet or testnet environments to enhance blockchain interactions and integrations.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | Network to use: "mainnet" or "testnet" |
Implementation Reference
- src/index.ts:270-296 (handler)Direct handler and registration for the 'list_famous_contracts' MCP tool using modern McpServer API. Fetches contracts from ContractService, filters available ones, and returns JSON.this.server.tool( 'list_famous_contracts', { network: z.string().optional().describe('Network to use: "mainnet" or "testnet"'), }, async ({ network }) => { const contractService = await this.getContractService(network); const contracts = contractService.listSupportedContracts(); const availableContracts = contracts.filter(contract => { return contractService.isContractAvailable(contract.name); }); const result = { contracts: availableContracts, network: contractService.getNetwork() }; return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } );
- src/index.ts:272-274 (schema)Input schema for the tool: optional network parameter.{ network: z.string().optional().describe('Network to use: "mainnet" or "testnet"'), },
- Core helper method in ContractService that lists supported famous contracts by mapping over FAMOUS_CONTRACTS and checking availability per network.listSupportedContracts(): Array<{ name: string, description: string, available: boolean, operationCount: number, network: NeoNetwork }> { try { return Object.values(FAMOUS_CONTRACTS).map(contract => { const contractName = contract.name; const isAvailable = this.isContractAvailable(contractName); const operationCount = Object.keys(contract.operations).length; return { name: contractName, description: contract.description, available: isAvailable, operationCount, network: this.network }; }); } catch (error) { // Log the error but return an empty array logger.error(`Error listing supported contracts`, { error: error instanceof Error ? error.message : String(error), network: this.network }); return []; } }
- src/contracts/contracts.ts:458-465 (helper)Constant exporting all famous contract definitions (NeoFS, NeoBurger, etc.) with script hashes and operations used by the tool.export const FAMOUS_CONTRACTS: { [key: string]: ContractDefinition } = { 'neofs': NeoFS, 'neoburger': NeoBurger, 'flamingo': Flamingo, 'neocompound': NeoCompound, 'grandshare': GrandShare, 'ghostmarket': GhostMarket };