@0xmonaco/types 0.8.11 → 0.8.14

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.
@@ -5,6 +5,7 @@
5
5
  * backend-authenticated application reporting endpoints. Reporting types use
6
6
  * the wire shape (snake_case); optional fields are `null` rather than omitted.
7
7
  */
8
+ import type { Address } from "viem";
8
9
  /**
9
10
  * Response to an application configuration request.
10
11
  */
@@ -18,7 +19,7 @@ export interface ApplicationConfigResponse {
18
19
  /** Webhook URL for receiving events (optional) */
19
20
  webhookUrl?: string;
20
21
  /** Vault contract address */
21
- vaultContractAddress: string;
22
+ vaultContractAddress: Address;
22
23
  /** Application client ID, embedded in on-chain deposit calls */
23
24
  clientId: string;
24
25
  }
@@ -66,7 +67,7 @@ export interface AppUser {
66
67
  /** User UUID */
67
68
  id: string;
68
69
  /** Wallet address */
69
- address: string;
70
+ address: Address;
70
71
  /** Display username */
71
72
  username: string | null;
72
73
  /** Account type: master or sub */
@@ -117,7 +118,7 @@ export interface AppMovement {
117
118
  /** Reference type */
118
119
  reference_type: string | null;
119
120
  /** Token address */
120
- token: string;
121
+ token: Address;
121
122
  /** Type of transaction */
122
123
  transaction_type: string;
123
124
  /** Blockchain transaction hash */
@@ -148,7 +149,7 @@ export interface AppBalance {
148
149
  /** Token symbol */
149
150
  symbol: string | null;
150
151
  /** Token address */
151
- token: string;
152
+ token: Address;
152
153
  /** Total balance */
153
154
  total_balance: string;
154
155
  /** Balance last update timestamp (ISO 8601) */
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Response types for authentication operations.
5
5
  */
6
+ import type { Address } from "viem";
6
7
  /**
7
8
  * Response to a challenge request.
8
9
  */
@@ -18,7 +19,7 @@ export interface User {
18
19
  /** Unique identifier for the user */
19
20
  id: string;
20
21
  /** Wallet address of the user */
21
- address: string;
22
+ address: Address;
22
23
  /** Username of the user */
23
24
  username?: string;
24
25
  }
@@ -33,7 +33,7 @@ export interface Token {
33
33
  */
34
34
  export interface UserBalance {
35
35
  /** Token address */
36
- token: string;
36
+ token: Address;
37
37
  /** Available balance for trading */
38
38
  available: bigint;
39
39
  /** Locked balance in open orders */
@@ -1,3 +1,4 @@
1
+ import type { Address } from "viem";
1
2
  import type { BaseAPI } from "../api";
2
3
  export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_ORDER" | "create_order" | "cancel_order" | "replace_order";
3
4
  export interface UpsertDelegatedAgentRequest {
@@ -16,7 +17,7 @@ export interface UpsertDelegatedAgentRequest {
16
17
  export interface DelegatedAgent {
17
18
  id: string;
18
19
  owner_user_id: string;
19
- agent_address: string;
20
+ agent_address: Address;
20
21
  name?: string;
21
22
  is_active: boolean;
22
23
  expires_at?: string;
@@ -56,7 +57,7 @@ export interface CreateDelegatedSessionResponse {
56
57
  expires_at: number;
57
58
  delegation_id: string;
58
59
  owner_user_id: string;
59
- agent_address: string;
60
+ agent_address: Address;
60
61
  }
61
62
  export interface DelegatedAgentsAPI extends BaseAPI {
62
63
  upsertDelegatedAgent(request: UpsertDelegatedAgentRequest): Promise<DelegatedAgent>;
@@ -3,7 +3,7 @@ import type { OrderSide, OrderType, PositionSide } from "../trading";
3
3
  export interface MarginAccountSummary {
4
4
  margin_account_id: string;
5
5
  label?: string;
6
- margin_bucket_id?: string;
6
+ risk_bucket_id?: string;
7
7
  margin_mode?: "ISOLATED" | "CROSS";
8
8
  trading_pair_id?: string;
9
9
  strategy_key?: string;
@@ -55,10 +55,18 @@ export interface TransferCollateralRequest {
55
55
  tradingPairId?: string;
56
56
  strategyKey?: string;
57
57
  }
58
- export interface TransferCollateralToAutoMarginAccountRequest extends TransferCollateralRequest {
58
+ export interface TransferCollateralToParentMarginAccountRequest {
59
+ asset: string;
60
+ amount: string;
61
+ }
62
+ export interface TransferCollateralToRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
59
63
  tradingPairId: string;
60
64
  strategyKey?: string;
61
65
  }
66
+ export interface TransferCollateralFromParentMarginAccountRequest {
67
+ asset: string;
68
+ amount: string;
69
+ }
62
70
  export interface TransferCollateralResponse {
63
71
  movement_id: string;
64
72
  margin_account_id: string;
@@ -99,7 +107,7 @@ export interface SimulateOrderRiskRequest {
99
107
  leverage: string;
100
108
  reduceOnly?: boolean;
101
109
  }
102
- export interface SimulateAutoMarginOrderRiskRequest extends SimulateOrderRiskRequest {
110
+ export interface SimulateRiskBucketOrderRiskRequest extends SimulateOrderRiskRequest {
103
111
  strategyKey?: string;
104
112
  }
105
113
  export interface SimulateOrderRiskResponse {
@@ -116,12 +124,36 @@ export interface SimulateOrderRiskResponse {
116
124
  }
117
125
  export interface MarginAccountsAPI extends BaseAPI {
118
126
  listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
127
+ getParentMarginAccountSummary(params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
128
+ /**
129
+ * @deprecated Prefer getParentMarginAccountSummary(). Parent margin account ids
130
+ * are auto-resolved for the authenticated wallet/application scope.
131
+ */
119
132
  getMarginAccountSummary(marginAccountId: string, params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
120
133
  getAvailableCollateral(params?: GetAvailableCollateralParams): Promise<GetAvailableCollateralResponse>;
134
+ /**
135
+ * @deprecated Prefer transferCollateralToParentMarginAccount() or
136
+ * transferCollateralToRiskBucket().
137
+ */
121
138
  transferCollateralToMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
122
- transferCollateralToAutoMarginAccount(request: TransferCollateralToAutoMarginAccountRequest): Promise<TransferCollateralResponse>;
139
+ transferCollateralToParentMarginAccount(request: TransferCollateralToParentMarginAccountRequest): Promise<TransferCollateralResponse>;
140
+ transferCollateralToRiskBucket(request: TransferCollateralToRiskBucketRequest): Promise<TransferCollateralResponse>;
141
+ /**
142
+ * @deprecated Prefer transferCollateralFromParentMarginAccount().
143
+ */
123
144
  transferCollateralFromMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
145
+ transferCollateralFromParentMarginAccount(request: TransferCollateralFromParentMarginAccountRequest): Promise<TransferCollateralResponse>;
146
+ getParentMarginAccountMovements(params?: GetMarginAccountMovementsParams): Promise<GetMarginAccountMovementsResponse>;
147
+ /**
148
+ * @deprecated Prefer getParentMarginAccountMovements(). Parent margin account ids
149
+ * are auto-resolved for the authenticated wallet/application scope.
150
+ */
124
151
  getMarginAccountMovements(marginAccountId: string, params?: GetMarginAccountMovementsParams): Promise<GetMarginAccountMovementsResponse>;
152
+ simulateParentMarginOrderRisk(request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
153
+ /**
154
+ * @deprecated Prefer simulateParentMarginOrderRisk(). Parent margin account ids
155
+ * are auto-resolved for the authenticated wallet/application scope.
156
+ */
125
157
  simulateOrderRisk(marginAccountId: string, request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
126
- simulateAutoMarginOrderRisk(request: SimulateAutoMarginOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
158
+ simulateRiskBucketOrderRisk(request: SimulateRiskBucketOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
127
159
  }
@@ -3,7 +3,9 @@
3
3
  *
4
4
  * Types for market data operations including trading pair metadata and OHLCV data.
5
5
  */
6
+ import type { Address } from "viem";
6
7
  import type { BaseAPI } from "../api";
8
+ import type { TradingMode } from "../trading";
7
9
  /**
8
10
  * Trading pair metadata
9
11
  */
@@ -21,9 +23,9 @@ export interface TradingPair {
21
23
  /** Quote asset ID (UUID) */
22
24
  quote_asset_id: string;
23
25
  /** Base token contract address */
24
- base_token_contract: string;
26
+ base_token_contract: Address;
25
27
  /** Quote token contract address */
26
- quote_token_contract: string;
28
+ quote_token_contract: Address;
27
29
  /** Base token decimals */
28
30
  base_decimals: number;
29
31
  /** Base token icon URL */
@@ -32,9 +34,9 @@ export interface TradingPair {
32
34
  quote_decimals: number;
33
35
  /** Quote token icon URL */
34
36
  quote_icon_url: string;
35
- /** Market type (e.g. SPOT) */
36
- market_type: string;
37
- /** Asset-class category: crypto, equities, or commodities */
37
+ /** Market type (SPOT or MARGIN) */
38
+ market_type: TradingMode;
39
+ /** Asset-class category: crypto, equities, commodities, or fx */
38
40
  category: string;
39
41
  /** Whether the market is active */
40
42
  is_active: boolean;
@@ -121,14 +123,14 @@ export interface GetTradingPairsParams {
121
123
  /** Number of items per page (max 100) */
122
124
  page_size?: number;
123
125
  /** Filter by market type (SPOT, MARGIN) */
124
- market_type?: string;
126
+ market_type?: TradingMode;
125
127
  /** Filter by base token symbol */
126
128
  base_token?: string;
127
129
  /** Filter by quote token symbol */
128
130
  quote_token?: string;
129
131
  /** Filter by active status */
130
132
  is_active?: boolean;
131
- /** Filter by asset-class category (crypto, equities, commodities) */
133
+ /** Filter by asset-class category (crypto, equities, commodities, fx) */
132
134
  category?: string;
133
135
  }
134
136
  /**
@@ -156,10 +158,10 @@ export interface GetScreenerParams {
156
158
  /** Items per page (min 1, max 100, default 50) */
157
159
  page_size?: number;
158
160
  /** Filter by market type: SPOT or MARGIN */
159
- market_type?: string;
161
+ market_type?: TradingMode;
160
162
  /** Filter by active status */
161
163
  is_active?: boolean;
162
- /** Filter by asset-class category (crypto, equities, commodities) */
164
+ /** Filter by asset-class category (crypto, equities, commodities, fx) */
163
165
  category?: string;
164
166
  }
165
167
  /**
@@ -203,7 +205,7 @@ export interface ScreenerItem {
203
205
  price_change_percent_7d: string | null;
204
206
  /** Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
205
207
  snapshot_7d: ScreenerSnapshotPoint[];
206
- /** Asset-class category: crypto, equities, or commodities */
208
+ /** Asset-class category: crypto, equities, commodities, or fx */
207
209
  category: string;
208
210
  /** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
209
211
  total_quote_volume_ltd: string;
@@ -381,9 +383,11 @@ export interface MarketAPI extends BaseAPI {
381
383
  /**
382
384
  * Fetch metadata for a single trading pair by its symbol (e.g. BTC-USDC).
383
385
  * @param symbol - Trading pair symbol
386
+ * @param marketType - Optional market type filter (e.g. "SPOT", "MARGIN") to
387
+ * disambiguate a symbol that exists in more than one market
384
388
  * @returns Promise resolving to trading pair or undefined if not found
385
389
  */
386
- getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
390
+ getTradingPairBySymbol(symbol: string, marketType?: TradingMode): Promise<TradingPair | undefined>;
387
391
  /**
388
392
  * Fetch the paginated market screener: per-pair price/volume/change windows
389
393
  * (1h, 24h, 7d) plus a 7-day daily snapshot, sorted by 24h quote volume.
@@ -5,7 +5,7 @@ export type ClosePositionType = "MARKET" | "LIMIT" | "IOC";
5
5
  export interface Position {
6
6
  position_id: string;
7
7
  margin_account_id: string;
8
- margin_bucket_id?: string;
8
+ risk_bucket_id?: string;
9
9
  trading_pair_id: string;
10
10
  side: PositionSide;
11
11
  size: string;
@@ -48,6 +48,27 @@ export interface ClosePositionResponse {
48
48
  message: string;
49
49
  submitted_quantity: string;
50
50
  }
51
+ export interface BatchCloseAllRequest {
52
+ tradingPairId?: string;
53
+ slippageToleranceBps?: number;
54
+ }
55
+ export interface BatchCloseError {
56
+ code: string;
57
+ message: string;
58
+ }
59
+ export interface BatchCloseResult {
60
+ position_id: string;
61
+ close_order_id?: string;
62
+ status?: string;
63
+ submitted_quantity?: string;
64
+ error?: BatchCloseError;
65
+ }
66
+ export interface BatchCloseAllResponse {
67
+ total_requested: number;
68
+ total_closed: number;
69
+ total_failed: number;
70
+ results: BatchCloseResult[];
71
+ }
51
72
  export interface PositionRisk {
52
73
  position_id: string;
53
74
  mark_price: string;
@@ -121,6 +142,7 @@ export interface PositionsAPI extends BaseAPI {
121
142
  listPositions(params?: ListPositionsParams): Promise<ListPositionsResponse>;
122
143
  getPosition(positionId: string): Promise<GetPositionResponse>;
123
144
  closePosition(positionId: string, request: ClosePositionRequest): Promise<ClosePositionResponse>;
145
+ batchCloseAllPositions(request?: BatchCloseAllRequest): Promise<BatchCloseAllResponse>;
124
146
  getPositionRisk(positionId: string): Promise<PositionRisk>;
125
147
  addPositionMargin(positionId: string, request: AddPositionMarginRequest): Promise<PositionMarginResponse>;
126
148
  reducePositionMargin(positionId: string, request: ReducePositionMarginRequest): Promise<PositionMarginResponse>;
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Types for user profile operations including fetching user profile data.
5
5
  */
6
+ import type { Address } from "viem";
6
7
  import type { BaseAPI } from "../api";
7
8
  import type { OrderSide, OrderStatus, OrderType, TimeInForce } from "../trading";
8
9
  /**
@@ -15,7 +16,7 @@ export interface ProfileMovement {
15
16
  /** Movement type */
16
17
  type: "deposit" | "withdrawal" | "trade" | "transfer" | string;
17
18
  /** Token address */
18
- token: string;
19
+ token: Address;
19
20
  /** Amount of the movement (as string to preserve precision) */
20
21
  amount: string;
21
22
  /** Movement timestamp (ISO string) */
@@ -43,7 +44,7 @@ export interface LedgerMovement {
43
44
  /** Transaction amount in raw format (wei) */
44
45
  amount_raw: string;
45
46
  /** Token contract address */
46
- token: string;
47
+ token: Address;
47
48
  /** Token symbol */
48
49
  symbol: string | null;
49
50
  /** Token decimals */
@@ -187,7 +188,7 @@ export interface AccountBalance {
187
188
  /** Asset ID (UUID for API calls) */
188
189
  asset_id: string;
189
190
  /** Token address */
190
- token: string;
191
+ token: Address;
191
192
  /** Token symbol */
192
193
  symbol: string | null;
193
194
  /** Decimal places for the token */
@@ -202,6 +203,8 @@ export interface AccountBalance {
202
203
  available_balance_raw: string;
203
204
  /** Locked balance in raw format (wei) */
204
205
  locked_balance_raw: string;
206
+ /** Total balance (available + locked) in raw format (wei) */
207
+ total_balance_raw: string;
205
208
  }
206
209
  /**
207
210
  * A single user trade execution.
@@ -369,7 +372,7 @@ export interface UserProfile {
369
372
  /** Unique identifier for the user */
370
373
  id: string;
371
374
  /** Wallet address of the user */
372
- address: string;
375
+ address: Address;
373
376
  /** Username of the user (can be null) */
374
377
  username: string | null;
375
378
  /** Account type (e.g., "master") */
@@ -1,4 +1,4 @@
1
- import type { PublicClient, TransactionReceipt, WalletClient } from "viem";
1
+ import type { Address, PublicClient, TransactionReceipt, WalletClient } from "viem";
2
2
  import type { ApplicationsAPI } from "../applications";
3
3
  import type { AuthAPI, AuthState, SessionCredentials } from "../auth/index";
4
4
  import type { DelegatedAgentsAPI } from "../delegated-agents";
@@ -157,7 +157,7 @@ export interface MonacoSDK {
157
157
  /** Check connection status */
158
158
  isConnected(): boolean;
159
159
  /** Get the current account address */
160
- getAccountAddress(): string;
160
+ getAccountAddress(): Address;
161
161
  /** Get the current network ('mainnet' or 'testnet') */
162
162
  getNetwork(): Network;
163
163
  /** Get the current chain ID */
@@ -7,6 +7,7 @@
7
7
  * permission (enforced server-side). Wire shapes are snake_case; optional
8
8
  * fields are `null` rather than omitted.
9
9
  */
10
+ import type { Address } from "viem";
10
11
  import type { BaseAPI } from "../api";
11
12
  import type { AccountBalance } from "../profile";
12
13
  /**
@@ -16,7 +17,7 @@ export interface SubAccount {
16
17
  /** Sub-account UUID */
17
18
  id: string;
18
19
  /** Sub-account wallet address */
19
- address: string;
20
+ address: Address;
20
21
  /** Sub-account display username */
21
22
  username: string | null;
22
23
  /** Whether the sub-account is allowed to withdraw */
@@ -35,7 +36,7 @@ export interface SubAccountLimit {
35
36
  /** Sub-account UUID this limit applies to */
36
37
  sub_account_id: string;
37
38
  /** Token contract address */
38
- token: string;
39
+ token: Address;
39
40
  /** Maximum daily spending limit in token units */
40
41
  daily_limit: string | null;
41
42
  /** Amount used today against the limit */
@@ -29,8 +29,8 @@ export interface TradingAPI extends BaseAPI {
29
29
  expirationDate?: string;
30
30
  timeInForce?: TimeInForce;
31
31
  marginAccountId?: string;
32
- marginBucketId?: string;
33
- marginBucketCollateral?: string;
32
+ riskBucketId?: string;
33
+ riskBucketCollateral?: string;
34
34
  strategyKey?: string;
35
35
  positionSide?: PositionSide;
36
36
  leverage?: string;
@@ -52,8 +52,8 @@ export interface TradingAPI extends BaseAPI {
52
52
  tradingMode?: TradingMode;
53
53
  slippageTolerance?: number;
54
54
  marginAccountId?: string;
55
- marginBucketId?: string;
56
- marginBucketCollateral?: string;
55
+ riskBucketId?: string;
56
+ riskBucketCollateral?: string;
57
57
  strategyKey?: string;
58
58
  positionSide?: PositionSide;
59
59
  leverage?: string;
@@ -74,8 +74,8 @@ 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 isolated margin bucket ID for bucket-scoped margin orders */
78
- margin_bucket_id?: string;
77
+ /** Resolved isolated risk bucket ID for risk-bucket-scoped margin orders */
78
+ risk_bucket_id?: string;
79
79
  /** Client strategy key carried for compatibility */
80
80
  strategy_key?: string;
81
81
  /** Delegated agent ID when submitted through a delegated session */
@@ -288,10 +288,10 @@ export interface BatchCreateOrderParams {
288
288
  timeInForce?: Extract<TimeInForce, "GTC" | "IOC" | "FOK">;
289
289
  /** Margin account UUID for margin/perp orders */
290
290
  marginAccountId?: string;
291
- /** Existing isolated margin bucket UUID for bucket-scoped margin orders */
292
- marginBucketId?: string;
293
- /** Collateral to allocate into a new isolated margin bucket */
294
- marginBucketCollateral?: string;
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
295
  /** Client strategy key carried for compatibility */
296
296
  strategyKey?: string;
297
297
  /** Position side for margin/perp orders */
@@ -12,6 +12,9 @@ export declare const GetMarginAccountSummarySchema: z.ZodObject<{
12
12
  marginAccountId: z.ZodUUID;
13
13
  tradingPairId: z.ZodOptional<z.ZodUUID>;
14
14
  }, z.core.$strip>;
15
+ export declare const GetParentMarginAccountSummarySchema: z.ZodOptional<z.ZodObject<{
16
+ tradingPairId: z.ZodOptional<z.ZodUUID>;
17
+ }, z.core.$strip>>;
15
18
  export declare const GetAvailableCollateralSchema: z.ZodOptional<z.ZodObject<{
16
19
  asset: z.ZodOptional<z.ZodString>;
17
20
  }, z.core.$strip>>;
@@ -24,7 +27,13 @@ export declare const TransferCollateralSchema: z.ZodObject<{
24
27
  strategyKey: z.ZodOptional<z.ZodString>;
25
28
  }, z.core.$strip>;
26
29
  }, z.core.$strip>;
27
- export declare const TransferCollateralToAutoMarginAccountSchema: z.ZodObject<{
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<{
28
37
  request: z.ZodObject<{
29
38
  asset: z.ZodString;
30
39
  amount: z.ZodString;
@@ -32,12 +41,23 @@ export declare const TransferCollateralToAutoMarginAccountSchema: z.ZodObject<{
32
41
  strategyKey: z.ZodOptional<z.ZodString>;
33
42
  }, z.core.$strip>;
34
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>;
35
50
  export declare const GetMarginAccountMovementsSchema: z.ZodObject<{
36
51
  page: z.ZodOptional<z.ZodNumber>;
37
52
  page_size: z.ZodOptional<z.ZodNumber>;
38
53
  marginAccountId: z.ZodUUID;
39
54
  movement_type: z.ZodOptional<z.ZodString>;
40
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>>;
41
61
  export declare const SimulateOrderRiskSchema: z.ZodObject<{
42
62
  marginAccountId: z.ZodUUID;
43
63
  request: z.ZodObject<{
@@ -61,7 +81,29 @@ export declare const SimulateOrderRiskSchema: z.ZodObject<{
61
81
  reduceOnly: z.ZodOptional<z.ZodBoolean>;
62
82
  }, z.core.$strict>;
63
83
  }, z.core.$strip>;
64
- export declare const SimulateAutoMarginOrderRiskSchema: z.ZodObject<{
84
+ export declare const SimulateParentMarginOrderRiskSchema: z.ZodObject<{
85
+ request: z.ZodObject<{
86
+ tradingPairId: z.ZodUUID;
87
+ side: z.ZodEnum<{
88
+ BUY: "BUY";
89
+ SELL: "SELL";
90
+ }>;
91
+ positionSide: z.ZodEnum<{
92
+ LONG: "LONG";
93
+ SHORT: "SHORT";
94
+ NONE: "NONE";
95
+ }>;
96
+ orderType: z.ZodEnum<{
97
+ LIMIT: "LIMIT";
98
+ MARKET: "MARKET";
99
+ }>;
100
+ price: z.ZodOptional<z.ZodString>;
101
+ quantity: z.ZodString;
102
+ leverage: z.ZodString;
103
+ reduceOnly: z.ZodOptional<z.ZodBoolean>;
104
+ }, z.core.$strict>;
105
+ }, z.core.$strip>;
106
+ export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
65
107
  request: z.ZodObject<{
66
108
  side: z.ZodEnum<{
67
109
  BUY: "BUY";
@@ -15,6 +15,11 @@ export const GetMarginAccountSummarySchema = z.object({
15
15
  marginAccountId: UUIDSchema,
16
16
  tradingPairId: UUIDSchema.optional(),
17
17
  });
18
+ export const GetParentMarginAccountSummarySchema = z
19
+ .object({
20
+ tradingPairId: UUIDSchema.optional(),
21
+ })
22
+ .optional();
18
23
  export const GetAvailableCollateralSchema = z
19
24
  .object({
20
25
  asset: z.string().trim().min(1, "Asset cannot be empty").optional(),
@@ -26,7 +31,11 @@ const TransferCollateralRequestSchema = z.object({
26
31
  tradingPairId: UUIDSchema.optional(),
27
32
  strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
28
33
  });
29
- const AutoMarginBucketRequestSchema = z.object({
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({
30
39
  tradingPairId: UUIDSchema,
31
40
  strategyKey: z.string().trim().min(1, "Strategy key cannot be empty").optional(),
32
41
  });
@@ -34,13 +43,22 @@ export const TransferCollateralSchema = z.object({
34
43
  marginAccountId: UUIDSchema,
35
44
  request: TransferCollateralRequestSchema,
36
45
  });
37
- export const TransferCollateralToAutoMarginAccountSchema = z.object({
38
- request: TransferCollateralRequestSchema.merge(AutoMarginBucketRequestSchema),
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,
39
54
  });
40
55
  export const GetMarginAccountMovementsSchema = PaginationSchema.extend({
41
56
  marginAccountId: UUIDSchema,
42
57
  movement_type: z.string().trim().min(1, "Movement type cannot be empty").optional(),
43
58
  });
59
+ export const GetParentMarginAccountMovementsSchema = PaginationSchema.extend({
60
+ movement_type: z.string().trim().min(1, "Movement type cannot be empty").optional(),
61
+ }).optional();
44
62
  const BaseSimulateOrderRiskRequestSchema = z.object({
45
63
  tradingPairId: UUIDSchema,
46
64
  side: OrderSideSchema,
@@ -52,7 +70,7 @@ const BaseSimulateOrderRiskRequestSchema = z.object({
52
70
  reduceOnly: z.boolean().optional(),
53
71
  });
54
72
  const SimulateOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.strict();
55
- const SimulateAutoMarginOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(AutoMarginBucketRequestSchema).strict();
73
+ const SimulateRiskBucketOrderRiskRequestSchema = BaseSimulateOrderRiskRequestSchema.merge(RiskBucketRequestSchema).strict();
56
74
  export const SimulateOrderRiskSchema = z
57
75
  .object({
58
76
  marginAccountId: UUIDSchema,
@@ -62,9 +80,17 @@ export const SimulateOrderRiskSchema = z
62
80
  message: "price is required for LIMIT risk simulations",
63
81
  path: ["request", "price"],
64
82
  });
65
- export const SimulateAutoMarginOrderRiskSchema = z
83
+ export const SimulateParentMarginOrderRiskSchema = z
84
+ .object({
85
+ request: SimulateOrderRiskRequestSchema,
86
+ })
87
+ .refine((data) => data.request.orderType !== "LIMIT" || data.request.price !== undefined, {
88
+ message: "price is required for LIMIT risk simulations",
89
+ path: ["request", "price"],
90
+ });
91
+ export const SimulateRiskBucketOrderRiskSchema = z
66
92
  .object({
67
- request: SimulateAutoMarginOrderRiskRequestSchema,
93
+ request: SimulateRiskBucketOrderRiskRequestSchema,
68
94
  })
69
95
  .refine((data) => data.request.orderType !== "LIMIT" || data.request.price !== undefined, {
70
96
  message: "price is required for LIMIT risk simulations",
@@ -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({