@0xmonaco/types 0.8.7-develop.34bd452 → 0.8.7-develop.a107b34
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.
- package/README.md +5 -3
- package/dist/api/index.d.ts +7 -0
- package/dist/applications/index.d.ts +47 -5
- package/dist/applications/index.js +2 -1
- package/dist/applications/requests.d.ts +78 -0
- package/dist/applications/requests.js +7 -0
- package/dist/applications/responses.d.ts +211 -1
- package/dist/applications/responses.js +3 -1
- package/dist/auth/index.d.ts +6 -12
- package/dist/auth/index.js +2 -2
- package/dist/auth/responses.d.ts +0 -11
- package/dist/delegated-agents/index.d.ts +17 -1
- package/dist/faucet/index.d.ts +54 -0
- package/dist/faucet/index.js +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/margin-accounts/index.d.ts +52 -16
- package/dist/market/index.d.ts +123 -4
- package/dist/positions/index.d.ts +23 -0
- package/dist/profile/index.d.ts +90 -1
- package/dist/sdk/index.d.ts +21 -0
- package/dist/sub-accounts/index.d.ts +145 -0
- package/dist/sub-accounts/index.js +9 -0
- package/dist/trading/index.d.ts +6 -6
- package/dist/trading/responses.d.ts +8 -27
- package/dist/validation/margin-accounts.d.ts +50 -10
- package/dist/validation/margin-accounts.js +36 -12
- package/dist/validation/positions.d.ts +4 -0
- package/dist/validation/positions.js +4 -0
- package/dist/validation/profile.d.ts +7 -0
- package/dist/validation/profile.js +7 -0
- package/dist/validation/trading.d.ts +8 -33
- package/dist/validation/trading.js +42 -33
- package/dist/validation/vault.d.ts +8 -0
- package/dist/validation/vault.js +3 -0
- package/dist/vault/index.d.ts +44 -12
- package/dist/vault/responses.d.ts +23 -8
- package/dist/whitelist/index.d.ts +44 -0
- package/dist/whitelist/index.js +10 -0
- package/dist/wire/assert.d.ts +54 -0
- package/dist/wire/assert.js +0 -0
- package/dist/wire/audit.d.ts +47 -0
- package/dist/wire/audit.js +43 -0
- package/dist/wire/coverage.d.ts +1 -0
- package/dist/wire/coverage.js +0 -0
- package/dist/wire/index.d.ts +21 -0
- package/dist/wire/index.js +2 -0
- package/dist/wire/operations.d.ts +15 -0
- package/dist/wire/operations.js +100 -0
- package/dist/wire/schema.d.ts +8810 -0
- package/dist/wire/schema.js +4 -0
- package/dist/withdrawals/index.d.ts +60 -0
- package/dist/withdrawals/index.js +0 -0
- package/package.json +6 -2
package/dist/trading/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { BaseAPI } from "../api/index";
|
|
7
7
|
import type { OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
8
|
-
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse,
|
|
8
|
+
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ParentTpSlLegParams, ReplaceOrderResponse } from "./responses";
|
|
9
9
|
/**
|
|
10
10
|
* Trading API interface.
|
|
11
11
|
* Provides methods for placing and managing orders.
|
|
@@ -29,6 +29,8 @@ export interface TradingAPI extends BaseAPI {
|
|
|
29
29
|
expirationDate?: string;
|
|
30
30
|
timeInForce?: TimeInForce;
|
|
31
31
|
marginAccountId?: string;
|
|
32
|
+
riskBucketId?: string;
|
|
33
|
+
riskBucketCollateral?: string;
|
|
32
34
|
strategyKey?: string;
|
|
33
35
|
positionSide?: PositionSide;
|
|
34
36
|
leverage?: string;
|
|
@@ -50,6 +52,8 @@ export interface TradingAPI extends BaseAPI {
|
|
|
50
52
|
tradingMode?: TradingMode;
|
|
51
53
|
slippageTolerance?: number;
|
|
52
54
|
marginAccountId?: string;
|
|
55
|
+
riskBucketId?: string;
|
|
56
|
+
riskBucketCollateral?: string;
|
|
53
57
|
strategyKey?: string;
|
|
54
58
|
positionSide?: PositionSide;
|
|
55
59
|
leverage?: string;
|
|
@@ -63,10 +67,6 @@ export interface TradingAPI extends BaseAPI {
|
|
|
63
67
|
* @returns Promise resolving to the cancellation result
|
|
64
68
|
*/
|
|
65
69
|
cancelOrder(orderId: string): Promise<CancelOrderResponse>;
|
|
66
|
-
/**
|
|
67
|
-
* Creates a standalone conditional TP/SL order.
|
|
68
|
-
*/
|
|
69
|
-
createConditionalOrder(params: CreateConditionalOrderParams): Promise<CreateConditionalOrderResponse>;
|
|
70
70
|
/**
|
|
71
71
|
* Cancels an active conditional TP/SL order.
|
|
72
72
|
*/
|
|
@@ -135,4 +135,4 @@ export interface TradingAPI extends BaseAPI {
|
|
|
135
135
|
}
|
|
136
136
|
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderType, PositionSide, TimeInForce, TradingMode, } from "./orders";
|
|
137
137
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
138
|
-
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder,
|
|
138
|
+
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, UpdatedFields, } from "./responses";
|
|
@@ -74,7 +74,9 @@ export interface CreateOrderResponse {
|
|
|
74
74
|
match_result?: MatchResult;
|
|
75
75
|
/** Resolved margin account ID for margin/perp orders */
|
|
76
76
|
margin_account_id?: string;
|
|
77
|
-
/** Resolved
|
|
77
|
+
/** Resolved isolated risk bucket ID for risk-bucket-scoped margin orders */
|
|
78
|
+
risk_bucket_id?: string;
|
|
79
|
+
/** Client strategy key carried for compatibility */
|
|
78
80
|
strategy_key?: string;
|
|
79
81
|
/** Delegated agent ID when submitted through a delegated session */
|
|
80
82
|
delegation_id?: string;
|
|
@@ -286,7 +288,11 @@ export interface BatchCreateOrderParams {
|
|
|
286
288
|
timeInForce?: Extract<TimeInForce, "GTC" | "IOC" | "FOK">;
|
|
287
289
|
/** Margin account UUID for margin/perp orders */
|
|
288
290
|
marginAccountId?: string;
|
|
289
|
-
/**
|
|
291
|
+
/** Existing isolated risk bucket UUID for risk-bucket-scoped margin orders */
|
|
292
|
+
riskBucketId?: string;
|
|
293
|
+
/** Collateral to allocate into a new isolated risk bucket */
|
|
294
|
+
riskBucketCollateral?: string;
|
|
295
|
+
/** Client strategy key carried for compatibility */
|
|
290
296
|
strategyKey?: string;
|
|
291
297
|
/** Position side for margin/perp orders */
|
|
292
298
|
positionSide?: PositionSide;
|
|
@@ -308,31 +314,6 @@ export interface BatchReplaceOrderParams {
|
|
|
308
314
|
/** For sub-accounts: use master's balance (optional) */
|
|
309
315
|
useMasterBalance?: boolean;
|
|
310
316
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Parameters for creating a standalone conditional TP/SL order.
|
|
313
|
-
*/
|
|
314
|
-
export interface CreateConditionalOrderParams {
|
|
315
|
-
tradingPairId: string;
|
|
316
|
-
marginAccountId: string;
|
|
317
|
-
conditionType: ConditionalOrderConditionType;
|
|
318
|
-
triggerPrice: string;
|
|
319
|
-
triggerSource?: ConditionalOrderTriggerSource;
|
|
320
|
-
side: OrderSide;
|
|
321
|
-
positionSide: Exclude<PositionSide, "NONE">;
|
|
322
|
-
orderType: OrderType;
|
|
323
|
-
limitPrice?: string;
|
|
324
|
-
quantity?: string;
|
|
325
|
-
reduceOnly?: boolean;
|
|
326
|
-
timeInForce?: Extract<TimeInForce, "GTC" | "IOC">;
|
|
327
|
-
slippageToleranceBps?: number;
|
|
328
|
-
expiresAt?: string;
|
|
329
|
-
}
|
|
330
|
-
export interface CreateConditionalOrderResponse {
|
|
331
|
-
conditional_order_id: string;
|
|
332
|
-
status: "SUCCESS" | "FAILED";
|
|
333
|
-
message: string;
|
|
334
|
-
state: ConditionalOrderState;
|
|
335
|
-
}
|
|
336
317
|
export interface CancelConditionalOrderResponse {
|
|
337
318
|
conditional_order_id: string;
|
|
338
319
|
status: "SUCCESS" | "FAILED";
|
|
@@ -8,13 +8,13 @@ export declare const ListMarginAccountsSchema: z.ZodObject<{
|
|
|
8
8
|
state: z.ZodOptional<z.ZodString>;
|
|
9
9
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
10
10
|
}, z.core.$strip>;
|
|
11
|
-
export declare const CreateMarginAccountSchema: z.ZodOptional<z.ZodObject<{
|
|
12
|
-
label: z.ZodOptional<z.ZodString>;
|
|
13
|
-
collateralAsset: z.ZodOptional<z.ZodString>;
|
|
14
|
-
}, z.core.$strip>>;
|
|
15
11
|
export declare const GetMarginAccountSummarySchema: z.ZodObject<{
|
|
16
12
|
marginAccountId: z.ZodUUID;
|
|
13
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
17
14
|
}, z.core.$strip>;
|
|
15
|
+
export declare const GetParentMarginAccountSummarySchema: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
18
|
export declare const GetAvailableCollateralSchema: z.ZodOptional<z.ZodObject<{
|
|
19
19
|
asset: z.ZodOptional<z.ZodString>;
|
|
20
20
|
}, z.core.$strip>>;
|
|
@@ -23,9 +23,17 @@ export declare const TransferCollateralSchema: z.ZodObject<{
|
|
|
23
23
|
request: z.ZodObject<{
|
|
24
24
|
asset: z.ZodString;
|
|
25
25
|
amount: z.ZodString;
|
|
26
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
27
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
26
28
|
}, z.core.$strip>;
|
|
27
29
|
}, z.core.$strip>;
|
|
28
|
-
export declare const
|
|
30
|
+
export declare const TransferCollateralToParentMarginAccountSchema: z.ZodObject<{
|
|
31
|
+
request: z.ZodObject<{
|
|
32
|
+
asset: z.ZodString;
|
|
33
|
+
amount: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
|
|
29
37
|
request: z.ZodObject<{
|
|
30
38
|
asset: z.ZodString;
|
|
31
39
|
amount: z.ZodString;
|
|
@@ -33,17 +41,27 @@ export declare const TransferCollateralToAutoMarginAccountSchema: z.ZodObject<{
|
|
|
33
41
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
34
42
|
}, z.core.$strip>;
|
|
35
43
|
}, z.core.$strip>;
|
|
44
|
+
export declare const TransferCollateralFromParentMarginAccountSchema: z.ZodObject<{
|
|
45
|
+
request: z.ZodObject<{
|
|
46
|
+
asset: z.ZodString;
|
|
47
|
+
amount: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
}, z.core.$strip>;
|
|
36
50
|
export declare const GetMarginAccountMovementsSchema: z.ZodObject<{
|
|
37
51
|
page: z.ZodOptional<z.ZodNumber>;
|
|
38
52
|
page_size: z.ZodOptional<z.ZodNumber>;
|
|
39
53
|
marginAccountId: z.ZodUUID;
|
|
40
54
|
movement_type: z.ZodOptional<z.ZodString>;
|
|
41
55
|
}, z.core.$strip>;
|
|
56
|
+
export declare const GetParentMarginAccountMovementsSchema: z.ZodOptional<z.ZodObject<{
|
|
57
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
page_size: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
movement_type: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
42
61
|
export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
43
62
|
marginAccountId: z.ZodUUID;
|
|
44
63
|
request: z.ZodObject<{
|
|
45
64
|
tradingPairId: z.ZodUUID;
|
|
46
|
-
strategyKey: z.ZodOptional<z.ZodString>;
|
|
47
65
|
side: z.ZodEnum<{
|
|
48
66
|
BUY: "BUY";
|
|
49
67
|
SELL: "SELL";
|
|
@@ -61,12 +79,11 @@ export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
|
61
79
|
quantity: z.ZodString;
|
|
62
80
|
leverage: z.ZodString;
|
|
63
81
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
-
}, z.core.$
|
|
82
|
+
}, z.core.$strict>;
|
|
65
83
|
}, z.core.$strip>;
|
|
66
|
-
export declare const
|
|
84
|
+
export declare const SimulateParentMarginOrderRiskSchema: z.ZodObject<{
|
|
67
85
|
request: z.ZodObject<{
|
|
68
86
|
tradingPairId: z.ZodUUID;
|
|
69
|
-
strategyKey: z.ZodOptional<z.ZodString>;
|
|
70
87
|
side: z.ZodEnum<{
|
|
71
88
|
BUY: "BUY";
|
|
72
89
|
SELL: "SELL";
|
|
@@ -84,5 +101,28 @@ export declare const SimulateAutoMarginOrderRiskSchema: z.ZodObject<{
|
|
|
84
101
|
quantity: z.ZodString;
|
|
85
102
|
leverage: z.ZodString;
|
|
86
103
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
-
}, z.core.$
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
107
|
+
request: z.ZodObject<{
|
|
108
|
+
side: z.ZodEnum<{
|
|
109
|
+
BUY: "BUY";
|
|
110
|
+
SELL: "SELL";
|
|
111
|
+
}>;
|
|
112
|
+
positionSide: z.ZodEnum<{
|
|
113
|
+
LONG: "LONG";
|
|
114
|
+
SHORT: "SHORT";
|
|
115
|
+
NONE: "NONE";
|
|
116
|
+
}>;
|
|
117
|
+
orderType: z.ZodEnum<{
|
|
118
|
+
LIMIT: "LIMIT";
|
|
119
|
+
MARKET: "MARKET";
|
|
120
|
+
}>;
|
|
121
|
+
price: z.ZodOptional<z.ZodString>;
|
|
122
|
+
quantity: z.ZodString;
|
|
123
|
+
leverage: z.ZodString;
|
|
124
|
+
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
125
|
+
tradingPairId: z.ZodUUID;
|
|
126
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strict>;
|
|
88
128
|
}, z.core.$strip>;
|
|
@@ -11,15 +11,15 @@ export const ListMarginAccountsSchema = PaginationSchema.extend({
|
|
|
11
11
|
state: z.string().trim().min(1, "State cannot be empty").optional(),
|
|
12
12
|
tradingPairId: UUIDSchema.optional(),
|
|
13
13
|
});
|
|
14
|
-
export const CreateMarginAccountSchema = z
|
|
15
|
-
.object({
|
|
16
|
-
label: z.string().trim().min(1, "Label cannot be empty").optional(),
|
|
17
|
-
collateralAsset: z.string().trim().min(1, "Collateral asset cannot be empty").optional(),
|
|
18
|
-
})
|
|
19
|
-
.optional();
|
|
20
14
|
export const GetMarginAccountSummarySchema = z.object({
|
|
21
15
|
marginAccountId: UUIDSchema,
|
|
16
|
+
tradingPairId: UUIDSchema.optional(),
|
|
22
17
|
});
|
|
18
|
+
export const GetParentMarginAccountSummarySchema = z
|
|
19
|
+
.object({
|
|
20
|
+
tradingPairId: UUIDSchema.optional(),
|
|
21
|
+
})
|
|
22
|
+
.optional();
|
|
23
23
|
export const GetAvailableCollateralSchema = z
|
|
24
24
|
.object({
|
|
25
25
|
asset: z.string().trim().min(1, "Asset cannot be empty").optional(),
|
|
@@ -28,8 +28,14 @@ export const GetAvailableCollateralSchema = z
|
|
|
28
28
|
const TransferCollateralRequestSchema = z.object({
|
|
29
29
|
asset: z.string().trim().min(1, "Asset cannot be empty"),
|
|
30
30
|
amount: PositiveDecimalStringSchema,
|
|
31
|
+
tradingPairId: UUIDSchema.optional(),
|
|
32
|
+
strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
|
|
31
33
|
});
|
|
32
|
-
const
|
|
34
|
+
const ParentMarginAccountCollateralRequestSchema = z.object({
|
|
35
|
+
asset: z.string().trim().min(1, "Asset cannot be empty"),
|
|
36
|
+
amount: PositiveDecimalStringSchema,
|
|
37
|
+
});
|
|
38
|
+
const RiskBucketRequestSchema = z.object({
|
|
33
39
|
tradingPairId: UUIDSchema,
|
|
34
40
|
strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
|
|
35
41
|
});
|
|
@@ -37,16 +43,24 @@ export const TransferCollateralSchema = z.object({
|
|
|
37
43
|
marginAccountId: UUIDSchema,
|
|
38
44
|
request: TransferCollateralRequestSchema,
|
|
39
45
|
});
|
|
40
|
-
export const
|
|
41
|
-
request:
|
|
46
|
+
export const TransferCollateralToParentMarginAccountSchema = z.object({
|
|
47
|
+
request: ParentMarginAccountCollateralRequestSchema,
|
|
48
|
+
});
|
|
49
|
+
export const TransferCollateralToRiskBucketSchema = z.object({
|
|
50
|
+
request: ParentMarginAccountCollateralRequestSchema.merge(RiskBucketRequestSchema),
|
|
51
|
+
});
|
|
52
|
+
export const TransferCollateralFromParentMarginAccountSchema = z.object({
|
|
53
|
+
request: ParentMarginAccountCollateralRequestSchema,
|
|
42
54
|
});
|
|
43
55
|
export const GetMarginAccountMovementsSchema = PaginationSchema.extend({
|
|
44
56
|
marginAccountId: UUIDSchema,
|
|
45
57
|
movement_type: z.string().trim().min(1, "Movement type cannot be empty").optional(),
|
|
46
58
|
});
|
|
47
|
-
const
|
|
59
|
+
export const GetParentMarginAccountMovementsSchema = PaginationSchema.extend({
|
|
60
|
+
movement_type: z.string().trim().min(1, "Movement type cannot be empty").optional(),
|
|
61
|
+
}).optional();
|
|
62
|
+
const BaseSimulateOrderRiskRequestSchema = z.object({
|
|
48
63
|
tradingPairId: UUIDSchema,
|
|
49
|
-
strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
|
|
50
64
|
side: OrderSideSchema,
|
|
51
65
|
positionSide: PositionSideSchema,
|
|
52
66
|
orderType: OrderTypeSchema,
|
|
@@ -55,6 +69,8 @@ const SimulateOrderRiskRequestSchema = z.object({
|
|
|
55
69
|
leverage: PositiveDecimalStringSchema,
|
|
56
70
|
reduceOnly: z.boolean().optional(),
|
|
57
71
|
});
|
|
72
|
+
const SimulateOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.strict();
|
|
73
|
+
const SimulateRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(RiskBucketRequestSchema).strict();
|
|
58
74
|
export const SimulateOrderRiskSchema = z
|
|
59
75
|
.object({
|
|
60
76
|
marginAccountId: UUIDSchema,
|
|
@@ -64,7 +80,7 @@ export const SimulateOrderRiskSchema = z
|
|
|
64
80
|
message: "price is required for LIMIT risk simulations",
|
|
65
81
|
path: ["request", "price"],
|
|
66
82
|
});
|
|
67
|
-
export const
|
|
83
|
+
export const SimulateParentMarginOrderRiskSchema = z
|
|
68
84
|
.object({
|
|
69
85
|
request: SimulateOrderRiskRequestSchema,
|
|
70
86
|
})
|
|
@@ -72,3 +88,11 @@ export const SimulateAutoMarginOrderRiskSchema = z
|
|
|
72
88
|
message: "price is required for LIMIT risk simulations",
|
|
73
89
|
path: ["request", "price"],
|
|
74
90
|
});
|
|
91
|
+
export const SimulateRiskBucketOrderRiskSchema = z
|
|
92
|
+
.object({
|
|
93
|
+
request: SimulateRiskBucketOrderRiskRequestSchema,
|
|
94
|
+
})
|
|
95
|
+
.refine((data) => data.request.orderType !== "LIMIT" || data.request.price !== undefined, {
|
|
96
|
+
message: "price is required for LIMIT risk simulations",
|
|
97
|
+
path: ["request", "price"],
|
|
98
|
+
});
|
|
@@ -29,6 +29,10 @@ export declare const ClosePositionSchema: z.ZodObject<{
|
|
|
29
29
|
quantity: z.ZodOptional<z.ZodString>;
|
|
30
30
|
}, z.core.$strip>;
|
|
31
31
|
}, z.core.$strip>;
|
|
32
|
+
export declare const BatchCloseAllSchema: z.ZodObject<{
|
|
33
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
34
|
+
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
}, z.core.$strip>;
|
|
32
36
|
export declare const GetPositionRiskSchema: z.ZodObject<{
|
|
33
37
|
positionId: z.ZodUUID;
|
|
34
38
|
}, z.core.$strip>;
|
|
@@ -38,6 +38,10 @@ export const ClosePositionSchema = PositionIdSchema.extend({
|
|
|
38
38
|
message: "limitPrice is only allowed for LIMIT close requests",
|
|
39
39
|
path: ["request", "limitPrice"],
|
|
40
40
|
});
|
|
41
|
+
export const BatchCloseAllSchema = z.object({
|
|
42
|
+
tradingPairId: UUIDSchema.optional(),
|
|
43
|
+
slippageToleranceBps: SlippageToleranceBpsSchema.optional(),
|
|
44
|
+
});
|
|
41
45
|
export const GetPositionRiskSchema = PositionIdSchema;
|
|
42
46
|
export const AddPositionMarginSchema = PositionIdSchema.extend({
|
|
43
47
|
request: z.object({
|
|
@@ -67,3 +67,10 @@ export declare const GetUserTradesSchema: z.ZodObject<{
|
|
|
67
67
|
page_size: z.ZodOptional<z.ZodNumber>;
|
|
68
68
|
trading_pair_id: z.ZodOptional<z.ZodUUID>;
|
|
69
69
|
}, z.core.$strip>;
|
|
70
|
+
export declare const ListFundingPaymentsSchema: z.ZodObject<{
|
|
71
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
page_size: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
trading_pair_id: z.ZodOptional<z.ZodUUID>;
|
|
74
|
+
position_id: z.ZodOptional<z.ZodUUID>;
|
|
75
|
+
margin_account_id: z.ZodOptional<z.ZodUUID>;
|
|
76
|
+
}, z.core.$strip>;
|
|
@@ -42,3 +42,10 @@ export const GetUserTradesSchema = z.object({
|
|
|
42
42
|
page_size: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
43
43
|
trading_pair_id: UUIDSchema.optional(),
|
|
44
44
|
});
|
|
45
|
+
export const ListFundingPaymentsSchema = z.object({
|
|
46
|
+
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
47
|
+
page_size: z.number().int("Page size must be an integer").min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
48
|
+
trading_pair_id: UUIDSchema.optional(),
|
|
49
|
+
position_id: UUIDSchema.optional(),
|
|
50
|
+
margin_account_id: UUIDSchema.optional(),
|
|
51
|
+
});
|
|
@@ -101,6 +101,8 @@ export declare const PlaceLimitOrderSchema: z.ZodObject<{
|
|
|
101
101
|
FOK: "FOK";
|
|
102
102
|
}>>;
|
|
103
103
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
104
|
+
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
105
|
+
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
104
106
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
105
107
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
106
108
|
LONG: "LONG";
|
|
@@ -156,6 +158,8 @@ export declare const PlaceMarketOrderSchema: z.ZodObject<{
|
|
|
156
158
|
}>>;
|
|
157
159
|
slippageTolerance: z.ZodOptional<z.ZodNumber>;
|
|
158
160
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
161
|
+
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
162
|
+
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
159
163
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
160
164
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
161
165
|
LONG: "LONG";
|
|
@@ -266,39 +270,6 @@ export declare const ClosePositionSideSchema: z.ZodEnum<{
|
|
|
266
270
|
LONG: "LONG";
|
|
267
271
|
SHORT: "SHORT";
|
|
268
272
|
}>;
|
|
269
|
-
export declare const CreateConditionalOrderSchema: z.ZodObject<{
|
|
270
|
-
tradingPairId: z.ZodUUID;
|
|
271
|
-
marginAccountId: z.ZodUUID;
|
|
272
|
-
conditionType: z.ZodEnum<{
|
|
273
|
-
STOP_LOSS: "STOP_LOSS";
|
|
274
|
-
TAKE_PROFIT: "TAKE_PROFIT";
|
|
275
|
-
}>;
|
|
276
|
-
triggerPrice: z.ZodString;
|
|
277
|
-
triggerSource: z.ZodOptional<z.ZodEnum<{
|
|
278
|
-
MARK_PRICE: "MARK_PRICE";
|
|
279
|
-
}>>;
|
|
280
|
-
side: z.ZodEnum<{
|
|
281
|
-
BUY: "BUY";
|
|
282
|
-
SELL: "SELL";
|
|
283
|
-
}>;
|
|
284
|
-
positionSide: z.ZodEnum<{
|
|
285
|
-
LONG: "LONG";
|
|
286
|
-
SHORT: "SHORT";
|
|
287
|
-
}>;
|
|
288
|
-
orderType: z.ZodEnum<{
|
|
289
|
-
LIMIT: "LIMIT";
|
|
290
|
-
MARKET: "MARKET";
|
|
291
|
-
}>;
|
|
292
|
-
limitPrice: z.ZodOptional<z.ZodString>;
|
|
293
|
-
quantity: z.ZodOptional<z.ZodString>;
|
|
294
|
-
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
-
timeInForce: z.ZodOptional<z.ZodEnum<{
|
|
296
|
-
GTC: "GTC";
|
|
297
|
-
IOC: "IOC";
|
|
298
|
-
}>>;
|
|
299
|
-
slippageToleranceBps: z.ZodOptional<z.ZodNumber>;
|
|
300
|
-
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
301
|
-
}, z.core.$strip>;
|
|
302
273
|
export declare const CancelConditionalOrderSchema: z.ZodObject<{
|
|
303
274
|
conditionalOrderId: z.ZodUUID;
|
|
304
275
|
}, z.core.$strip>;
|
|
@@ -349,6 +320,8 @@ export declare const BatchCreateOrderItemSchema: z.ZodObject<{
|
|
|
349
320
|
FOK: "FOK";
|
|
350
321
|
}>>;
|
|
351
322
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
323
|
+
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
324
|
+
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
352
325
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
353
326
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
354
327
|
LONG: "LONG";
|
|
@@ -389,6 +362,8 @@ export declare const BatchCreateOrdersSchema: z.ZodObject<{
|
|
|
389
362
|
FOK: "FOK";
|
|
390
363
|
}>>;
|
|
391
364
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
365
|
+
riskBucketId: z.ZodOptional<z.ZodUUID>;
|
|
366
|
+
riskBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
392
367
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
393
368
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
394
369
|
LONG: "LONG";
|
|
@@ -117,6 +117,8 @@ export const PlaceLimitOrderSchema = z
|
|
|
117
117
|
expirationDate: ISO8601DateSchema.optional(),
|
|
118
118
|
timeInForce: TimeInForceSchema.optional(),
|
|
119
119
|
marginAccountId: UUIDSchema.optional(),
|
|
120
|
+
riskBucketId: UUIDSchema.optional(),
|
|
121
|
+
riskBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
120
122
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
121
123
|
positionSide: PositionSideSchema.optional(),
|
|
122
124
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
@@ -145,6 +147,18 @@ export const PlaceLimitOrderSchema = z
|
|
|
145
147
|
.refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
|
|
146
148
|
message: "Parent TP/SL cannot be attached to reduceOnly orders",
|
|
147
149
|
path: ["options", "reduceOnly"],
|
|
150
|
+
})
|
|
151
|
+
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
152
|
+
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
153
|
+
path: ["options", "tradingMode"],
|
|
154
|
+
})
|
|
155
|
+
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.riskBucketId === undefined, {
|
|
156
|
+
message: "riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",
|
|
157
|
+
path: ["options", "riskBucketId"],
|
|
158
|
+
})
|
|
159
|
+
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.reduceOnly !== true, {
|
|
160
|
+
message: "reduceOnly orders cannot create a new risk bucket",
|
|
161
|
+
path: ["options", "reduceOnly"],
|
|
148
162
|
});
|
|
149
163
|
/**
|
|
150
164
|
* Place Market Order validation schema
|
|
@@ -159,6 +173,8 @@ export const PlaceMarketOrderSchema = z
|
|
|
159
173
|
tradingMode: TradingModeSchema.optional(),
|
|
160
174
|
slippageTolerance: SlippageToleranceSchema,
|
|
161
175
|
marginAccountId: UUIDSchema.optional(),
|
|
176
|
+
riskBucketId: UUIDSchema.optional(),
|
|
177
|
+
riskBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
162
178
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
163
179
|
positionSide: PositionSideSchema.optional(),
|
|
164
180
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
@@ -187,6 +203,18 @@ export const PlaceMarketOrderSchema = z
|
|
|
187
203
|
.refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
|
|
188
204
|
message: "Parent TP/SL cannot be attached to reduceOnly orders",
|
|
189
205
|
path: ["options", "reduceOnly"],
|
|
206
|
+
})
|
|
207
|
+
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
208
|
+
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
209
|
+
path: ["options", "tradingMode"],
|
|
210
|
+
})
|
|
211
|
+
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.riskBucketId === undefined, {
|
|
212
|
+
message: "riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",
|
|
213
|
+
path: ["options", "riskBucketId"],
|
|
214
|
+
})
|
|
215
|
+
.refine((data) => data.options?.riskBucketCollateral === undefined || data.options?.reduceOnly !== true, {
|
|
216
|
+
message: "reduceOnly orders cannot create a new risk bucket",
|
|
217
|
+
path: ["options", "reduceOnly"],
|
|
190
218
|
});
|
|
191
219
|
/**
|
|
192
220
|
* Cancel Order validation schema
|
|
@@ -240,39 +268,6 @@ export const ConditionalOrderStateSchema = z.enum(["PENDING_PARENT", "ACTIVE", "
|
|
|
240
268
|
export const ClosePositionSideSchema = z.enum(["LONG", "SHORT"], {
|
|
241
269
|
message: 'Position side must be "LONG" or "SHORT"',
|
|
242
270
|
});
|
|
243
|
-
export const CreateConditionalOrderSchema = z
|
|
244
|
-
.object({
|
|
245
|
-
tradingPairId: UUIDSchema,
|
|
246
|
-
marginAccountId: UUIDSchema,
|
|
247
|
-
conditionType: ConditionalOrderConditionTypeSchema,
|
|
248
|
-
triggerPrice: PositiveDecimalStringSchema,
|
|
249
|
-
triggerSource: ConditionalOrderTriggerSourceSchema.optional(),
|
|
250
|
-
side: OrderSideSchema,
|
|
251
|
-
positionSide: ClosePositionSideSchema,
|
|
252
|
-
orderType: OrderTypeSchema,
|
|
253
|
-
limitPrice: PositiveDecimalStringSchema.optional(),
|
|
254
|
-
quantity: PositiveDecimalStringSchema.optional(),
|
|
255
|
-
reduceOnly: z.boolean().optional(),
|
|
256
|
-
timeInForce: ConditionalTimeInForceSchema.optional(),
|
|
257
|
-
slippageToleranceBps: SlippageToleranceBpsSchema.optional(),
|
|
258
|
-
expiresAt: ISO8601DateSchema.optional(),
|
|
259
|
-
})
|
|
260
|
-
.refine((data) => data.orderType !== "LIMIT" || data.limitPrice !== undefined, {
|
|
261
|
-
message: "limitPrice is required for LIMIT conditional orders",
|
|
262
|
-
path: ["limitPrice"],
|
|
263
|
-
})
|
|
264
|
-
.refine((data) => data.orderType !== "MARKET" || data.limitPrice === undefined, {
|
|
265
|
-
message: "limitPrice must not be provided for MARKET conditional orders",
|
|
266
|
-
path: ["limitPrice"],
|
|
267
|
-
})
|
|
268
|
-
.refine((data) => data.orderType !== "MARKET" || data.timeInForce === undefined, {
|
|
269
|
-
message: "timeInForce is only allowed for LIMIT conditional orders",
|
|
270
|
-
path: ["timeInForce"],
|
|
271
|
-
})
|
|
272
|
-
.refine((data) => data.orderType !== "LIMIT" || data.slippageToleranceBps === undefined, {
|
|
273
|
-
message: "slippageToleranceBps is only allowed for MARKET conditional orders",
|
|
274
|
-
path: ["slippageToleranceBps"],
|
|
275
|
-
});
|
|
276
271
|
export const CancelConditionalOrderSchema = z.object({
|
|
277
272
|
conditionalOrderId: UUIDSchema,
|
|
278
273
|
});
|
|
@@ -303,6 +298,8 @@ export const BatchCreateOrderItemSchema = z
|
|
|
303
298
|
expirationDate: ISO8601DateSchema.optional(),
|
|
304
299
|
timeInForce: TimeInForceSchema.optional(),
|
|
305
300
|
marginAccountId: UUIDSchema.optional(),
|
|
301
|
+
riskBucketId: UUIDSchema.optional(),
|
|
302
|
+
riskBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
306
303
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
307
304
|
positionSide: PositionSideSchema.optional(),
|
|
308
305
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
@@ -315,6 +312,18 @@ export const BatchCreateOrderItemSchema = z
|
|
|
315
312
|
.refine((data) => data.orderType !== "MARKET" || data.price === undefined, {
|
|
316
313
|
message: "Price must not be provided for MARKET orders",
|
|
317
314
|
path: ["price"],
|
|
315
|
+
})
|
|
316
|
+
.refine((data) => data.riskBucketCollateral === undefined || data.tradingMode === "MARGIN", {
|
|
317
|
+
message: "riskBucketCollateral is only supported for MARGIN orders",
|
|
318
|
+
path: ["tradingMode"],
|
|
319
|
+
})
|
|
320
|
+
.refine((data) => data.riskBucketCollateral === undefined || data.riskBucketId === undefined, {
|
|
321
|
+
message: "riskBucketCollateral creates a new risk bucket and cannot be combined with riskBucketId",
|
|
322
|
+
path: ["riskBucketId"],
|
|
323
|
+
})
|
|
324
|
+
.refine((data) => data.riskBucketCollateral === undefined || data.reduceOnly !== true, {
|
|
325
|
+
message: "reduceOnly orders cannot create a new risk bucket",
|
|
326
|
+
path: ["reduceOnly"],
|
|
318
327
|
})
|
|
319
328
|
.refine((data) => data.tradingMode !== "MARGIN" || data.positionSide !== undefined, {
|
|
320
329
|
message: "positionSide is required for MARGIN orders",
|
|
@@ -44,6 +44,10 @@ export declare const DepositSchema: z.ZodObject<{
|
|
|
44
44
|
assetId: z.ZodUUID;
|
|
45
45
|
amount: z.ZodUnion<readonly [z.ZodString, z.ZodBigInt]>;
|
|
46
46
|
autoWait: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
target: z.ZodOptional<z.ZodEnum<{
|
|
48
|
+
spot: "spot";
|
|
49
|
+
margin: "margin";
|
|
50
|
+
}>>;
|
|
47
51
|
}, z.core.$strip>;
|
|
48
52
|
/**
|
|
49
53
|
* Withdraw validation schema.
|
|
@@ -57,6 +61,10 @@ export declare const WithdrawSchema: z.ZodObject<{
|
|
|
57
61
|
amount: z.ZodUnion<readonly [z.ZodString, z.ZodBigInt]>;
|
|
58
62
|
destination: z.ZodString;
|
|
59
63
|
autoWait: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
65
|
+
spot: "spot";
|
|
66
|
+
margin: "margin";
|
|
67
|
+
}>>;
|
|
60
68
|
}, z.core.$strip>;
|
|
61
69
|
/**
|
|
62
70
|
* Get Balance validation schema
|
package/dist/validation/vault.js
CHANGED
|
@@ -57,6 +57,8 @@ export const DepositSchema = z.object({
|
|
|
57
57
|
assetId: UUIDSchema,
|
|
58
58
|
amount: PositiveBigIntStringSchema,
|
|
59
59
|
autoWait: z.boolean().optional(),
|
|
60
|
+
// Destination ledger: "spot" (default) or "margin" to route into margin collateral.
|
|
61
|
+
target: z.enum(["spot", "margin"]).optional(),
|
|
60
62
|
});
|
|
61
63
|
/**
|
|
62
64
|
* Withdraw validation schema.
|
|
@@ -70,6 +72,7 @@ export const WithdrawSchema = z.object({
|
|
|
70
72
|
amount: PositiveBigIntStringSchema,
|
|
71
73
|
destination: z.string().regex(/^0x[a-fA-F0-9]{40}$/, "destination must be a 0x-prefixed 20-byte hex address"),
|
|
72
74
|
autoWait: z.boolean().optional(),
|
|
75
|
+
source: z.enum(["spot", "margin"]).optional(),
|
|
73
76
|
});
|
|
74
77
|
/**
|
|
75
78
|
* Get Balance validation schema
|