@0xmonaco/types 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,6 +16,11 @@ export declare const SimulateFeeParamsSchema: z.ZodObject<{
16
16
  }>;
17
17
  price: z.ZodString;
18
18
  quantity: z.ZodString;
19
+ order_type: z.ZodOptional<z.ZodEnum<{
20
+ LIMIT: "LIMIT";
21
+ MARKET: "MARKET";
22
+ }>>;
23
+ slippage_tolerance_bps: z.ZodOptional<z.ZodNumber>;
19
24
  }, z.core.$strip>;
20
25
  /**
21
26
  * Zod schema for fee simulation response
@@ -33,6 +38,9 @@ export declare const SimulateFeeResponseSchema: z.ZodObject<{
33
38
  notional: z.ZodString;
34
39
  taker_total_payment: z.ZodString;
35
40
  total_taker_fees: z.ZodString;
41
+ max_quantity: z.ZodNullable<z.ZodString>;
42
+ max_quantity_raw: z.ZodNullable<z.ZodString>;
43
+ slippage_tolerance_bps: z.ZodNullable<z.ZodNumber>;
36
44
  }, z.core.$strip>;
37
45
  /**
38
46
  * Parameters for simulating order fees
@@ -8,7 +8,8 @@ import { z } from "zod";
8
8
  /**
9
9
  * Zod schema for simulating order fees parameters
10
10
  */
11
- export const SimulateFeeParamsSchema = z.object({
11
+ export const SimulateFeeParamsSchema = z
12
+ .object({
12
13
  /** Trading pair ID */
13
14
  trading_pair_id: z.string().trim().min(1, "Trading pair ID is required and cannot be empty"),
14
15
  /** Order side: "BUY" or "SELL" */
@@ -29,6 +30,24 @@ export const SimulateFeeParamsSchema = z.object({
29
30
  .min(1, "Quantity is required and cannot be empty")
30
31
  .refine((val) => !Number.isNaN(Number(val)), "Quantity must be a valid number")
31
32
  .refine((val) => Number(val) > 0, "Quantity must be greater than 0"),
33
+ /** Order type: "LIMIT" (default) or "MARKET". MARKET orders include a slippage buffer in the lock amount. */
34
+ order_type: z.enum(["LIMIT", "MARKET"]).optional(),
35
+ /** Slippage tolerance in basis points (0–1000). Only valid for MARKET orders. Default: 500 (5%). */
36
+ slippage_tolerance_bps: z
37
+ .number()
38
+ .int()
39
+ .min(0, "Slippage tolerance must be between 0 and 1000 bps")
40
+ .max(1000, "Slippage tolerance must be between 0 and 1000 bps")
41
+ .optional(),
42
+ })
43
+ .superRefine((data, ctx) => {
44
+ if (data.slippage_tolerance_bps !== undefined && data.order_type !== "MARKET") {
45
+ ctx.addIssue({
46
+ code: z.ZodIssueCode.custom,
47
+ message: "slippage_tolerance_bps is only valid when order_type is MARKET",
48
+ path: ["slippage_tolerance_bps"],
49
+ });
50
+ }
32
51
  });
33
52
  /**
34
53
  * Zod schema for fee simulation response
@@ -58,4 +77,10 @@ export const SimulateFeeResponseSchema = z.object({
58
77
  taker_total_payment: z.string(),
59
78
  /** Total taker fees (monaco + application) */
60
79
  total_taker_fees: z.string(),
80
+ /** Maximum quantity affordable at the given price, accounting for fees (null if not authenticated or balance unavailable) */
81
+ max_quantity: z.string().nullable(),
82
+ /** Maximum quantity in RAW (smallest unit) format */
83
+ max_quantity_raw: z.string().nullable(),
84
+ /** Slippage tolerance used in the calculation, echoed back for MARKET orders (null for LIMIT orders) */
85
+ slippage_tolerance_bps: z.number().nullable(),
61
86
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",