UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

39 lines (38 loc) 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SeiUnstakeTool = void 0; const tools_1 = require("langchain/tools"); const zod_1 = require("zod"); const UnstakeInputSchema = zod_1.z.object({ amount: zod_1.z.string().min(1, "Amount must not be empty"), }); class SeiUnstakeTool extends tools_1.StructuredTool { constructor(seiKit) { super(); this.seiKit = seiKit; this.name = 'sei_unstake_tool'; this.description = `Unstake SEI tokens. Parameters: - amount: The amount of SEI tokens to unstake as a string (e.g., "1.5").`; this.schema = UnstakeInputSchema; } async _call(input) { try { const unstake = await this.seiKit.unstake(input.amount); return JSON.stringify({ status: "success", unstake, amount: input.amount, }); } catch (error) { return JSON.stringify({ status: "error", message: error.message, code: error.code || "UNKNOWN_ERROR", }); } } } exports.SeiUnstakeTool = SeiUnstakeTool; //# sourceMappingURL=unstake.js.map