sei-agent-kit
Version:
A package for building AI agents on the SEI blockchain
26 lines • 1.67 kB
JavaScript
import { StructuredTool } from "langchain/tools";
import { z } from "zod";
const CitrexCancelAndReplaceOrderInputSchema = z.object({
orderId: z.string().startsWith("0x").describe("The ID of the order to replace"),
isBuy: z.boolean().describe("Whether to buy (true) or sell (false)"),
price: z.number().positive().describe("The price of the asset you intend to order"),
productId: z.number().int().positive().describe("The product ID of asset"),
quantity: z.number().positive().describe("The amount of the asset you intend to order"),
expiration: z.number().optional().describe("The expiration time of the order in milliseconds (default: now + 30 days)"),
nonce: z.number().optional().describe("A unique identifier for the order (default: current unix timestamp in nano seconds)"),
});
export class SeiCitrexCancelAndReplaceOrderTool extends StructuredTool {
seiKit;
name = "citrex_cancel_and_replace_order";
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.";
schema = CitrexCancelAndReplaceOrderInputSchema;
constructor(seiKit) {
super();
this.seiKit = seiKit;
}
async _call(input) {
const { orderId, ...orderArgs } = input;
return this.seiKit.citrexCancelAndReplaceOrder(orderId, orderArgs);
}
}
//# sourceMappingURL=cancelAndReplaceOrder.js.map