@0xmonaco/types 0.8.1 → 0.8.5
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/dist/delegated-agents/index.d.ts +53 -0
- package/dist/delegated-agents/index.js +0 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/margin-accounts/index.d.ts +13 -0
- package/dist/sdk/index.d.ts +3 -0
- package/dist/trading/index.d.ts +2 -0
- package/dist/trading/responses.d.ts +8 -0
- package/dist/validation/margin-accounts.d.ts +33 -0
- package/dist/validation/margin-accounts.js +31 -16
- package/dist/validation/trading.d.ts +4 -0
- package/dist/validation/trading.js +3 -12
- package/package.json +2 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { BaseAPI } from "../api";
|
|
2
|
+
export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_ORDER" | "create_order" | "cancel_order" | "replace_order";
|
|
3
|
+
export interface UpsertDelegatedAgentRequest {
|
|
4
|
+
agentAddress: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
expiresAt?: string;
|
|
7
|
+
allowedActions: DelegatedAgentAction[];
|
|
8
|
+
allowedTradingPairIds: string[];
|
|
9
|
+
allowedMarginAccountIds?: string[];
|
|
10
|
+
allowedOrderTypes?: Array<"LIMIT" | "MARKET">;
|
|
11
|
+
allowedTimeInForce?: Array<"GTC" | "IOC" | "FOK">;
|
|
12
|
+
maxLeverage?: string;
|
|
13
|
+
maxOrderNotional?: string;
|
|
14
|
+
maxOpenOrders?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface DelegatedAgent {
|
|
17
|
+
id: string;
|
|
18
|
+
owner_user_id: string;
|
|
19
|
+
agent_address: string;
|
|
20
|
+
name?: string;
|
|
21
|
+
is_active: boolean;
|
|
22
|
+
expires_at?: string;
|
|
23
|
+
revoked_at?: string;
|
|
24
|
+
allowed_actions: string[];
|
|
25
|
+
allowed_trading_pair_ids: string[];
|
|
26
|
+
allowed_margin_account_ids: string[];
|
|
27
|
+
allowed_order_types?: string[];
|
|
28
|
+
allowed_time_in_force?: string[];
|
|
29
|
+
max_leverage?: string;
|
|
30
|
+
max_order_notional?: string;
|
|
31
|
+
max_open_orders?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface ListDelegatedAgentsResponse {
|
|
34
|
+
agents: DelegatedAgent[];
|
|
35
|
+
}
|
|
36
|
+
export interface CreateDelegatedSessionRequest {
|
|
37
|
+
ownerUserId: string;
|
|
38
|
+
}
|
|
39
|
+
export interface CreateDelegatedSessionResponse {
|
|
40
|
+
access_token: string;
|
|
41
|
+
expires_at: number;
|
|
42
|
+
delegation_id: string;
|
|
43
|
+
owner_user_id: string;
|
|
44
|
+
agent_address: string;
|
|
45
|
+
}
|
|
46
|
+
export interface DelegatedAgentsAPI extends BaseAPI {
|
|
47
|
+
upsertDelegatedAgent(request: UpsertDelegatedAgentRequest): Promise<DelegatedAgent>;
|
|
48
|
+
listDelegatedAgents(): Promise<ListDelegatedAgentsResponse>;
|
|
49
|
+
revokeDelegatedAgent(delegatedAgentId: string): Promise<{
|
|
50
|
+
status: "REVOKED";
|
|
51
|
+
}>;
|
|
52
|
+
createDelegatedSession(request: CreateDelegatedSessionRequest): Promise<CreateDelegatedSessionResponse>;
|
|
53
|
+
}
|
|
File without changes
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import type { OrderSide, OrderType, PositionSide } from "../trading";
|
|
|
3
3
|
export interface MarginAccountSummary {
|
|
4
4
|
margin_account_id: string;
|
|
5
5
|
label?: string;
|
|
6
|
+
trading_pair_id?: string;
|
|
7
|
+
strategy_key?: string;
|
|
6
8
|
account_state: string;
|
|
7
9
|
equity: string;
|
|
8
10
|
initial_margin_required: string;
|
|
@@ -18,6 +20,7 @@ export interface ListMarginAccountsParams {
|
|
|
18
20
|
page?: number;
|
|
19
21
|
page_size?: number;
|
|
20
22
|
state?: string;
|
|
23
|
+
tradingPairId?: string;
|
|
21
24
|
}
|
|
22
25
|
export interface ListMarginAccountsResponse {
|
|
23
26
|
accounts: MarginAccountSummary[];
|
|
@@ -49,9 +52,14 @@ export interface TransferCollateralRequest {
|
|
|
49
52
|
asset: string;
|
|
50
53
|
amount: string;
|
|
51
54
|
}
|
|
55
|
+
export interface TransferCollateralToAutoMarginAccountRequest extends TransferCollateralRequest {
|
|
56
|
+
tradingPairId: string;
|
|
57
|
+
strategyKey?: string;
|
|
58
|
+
}
|
|
52
59
|
export interface TransferCollateralResponse {
|
|
53
60
|
movement_id: string;
|
|
54
61
|
margin_account_id: string;
|
|
62
|
+
strategy_key?: string;
|
|
55
63
|
asset: string;
|
|
56
64
|
amount: string;
|
|
57
65
|
status: string;
|
|
@@ -80,6 +88,7 @@ export interface GetMarginAccountMovementsResponse {
|
|
|
80
88
|
}
|
|
81
89
|
export interface SimulateOrderRiskRequest {
|
|
82
90
|
tradingPairId: string;
|
|
91
|
+
strategyKey?: string;
|
|
83
92
|
side: OrderSide;
|
|
84
93
|
positionSide: PositionSide;
|
|
85
94
|
orderType: OrderType;
|
|
@@ -91,6 +100,8 @@ export interface SimulateOrderRiskRequest {
|
|
|
91
100
|
export interface SimulateOrderRiskResponse {
|
|
92
101
|
accepted: boolean;
|
|
93
102
|
reject_reason?: string;
|
|
103
|
+
margin_account_id: string;
|
|
104
|
+
strategy_key?: string;
|
|
94
105
|
equity_after: string;
|
|
95
106
|
initial_margin_required_after: string;
|
|
96
107
|
maintenance_margin_required_after: string;
|
|
@@ -104,7 +115,9 @@ export interface MarginAccountsAPI extends BaseAPI {
|
|
|
104
115
|
getMarginAccountSummary(marginAccountId: string): Promise<MarginAccountSummary>;
|
|
105
116
|
getAvailableCollateral(params?: GetAvailableCollateralParams): Promise<GetAvailableCollateralResponse>;
|
|
106
117
|
transferCollateralToMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
118
|
+
transferCollateralToAutoMarginAccount(request: TransferCollateralToAutoMarginAccountRequest): Promise<TransferCollateralResponse>;
|
|
107
119
|
transferCollateralFromMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
108
120
|
getMarginAccountMovements(marginAccountId: string, params?: GetMarginAccountMovementsParams): Promise<GetMarginAccountMovementsResponse>;
|
|
109
121
|
simulateOrderRisk(marginAccountId: string, request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
122
|
+
simulateAutoMarginOrderRisk(request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
110
123
|
}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PublicClient, TransactionReceipt, WalletClient } from "viem";
|
|
2
2
|
import type { ApplicationsAPI } from "../applications";
|
|
3
3
|
import type { AuthAPI, AuthState } from "../auth/index";
|
|
4
|
+
import type { DelegatedAgentsAPI } from "../delegated-agents";
|
|
4
5
|
import type { FeesAPI } from "../fees";
|
|
5
6
|
import type { MarginAccountsAPI } from "../margin-accounts";
|
|
6
7
|
import type { Interval, MarketAPI } from "../market";
|
|
@@ -43,6 +44,8 @@ export interface MonacoSDK {
|
|
|
43
44
|
auth: AuthAPI;
|
|
44
45
|
/** Fees operations API */
|
|
45
46
|
fees: FeesAPI;
|
|
47
|
+
/** Delegated trading agent operations API */
|
|
48
|
+
delegatedAgents: DelegatedAgentsAPI;
|
|
46
49
|
/** Vault operations API */
|
|
47
50
|
vault: VaultAPI;
|
|
48
51
|
/** Trading operations API */
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface TradingAPI extends BaseAPI {
|
|
|
29
29
|
expirationDate?: string;
|
|
30
30
|
timeInForce?: TimeInForce;
|
|
31
31
|
marginAccountId?: string;
|
|
32
|
+
strategyKey?: string;
|
|
32
33
|
positionSide?: PositionSide;
|
|
33
34
|
leverage?: string;
|
|
34
35
|
reduceOnly?: boolean;
|
|
@@ -49,6 +50,7 @@ export interface TradingAPI extends BaseAPI {
|
|
|
49
50
|
tradingMode?: TradingMode;
|
|
50
51
|
slippageTolerance?: number;
|
|
51
52
|
marginAccountId?: string;
|
|
53
|
+
strategyKey?: string;
|
|
52
54
|
positionSide?: PositionSide;
|
|
53
55
|
leverage?: string;
|
|
54
56
|
reduceOnly?: boolean;
|
|
@@ -72,6 +72,12 @@ export interface CreateOrderResponse {
|
|
|
72
72
|
message: string;
|
|
73
73
|
/** Match result information if order was processed by matching engine */
|
|
74
74
|
match_result?: MatchResult;
|
|
75
|
+
/** Resolved margin account ID for margin/perp orders */
|
|
76
|
+
margin_account_id?: string;
|
|
77
|
+
/** Resolved hidden strategy bucket key for auto margin buckets */
|
|
78
|
+
strategy_key?: string;
|
|
79
|
+
/** Delegated agent ID when submitted through a delegated session */
|
|
80
|
+
delegation_id?: string;
|
|
75
81
|
/** Conditional order ID for an attached take-profit leg */
|
|
76
82
|
take_profit_order_id?: string;
|
|
77
83
|
/** Conditional order ID for an attached stop-loss leg */
|
|
@@ -280,6 +286,8 @@ export interface BatchCreateOrderParams {
|
|
|
280
286
|
timeInForce?: Extract<TimeInForce, "GTC" | "IOC" | "FOK">;
|
|
281
287
|
/** Margin account UUID for margin/perp orders */
|
|
282
288
|
marginAccountId?: string;
|
|
289
|
+
/** Optional strategy bucket key used when marginAccountId is omitted */
|
|
290
|
+
strategyKey?: string;
|
|
283
291
|
/** Position side for margin/perp orders */
|
|
284
292
|
positionSide?: PositionSide;
|
|
285
293
|
/** Leverage for margin/perp orders */
|
|
@@ -6,6 +6,7 @@ export declare const ListMarginAccountsSchema: z.ZodObject<{
|
|
|
6
6
|
page: z.ZodOptional<z.ZodNumber>;
|
|
7
7
|
page_size: z.ZodOptional<z.ZodNumber>;
|
|
8
8
|
state: z.ZodOptional<z.ZodString>;
|
|
9
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
9
10
|
}, z.core.$strip>;
|
|
10
11
|
export declare const CreateMarginAccountSchema: z.ZodOptional<z.ZodObject<{
|
|
11
12
|
label: z.ZodOptional<z.ZodString>;
|
|
@@ -24,6 +25,14 @@ export declare const TransferCollateralSchema: z.ZodObject<{
|
|
|
24
25
|
amount: z.ZodString;
|
|
25
26
|
}, z.core.$strip>;
|
|
26
27
|
}, z.core.$strip>;
|
|
28
|
+
export declare const TransferCollateralToAutoMarginAccountSchema: z.ZodObject<{
|
|
29
|
+
request: z.ZodObject<{
|
|
30
|
+
asset: z.ZodString;
|
|
31
|
+
amount: z.ZodString;
|
|
32
|
+
tradingPairId: z.ZodUUID;
|
|
33
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
}, z.core.$strip>;
|
|
27
36
|
export declare const GetMarginAccountMovementsSchema: z.ZodObject<{
|
|
28
37
|
page: z.ZodOptional<z.ZodNumber>;
|
|
29
38
|
page_size: z.ZodOptional<z.ZodNumber>;
|
|
@@ -34,6 +43,30 @@ export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
|
34
43
|
marginAccountId: z.ZodUUID;
|
|
35
44
|
request: z.ZodObject<{
|
|
36
45
|
tradingPairId: z.ZodUUID;
|
|
46
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
47
|
+
side: z.ZodEnum<{
|
|
48
|
+
BUY: "BUY";
|
|
49
|
+
SELL: "SELL";
|
|
50
|
+
}>;
|
|
51
|
+
positionSide: z.ZodEnum<{
|
|
52
|
+
LONG: "LONG";
|
|
53
|
+
SHORT: "SHORT";
|
|
54
|
+
NONE: "NONE";
|
|
55
|
+
}>;
|
|
56
|
+
orderType: z.ZodEnum<{
|
|
57
|
+
LIMIT: "LIMIT";
|
|
58
|
+
MARKET: "MARKET";
|
|
59
|
+
}>;
|
|
60
|
+
price: z.ZodOptional<z.ZodString>;
|
|
61
|
+
quantity: z.ZodString;
|
|
62
|
+
leverage: z.ZodString;
|
|
63
|
+
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
}, z.core.$strip>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export declare const SimulateAutoMarginOrderRiskSchema: z.ZodObject<{
|
|
67
|
+
request: z.ZodObject<{
|
|
68
|
+
tradingPairId: z.ZodUUID;
|
|
69
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
37
70
|
side: z.ZodEnum<{
|
|
38
71
|
BUY: "BUY";
|
|
39
72
|
SELL: "SELL";
|
|
@@ -9,6 +9,7 @@ const PaginationSchema = z.object({
|
|
|
9
9
|
});
|
|
10
10
|
export const ListMarginAccountsSchema = PaginationSchema.extend({
|
|
11
11
|
state: z.string().trim().min(1, "State cannot be empty").optional(),
|
|
12
|
+
tradingPairId: UUIDSchema.optional(),
|
|
12
13
|
});
|
|
13
14
|
export const CreateMarginAccountSchema = z
|
|
14
15
|
.object({
|
|
@@ -24,36 +25,50 @@ export const GetAvailableCollateralSchema = z
|
|
|
24
25
|
asset: z.string().trim().min(1, "Asset cannot be empty").optional(),
|
|
25
26
|
})
|
|
26
27
|
.optional();
|
|
28
|
+
const TransferCollateralRequestSchema = z.object({
|
|
29
|
+
asset: z.string().trim().min(1, "Asset cannot be empty"),
|
|
30
|
+
amount: PositiveDecimalStringSchema,
|
|
31
|
+
});
|
|
32
|
+
const AutoMarginBucketRequestSchema = z.object({
|
|
33
|
+
tradingPairId: UUIDSchema,
|
|
34
|
+
strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
|
|
35
|
+
});
|
|
27
36
|
export const TransferCollateralSchema = z.object({
|
|
28
37
|
marginAccountId: UUIDSchema,
|
|
29
|
-
request:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
38
|
+
request: TransferCollateralRequestSchema,
|
|
39
|
+
});
|
|
40
|
+
export const TransferCollateralToAutoMarginAccountSchema = z.object({
|
|
41
|
+
request: TransferCollateralRequestSchema.merge(AutoMarginBucketRequestSchema),
|
|
33
42
|
});
|
|
34
43
|
export const GetMarginAccountMovementsSchema = PaginationSchema.extend({
|
|
35
44
|
marginAccountId: UUIDSchema,
|
|
36
45
|
movement_type: z.string().trim().min(1, "Movement type cannot be empty").optional(),
|
|
37
46
|
});
|
|
47
|
+
const SimulateOrderRiskRequestSchema = z.object({
|
|
48
|
+
tradingPairId: UUIDSchema,
|
|
49
|
+
strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
|
|
50
|
+
side: OrderSideSchema,
|
|
51
|
+
positionSide: PositionSideSchema,
|
|
52
|
+
orderType: OrderTypeSchema,
|
|
53
|
+
price: PositiveDecimalStringSchema.optional(),
|
|
54
|
+
quantity: PositiveDecimalStringSchema,
|
|
55
|
+
leverage: PositiveDecimalStringSchema,
|
|
56
|
+
reduceOnly: z.boolean().optional(),
|
|
57
|
+
});
|
|
38
58
|
export const SimulateOrderRiskSchema = z
|
|
39
59
|
.object({
|
|
40
60
|
marginAccountId: UUIDSchema,
|
|
41
|
-
request:
|
|
42
|
-
tradingPairId: UUIDSchema,
|
|
43
|
-
side: OrderSideSchema,
|
|
44
|
-
positionSide: PositionSideSchema,
|
|
45
|
-
orderType: OrderTypeSchema,
|
|
46
|
-
price: PositiveDecimalStringSchema.optional(),
|
|
47
|
-
quantity: PositiveDecimalStringSchema,
|
|
48
|
-
leverage: PositiveDecimalStringSchema,
|
|
49
|
-
reduceOnly: z.boolean().optional(),
|
|
50
|
-
}),
|
|
61
|
+
request: SimulateOrderRiskRequestSchema,
|
|
51
62
|
})
|
|
52
63
|
.refine((data) => data.request.orderType !== "LIMIT" || data.request.price !== undefined, {
|
|
53
64
|
message: "price is required for LIMIT risk simulations",
|
|
54
65
|
path: ["request", "price"],
|
|
66
|
+
});
|
|
67
|
+
export const SimulateAutoMarginOrderRiskSchema = z
|
|
68
|
+
.object({
|
|
69
|
+
request: SimulateOrderRiskRequestSchema,
|
|
55
70
|
})
|
|
56
|
-
.refine((data) => data.request.orderType !== "
|
|
57
|
-
message: "price
|
|
71
|
+
.refine((data) => data.request.orderType !== "LIMIT" || data.request.price !== undefined, {
|
|
72
|
+
message: "price is required for LIMIT risk simulations",
|
|
58
73
|
path: ["request", "price"],
|
|
59
74
|
});
|
|
@@ -101,6 +101,7 @@ export declare const PlaceLimitOrderSchema: z.ZodObject<{
|
|
|
101
101
|
FOK: "FOK";
|
|
102
102
|
}>>;
|
|
103
103
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
104
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
104
105
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
105
106
|
LONG: "LONG";
|
|
106
107
|
SHORT: "SHORT";
|
|
@@ -155,6 +156,7 @@ export declare const PlaceMarketOrderSchema: z.ZodObject<{
|
|
|
155
156
|
}>>;
|
|
156
157
|
slippageTolerance: z.ZodOptional<z.ZodNumber>;
|
|
157
158
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
159
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
158
160
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
159
161
|
LONG: "LONG";
|
|
160
162
|
SHORT: "SHORT";
|
|
@@ -347,6 +349,7 @@ export declare const BatchCreateOrderItemSchema: z.ZodObject<{
|
|
|
347
349
|
FOK: "FOK";
|
|
348
350
|
}>>;
|
|
349
351
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
352
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
350
353
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
351
354
|
LONG: "LONG";
|
|
352
355
|
SHORT: "SHORT";
|
|
@@ -386,6 +389,7 @@ export declare const BatchCreateOrdersSchema: z.ZodObject<{
|
|
|
386
389
|
FOK: "FOK";
|
|
387
390
|
}>>;
|
|
388
391
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
392
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
389
393
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
390
394
|
LONG: "LONG";
|
|
391
395
|
SHORT: "SHORT";
|
|
@@ -117,6 +117,7 @@ export const PlaceLimitOrderSchema = z
|
|
|
117
117
|
expirationDate: ISO8601DateSchema.optional(),
|
|
118
118
|
timeInForce: TimeInForceSchema.optional(),
|
|
119
119
|
marginAccountId: UUIDSchema.optional(),
|
|
120
|
+
strategyKey: z.string().min(1).max(128).optional(),
|
|
120
121
|
positionSide: PositionSideSchema.optional(),
|
|
121
122
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
122
123
|
reduceOnly: z.boolean().optional(),
|
|
@@ -124,10 +125,6 @@ export const PlaceLimitOrderSchema = z
|
|
|
124
125
|
stopLoss: ParentTpSlLegSchema.optional(),
|
|
125
126
|
})
|
|
126
127
|
.optional(),
|
|
127
|
-
})
|
|
128
|
-
.refine((data) => data.options?.tradingMode !== "MARGIN" || data.options.marginAccountId !== undefined, {
|
|
129
|
-
message: "marginAccountId is required for MARGIN orders",
|
|
130
|
-
path: ["options", "marginAccountId"],
|
|
131
128
|
})
|
|
132
129
|
.refine((data) => data.options?.tradingMode !== "MARGIN" || data.options.positionSide !== undefined, {
|
|
133
130
|
message: "positionSide is required for MARGIN orders",
|
|
@@ -162,6 +159,7 @@ export const PlaceMarketOrderSchema = z
|
|
|
162
159
|
tradingMode: TradingModeSchema.optional(),
|
|
163
160
|
slippageTolerance: SlippageToleranceSchema,
|
|
164
161
|
marginAccountId: UUIDSchema.optional(),
|
|
162
|
+
strategyKey: z.string().min(1).max(128).optional(),
|
|
165
163
|
positionSide: PositionSideSchema.optional(),
|
|
166
164
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
167
165
|
reduceOnly: z.boolean().optional(),
|
|
@@ -169,10 +167,6 @@ export const PlaceMarketOrderSchema = z
|
|
|
169
167
|
stopLoss: ParentTpSlLegSchema.optional(),
|
|
170
168
|
})
|
|
171
169
|
.optional(),
|
|
172
|
-
})
|
|
173
|
-
.refine((data) => data.options?.tradingMode !== "MARGIN" || data.options.marginAccountId !== undefined, {
|
|
174
|
-
message: "marginAccountId is required for MARGIN orders",
|
|
175
|
-
path: ["options", "marginAccountId"],
|
|
176
170
|
})
|
|
177
171
|
.refine((data) => data.options?.tradingMode !== "MARGIN" || data.options.positionSide !== undefined, {
|
|
178
172
|
message: "positionSide is required for MARGIN orders",
|
|
@@ -309,6 +303,7 @@ export const BatchCreateOrderItemSchema = z
|
|
|
309
303
|
expirationDate: ISO8601DateSchema.optional(),
|
|
310
304
|
timeInForce: TimeInForceSchema.optional(),
|
|
311
305
|
marginAccountId: UUIDSchema.optional(),
|
|
306
|
+
strategyKey: z.string().min(1).max(128).optional(),
|
|
312
307
|
positionSide: PositionSideSchema.optional(),
|
|
313
308
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
314
309
|
reduceOnly: z.boolean().optional(),
|
|
@@ -320,10 +315,6 @@ export const BatchCreateOrderItemSchema = z
|
|
|
320
315
|
.refine((data) => data.orderType !== "MARKET" || data.price === undefined, {
|
|
321
316
|
message: "Price must not be provided for MARKET orders",
|
|
322
317
|
path: ["price"],
|
|
323
|
-
})
|
|
324
|
-
.refine((data) => data.tradingMode !== "MARGIN" || data.marginAccountId !== undefined, {
|
|
325
|
-
message: "marginAccountId is required for MARGIN orders",
|
|
326
|
-
path: ["marginAccountId"],
|
|
327
318
|
})
|
|
328
319
|
.refine((data) => data.tradingMode !== "MARGIN" || data.positionSide !== undefined, {
|
|
329
320
|
message: "positionSide is required for MARGIN orders",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/types",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"lint": "biome lint ."
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@0xmonaco/contracts": "0.8.
|
|
23
|
+
"@0xmonaco/contracts": "0.8.5",
|
|
24
24
|
"zod": "^4.1.12"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|