sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
39 lines (38 loc) • 1.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SeiStakeTool = void 0;
const tools_1 = require("langchain/tools");
const zod_1 = require("zod");
const StakeInputSchema = zod_1.z.object({
amount: zod_1.z.string().min(1, "Amount must not be empty"),
});
class SeiStakeTool extends tools_1.StructuredTool {
constructor(seiKit) {
super();
this.seiKit = seiKit;
this.name = 'sei_stake_tool';
this.description = `Stake SEI tokens.
Parameters:
- amount: The amount of SEI tokens to stake as a string (e.g., "1.5").`;
this.schema = StakeInputSchema;
}
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",
});
}
}
}
exports.SeiStakeTool = SeiStakeTool;
//# sourceMappingURL=stake.js.map