UNPKG

@covalenthq/goldrush-mcp-server

Version:

GoldRush MCP Server for interacting with Covalent GoldRush API

124 lines 5.09 kB
import { validQuoteValues } from "../utils/constants.js"; import { stringifyWithBigInt } from "../utils/helpers.js"; import { ChainName, } from "@covalenthq/client-sdk"; import { z } from "zod"; export function addAllChainsServiceTools(server, goldRushClient) { server.tool("multichain_transactions", "Gets transactions for multiple wallet addresses across multiple blockchains. " + "Requires addresses array. Optional parameters include chains array, " + "pagination (before/after), limit (default 10), quoteCurrency for value conversion, " + "and options to include logs (withLogs, withDecodedLogs). " + "Use this to analyze transaction history across different networks simultaneously.", { chains: z .array(z.union([ z.enum(Object.values(ChainName)), z.number(), ])) .optional(), addresses: z.array(z.string()).optional(), limit: z.number().optional().default(10), before: z.string().optional(), after: z.string().optional(), withLogs: z.boolean().optional().default(false), withDecodedLogs: z.boolean().optional().default(false), quoteCurrency: z .enum(Object.values(validQuoteValues)) .optional(), }, async (params) => { try { const response = await goldRushClient.AllChainsService.getMultiChainMultiAddressTransactions({ chains: params.chains, addresses: params.addresses, limit: params.limit, before: params.before, after: params.after, withLogs: params.withLogs, withDecodedLogs: params.withDecodedLogs, quoteCurrency: params.quoteCurrency, }); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } }); server.tool("multichain_balances", "Gets token balances for a wallet address across multiple blockchains. " + "Requires walletAddress. Optional parameters include chains array to specify networks, " + "quoteCurrency for value conversion, limit (default 10), pagination (before), " + "and cutoffTimestamp to filter by time. " + "Use this to get a comprehensive view of token holdings across different blockchains.", { walletAddress: z.string(), quoteCurrency: z .enum(Object.values(validQuoteValues)) .optional(), before: z.string().optional(), limit: z.number().optional().default(10), chains: z .array(z.union([ z.enum(Object.values(ChainName)), z.number(), ])) .optional(), cutoffTimestamp: z.number().optional(), }, async (params) => { try { const response = await goldRushClient.AllChainsService.getMultiChainBalances(params.walletAddress, { quoteCurrency: params.quoteCurrency, before: params.before, limit: params.limit, chains: params.chains, cutoffTimestamp: params.cutoffTimestamp, }); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } }); server.tool("multichain_address_activity", "Gets a summary of wallet activity across all supported blockchains. " + "Requires walletAddress. Optional parameter testnets (default false) " + "determines whether to include testnet activity. " + "Returns a comprehensive summary of chain activity including transaction counts, " + "first/last activity timestamps, and activity status across all networks.", { walletAddress: z.string(), testnets: z.boolean().optional().default(false), }, async (params) => { try { const response = await goldRushClient.AllChainsService.getAddressActivity(params.walletAddress, { testnets: params.testnets }); return { content: [ { type: "text", text: stringifyWithBigInt(response.data), }, ], }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error}` }], isError: true, }; } }); } //# sourceMappingURL=AllChainsService.js.map