UNPKG

pharos-agent-kit

Version:
56 lines 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const zod_1 = require("zod"); const getProtocolTvlAction = { name: "DEFILLAMA_GET_PROTOCOL_TVL", similes: [ "get protocol tvl", "fetch protocol tvl", "check protocol tvl", "get total value locked", "fetch total value locked", ], description: "Fetches the Total Value Locked (TVL) for a protocol using the DeFiLlama API. The protocol name should match the DeFiLlama protocol identifier.", examples: [ [ { input: { protocolName: "uniswap-v3", }, output: { status: "success", summary: { tvl: 98274459992.88, protocolName: "uniswap-v3", }, }, explanation: "The user wants to fetch the TVL for Uniswap V3 protocol. The action returns the current TVL in USD.", }, ], ], schema: zod_1.z.object({ protocolName: zod_1.z .string() .describe("The DeFiLlama protocol identifier (e.g. 'aave-v3', 'uniswap-v3')"), }), handler: async (agent, input) => { try { const tvl = await agent.fetchProtocolTvl(input.protocolName); return { status: "success", summary: { tvl, protocolName: input.protocolName, }, }; } catch (error) { return { status: "error", error: error.message, }; } }, }; exports.default = getProtocolTvlAction; //# sourceMappingURL=get_protocol_tvl_action.js.map