UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

41 lines 1.39 kB
import { z } from "zod"; import { StructuredTool } from "langchain/tools"; const SeiRepayTakaraInputSchema = z.object({ ticker: z .string() .describe("The token ticker (e.g., 'USDC', 'SEI')"), repayAmount: 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 */ export class SeiRepayTakaraTool extends StructuredTool { seiKit; name = "repay_takara"; description = "Repays borrowed tokens to the Takara Protocol. Use 'MAX' as repayAmount to repay the full borrow balance."; schema = SeiRepayTakaraInputSchema; constructor(seiKit) { super(); this.seiKit = seiKit; } 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", }); } } } //# sourceMappingURL=repay.js.map