sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
29 lines • 1.94 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SeiCitrexCancelAndReplaceOrderTool = void 0;
const tools_1 = require("langchain/tools");
const zod_1 = require("zod");
const CitrexCancelAndReplaceOrderInputSchema = zod_1.z.object({
orderId: zod_1.z.string().startsWith("0x").describe("The ID of the order to replace"),
isBuy: zod_1.z.boolean().describe("Whether to buy (true) or sell (false)"),
price: zod_1.z.number().positive().describe("The price of the asset you intend to order"),
productId: zod_1.z.number().int().positive().describe("The product ID of asset"),
quantity: zod_1.z.number().positive().describe("The amount of the asset you intend to order"),
expiration: zod_1.z.number().optional().describe("The expiration time of the order in milliseconds (default: now + 30 days)"),
nonce: zod_1.z.number().optional().describe("A unique identifier for the order (default: current unix timestamp in nano seconds)"),
});
class SeiCitrexCancelAndReplaceOrderTool extends tools_1.StructuredTool {
constructor(seiKit) {
super();
this.seiKit = seiKit;
this.name = "citrex_cancel_and_replace_order";
this.description = "Cancels and replaces an order on the Citrex Protocol. This is useful for updating an existing order without having to cancel it first and then place a new one. Returns the newly created order with details including order ID, account address, product information, price, quantity, order type, time in force, buy/sell direction, creation time, expiry, and status.";
this.schema = CitrexCancelAndReplaceOrderInputSchema;
}
async _call(input) {
const { orderId, ...orderArgs } = input;
return this.seiKit.citrexCancelAndReplaceOrder(orderId, orderArgs);
}
}
exports.SeiCitrexCancelAndReplaceOrderTool = SeiCitrexCancelAndReplaceOrderTool;
//# sourceMappingURL=cancelAndReplaceOrder.js.map