@0xmonaco/types 0.8.5 → 0.8.7-develop.0f12336
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 +13 -5
- package/dist/api/index.js +1 -1
- 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 +213 -2
- package/dist/applications/responses.js +3 -1
- package/dist/auth/index.d.ts +29 -31
- package/dist/auth/index.js +2 -2
- package/dist/auth/responses.d.ts +25 -21
- package/dist/contracts/balances.d.ts +1 -1
- package/dist/delegated-agents/index.d.ts +35 -18
- package/dist/faucet/index.d.ts +54 -0
- package/dist/faucet/index.js +10 -0
- package/dist/fees/index.d.ts +4 -4
- package/dist/fees/responses.d.ts +17 -17
- package/dist/fees/responses.js +20 -20
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/margin-accounts/index.d.ts +91 -55
- package/dist/market/index.d.ts +214 -94
- package/dist/positions/index.d.ts +67 -44
- package/dist/profile/index.d.ts +157 -67
- package/dist/sdk/index.d.ts +43 -5
- package/dist/sub-accounts/index.d.ts +146 -0
- package/dist/sub-accounts/index.js +9 -0
- package/dist/trading/index.d.ts +8 -8
- package/dist/trading/orders.d.ts +20 -20
- package/dist/trading/responses.d.ts +82 -101
- package/dist/validation/margin-accounts.d.ts +53 -13
- package/dist/validation/margin-accounts.js +38 -14
- package/dist/validation/market.d.ts +1 -1
- package/dist/validation/market.js +1 -1
- package/dist/validation/positions.d.ts +11 -7
- package/dist/validation/positions.js +10 -6
- package/dist/validation/profile.d.ts +13 -6
- package/dist/validation/profile.js +13 -6
- package/dist/validation/trading.d.ts +17 -42
- package/dist/validation/trading.js +51 -42
- package/dist/validation/vault.d.ts +8 -0
- package/dist/validation/vault.js +3 -0
- package/dist/vault/index.d.ts +46 -13
- package/dist/vault/responses.d.ts +50 -12
- package/dist/websocket/events/balance-events.d.ts +2 -1
- package/dist/websocket/events/movement-events.d.ts +2 -1
- 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 +101 -0
- package/dist/wire/schema.d.ts +8930 -0
- package/dist/wire/schema.js +4 -0
- package/dist/withdrawals/index.d.ts +114 -0
- package/dist/withdrawals/index.js +0 -0
- package/package.json +6 -2
|
@@ -5,21 +5,21 @@ import { z } from "zod";
|
|
|
5
5
|
import { OrderSideSchema, OrderTypeSchema, PositionSideSchema, PositiveDecimalStringSchema, UUIDSchema } from "./trading";
|
|
6
6
|
const PaginationSchema = z.object({
|
|
7
7
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
8
|
-
|
|
8
|
+
pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
9
9
|
});
|
|
10
10
|
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(),
|
|
33
|
+
});
|
|
34
|
+
const ParentMarginAccountCollateralRequestSchema = z.object({
|
|
35
|
+
asset: z.string().trim().min(1, "Asset cannot be empty"),
|
|
36
|
+
amount: PositiveDecimalStringSchema,
|
|
31
37
|
});
|
|
32
|
-
const
|
|
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
|
+
movementType: z.string().trim().min(1, "Movement type cannot be empty").optional(),
|
|
46
58
|
});
|
|
47
|
-
const
|
|
59
|
+
export const GetParentMarginAccountMovementsSchema = PaginationSchema.extend({
|
|
60
|
+
movementType: 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
|
+
});
|
|
@@ -203,7 +203,7 @@ export declare const GetTradingPairSchema: z.ZodObject<{
|
|
|
203
203
|
*/
|
|
204
204
|
export declare const SearchTradingPairsSchema: z.ZodObject<{
|
|
205
205
|
query: z.ZodOptional<z.ZodString>;
|
|
206
|
-
|
|
206
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
207
207
|
page: z.ZodOptional<z.ZodNumber>;
|
|
208
208
|
}, z.core.$strip>;
|
|
209
209
|
/**
|
|
@@ -214,7 +214,7 @@ export const GetTradingPairSchema = z.object({
|
|
|
214
214
|
*/
|
|
215
215
|
export const SearchTradingPairsSchema = z.object({
|
|
216
216
|
query: z.string().min(1, "Search query cannot be empty").optional(),
|
|
217
|
-
|
|
217
|
+
pageSize: z.number().int().min(1).max(100).optional(),
|
|
218
218
|
page: z.number().int().min(1).optional(),
|
|
219
219
|
});
|
|
220
220
|
/**
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
export declare const ListPositionsSchema: z.ZodObject<{
|
|
6
6
|
page: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
9
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
10
10
|
status: z.ZodOptional<z.ZodEnum<{
|
|
11
11
|
OPEN: "OPEN";
|
|
12
12
|
CLOSED: "CLOSED";
|
|
@@ -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>;
|
|
@@ -82,8 +86,8 @@ export declare const AttachPositionTpSlSchema: z.ZodObject<{
|
|
|
82
86
|
}, z.core.$strip>;
|
|
83
87
|
export declare const ListPositionHistorySchema: z.ZodObject<{
|
|
84
88
|
page: z.ZodOptional<z.ZodNumber>;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
90
|
+
positionId: z.ZodOptional<z.ZodUUID>;
|
|
91
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
92
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
89
93
|
}, z.core.$strip>;
|
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { ConditionalTimeInForceSchema, ISO8601DateSchema, OrderTypeSchema, PositiveDecimalStringSchema, SlippageToleranceBpsSchema, UUIDSchema, } from "./trading";
|
|
6
6
|
const PaginationSchema = z.object({
|
|
7
7
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
8
|
-
|
|
8
|
+
pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
9
9
|
});
|
|
10
10
|
const PositionStatusSchema = z.enum(["OPEN", "CLOSED", "LIQUIDATING"], {
|
|
11
11
|
message: 'Position status must be "OPEN", "CLOSED", or "LIQUIDATING"',
|
|
@@ -17,8 +17,8 @@ const PositionIdSchema = z.object({
|
|
|
17
17
|
positionId: UUIDSchema,
|
|
18
18
|
});
|
|
19
19
|
export const ListPositionsSchema = PaginationSchema.extend({
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
marginAccountId: UUIDSchema.optional(),
|
|
21
|
+
tradingPairId: UUIDSchema.optional(),
|
|
22
22
|
status: PositionStatusSchema.optional(),
|
|
23
23
|
});
|
|
24
24
|
export const GetPositionSchema = PositionIdSchema;
|
|
@@ -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({
|
|
@@ -87,7 +91,7 @@ export const AttachPositionTpSlSchema = PositionIdSchema.extend({
|
|
|
87
91
|
}),
|
|
88
92
|
});
|
|
89
93
|
export const ListPositionHistorySchema = PaginationSchema.extend({
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
positionId: UUIDSchema.optional(),
|
|
95
|
+
marginAccountId: UUIDSchema.optional(),
|
|
96
|
+
tradingPairId: UUIDSchema.optional(),
|
|
93
97
|
});
|
|
@@ -36,15 +36,15 @@ export declare const TransactionTypeSchema: z.ZodEnum<{
|
|
|
36
36
|
*/
|
|
37
37
|
export declare const GetUserMovementsSchema: z.ZodObject<{
|
|
38
38
|
page: z.ZodOptional<z.ZodNumber>;
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
entryType: z.ZodOptional<z.ZodEnum<{
|
|
41
41
|
CREDIT: "CREDIT";
|
|
42
42
|
DEBIT: "DEBIT";
|
|
43
43
|
LOCK: "LOCK";
|
|
44
44
|
UNLOCK: "UNLOCK";
|
|
45
45
|
FEE: "FEE";
|
|
46
46
|
}>>;
|
|
47
|
-
|
|
47
|
+
transactionType: z.ZodOptional<z.ZodEnum<{
|
|
48
48
|
FEE: "FEE";
|
|
49
49
|
DEPOSIT: "DEPOSIT";
|
|
50
50
|
WITHDRAWAL: "WITHDRAWAL";
|
|
@@ -54,7 +54,7 @@ export declare const GetUserMovementsSchema: z.ZodObject<{
|
|
|
54
54
|
INTEREST: "INTEREST";
|
|
55
55
|
REWARD: "REWARD";
|
|
56
56
|
}>>;
|
|
57
|
-
|
|
57
|
+
assetId: z.ZodOptional<z.ZodUUID>;
|
|
58
58
|
}, z.core.$strip>;
|
|
59
59
|
/**
|
|
60
60
|
* Get User Trades validation schema
|
|
@@ -64,6 +64,13 @@ export declare const GetUserMovementsSchema: z.ZodObject<{
|
|
|
64
64
|
*/
|
|
65
65
|
export declare const GetUserTradesSchema: z.ZodObject<{
|
|
66
66
|
page: z.ZodOptional<z.ZodNumber>;
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export declare const ListFundingPaymentsSchema: z.ZodObject<{
|
|
71
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
74
|
+
positionId: z.ZodOptional<z.ZodUUID>;
|
|
75
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
69
76
|
}, z.core.$strip>;
|
|
@@ -26,10 +26,10 @@ export const TransactionTypeSchema = z.enum(["DEPOSIT", "WITHDRAWAL", "TRADE", "
|
|
|
26
26
|
*/
|
|
27
27
|
export const GetUserMovementsSchema = z.object({
|
|
28
28
|
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
pageSize: 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(),
|
|
30
|
+
entryType: LedgerEntryTypeSchema.optional(),
|
|
31
|
+
transactionType: TransactionTypeSchema.optional(),
|
|
32
|
+
assetId: UUIDSchema.optional(),
|
|
33
33
|
});
|
|
34
34
|
/**
|
|
35
35
|
* Get User Trades validation schema
|
|
@@ -39,6 +39,13 @@ export const GetUserMovementsSchema = z.object({
|
|
|
39
39
|
*/
|
|
40
40
|
export const GetUserTradesSchema = z.object({
|
|
41
41
|
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
pageSize: 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
|
+
tradingPairId: UUIDSchema.optional(),
|
|
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
|
+
pageSize: 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
|
+
tradingPairId: UUIDSchema.optional(),
|
|
49
|
+
positionId: UUIDSchema.optional(),
|
|
50
|
+
marginAccountId: UUIDSchema.optional(),
|
|
44
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";
|
|
@@ -222,9 +226,9 @@ export declare const ReplaceOrderSchema: z.ZodObject<{
|
|
|
222
226
|
* Validates parameters for fetching paginated orders.
|
|
223
227
|
* Matches the getPaginatedOrders method signature which accepts:
|
|
224
228
|
* - status: OrderStatus (optional filter)
|
|
225
|
-
* -
|
|
229
|
+
* - tradingPairId: trading pair UUID (optional filter)
|
|
226
230
|
* - page: number (default: 1)
|
|
227
|
-
* -
|
|
231
|
+
* - pageSize: number (default: 10, max: 100)
|
|
228
232
|
*/
|
|
229
233
|
export declare const GetPaginatedOrdersSchema: z.ZodObject<{
|
|
230
234
|
status: z.ZodOptional<z.ZodEnum<{
|
|
@@ -237,14 +241,14 @@ export declare const GetPaginatedOrdersSchema: z.ZodObject<{
|
|
|
237
241
|
REJECTED: "REJECTED";
|
|
238
242
|
EXPIRED: "EXPIRED";
|
|
239
243
|
}>>;
|
|
240
|
-
|
|
241
|
-
|
|
244
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
245
|
+
tradingMode: z.ZodOptional<z.ZodEnum<{
|
|
242
246
|
SPOT: "SPOT";
|
|
243
247
|
MARGIN: "MARGIN";
|
|
244
248
|
}>>;
|
|
245
|
-
|
|
249
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
246
250
|
page: z.ZodOptional<z.ZodNumber>;
|
|
247
|
-
|
|
251
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
248
252
|
}, z.core.$strip>;
|
|
249
253
|
export declare const ConditionalOrderConditionTypeSchema: z.ZodEnum<{
|
|
250
254
|
STOP_LOSS: "STOP_LOSS";
|
|
@@ -266,45 +270,12 @@ 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>;
|
|
305
276
|
export declare const ListConditionalOrdersSchema: z.ZodObject<{
|
|
306
|
-
|
|
307
|
-
|
|
277
|
+
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
278
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
308
279
|
state: z.ZodOptional<z.ZodEnum<{
|
|
309
280
|
CANCELLED: "CANCELLED";
|
|
310
281
|
EXPIRED: "EXPIRED";
|
|
@@ -315,7 +286,7 @@ export declare const ListConditionalOrdersSchema: z.ZodObject<{
|
|
|
315
286
|
FAILED: "FAILED";
|
|
316
287
|
}>>;
|
|
317
288
|
page: z.ZodOptional<z.ZodNumber>;
|
|
318
|
-
|
|
289
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
319
290
|
}, z.core.$strip>;
|
|
320
291
|
/**
|
|
321
292
|
* Single batch create order item validation schema
|
|
@@ -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
|
|
@@ -216,17 +244,17 @@ export const ReplaceOrderSchema = z.object({
|
|
|
216
244
|
* Validates parameters for fetching paginated orders.
|
|
217
245
|
* Matches the getPaginatedOrders method signature which accepts:
|
|
218
246
|
* - status: OrderStatus (optional filter)
|
|
219
|
-
* -
|
|
247
|
+
* - tradingPairId: trading pair UUID (optional filter)
|
|
220
248
|
* - page: number (default: 1)
|
|
221
|
-
* -
|
|
249
|
+
* - pageSize: number (default: 10, max: 100)
|
|
222
250
|
*/
|
|
223
251
|
export const GetPaginatedOrdersSchema = z.object({
|
|
224
252
|
status: z.enum(ORDER_STATUS_VALUES).optional(),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
253
|
+
tradingPairId: UUIDSchema.optional(),
|
|
254
|
+
tradingMode: TradingModeSchema.optional(),
|
|
255
|
+
marginAccountId: UUIDSchema.optional(),
|
|
228
256
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
229
|
-
|
|
257
|
+
pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
230
258
|
});
|
|
231
259
|
export const ConditionalOrderConditionTypeSchema = z.enum(["STOP_LOSS", "TAKE_PROFIT"], {
|
|
232
260
|
message: 'conditionType must be "STOP_LOSS" or "TAKE_PROFIT"',
|
|
@@ -240,48 +268,15 @@ 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
|
});
|
|
279
274
|
export const ListConditionalOrdersSchema = z.object({
|
|
280
|
-
|
|
281
|
-
|
|
275
|
+
marginAccountId: UUIDSchema.optional(),
|
|
276
|
+
tradingPairId: UUIDSchema.optional(),
|
|
282
277
|
state: ConditionalOrderStateSchema.optional(),
|
|
283
278
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
284
|
-
|
|
279
|
+
pageSize: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
285
280
|
});
|
|
286
281
|
/**
|
|
287
282
|
* Single batch create order item validation schema
|
|
@@ -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
|