UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

36 lines (35 loc) 1.03 kB
import { StructuredTool } from "langchain/tools"; import { z } from "zod"; const StakeInputSchema = z.object({ amount: z.string().min(1, "Amount must not be empty"), }); export class SeiStakeTool extends StructuredTool { seiKit; name = 'sei_stake_tool'; description = `Stake SEI tokens. Parameters: - amount: The amount of SEI tokens to stake as a string (e.g., "1.5").`; schema = StakeInputSchema; constructor(seiKit) { super(); this.seiKit = seiKit; } async _call(input) { try { const stake = await this.seiKit.stake(input.amount); return JSON.stringify({ status: "success", stake, amount: input.amount, }); } catch (error) { return JSON.stringify({ status: "error", message: error.message, code: error.code || "UNKNOWN_ERROR", }); } } } //# sourceMappingURL=stake.js.map