Skip to main content
Glama

zetrix_ws_subscribe_tx

Subscribe to real-time transaction notifications for specific Zetrix blockchain addresses to monitor account activity and receive instant updates.

Instructions

Subscribe to transaction notifications for specific addresses

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addressesYesArray of account addresses to subscribe to

Implementation Reference

  • MCP server tool handler for 'zetrix_ws_subscribe_tx': validates arguments, gets WebSocket client, calls subscribeTransactions, and returns result.
    case "zetrix_ws_subscribe_tx": { if (!args) { throw new Error("Missing arguments"); } const wsClient = getWebSocketClient(); const result = await wsClient.subscribeTransactions( args.addresses as string[] ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
  • Tool definition including name, description, and input schema requiring 'addresses' array.
    { name: "zetrix_ws_subscribe_tx", description: "Subscribe to transaction notifications for specific addresses", inputSchema: { type: "object", properties: { addresses: { type: "array", description: "Array of account addresses to subscribe to", }, }, required: ["addresses"], }, },
  • Core implementation of transaction subscription: sends CHAIN_SUBSCRIBE_TX WebSocket message, awaits successful response with timeout.
    subscribeTransactions(addresses: string[]): Promise<ChainResponse> { return new Promise((resolve, reject) => { if (!this.isRegistered) { reject(new Error("WebSocket not registered. Call registerAndConnect first.")); return; } const request: ChainSubscribeTxRequest = { type: ChainMessageType.CHAIN_SUBSCRIBE_TX, address: addresses, }; const timeout = setTimeout(() => { reject(new Error("Subscription timeout")); }, 10000); const onMessage = (response: ChainResponse) => { if (response.error_code === 0) { clearTimeout(timeout); resolve(response); } }; this.once("message", onMessage); this.sendMessage(request); }); }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Zetrix-Chain/zetrix-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server