UNPKG

sei-agent-kit

Version:

A package for building AI agents on the SEI blockchain

33 lines 2.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SeiCitrexPlaceOrderTool = void 0; const tools_1 = require("langchain/tools"); const enums_js_1 = require("../../../node_modules/citrex-sdk/lib/enums.js"); const zod_1 = require("zod"); // Input schema for placing an order on Citrex const CitrexPlaceOrderInputSchema = zod_1.z.object({ 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 ex. 1, 2"), orderType: zod_1.z.nativeEnum(enums_js_1.OrderType).optional().describe("The type of order (default: MARKET)"), timeInForce: zod_1.z.nativeEnum(enums_js_1.TimeInForce).optional().describe("The time in force for the order (default: FOK)"), 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)"), priceIncrement: zod_1.z.number().optional().describe("The price precision for the product (required for MARKET orders) find it in the product info under the 'increment' key. in wei ex. (10000000000000)"), slippage: zod_1.z.number().optional().describe("The percentage by which to adjust the price when orderType is MARKET (default: 2.5%)"), }); class SeiCitrexPlaceOrderTool extends tools_1.StructuredTool { constructor(seiKit) { super(); this.seiKit = seiKit; this.name = "citrex_place_order"; this.description = "Places an order on the Citrex Protocol. You can place limit or market orders to buy or sell assets. Returns the 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 = CitrexPlaceOrderInputSchema; } async _call(input) { return this.seiKit.citrexPlaceOrder(input); } } exports.SeiCitrexPlaceOrderTool = SeiCitrexPlaceOrderTool; //# sourceMappingURL=placeOrder.js.map