@0xmonaco/types 0.8.7-develop.5d0e403 → 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/margin-accounts/index.d.ts +52 -16
- package/dist/market/index.d.ts +41 -5
- package/dist/positions/index.d.ts +23 -1
- package/dist/profile/index.d.ts +79 -0
- package/dist/sdk/index.d.ts +9 -0
- package/dist/trading/index.d.ts +6 -10
- package/dist/trading/responses.d.ts +6 -31
- 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 -41
- package/dist/validation/trading.js +27 -60
- 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/wire/audit.d.ts +47 -0
- package/dist/wire/audit.js +43 -0
- package/dist/wire/index.d.ts +7 -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 +687 -296
- package/dist/withdrawals/index.d.ts +25 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ import { MonacoSDK, SDKConfig } from "@0xmonaco/types";
|
|
|
22
22
|
// SDK configuration
|
|
23
23
|
interface SDKConfig {
|
|
24
24
|
walletClient?: WalletClient; // Wallet client for signing operations
|
|
25
|
-
network: Network; //
|
|
25
|
+
network: Network; // Use "staging" for public testnet or "mainnet" for production
|
|
26
26
|
seiRpcUrl: string; // RPC URL for Sei blockchain interactions
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -293,7 +293,7 @@ Types for network configuration:
|
|
|
293
293
|
```typescript
|
|
294
294
|
import { Network, NetworkEndpoints } from "@0xmonaco/types";
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
const publicNetwork: Network = "staging";
|
|
297
297
|
|
|
298
298
|
interface NetworkEndpoints {
|
|
299
299
|
rpcUrl: string;
|
|
@@ -301,13 +301,15 @@ interface NetworkEndpoints {
|
|
|
301
301
|
}
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
+
For public integrations, use `"staging"` or `"mainnet"`.
|
|
305
|
+
|
|
304
306
|
## Type Reference
|
|
305
307
|
|
|
306
308
|
### SDK Types
|
|
307
309
|
|
|
308
310
|
- `MonacoSDK`: Main SDK interface with all API modules
|
|
309
311
|
- `SDKConfig`: Configuration options for the Monaco SDK
|
|
310
|
-
- `Network`:
|
|
312
|
+
- `Network`: SDK network preset type. Public integrations should use `"staging"` or `"mainnet"`.
|
|
311
313
|
- `AuthState`: Authentication state information
|
|
312
314
|
|
|
313
315
|
### Vault Types
|
|
@@ -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
|
+
risk_bucket_id?: string;
|
|
7
|
+
margin_mode?: "ISOLATED" | "CROSS";
|
|
6
8
|
trading_pair_id?: string;
|
|
7
9
|
strategy_key?: string;
|
|
8
10
|
account_state: string;
|
|
@@ -28,16 +30,8 @@ export interface ListMarginAccountsResponse {
|
|
|
28
30
|
page: number;
|
|
29
31
|
page_size: number;
|
|
30
32
|
}
|
|
31
|
-
export interface
|
|
32
|
-
|
|
33
|
-
collateralAsset?: string;
|
|
34
|
-
}
|
|
35
|
-
export interface EnsureParentMarginAccountResponse {
|
|
36
|
-
margin_account_id: string;
|
|
37
|
-
label?: string;
|
|
38
|
-
account_state: string;
|
|
39
|
-
collateral_asset: string;
|
|
40
|
-
created_at: string;
|
|
33
|
+
export interface GetMarginAccountSummaryParams {
|
|
34
|
+
tradingPairId?: string;
|
|
41
35
|
}
|
|
42
36
|
export interface GetAvailableCollateralParams {
|
|
43
37
|
asset?: string;
|
|
@@ -47,15 +41,32 @@ export interface GetAvailableCollateralResponse {
|
|
|
47
41
|
wallet_available: string;
|
|
48
42
|
wallet_locked: string;
|
|
49
43
|
margin_transferable?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Free collateral held in the user's parent margin account for this asset
|
|
46
|
+
* (equity minus initial margin required) — collateral already inside margin
|
|
47
|
+
* and available to open new positions or transfer back out. Absent when the
|
|
48
|
+
* user has no margin account yet.
|
|
49
|
+
*/
|
|
50
|
+
margin_available_collateral?: string;
|
|
50
51
|
}
|
|
51
52
|
export interface TransferCollateralRequest {
|
|
52
53
|
asset: string;
|
|
53
54
|
amount: string;
|
|
55
|
+
tradingPairId?: string;
|
|
56
|
+
strategyKey?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface TransferCollateralToParentMarginAccountRequest {
|
|
59
|
+
asset: string;
|
|
60
|
+
amount: string;
|
|
54
61
|
}
|
|
55
|
-
export interface
|
|
62
|
+
export interface TransferCollateralToRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
|
|
56
63
|
tradingPairId: string;
|
|
57
64
|
strategyKey?: string;
|
|
58
65
|
}
|
|
66
|
+
export interface TransferCollateralFromParentMarginAccountRequest {
|
|
67
|
+
asset: string;
|
|
68
|
+
amount: string;
|
|
69
|
+
}
|
|
59
70
|
export interface TransferCollateralResponse {
|
|
60
71
|
movement_id: string;
|
|
61
72
|
margin_account_id: string;
|
|
@@ -88,7 +99,6 @@ export interface GetMarginAccountMovementsResponse {
|
|
|
88
99
|
}
|
|
89
100
|
export interface SimulateOrderRiskRequest {
|
|
90
101
|
tradingPairId: string;
|
|
91
|
-
strategyKey?: string;
|
|
92
102
|
side: OrderSide;
|
|
93
103
|
positionSide: PositionSide;
|
|
94
104
|
orderType: OrderType;
|
|
@@ -97,6 +107,9 @@ export interface SimulateOrderRiskRequest {
|
|
|
97
107
|
leverage: string;
|
|
98
108
|
reduceOnly?: boolean;
|
|
99
109
|
}
|
|
110
|
+
export interface SimulateRiskBucketOrderRiskRequest extends SimulateOrderRiskRequest {
|
|
111
|
+
strategyKey?: string;
|
|
112
|
+
}
|
|
100
113
|
export interface SimulateOrderRiskResponse {
|
|
101
114
|
accepted: boolean;
|
|
102
115
|
reject_reason?: string;
|
|
@@ -111,13 +124,36 @@ export interface SimulateOrderRiskResponse {
|
|
|
111
124
|
}
|
|
112
125
|
export interface MarginAccountsAPI extends BaseAPI {
|
|
113
126
|
listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
|
|
114
|
-
|
|
115
|
-
|
|
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
|
+
*/
|
|
132
|
+
getMarginAccountSummary(marginAccountId: string, params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
|
|
116
133
|
getAvailableCollateral(params?: GetAvailableCollateralParams): Promise<GetAvailableCollateralResponse>;
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated Prefer transferCollateralToParentMarginAccount() or
|
|
136
|
+
* transferCollateralToRiskBucket().
|
|
137
|
+
*/
|
|
117
138
|
transferCollateralToMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
118
|
-
|
|
139
|
+
transferCollateralToParentMarginAccount(request: TransferCollateralToParentMarginAccountRequest): Promise<TransferCollateralResponse>;
|
|
140
|
+
transferCollateralToRiskBucket(request: TransferCollateralToRiskBucketRequest): Promise<TransferCollateralResponse>;
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated Prefer transferCollateralFromParentMarginAccount().
|
|
143
|
+
*/
|
|
119
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
|
+
*/
|
|
120
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
|
+
*/
|
|
121
157
|
simulateOrderRisk(marginAccountId: string, request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
122
|
-
|
|
158
|
+
simulateRiskBucketOrderRisk(request: SimulateRiskBucketOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
123
159
|
}
|
package/dist/market/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Types for market data operations including trading pair metadata and OHLCV data.
|
|
5
5
|
*/
|
|
6
6
|
import type { BaseAPI } from "../api";
|
|
7
|
+
import type { TradingMode } from "../trading";
|
|
7
8
|
/**
|
|
8
9
|
* Trading pair metadata
|
|
9
10
|
*/
|
|
@@ -32,8 +33,10 @@ export interface TradingPair {
|
|
|
32
33
|
quote_decimals: number;
|
|
33
34
|
/** Quote token icon URL */
|
|
34
35
|
quote_icon_url: string;
|
|
35
|
-
/** Market type (
|
|
36
|
-
market_type:
|
|
36
|
+
/** Market type (SPOT or MARGIN) */
|
|
37
|
+
market_type: TradingMode;
|
|
38
|
+
/** Asset-class category: crypto, equities, commodities, or fx */
|
|
39
|
+
category: string;
|
|
37
40
|
/** Whether the market is active */
|
|
38
41
|
is_active: boolean;
|
|
39
42
|
/** Maker fee in basis points */
|
|
@@ -119,13 +122,15 @@ export interface GetTradingPairsParams {
|
|
|
119
122
|
/** Number of items per page (max 100) */
|
|
120
123
|
page_size?: number;
|
|
121
124
|
/** Filter by market type (SPOT, MARGIN) */
|
|
122
|
-
market_type?:
|
|
125
|
+
market_type?: TradingMode;
|
|
123
126
|
/** Filter by base token symbol */
|
|
124
127
|
base_token?: string;
|
|
125
128
|
/** Filter by quote token symbol */
|
|
126
129
|
quote_token?: string;
|
|
127
130
|
/** Filter by active status */
|
|
128
131
|
is_active?: boolean;
|
|
132
|
+
/** Filter by asset-class category (crypto, equities, commodities, fx) */
|
|
133
|
+
category?: string;
|
|
129
134
|
}
|
|
130
135
|
/**
|
|
131
136
|
* Response for listing trading pairs with pagination
|
|
@@ -152,9 +157,11 @@ export interface GetScreenerParams {
|
|
|
152
157
|
/** Items per page (min 1, max 100, default 50) */
|
|
153
158
|
page_size?: number;
|
|
154
159
|
/** Filter by market type: SPOT or MARGIN */
|
|
155
|
-
market_type?:
|
|
160
|
+
market_type?: TradingMode;
|
|
156
161
|
/** Filter by active status */
|
|
157
162
|
is_active?: boolean;
|
|
163
|
+
/** Filter by asset-class category (crypto, equities, commodities, fx) */
|
|
164
|
+
category?: string;
|
|
158
165
|
}
|
|
159
166
|
/**
|
|
160
167
|
* One UTC-day bucket in a pair's 7-day screener snapshot
|
|
@@ -197,6 +204,12 @@ export interface ScreenerItem {
|
|
|
197
204
|
price_change_percent_7d: string | null;
|
|
198
205
|
/** Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
|
|
199
206
|
snapshot_7d: ScreenerSnapshotPoint[];
|
|
207
|
+
/** Asset-class category: crypto, equities, commodities, or fx */
|
|
208
|
+
category: string;
|
|
209
|
+
/** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
|
|
210
|
+
total_quote_volume_ltd: string;
|
|
211
|
+
/** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
|
|
212
|
+
total_trade_count_ltd: number;
|
|
200
213
|
}
|
|
201
214
|
/**
|
|
202
215
|
* Paginated screener response, sorted by quote_volume_24h desc (nulls last)
|
|
@@ -240,6 +253,21 @@ export interface MarketMetadata {
|
|
|
240
253
|
price_change_percent_24h: string | null;
|
|
241
254
|
/** Unix timestamp (ms) when market started trading (null if not available) */
|
|
242
255
|
market_initialization_timestamp: number | null;
|
|
256
|
+
/** Life-to-date cumulative base-token volume since inception ("0" if no trades yet) */
|
|
257
|
+
total_base_volume_ltd: string;
|
|
258
|
+
/** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
|
|
259
|
+
total_quote_volume_ltd: string;
|
|
260
|
+
/** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
|
|
261
|
+
total_trade_count_ltd: number;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Exchange-wide life-to-date cumulative statistics across all trading pairs.
|
|
265
|
+
*/
|
|
266
|
+
export interface MarketStats {
|
|
267
|
+
/** Life-to-date cumulative quote-token (notional) volume summed across all pairs */
|
|
268
|
+
total_quote_volume_ltd: string;
|
|
269
|
+
/** Life-to-date cumulative number of trades summed across all pairs */
|
|
270
|
+
total_trade_count_ltd: number;
|
|
243
271
|
}
|
|
244
272
|
export interface RiskTier {
|
|
245
273
|
notional_floor: string;
|
|
@@ -354,9 +382,11 @@ export interface MarketAPI extends BaseAPI {
|
|
|
354
382
|
/**
|
|
355
383
|
* Fetch metadata for a single trading pair by its symbol (e.g. BTC-USDC).
|
|
356
384
|
* @param symbol - Trading pair symbol
|
|
385
|
+
* @param marketType - Optional market type filter (e.g. "SPOT", "MARGIN") to
|
|
386
|
+
* disambiguate a symbol that exists in more than one market
|
|
357
387
|
* @returns Promise resolving to trading pair or undefined if not found
|
|
358
388
|
*/
|
|
359
|
-
getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
|
|
389
|
+
getTradingPairBySymbol(symbol: string, marketType?: TradingMode): Promise<TradingPair | undefined>;
|
|
360
390
|
/**
|
|
361
391
|
* Fetch the paginated market screener: per-pair price/volume/change windows
|
|
362
392
|
* (1h, 24h, 7d) plus a 7-day daily snapshot, sorted by 24h quote volume.
|
|
@@ -364,6 +394,12 @@ export interface MarketAPI extends BaseAPI {
|
|
|
364
394
|
* @returns Promise resolving to the paginated screener response
|
|
365
395
|
*/
|
|
366
396
|
getScreener(params?: GetScreenerParams): Promise<GetScreenerResponse>;
|
|
397
|
+
/**
|
|
398
|
+
* Fetch exchange-wide life-to-date cumulative statistics across all trading
|
|
399
|
+
* pairs: total quote-token (notional) volume and total number of trades.
|
|
400
|
+
* @returns Promise resolving to the global market stats
|
|
401
|
+
*/
|
|
402
|
+
getMarketStats(): Promise<MarketStats>;
|
|
367
403
|
/**
|
|
368
404
|
* Fetch historical candlestick data for a trading pair.
|
|
369
405
|
*
|
|
@@ -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
|
-
|
|
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>;
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -202,6 +202,8 @@ export interface AccountBalance {
|
|
|
202
202
|
available_balance_raw: string;
|
|
203
203
|
/** Locked balance in raw format (wei) */
|
|
204
204
|
locked_balance_raw: string;
|
|
205
|
+
/** Total balance (available + locked) in raw format (wei) */
|
|
206
|
+
total_balance_raw: string;
|
|
205
207
|
}
|
|
206
208
|
/**
|
|
207
209
|
* A single user trade execution.
|
|
@@ -250,6 +252,67 @@ export interface GetUserTradesResponse {
|
|
|
250
252
|
/** Total number of pages */
|
|
251
253
|
total_pages: number;
|
|
252
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Direction of a funding payment from the user's perspective.
|
|
257
|
+
*/
|
|
258
|
+
export type FundingDirection = "PAID" | "RECEIVED";
|
|
259
|
+
/**
|
|
260
|
+
* A single funding payment settled against a margin position.
|
|
261
|
+
*/
|
|
262
|
+
export interface FundingPayment {
|
|
263
|
+
/** Funding payment unique identifier (UUID) */
|
|
264
|
+
id: string;
|
|
265
|
+
/** Margin position identifier (UUID) */
|
|
266
|
+
position_id: string;
|
|
267
|
+
/** Margin account identifier (UUID) */
|
|
268
|
+
margin_account_id: string;
|
|
269
|
+
/** Trading pair identifier (UUID) */
|
|
270
|
+
trading_pair_id: string;
|
|
271
|
+
/** Funding rate applied for the epoch (as string to preserve precision) */
|
|
272
|
+
funding_rate: string;
|
|
273
|
+
/** Absolute position size at settlement (as string to preserve precision) */
|
|
274
|
+
position_size: string;
|
|
275
|
+
/** Signed funding amount; positive means paid, negative means received (as string) */
|
|
276
|
+
payment_amount: string;
|
|
277
|
+
/** Funding direction for the user */
|
|
278
|
+
direction: FundingDirection;
|
|
279
|
+
/** Funding window start timestamp (ISO 8601), if known */
|
|
280
|
+
period_start?: string;
|
|
281
|
+
/** Funding window end timestamp (ISO 8601), if known */
|
|
282
|
+
period_end?: string;
|
|
283
|
+
/** Funding payment creation timestamp (ISO 8601), if known */
|
|
284
|
+
created_at?: string;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Query parameters for listing funding payments.
|
|
288
|
+
*/
|
|
289
|
+
export interface ListFundingPaymentsParams {
|
|
290
|
+
/** Page number (starts from 1) */
|
|
291
|
+
page?: number;
|
|
292
|
+
/** Number of items per page (max 100) */
|
|
293
|
+
page_size?: number;
|
|
294
|
+
/** Filter by trading pair ID (UUID) */
|
|
295
|
+
trading_pair_id?: string;
|
|
296
|
+
/** Filter by margin position ID (UUID) */
|
|
297
|
+
position_id?: string;
|
|
298
|
+
/** Filter by margin account ID (UUID) */
|
|
299
|
+
margin_account_id?: string;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Response from listing funding payments.
|
|
303
|
+
*/
|
|
304
|
+
export interface ListFundingPaymentsResponse {
|
|
305
|
+
/** List of funding payment records */
|
|
306
|
+
records: FundingPayment[];
|
|
307
|
+
/** Current page number */
|
|
308
|
+
page: number;
|
|
309
|
+
/** Items per page */
|
|
310
|
+
page_size: number;
|
|
311
|
+
/** Total number of matching records */
|
|
312
|
+
total: number;
|
|
313
|
+
/** Total number of pages */
|
|
314
|
+
total_pages: number;
|
|
315
|
+
}
|
|
253
316
|
/**
|
|
254
317
|
* Time period for portfolio stats and chart queries.
|
|
255
318
|
*/
|
|
@@ -412,4 +475,20 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
412
475
|
* @throws ValidationError If pagination params (page/limit) are invalid or trading_pair_id is not a valid UUID; this may occur before any network request.
|
|
413
476
|
*/
|
|
414
477
|
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
478
|
+
/**
|
|
479
|
+
* List the current user's funding payment history with pagination and filters.
|
|
480
|
+
*
|
|
481
|
+
* Fetches funding payments from the /api/v1/accounts/funding-payments endpoint.
|
|
482
|
+
* Requires a valid access token to be set.
|
|
483
|
+
*
|
|
484
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
485
|
+
* @param params.page - Page number (starts from 1)
|
|
486
|
+
* @param params.page_size - Number of items per page (max 100)
|
|
487
|
+
* @param params.trading_pair_id - Filter by trading pair ID (UUID)
|
|
488
|
+
* @param params.position_id - Filter by margin position ID (UUID)
|
|
489
|
+
* @param params.margin_account_id - Filter by margin account ID (UUID)
|
|
490
|
+
* @returns Promise resolving to paginated funding payments response
|
|
491
|
+
* @throws ValidationError If pagination params or a UUID filter are invalid; this may occur before any network request.
|
|
492
|
+
*/
|
|
493
|
+
listFundingPayments(params?: ListFundingPaymentsParams): Promise<ListFundingPaymentsResponse>;
|
|
415
494
|
}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -137,6 +137,15 @@ export interface MonacoSDK {
|
|
|
137
137
|
login(clientId: string, options?: {
|
|
138
138
|
connectWebSocket?: boolean;
|
|
139
139
|
}): Promise<AuthState>;
|
|
140
|
+
/**
|
|
141
|
+
* Create and adopt an owner-scoped delegated session.
|
|
142
|
+
*
|
|
143
|
+
* The current authenticated session must belong to an agent wallet that has
|
|
144
|
+
* an active delegation from `ownerUserId`. On success, the SDK signs
|
|
145
|
+
* subsequent requests with the delegated session keypair, so account reads
|
|
146
|
+
* and trading calls operate on the owner while preserving agent attribution.
|
|
147
|
+
*/
|
|
148
|
+
loginAsDelegatedOwner(ownerUserId: string): Promise<AuthState>;
|
|
140
149
|
/** Log out the user */
|
|
141
150
|
logout(): Promise<void>;
|
|
142
151
|
/** Refresh the access token */
|
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,8 +29,8 @@ export interface TradingAPI extends BaseAPI {
|
|
|
29
29
|
expirationDate?: string;
|
|
30
30
|
timeInForce?: TimeInForce;
|
|
31
31
|
marginAccountId?: string;
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
56
|
-
|
|
55
|
+
riskBucketId?: string;
|
|
56
|
+
riskBucketCollateral?: string;
|
|
57
57
|
strategyKey?: string;
|
|
58
58
|
positionSide?: PositionSide;
|
|
59
59
|
leverage?: string;
|
|
@@ -67,10 +67,6 @@ export interface TradingAPI extends BaseAPI {
|
|
|
67
67
|
* @returns Promise resolving to the cancellation result
|
|
68
68
|
*/
|
|
69
69
|
cancelOrder(orderId: string): Promise<CancelOrderResponse>;
|
|
70
|
-
/**
|
|
71
|
-
* Creates a standalone conditional TP/SL order.
|
|
72
|
-
*/
|
|
73
|
-
createConditionalOrder(params: CreateConditionalOrderParams): Promise<CreateConditionalOrderResponse>;
|
|
74
70
|
/**
|
|
75
71
|
* Cancels an active conditional TP/SL order.
|
|
76
72
|
*/
|
|
@@ -139,4 +135,4 @@ export interface TradingAPI extends BaseAPI {
|
|
|
139
135
|
}
|
|
140
136
|
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderType, PositionSide, TimeInForce, TradingMode, } from "./orders";
|
|
141
137
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
142
|
-
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,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
|
|
78
|
-
|
|
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
|
|
292
|
-
|
|
293
|
-
/** Collateral to allocate into a new isolated
|
|
294
|
-
|
|
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 */
|
|
@@ -314,31 +314,6 @@ export interface BatchReplaceOrderParams {
|
|
|
314
314
|
/** For sub-accounts: use master's balance (optional) */
|
|
315
315
|
useMasterBalance?: boolean;
|
|
316
316
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Parameters for creating a standalone conditional TP/SL order.
|
|
319
|
-
*/
|
|
320
|
-
export interface CreateConditionalOrderParams {
|
|
321
|
-
tradingPairId: string;
|
|
322
|
-
marginAccountId: string;
|
|
323
|
-
conditionType: ConditionalOrderConditionType;
|
|
324
|
-
triggerPrice: string;
|
|
325
|
-
triggerSource?: ConditionalOrderTriggerSource;
|
|
326
|
-
side: OrderSide;
|
|
327
|
-
positionSide: Exclude<PositionSide, "NONE">;
|
|
328
|
-
orderType: OrderType;
|
|
329
|
-
limitPrice?: string;
|
|
330
|
-
quantity?: string;
|
|
331
|
-
reduceOnly?: boolean;
|
|
332
|
-
timeInForce?: Extract<TimeInForce, "GTC" | "IOC">;
|
|
333
|
-
slippageToleranceBps?: number;
|
|
334
|
-
expiresAt?: string;
|
|
335
|
-
}
|
|
336
|
-
export interface CreateConditionalOrderResponse {
|
|
337
|
-
conditional_order_id: string;
|
|
338
|
-
status: "SUCCESS" | "FAILED";
|
|
339
|
-
message: string;
|
|
340
|
-
state: ConditionalOrderState;
|
|
341
|
-
}
|
|
342
317
|
export interface CancelConditionalOrderResponse {
|
|
343
318
|
conditional_order_id: string;
|
|
344
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 EnsureParentMarginAccountSchema: 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>;
|