"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PoolTool = void 0;
const zod_1 = require("zod");
const ai_1 = require("ai");
const pool_1 = require("../pool");
const pools = new pool_1.Pools();
const poolToolInputSchema = zod_1.z.object({
    chainId: zod_1.z.number().describe("Chain ID to get the pools for"),
    provider: zod_1.z
        .enum(pools.validProviderIDList())
        .describe("Provider to get the pools for"),
});
class PoolTool {
    constructor() {
        this.pools = pools;
        this.tool = (0, ai_1.tool)({
            description: "Get Pools for given chain and provider",
            inputSchema: poolToolInputSchema,
            execute: async (parameters) => {
                try {
                    const topPools = await this.pools.getPools(parameters.provider, parameters.chainId);
                    return JSON.stringify(topPools, null, 2);
                }
                catch (error) {
                    console.error(error);
                    return "Unable to retrieve pools";
                }
            }
        });
    }
}
exports.PoolTool = PoolTool;
