@0xmonaco/types 0.8.8 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/api/index.d.ts +7 -0
- package/dist/applications/index.d.ts +47 -5
- package/dist/applications/index.js +2 -1
- package/dist/applications/requests.d.ts +78 -0
- package/dist/applications/requests.js +7 -0
- package/dist/applications/responses.d.ts +211 -1
- package/dist/applications/responses.js +3 -1
- package/dist/auth/index.d.ts +6 -12
- package/dist/auth/index.js +2 -2
- package/dist/auth/responses.d.ts +0 -11
- package/dist/delegated-agents/index.d.ts +17 -1
- package/dist/faucet/index.d.ts +54 -0
- package/dist/faucet/index.js +10 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/margin-accounts/index.d.ts +18 -14
- package/dist/market/index.d.ts +116 -0
- package/dist/positions/index.d.ts +1 -0
- package/dist/profile/index.d.ts +88 -1
- package/dist/sdk/index.d.ts +21 -0
- package/dist/sub-accounts/index.d.ts +145 -0
- package/dist/sub-accounts/index.js +9 -0
- package/dist/trading/index.d.ts +6 -6
- package/dist/trading/responses.d.ts +8 -27
- package/dist/validation/margin-accounts.d.ts +7 -9
- package/dist/validation/margin-accounts.js +7 -9
- package/dist/validation/profile.d.ts +7 -0
- package/dist/validation/profile.js +7 -0
- package/dist/validation/trading.d.ts +8 -33
- package/dist/validation/trading.js +42 -33
- package/dist/validation/vault.d.ts +4 -0
- package/dist/validation/vault.js +2 -0
- package/dist/vault/index.d.ts +13 -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 +94 -0
- package/dist/wire/schema.d.ts +8460 -0
- package/dist/wire/schema.js +4 -0
- package/dist/withdrawals/index.d.ts +43 -0
- package/dist/withdrawals/index.js +0 -0
- package/package.json +6 -2
|
@@ -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
|
+
margin_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 CreateMarginAccountResponse {
|
|
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,10 +41,19 @@ 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;
|
|
54
57
|
}
|
|
55
58
|
export interface TransferCollateralToAutoMarginAccountRequest extends TransferCollateralRequest {
|
|
56
59
|
tradingPairId: string;
|
|
@@ -88,7 +91,6 @@ export interface GetMarginAccountMovementsResponse {
|
|
|
88
91
|
}
|
|
89
92
|
export interface SimulateOrderRiskRequest {
|
|
90
93
|
tradingPairId: string;
|
|
91
|
-
strategyKey?: string;
|
|
92
94
|
side: OrderSide;
|
|
93
95
|
positionSide: PositionSide;
|
|
94
96
|
orderType: OrderType;
|
|
@@ -97,6 +99,9 @@ export interface SimulateOrderRiskRequest {
|
|
|
97
99
|
leverage: string;
|
|
98
100
|
reduceOnly?: boolean;
|
|
99
101
|
}
|
|
102
|
+
export interface SimulateAutoMarginOrderRiskRequest extends SimulateOrderRiskRequest {
|
|
103
|
+
strategyKey?: string;
|
|
104
|
+
}
|
|
100
105
|
export interface SimulateOrderRiskResponse {
|
|
101
106
|
accepted: boolean;
|
|
102
107
|
reject_reason?: string;
|
|
@@ -111,13 +116,12 @@ export interface SimulateOrderRiskResponse {
|
|
|
111
116
|
}
|
|
112
117
|
export interface MarginAccountsAPI extends BaseAPI {
|
|
113
118
|
listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
|
|
114
|
-
|
|
115
|
-
getMarginAccountSummary(marginAccountId: string): Promise<MarginAccountSummary>;
|
|
119
|
+
getMarginAccountSummary(marginAccountId: string, params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
|
|
116
120
|
getAvailableCollateral(params?: GetAvailableCollateralParams): Promise<GetAvailableCollateralResponse>;
|
|
117
121
|
transferCollateralToMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
118
122
|
transferCollateralToAutoMarginAccount(request: TransferCollateralToAutoMarginAccountRequest): Promise<TransferCollateralResponse>;
|
|
119
123
|
transferCollateralFromMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
120
124
|
getMarginAccountMovements(marginAccountId: string, params?: GetMarginAccountMovementsParams): Promise<GetMarginAccountMovementsResponse>;
|
|
121
125
|
simulateOrderRisk(marginAccountId: string, request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
122
|
-
simulateAutoMarginOrderRisk(request:
|
|
126
|
+
simulateAutoMarginOrderRisk(request: SimulateAutoMarginOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
123
127
|
}
|
package/dist/market/index.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export interface TradingPair {
|
|
|
34
34
|
quote_icon_url: string;
|
|
35
35
|
/** Market type (e.g. SPOT) */
|
|
36
36
|
market_type: string;
|
|
37
|
+
/** Asset-class category: crypto, equities, or commodities */
|
|
38
|
+
category: string;
|
|
37
39
|
/** Whether the market is active */
|
|
38
40
|
is_active: boolean;
|
|
39
41
|
/** Maker fee in basis points */
|
|
@@ -46,6 +48,10 @@ export interface TradingPair {
|
|
|
46
48
|
max_order_size: string;
|
|
47
49
|
/** Tick size for price increments */
|
|
48
50
|
tick_size: string;
|
|
51
|
+
/** Minimum supported leverage for margin markets (optional, margin only) */
|
|
52
|
+
min_leverage?: string | null;
|
|
53
|
+
/** Maximum supported leverage for margin markets (optional, margin only) */
|
|
54
|
+
max_leverage?: string | null;
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
57
|
* OHLCV candlestick data point (matches API response format)
|
|
@@ -122,6 +128,8 @@ export interface GetTradingPairsParams {
|
|
|
122
128
|
quote_token?: string;
|
|
123
129
|
/** Filter by active status */
|
|
124
130
|
is_active?: boolean;
|
|
131
|
+
/** Filter by asset-class category (crypto, equities, commodities) */
|
|
132
|
+
category?: string;
|
|
125
133
|
}
|
|
126
134
|
/**
|
|
127
135
|
* Response for listing trading pairs with pagination
|
|
@@ -139,6 +147,79 @@ export interface GetTradingPairsResponse {
|
|
|
139
147
|
export interface GetTradingPairResponse {
|
|
140
148
|
trading_pair: TradingPair;
|
|
141
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Query parameters for the market screener
|
|
152
|
+
*/
|
|
153
|
+
export interface GetScreenerParams {
|
|
154
|
+
/** Page number (min 1, default 1) */
|
|
155
|
+
page?: number;
|
|
156
|
+
/** Items per page (min 1, max 100, default 50) */
|
|
157
|
+
page_size?: number;
|
|
158
|
+
/** Filter by market type: SPOT or MARGIN */
|
|
159
|
+
market_type?: string;
|
|
160
|
+
/** Filter by active status */
|
|
161
|
+
is_active?: boolean;
|
|
162
|
+
/** Filter by asset-class category (crypto, equities, commodities) */
|
|
163
|
+
category?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* One UTC-day bucket in a pair's 7-day screener snapshot
|
|
167
|
+
*/
|
|
168
|
+
export interface ScreenerSnapshotPoint {
|
|
169
|
+
/** UTC day boundary (ms since epoch, as string) */
|
|
170
|
+
bucket_start: string;
|
|
171
|
+
/** Quote-token volume for the day */
|
|
172
|
+
quote_volume: string;
|
|
173
|
+
/** Percent price change (close - open) / open * 100 for the day */
|
|
174
|
+
price_change_percent: string;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Per-pair screener row. Window fields are null when there is insufficient history.
|
|
178
|
+
*/
|
|
179
|
+
export interface ScreenerItem {
|
|
180
|
+
/** Trading pair UUID */
|
|
181
|
+
trading_pair_id: string;
|
|
182
|
+
/** Trading pair symbol (e.g. "BTC/USDC") */
|
|
183
|
+
symbol: string;
|
|
184
|
+
/** Base token icon URL */
|
|
185
|
+
base_icon_url: string;
|
|
186
|
+
/** Quote token icon URL */
|
|
187
|
+
quote_icon_url: string;
|
|
188
|
+
/** Most recent close price (null if no trades yet) */
|
|
189
|
+
last_price: string | null;
|
|
190
|
+
/** Timestamp of the last candle (ms since epoch, as string; null if no trades yet) */
|
|
191
|
+
last_price_timestamp: string | null;
|
|
192
|
+
/** Quote-token volume in the last 1 hour (null if <1h history) */
|
|
193
|
+
quote_volume_1h: string | null;
|
|
194
|
+
/** Quote-token volume in the last 24 hours (null if <24h history) */
|
|
195
|
+
quote_volume_24h: string | null;
|
|
196
|
+
/** Quote-token volume in the last 7 days (null if <7d history) */
|
|
197
|
+
quote_volume_7d: string | null;
|
|
198
|
+
/** Percent price change over the last 1 hour (null if <1h history) */
|
|
199
|
+
price_change_percent_1h: string | null;
|
|
200
|
+
/** Percent price change over the last 24 hours (null if <24h history) */
|
|
201
|
+
price_change_percent_24h: string | null;
|
|
202
|
+
/** Percent price change over the last 7 days (null if <7d history) */
|
|
203
|
+
price_change_percent_7d: string | null;
|
|
204
|
+
/** Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
|
|
205
|
+
snapshot_7d: ScreenerSnapshotPoint[];
|
|
206
|
+
/** Asset-class category: crypto, equities, or commodities */
|
|
207
|
+
category: string;
|
|
208
|
+
/** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
|
|
209
|
+
total_quote_volume_ltd: string;
|
|
210
|
+
/** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
|
|
211
|
+
total_trade_count_ltd: number;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Paginated screener response, sorted by quote_volume_24h desc (nulls last)
|
|
215
|
+
*/
|
|
216
|
+
export interface GetScreenerResponse {
|
|
217
|
+
items: ScreenerItem[];
|
|
218
|
+
page: number;
|
|
219
|
+
page_size: number;
|
|
220
|
+
total: number;
|
|
221
|
+
total_pages: number;
|
|
222
|
+
}
|
|
142
223
|
/**
|
|
143
224
|
* API response wrapper for single trading pair
|
|
144
225
|
*/
|
|
@@ -171,6 +252,21 @@ export interface MarketMetadata {
|
|
|
171
252
|
price_change_percent_24h: string | null;
|
|
172
253
|
/** Unix timestamp (ms) when market started trading (null if not available) */
|
|
173
254
|
market_initialization_timestamp: number | null;
|
|
255
|
+
/** Life-to-date cumulative base-token volume since inception ("0" if no trades yet) */
|
|
256
|
+
total_base_volume_ltd: string;
|
|
257
|
+
/** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
|
|
258
|
+
total_quote_volume_ltd: string;
|
|
259
|
+
/** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
|
|
260
|
+
total_trade_count_ltd: number;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Exchange-wide life-to-date cumulative statistics across all trading pairs.
|
|
264
|
+
*/
|
|
265
|
+
export interface MarketStats {
|
|
266
|
+
/** Life-to-date cumulative quote-token (notional) volume summed across all pairs */
|
|
267
|
+
total_quote_volume_ltd: string;
|
|
268
|
+
/** Life-to-date cumulative number of trades summed across all pairs */
|
|
269
|
+
total_trade_count_ltd: number;
|
|
174
270
|
}
|
|
175
271
|
export interface RiskTier {
|
|
176
272
|
notional_floor: string;
|
|
@@ -275,12 +371,32 @@ export interface MarketAPI extends BaseAPI {
|
|
|
275
371
|
* @returns Promise resolving to paginated response with trading pairs
|
|
276
372
|
*/
|
|
277
373
|
getPaginatedTradingPairs(params?: GetTradingPairsParams): Promise<GetTradingPairsResponse>;
|
|
374
|
+
/**
|
|
375
|
+
* Fetch a single trading pair by its UUID.
|
|
376
|
+
* @param tradingPairId - Trading pair UUID
|
|
377
|
+
* @returns Promise resolving to the trading pair
|
|
378
|
+
* @throws {APIError} If the pair is not found
|
|
379
|
+
*/
|
|
380
|
+
getTradingPair(tradingPairId: string): Promise<TradingPair>;
|
|
278
381
|
/**
|
|
279
382
|
* Fetch metadata for a single trading pair by its symbol (e.g. BTC-USDC).
|
|
280
383
|
* @param symbol - Trading pair symbol
|
|
281
384
|
* @returns Promise resolving to trading pair or undefined if not found
|
|
282
385
|
*/
|
|
283
386
|
getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
|
|
387
|
+
/**
|
|
388
|
+
* Fetch the paginated market screener: per-pair price/volume/change windows
|
|
389
|
+
* (1h, 24h, 7d) plus a 7-day daily snapshot, sorted by 24h quote volume.
|
|
390
|
+
* @param params - Optional pagination and filter parameters
|
|
391
|
+
* @returns Promise resolving to the paginated screener response
|
|
392
|
+
*/
|
|
393
|
+
getScreener(params?: GetScreenerParams): Promise<GetScreenerResponse>;
|
|
394
|
+
/**
|
|
395
|
+
* Fetch exchange-wide life-to-date cumulative statistics across all trading
|
|
396
|
+
* pairs: total quote-token (notional) volume and total number of trades.
|
|
397
|
+
* @returns Promise resolving to the global market stats
|
|
398
|
+
*/
|
|
399
|
+
getMarketStats(): Promise<MarketStats>;
|
|
284
400
|
/**
|
|
285
401
|
* Fetch historical candlestick data for a trading pair.
|
|
286
402
|
*
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -76,6 +76,12 @@ export interface LedgerMovement {
|
|
|
76
76
|
block_number: number | null;
|
|
77
77
|
/** Transaction timestamp */
|
|
78
78
|
created_at: string | null;
|
|
79
|
+
/** Asset UUID this movement affects */
|
|
80
|
+
asset_id?: string | null;
|
|
81
|
+
/** User UUID who owns this movement */
|
|
82
|
+
user_id?: string | null;
|
|
83
|
+
/** Balance UUID this movement affects */
|
|
84
|
+
balance_id?: string | null;
|
|
79
85
|
}
|
|
80
86
|
/**
|
|
81
87
|
* Ledger entry type for filtering movements.
|
|
@@ -190,7 +196,7 @@ export interface AccountBalance {
|
|
|
190
196
|
available_balance: string;
|
|
191
197
|
/** Locked balance (in orders or pending operations, normalized) */
|
|
192
198
|
locked_balance: string;
|
|
193
|
-
/** Total balance (available + locked
|
|
199
|
+
/** Total balance (available + locked, normalized) */
|
|
194
200
|
total_balance: string;
|
|
195
201
|
/** Available balance in raw format (wei) */
|
|
196
202
|
available_balance_raw: string;
|
|
@@ -244,6 +250,67 @@ export interface GetUserTradesResponse {
|
|
|
244
250
|
/** Total number of pages */
|
|
245
251
|
total_pages: number;
|
|
246
252
|
}
|
|
253
|
+
/**
|
|
254
|
+
* Direction of a funding payment from the user's perspective.
|
|
255
|
+
*/
|
|
256
|
+
export type FundingDirection = "PAID" | "RECEIVED";
|
|
257
|
+
/**
|
|
258
|
+
* A single funding payment settled against a margin position.
|
|
259
|
+
*/
|
|
260
|
+
export interface FundingPayment {
|
|
261
|
+
/** Funding payment unique identifier (UUID) */
|
|
262
|
+
id: string;
|
|
263
|
+
/** Margin position identifier (UUID) */
|
|
264
|
+
position_id: string;
|
|
265
|
+
/** Margin account identifier (UUID) */
|
|
266
|
+
margin_account_id: string;
|
|
267
|
+
/** Trading pair identifier (UUID) */
|
|
268
|
+
trading_pair_id: string;
|
|
269
|
+
/** Funding rate applied for the epoch (as string to preserve precision) */
|
|
270
|
+
funding_rate: string;
|
|
271
|
+
/** Absolute position size at settlement (as string to preserve precision) */
|
|
272
|
+
position_size: string;
|
|
273
|
+
/** Signed funding amount; positive means paid, negative means received (as string) */
|
|
274
|
+
payment_amount: string;
|
|
275
|
+
/** Funding direction for the user */
|
|
276
|
+
direction: FundingDirection;
|
|
277
|
+
/** Funding window start timestamp (ISO 8601), if known */
|
|
278
|
+
period_start?: string;
|
|
279
|
+
/** Funding window end timestamp (ISO 8601), if known */
|
|
280
|
+
period_end?: string;
|
|
281
|
+
/** Funding payment creation timestamp (ISO 8601), if known */
|
|
282
|
+
created_at?: string;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Query parameters for listing funding payments.
|
|
286
|
+
*/
|
|
287
|
+
export interface ListFundingPaymentsParams {
|
|
288
|
+
/** Page number (starts from 1) */
|
|
289
|
+
page?: number;
|
|
290
|
+
/** Number of items per page (max 100) */
|
|
291
|
+
page_size?: number;
|
|
292
|
+
/** Filter by trading pair ID (UUID) */
|
|
293
|
+
trading_pair_id?: string;
|
|
294
|
+
/** Filter by margin position ID (UUID) */
|
|
295
|
+
position_id?: string;
|
|
296
|
+
/** Filter by margin account ID (UUID) */
|
|
297
|
+
margin_account_id?: string;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Response from listing funding payments.
|
|
301
|
+
*/
|
|
302
|
+
export interface ListFundingPaymentsResponse {
|
|
303
|
+
/** List of funding payment records */
|
|
304
|
+
records: FundingPayment[];
|
|
305
|
+
/** Current page number */
|
|
306
|
+
page: number;
|
|
307
|
+
/** Items per page */
|
|
308
|
+
page_size: number;
|
|
309
|
+
/** Total number of matching records */
|
|
310
|
+
total: number;
|
|
311
|
+
/** Total number of pages */
|
|
312
|
+
total_pages: number;
|
|
313
|
+
}
|
|
247
314
|
/**
|
|
248
315
|
* Time period for portfolio stats and chart queries.
|
|
249
316
|
*/
|
|
@@ -315,6 +382,10 @@ export interface UserProfile {
|
|
|
315
382
|
maker_fee_bps: number;
|
|
316
383
|
/** Account creation timestamp (ISO string) */
|
|
317
384
|
created_at: string;
|
|
385
|
+
/** Additional taker fee in basis points contributed by the application (if any) */
|
|
386
|
+
application_taker_fee_bps?: number;
|
|
387
|
+
/** Additional maker fee in basis points contributed by the application (if any) */
|
|
388
|
+
application_maker_fee_bps?: number;
|
|
318
389
|
}
|
|
319
390
|
/**
|
|
320
391
|
* Profile API interface.
|
|
@@ -402,4 +473,20 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
402
473
|
* @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.
|
|
403
474
|
*/
|
|
404
475
|
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
476
|
+
/**
|
|
477
|
+
* List the current user's funding payment history with pagination and filters.
|
|
478
|
+
*
|
|
479
|
+
* Fetches funding payments from the /api/v1/accounts/funding-payments endpoint.
|
|
480
|
+
* Requires a valid access token to be set.
|
|
481
|
+
*
|
|
482
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
483
|
+
* @param params.page - Page number (starts from 1)
|
|
484
|
+
* @param params.page_size - Number of items per page (max 100)
|
|
485
|
+
* @param params.trading_pair_id - Filter by trading pair ID (UUID)
|
|
486
|
+
* @param params.position_id - Filter by margin position ID (UUID)
|
|
487
|
+
* @param params.margin_account_id - Filter by margin account ID (UUID)
|
|
488
|
+
* @returns Promise resolving to paginated funding payments response
|
|
489
|
+
* @throws ValidationError If pagination params or a UUID filter are invalid; this may occur before any network request.
|
|
490
|
+
*/
|
|
491
|
+
listFundingPayments(params?: ListFundingPaymentsParams): Promise<ListFundingPaymentsResponse>;
|
|
405
492
|
}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -2,14 +2,18 @@ import type { 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";
|
|
5
|
+
import type { FaucetAPI } from "../faucet";
|
|
5
6
|
import type { FeesAPI } from "../fees";
|
|
6
7
|
import type { MarginAccountsAPI } from "../margin-accounts";
|
|
7
8
|
import type { Interval, MarketAPI } from "../market";
|
|
8
9
|
import type { PositionsAPI } from "../positions";
|
|
9
10
|
import type { ProfileAPI } from "../profile";
|
|
11
|
+
import type { SubAccountsAPI } from "../sub-accounts";
|
|
10
12
|
import type { TradingAPI, TradingMode } from "../trading";
|
|
11
13
|
import type { VaultAPI } from "../vault";
|
|
12
14
|
import type { ConditionalOrderEvent, OHLCVEvent, OrderbookEvent, OrderbookQuotationMode, OrderEvent, TradeEvent, UserBalanceEvent, UserMovementEvent } from "../websocket";
|
|
15
|
+
import type { WhitelistAPI } from "../whitelist";
|
|
16
|
+
import type { WithdrawalsAPI } from "../withdrawals";
|
|
13
17
|
import type { Network } from "./network";
|
|
14
18
|
/**
|
|
15
19
|
* Configuration options for the Monaco SDK.
|
|
@@ -65,6 +69,8 @@ export interface MonacoSDK {
|
|
|
65
69
|
delegatedAgents: DelegatedAgentsAPI;
|
|
66
70
|
/** Vault operations API */
|
|
67
71
|
vault: VaultAPI;
|
|
72
|
+
/** Low-level withdrawals API (initiate + fetch signed calldata) */
|
|
73
|
+
withdrawals: WithdrawalsAPI;
|
|
68
74
|
/** Trading operations API */
|
|
69
75
|
trading: TradingAPI;
|
|
70
76
|
/** Market metadata API */
|
|
@@ -73,6 +79,12 @@ export interface MonacoSDK {
|
|
|
73
79
|
marginAccounts: MarginAccountsAPI;
|
|
74
80
|
/** Perp position operations API */
|
|
75
81
|
positions: PositionsAPI;
|
|
82
|
+
/** Sub-account management API */
|
|
83
|
+
subAccounts: SubAccountsAPI;
|
|
84
|
+
/** Testnet faucet API */
|
|
85
|
+
faucet: FaucetAPI;
|
|
86
|
+
/** Public whitelist (waitlist) submission API */
|
|
87
|
+
whitelist: WhitelistAPI;
|
|
76
88
|
/** Profile operations API */
|
|
77
89
|
profile: ProfileAPI;
|
|
78
90
|
/** Orderbook REST API for fetching orderbook snapshots */
|
|
@@ -125,6 +137,15 @@ export interface MonacoSDK {
|
|
|
125
137
|
login(clientId: string, options?: {
|
|
126
138
|
connectWebSocket?: boolean;
|
|
127
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>;
|
|
128
149
|
/** Log out the user */
|
|
129
150
|
logout(): Promise<void>;
|
|
130
151
|
/** Refresh the access token */
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sub-Accounts Types
|
|
3
|
+
*
|
|
4
|
+
* Types for managing sub-accounts and their per-asset spending limits. All
|
|
5
|
+
* endpoints are session-authenticated; the limit mutations additionally
|
|
6
|
+
* require the caller to be a master account with the `ManageSubAccounts`
|
|
7
|
+
* permission (enforced server-side). Wire shapes are snake_case; optional
|
|
8
|
+
* fields are `null` rather than omitted.
|
|
9
|
+
*/
|
|
10
|
+
import type { BaseAPI } from "../api";
|
|
11
|
+
import type { AccountBalance } from "../profile";
|
|
12
|
+
/**
|
|
13
|
+
* A sub-account owned by the authenticated master account, with its balances.
|
|
14
|
+
*/
|
|
15
|
+
export interface SubAccount {
|
|
16
|
+
/** Sub-account UUID */
|
|
17
|
+
id: string;
|
|
18
|
+
/** Sub-account wallet address */
|
|
19
|
+
address: string;
|
|
20
|
+
/** Sub-account display username */
|
|
21
|
+
username: string | null;
|
|
22
|
+
/** Whether the sub-account is allowed to withdraw */
|
|
23
|
+
can_withdraw: boolean;
|
|
24
|
+
/** Account creation timestamp (ISO 8601) */
|
|
25
|
+
created_at: string;
|
|
26
|
+
/** Per-asset balances held by the sub-account */
|
|
27
|
+
balances: AccountBalance[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A per-asset spending limit on a sub-account.
|
|
31
|
+
*/
|
|
32
|
+
export interface SubAccountLimit {
|
|
33
|
+
/** Limit UUID */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Sub-account UUID this limit applies to */
|
|
36
|
+
sub_account_id: string;
|
|
37
|
+
/** Token contract address */
|
|
38
|
+
token: string;
|
|
39
|
+
/** Maximum daily spending limit in token units */
|
|
40
|
+
daily_limit: string | null;
|
|
41
|
+
/** Amount used today against the limit */
|
|
42
|
+
used_today: string;
|
|
43
|
+
/** Limit creation timestamp (ISO 8601) */
|
|
44
|
+
created_at: string;
|
|
45
|
+
/** Last update timestamp (ISO 8601) */
|
|
46
|
+
updated_at: string | null;
|
|
47
|
+
/** Master account UUID that owns this sub-account */
|
|
48
|
+
master_account_id: string;
|
|
49
|
+
/** Maximum amount allowed in token units */
|
|
50
|
+
max_amount: string;
|
|
51
|
+
/** Last reset timestamp for the daily limit (ISO 8601) */
|
|
52
|
+
last_reset_at: string | null;
|
|
53
|
+
/** Whether the limit is active */
|
|
54
|
+
is_active: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Body for creating a sub-account limit.
|
|
58
|
+
*/
|
|
59
|
+
export interface CreateSubAccountLimitRequest {
|
|
60
|
+
/** Sub-account UUID to create the limit for */
|
|
61
|
+
sub_account_id: string;
|
|
62
|
+
/** Asset UUID to limit */
|
|
63
|
+
asset_id: string;
|
|
64
|
+
/** Maximum amount allowed in token units */
|
|
65
|
+
max_amount: string;
|
|
66
|
+
/** Maximum daily spending limit in token units */
|
|
67
|
+
daily_limit?: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Body for updating a sub-account limit. The sub-account and asset are taken
|
|
71
|
+
* from the path; all body fields are optional (partial update).
|
|
72
|
+
*/
|
|
73
|
+
export interface UpdateSubAccountLimitBody {
|
|
74
|
+
/** New maximum amount allowed in token units */
|
|
75
|
+
max_amount?: string;
|
|
76
|
+
/** New maximum daily spending limit in token units */
|
|
77
|
+
daily_limit?: string;
|
|
78
|
+
/** Whether the limit is active */
|
|
79
|
+
is_active?: boolean;
|
|
80
|
+
}
|
|
81
|
+
/** Paginated list of the master account's sub-accounts. */
|
|
82
|
+
export interface ListSubAccountsResponse {
|
|
83
|
+
sub_accounts: SubAccount[];
|
|
84
|
+
/** Total number of sub-accounts */
|
|
85
|
+
total: number;
|
|
86
|
+
}
|
|
87
|
+
/** Response wrapping a single created limit. */
|
|
88
|
+
export interface CreateSubAccountLimitResponse {
|
|
89
|
+
limit: SubAccountLimit;
|
|
90
|
+
}
|
|
91
|
+
/** Response wrapping a single updated limit. */
|
|
92
|
+
export interface UpdateSubAccountLimitResponse {
|
|
93
|
+
limit: SubAccountLimit;
|
|
94
|
+
}
|
|
95
|
+
/** Response wrapping a sub-account's limits. */
|
|
96
|
+
export interface GetSubAccountLimitsResponse {
|
|
97
|
+
limits: SubAccountLimit[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sub-accounts API interface.
|
|
101
|
+
*
|
|
102
|
+
* `list` and `getLimits` need only session auth; `createLimit`, `updateLimit`,
|
|
103
|
+
* and `deleteLimit` additionally require the master account to hold the
|
|
104
|
+
* `ManageSubAccounts` permission (enforced server-side — a non-master or
|
|
105
|
+
* unpermissioned caller gets a 403).
|
|
106
|
+
*/
|
|
107
|
+
export interface SubAccountsAPI extends BaseAPI {
|
|
108
|
+
/**
|
|
109
|
+
* Lists the authenticated master account's sub-accounts with balances.
|
|
110
|
+
*
|
|
111
|
+
* @returns Promise resolving to the sub-accounts and total count
|
|
112
|
+
*/
|
|
113
|
+
list(): Promise<ListSubAccountsResponse>;
|
|
114
|
+
/**
|
|
115
|
+
* Creates a per-asset spending limit on a sub-account.
|
|
116
|
+
*
|
|
117
|
+
* @param body - Sub-account, asset, max amount, and optional daily limit
|
|
118
|
+
* @returns Promise resolving to the created limit
|
|
119
|
+
*/
|
|
120
|
+
createLimit(body: CreateSubAccountLimitRequest): Promise<CreateSubAccountLimitResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Gets the limits configured for a sub-account.
|
|
123
|
+
*
|
|
124
|
+
* @param subAccountId - Sub-account UUID
|
|
125
|
+
* @returns Promise resolving to the sub-account's limits
|
|
126
|
+
*/
|
|
127
|
+
getLimits(subAccountId: string): Promise<GetSubAccountLimitsResponse>;
|
|
128
|
+
/**
|
|
129
|
+
* Updates a sub-account's per-asset limit (partial update).
|
|
130
|
+
*
|
|
131
|
+
* @param subAccountId - Sub-account UUID
|
|
132
|
+
* @param assetId - Asset UUID
|
|
133
|
+
* @param body - Fields to update
|
|
134
|
+
* @returns Promise resolving to the updated limit
|
|
135
|
+
*/
|
|
136
|
+
updateLimit(subAccountId: string, assetId: string, body: UpdateSubAccountLimitBody): Promise<UpdateSubAccountLimitResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Deletes a sub-account's per-asset limit.
|
|
139
|
+
*
|
|
140
|
+
* @param subAccountId - Sub-account UUID
|
|
141
|
+
* @param assetId - Asset UUID
|
|
142
|
+
* @returns Promise resolving when the limit is deleted
|
|
143
|
+
*/
|
|
144
|
+
deleteLimit(subAccountId: string, assetId: string): Promise<void>;
|
|
145
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sub-Accounts Types
|
|
3
|
+
*
|
|
4
|
+
* Types for managing sub-accounts and their per-asset spending limits. All
|
|
5
|
+
* endpoints are session-authenticated; the limit mutations additionally
|
|
6
|
+
* require the caller to be a master account with the `ManageSubAccounts`
|
|
7
|
+
* permission (enforced server-side). Wire shapes are snake_case; optional
|
|
8
|
+
* fields are `null` rather than omitted.
|
|
9
|
+
*/
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { BaseAPI } from "../api/index";
|
|
7
7
|
import type { OrderSide, PositionSide, TimeInForce, TradingMode } from "./orders";
|
|
8
|
-
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse,
|
|
8
|
+
import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, ParentTpSlLegParams, ReplaceOrderResponse } from "./responses";
|
|
9
9
|
/**
|
|
10
10
|
* Trading API interface.
|
|
11
11
|
* Provides methods for placing and managing orders.
|
|
@@ -29,6 +29,8 @@ export interface TradingAPI extends BaseAPI {
|
|
|
29
29
|
expirationDate?: string;
|
|
30
30
|
timeInForce?: TimeInForce;
|
|
31
31
|
marginAccountId?: string;
|
|
32
|
+
marginBucketId?: string;
|
|
33
|
+
marginBucketCollateral?: string;
|
|
32
34
|
strategyKey?: string;
|
|
33
35
|
positionSide?: PositionSide;
|
|
34
36
|
leverage?: string;
|
|
@@ -50,6 +52,8 @@ export interface TradingAPI extends BaseAPI {
|
|
|
50
52
|
tradingMode?: TradingMode;
|
|
51
53
|
slippageTolerance?: number;
|
|
52
54
|
marginAccountId?: string;
|
|
55
|
+
marginBucketId?: string;
|
|
56
|
+
marginBucketCollateral?: string;
|
|
53
57
|
strategyKey?: string;
|
|
54
58
|
positionSide?: PositionSide;
|
|
55
59
|
leverage?: string;
|
|
@@ -63,10 +67,6 @@ export interface TradingAPI extends BaseAPI {
|
|
|
63
67
|
* @returns Promise resolving to the cancellation result
|
|
64
68
|
*/
|
|
65
69
|
cancelOrder(orderId: string): Promise<CancelOrderResponse>;
|
|
66
|
-
/**
|
|
67
|
-
* Creates a standalone conditional TP/SL order.
|
|
68
|
-
*/
|
|
69
|
-
createConditionalOrder(params: CreateConditionalOrderParams): Promise<CreateConditionalOrderResponse>;
|
|
70
70
|
/**
|
|
71
71
|
* Cancels an active conditional TP/SL order.
|
|
72
72
|
*/
|
|
@@ -135,4 +135,4 @@ export interface TradingAPI extends BaseAPI {
|
|
|
135
135
|
}
|
|
136
136
|
export type { ConditionalOrderConditionType, ConditionalOrderState, ConditionalOrderTriggerSource, Order, OrderRole, OrderSide, OrderStatus, OrderType, PositionSide, TimeInForce, TradingMode, } from "./orders";
|
|
137
137
|
export { ORDER_STATUS_VALUES } from "./orders";
|
|
138
|
-
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder,
|
|
138
|
+
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelConditionalOrderResponse, CancelOrderResponse, ConditionalOrder, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, MatchResult, ParentTpSlLegParams, ReplaceOrderResponse, UpdatedFields, } from "./responses";
|