"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DollarToTokenAmountTool = void 0;
const zod_1 = require("zod");
const ai_1 = require("ai");
const price_1 = require("../price");
const dollarToTokenAmountToolInputSchema = zod_1.z.object({
    tokenAddresses: zod_1.z.string(),
    chainId: zod_1.z.number(),
    amount: zod_1.z.number(),
});
class DollarToTokenAmountTool {
    constructor() {
        this.price = new price_1.Price();
        this.tool = (0, ai_1.tool)({
            description: "Get the amount of token from a dollar amount",
            inputSchema: dollarToTokenAmountToolInputSchema,
            execute: async (parameters) => {
                const priceData = await this.price.getCryptoPrices(parameters.tokenAddresses, parameters.chainId);
                // log the amount and price
                const amount = parameters.amount;
                const token_price = priceData[parameters.tokenAddresses];
                return amount / token_price;
            },
        });
    }
}
exports.DollarToTokenAmountTool = DollarToTokenAmountTool;
