sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
36 lines (35 loc) • 1.05 kB
JavaScript
import { StructuredTool } from "langchain/tools";
import { z } from "zod";
const UnstakeInputSchema = z.object({
amount: z.string().min(1, "Amount must not be empty"),
});
export class SeiUnstakeTool extends StructuredTool {
seiKit;
name = 'sei_unstake_tool';
description = `Unstake SEI tokens.
Parameters:
- amount: The amount of SEI tokens to unstake as a string (e.g., "1.5").`;
schema = UnstakeInputSchema;
constructor(seiKit) {
super();
this.seiKit = seiKit;
}
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",
});
}
}
}
//# sourceMappingURL=unstake.js.map