@0xmonaco/types 0.8.8 → 0.8.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +11 -14
- package/dist/market/index.d.ts +83 -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/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 +93 -0
- package/dist/wire/schema.d.ts +8352 -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;
|
|
@@ -51,6 +45,8 @@ export interface GetAvailableCollateralResponse {
|
|
|
51
45
|
export interface TransferCollateralRequest {
|
|
52
46
|
asset: string;
|
|
53
47
|
amount: string;
|
|
48
|
+
tradingPairId?: string;
|
|
49
|
+
strategyKey?: string;
|
|
54
50
|
}
|
|
55
51
|
export interface TransferCollateralToAutoMarginAccountRequest extends TransferCollateralRequest {
|
|
56
52
|
tradingPairId: string;
|
|
@@ -88,7 +84,6 @@ export interface GetMarginAccountMovementsResponse {
|
|
|
88
84
|
}
|
|
89
85
|
export interface SimulateOrderRiskRequest {
|
|
90
86
|
tradingPairId: string;
|
|
91
|
-
strategyKey?: string;
|
|
92
87
|
side: OrderSide;
|
|
93
88
|
positionSide: PositionSide;
|
|
94
89
|
orderType: OrderType;
|
|
@@ -97,6 +92,9 @@ export interface SimulateOrderRiskRequest {
|
|
|
97
92
|
leverage: string;
|
|
98
93
|
reduceOnly?: boolean;
|
|
99
94
|
}
|
|
95
|
+
export interface SimulateAutoMarginOrderRiskRequest extends SimulateOrderRiskRequest {
|
|
96
|
+
strategyKey?: string;
|
|
97
|
+
}
|
|
100
98
|
export interface SimulateOrderRiskResponse {
|
|
101
99
|
accepted: boolean;
|
|
102
100
|
reject_reason?: string;
|
|
@@ -111,13 +109,12 @@ export interface SimulateOrderRiskResponse {
|
|
|
111
109
|
}
|
|
112
110
|
export interface MarginAccountsAPI extends BaseAPI {
|
|
113
111
|
listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
|
|
114
|
-
|
|
115
|
-
getMarginAccountSummary(marginAccountId: string): Promise<MarginAccountSummary>;
|
|
112
|
+
getMarginAccountSummary(marginAccountId: string, params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
|
|
116
113
|
getAvailableCollateral(params?: GetAvailableCollateralParams): Promise<GetAvailableCollateralResponse>;
|
|
117
114
|
transferCollateralToMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
118
115
|
transferCollateralToAutoMarginAccount(request: TransferCollateralToAutoMarginAccountRequest): Promise<TransferCollateralResponse>;
|
|
119
116
|
transferCollateralFromMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
120
117
|
getMarginAccountMovements(marginAccountId: string, params?: GetMarginAccountMovementsParams): Promise<GetMarginAccountMovementsResponse>;
|
|
121
118
|
simulateOrderRisk(marginAccountId: string, request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
122
|
-
simulateAutoMarginOrderRisk(request:
|
|
119
|
+
simulateAutoMarginOrderRisk(request: SimulateAutoMarginOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
123
120
|
}
|
package/dist/market/index.d.ts
CHANGED
|
@@ -46,6 +46,10 @@ export interface TradingPair {
|
|
|
46
46
|
max_order_size: string;
|
|
47
47
|
/** Tick size for price increments */
|
|
48
48
|
tick_size: string;
|
|
49
|
+
/** Minimum supported leverage for margin markets (optional, margin only) */
|
|
50
|
+
min_leverage?: string | null;
|
|
51
|
+
/** Maximum supported leverage for margin markets (optional, margin only) */
|
|
52
|
+
max_leverage?: string | null;
|
|
49
53
|
}
|
|
50
54
|
/**
|
|
51
55
|
* OHLCV candlestick data point (matches API response format)
|
|
@@ -139,6 +143,71 @@ export interface GetTradingPairsResponse {
|
|
|
139
143
|
export interface GetTradingPairResponse {
|
|
140
144
|
trading_pair: TradingPair;
|
|
141
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Query parameters for the market screener
|
|
148
|
+
*/
|
|
149
|
+
export interface GetScreenerParams {
|
|
150
|
+
/** Page number (min 1, default 1) */
|
|
151
|
+
page?: number;
|
|
152
|
+
/** Items per page (min 1, max 100, default 50) */
|
|
153
|
+
page_size?: number;
|
|
154
|
+
/** Filter by market type: SPOT or MARGIN */
|
|
155
|
+
market_type?: string;
|
|
156
|
+
/** Filter by active status */
|
|
157
|
+
is_active?: boolean;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* One UTC-day bucket in a pair's 7-day screener snapshot
|
|
161
|
+
*/
|
|
162
|
+
export interface ScreenerSnapshotPoint {
|
|
163
|
+
/** UTC day boundary (ms since epoch, as string) */
|
|
164
|
+
bucket_start: string;
|
|
165
|
+
/** Quote-token volume for the day */
|
|
166
|
+
quote_volume: string;
|
|
167
|
+
/** Percent price change (close - open) / open * 100 for the day */
|
|
168
|
+
price_change_percent: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Per-pair screener row. Window fields are null when there is insufficient history.
|
|
172
|
+
*/
|
|
173
|
+
export interface ScreenerItem {
|
|
174
|
+
/** Trading pair UUID */
|
|
175
|
+
trading_pair_id: string;
|
|
176
|
+
/** Trading pair symbol (e.g. "BTC/USDC") */
|
|
177
|
+
symbol: string;
|
|
178
|
+
/** Base token icon URL */
|
|
179
|
+
base_icon_url: string;
|
|
180
|
+
/** Quote token icon URL */
|
|
181
|
+
quote_icon_url: string;
|
|
182
|
+
/** Most recent close price (null if no trades yet) */
|
|
183
|
+
last_price: string | null;
|
|
184
|
+
/** Timestamp of the last candle (ms since epoch, as string; null if no trades yet) */
|
|
185
|
+
last_price_timestamp: string | null;
|
|
186
|
+
/** Quote-token volume in the last 1 hour (null if <1h history) */
|
|
187
|
+
quote_volume_1h: string | null;
|
|
188
|
+
/** Quote-token volume in the last 24 hours (null if <24h history) */
|
|
189
|
+
quote_volume_24h: string | null;
|
|
190
|
+
/** Quote-token volume in the last 7 days (null if <7d history) */
|
|
191
|
+
quote_volume_7d: string | null;
|
|
192
|
+
/** Percent price change over the last 1 hour (null if <1h history) */
|
|
193
|
+
price_change_percent_1h: string | null;
|
|
194
|
+
/** Percent price change over the last 24 hours (null if <24h history) */
|
|
195
|
+
price_change_percent_24h: string | null;
|
|
196
|
+
/** Percent price change over the last 7 days (null if <7d history) */
|
|
197
|
+
price_change_percent_7d: string | null;
|
|
198
|
+
/** Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
|
|
199
|
+
snapshot_7d: ScreenerSnapshotPoint[];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Paginated screener response, sorted by quote_volume_24h desc (nulls last)
|
|
203
|
+
*/
|
|
204
|
+
export interface GetScreenerResponse {
|
|
205
|
+
items: ScreenerItem[];
|
|
206
|
+
page: number;
|
|
207
|
+
page_size: number;
|
|
208
|
+
total: number;
|
|
209
|
+
total_pages: number;
|
|
210
|
+
}
|
|
142
211
|
/**
|
|
143
212
|
* API response wrapper for single trading pair
|
|
144
213
|
*/
|
|
@@ -275,12 +344,26 @@ export interface MarketAPI extends BaseAPI {
|
|
|
275
344
|
* @returns Promise resolving to paginated response with trading pairs
|
|
276
345
|
*/
|
|
277
346
|
getPaginatedTradingPairs(params?: GetTradingPairsParams): Promise<GetTradingPairsResponse>;
|
|
347
|
+
/**
|
|
348
|
+
* Fetch a single trading pair by its UUID.
|
|
349
|
+
* @param tradingPairId - Trading pair UUID
|
|
350
|
+
* @returns Promise resolving to the trading pair
|
|
351
|
+
* @throws {APIError} If the pair is not found
|
|
352
|
+
*/
|
|
353
|
+
getTradingPair(tradingPairId: string): Promise<TradingPair>;
|
|
278
354
|
/**
|
|
279
355
|
* Fetch metadata for a single trading pair by its symbol (e.g. BTC-USDC).
|
|
280
356
|
* @param symbol - Trading pair symbol
|
|
281
357
|
* @returns Promise resolving to trading pair or undefined if not found
|
|
282
358
|
*/
|
|
283
359
|
getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
|
|
360
|
+
/**
|
|
361
|
+
* Fetch the paginated market screener: per-pair price/volume/change windows
|
|
362
|
+
* (1h, 24h, 7d) plus a 7-day daily snapshot, sorted by 24h quote volume.
|
|
363
|
+
* @param params - Optional pagination and filter parameters
|
|
364
|
+
* @returns Promise resolving to the paginated screener response
|
|
365
|
+
*/
|
|
366
|
+
getScreener(params?: GetScreenerParams): Promise<GetScreenerResponse>;
|
|
284
367
|
/**
|
|
285
368
|
* Fetch historical candlestick data for a trading pair.
|
|
286
369
|
*
|
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";
|
|
@@ -74,7 +74,9 @@ 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
|
|
77
|
+
/** Resolved isolated margin bucket ID for bucket-scoped margin orders */
|
|
78
|
+
margin_bucket_id?: string;
|
|
79
|
+
/** Client strategy key carried for compatibility */
|
|
78
80
|
strategy_key?: string;
|
|
79
81
|
/** Delegated agent ID when submitted through a delegated session */
|
|
80
82
|
delegation_id?: string;
|
|
@@ -286,7 +288,11 @@ export interface BatchCreateOrderParams {
|
|
|
286
288
|
timeInForce?: Extract<TimeInForce, "GTC" | "IOC" | "FOK">;
|
|
287
289
|
/** Margin account UUID for margin/perp orders */
|
|
288
290
|
marginAccountId?: string;
|
|
289
|
-
/**
|
|
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;
|
|
295
|
+
/** Client strategy key carried for compatibility */
|
|
290
296
|
strategyKey?: string;
|
|
291
297
|
/** Position side for margin/perp orders */
|
|
292
298
|
positionSide?: PositionSide;
|
|
@@ -308,31 +314,6 @@ export interface BatchReplaceOrderParams {
|
|
|
308
314
|
/** For sub-accounts: use master's balance (optional) */
|
|
309
315
|
useMasterBalance?: boolean;
|
|
310
316
|
}
|
|
311
|
-
/**
|
|
312
|
-
* Parameters for creating a standalone conditional TP/SL order.
|
|
313
|
-
*/
|
|
314
|
-
export interface CreateConditionalOrderParams {
|
|
315
|
-
tradingPairId: string;
|
|
316
|
-
marginAccountId: string;
|
|
317
|
-
conditionType: ConditionalOrderConditionType;
|
|
318
|
-
triggerPrice: string;
|
|
319
|
-
triggerSource?: ConditionalOrderTriggerSource;
|
|
320
|
-
side: OrderSide;
|
|
321
|
-
positionSide: Exclude<PositionSide, "NONE">;
|
|
322
|
-
orderType: OrderType;
|
|
323
|
-
limitPrice?: string;
|
|
324
|
-
quantity?: string;
|
|
325
|
-
reduceOnly?: boolean;
|
|
326
|
-
timeInForce?: Extract<TimeInForce, "GTC" | "IOC">;
|
|
327
|
-
slippageToleranceBps?: number;
|
|
328
|
-
expiresAt?: string;
|
|
329
|
-
}
|
|
330
|
-
export interface CreateConditionalOrderResponse {
|
|
331
|
-
conditional_order_id: string;
|
|
332
|
-
status: "SUCCESS" | "FAILED";
|
|
333
|
-
message: string;
|
|
334
|
-
state: ConditionalOrderState;
|
|
335
|
-
}
|
|
336
317
|
export interface CancelConditionalOrderResponse {
|
|
337
318
|
conditional_order_id: string;
|
|
338
319
|
status: "SUCCESS" | "FAILED";
|
|
@@ -8,12 +8,9 @@ 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 CreateMarginAccountSchema: 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>;
|
|
18
15
|
export declare const GetAvailableCollateralSchema: z.ZodOptional<z.ZodObject<{
|
|
19
16
|
asset: z.ZodOptional<z.ZodString>;
|
|
@@ -23,6 +20,8 @@ export declare const TransferCollateralSchema: z.ZodObject<{
|
|
|
23
20
|
request: z.ZodObject<{
|
|
24
21
|
asset: z.ZodString;
|
|
25
22
|
amount: z.ZodString;
|
|
23
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
24
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
26
25
|
}, z.core.$strip>;
|
|
27
26
|
}, z.core.$strip>;
|
|
28
27
|
export declare const TransferCollateralToAutoMarginAccountSchema: z.ZodObject<{
|
|
@@ -43,7 +42,6 @@ export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
|
43
42
|
marginAccountId: z.ZodUUID;
|
|
44
43
|
request: z.ZodObject<{
|
|
45
44
|
tradingPairId: z.ZodUUID;
|
|
46
|
-
strategyKey: z.ZodOptional<z.ZodString>;
|
|
47
45
|
side: z.ZodEnum<{
|
|
48
46
|
BUY: "BUY";
|
|
49
47
|
SELL: "SELL";
|
|
@@ -61,12 +59,10 @@ export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
|
61
59
|
quantity: z.ZodString;
|
|
62
60
|
leverage: z.ZodString;
|
|
63
61
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
-
}, z.core.$
|
|
62
|
+
}, z.core.$strict>;
|
|
65
63
|
}, z.core.$strip>;
|
|
66
64
|
export declare const SimulateAutoMarginOrderRiskSchema: z.ZodObject<{
|
|
67
65
|
request: z.ZodObject<{
|
|
68
|
-
tradingPairId: z.ZodUUID;
|
|
69
|
-
strategyKey: z.ZodOptional<z.ZodString>;
|
|
70
66
|
side: z.ZodEnum<{
|
|
71
67
|
BUY: "BUY";
|
|
72
68
|
SELL: "SELL";
|
|
@@ -84,5 +80,7 @@ export declare const SimulateAutoMarginOrderRiskSchema: z.ZodObject<{
|
|
|
84
80
|
quantity: z.ZodString;
|
|
85
81
|
leverage: z.ZodString;
|
|
86
82
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
-
|
|
83
|
+
tradingPairId: z.ZodUUID;
|
|
84
|
+
strategyKey: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strict>;
|
|
88
86
|
}, z.core.$strip>;
|