UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

44 lines 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SeiRepayTakaraTool = void 0; const zod_1 = require("zod"); const tools_1 = require("langchain/tools"); const SeiRepayTakaraInputSchema = zod_1.z.object({ ticker: zod_1.z .string() .describe("The token ticker (e.g., 'USDC', 'SEI')"), repayAmount: zod_1.z .string() .describe("The amount to repay in human-readable format (e.g., '50' for 50 USDC). Use 'MAX' to repay full balance"), }); /** * LangChain tool for repaying borrowed Takara tokens */ class SeiRepayTakaraTool extends tools_1.StructuredTool { constructor(seiKit) { super(); this.seiKit = seiKit; this.name = "repay_takara"; this.description = "Repays borrowed tokens to the Takara Protocol. Use 'MAX' as repayAmount to repay the full borrow balance."; this.schema = SeiRepayTakaraInputSchema; } async _call({ ticker, repayAmount }) { try { const result = await this.seiKit.repayTakara(ticker, repayAmount); return JSON.stringify({ status: "success", message: `Successfully repaid tokens. Transaction hash: ${result}`, txHash: result, }); } catch (error) { return JSON.stringify({ status: "error", message: error.message, code: error.code || "UNKNOWN_ERROR", }); } } } exports.SeiRepayTakaraTool = SeiRepayTakaraTool; //# sourceMappingURL=repay.js.map