UNPKG

@agentek/tools

Version:

Blockchain tools for AI agents

65 lines 2.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.coinchanGetVestableAmount = exports.coinchanGetCoinsCount = exports.coinchanGetCoins = void 0; const client_js_1 = require("../client.js"); const zod_1 = require("zod"); const constants_js_1 = require("./constants.js"); exports.coinchanGetCoins = (0, client_js_1.createTool)({ name: "coinchanGetCoins", description: "Fetch a list of Coinchan token IDs between index ranges", supportedChains: constants_js_1.supportedChains, parameters: zod_1.z.object({ chainId: zod_1.z.number(), start: zod_1.z.number(), finish: zod_1.z.number(), }), execute: async (client, args) => { const { chainId, start, finish } = args; const publicClient = client.getPublicClient(chainId); const coins = await publicClient.readContract({ address: constants_js_1.CoinchanAddress, abi: constants_js_1.CoinchanAbi, functionName: "getCoins", args: [start, finish] }); return { start, finish, coins }; } }); exports.coinchanGetCoinsCount = (0, client_js_1.createTool)({ name: "coinchanGetCoinsCount", description: "Get total number of Coinchan tokens created", supportedChains: constants_js_1.supportedChains, parameters: zod_1.z.object({ chainId: zod_1.z.number() }), execute: async (client, args) => { const { chainId } = args; const publicClient = client.getPublicClient(chainId); const count = await publicClient.readContract({ address: constants_js_1.CoinchanAddress, abi: constants_js_1.CoinchanAbi, functionName: "getCoinsCount", args: [] }); return { count }; } }); exports.coinchanGetVestableAmount = (0, client_js_1.createTool)({ name: "coinchanGetVestableAmount", description: "Get the amount of liquidity currently available to vest for a locked Coinchan token", supportedChains: constants_js_1.supportedChains, parameters: zod_1.z.object({ chainId: zod_1.z.number(), coinId: zod_1.z.bigint(), }), execute: async (client, args) => { const { chainId, coinId } = args; const publicClient = client.getPublicClient(chainId); const vestable = await publicClient.readContract({ address: constants_js_1.CoinchanAddress, abi: constants_js_1.CoinchanAbi, functionName: "getVestableAmount", args: [coinId] }); return { coinId, vestable: vestable.toString() }; } }); //# sourceMappingURL=tools.js.map