@0xmonaco/types 0.8.7-develop.34bd452 → 0.8.7-develop.5d0e403
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 +3 -3
- package/dist/market/index.d.ts +83 -0
- package/dist/positions/index.d.ts +1 -0
- package/dist/profile/index.d.ts +11 -1
- package/dist/sdk/index.d.ts +12 -0
- package/dist/sub-accounts/index.d.ts +145 -0
- package/dist/sub-accounts/index.js +9 -0
- package/dist/trading/index.d.ts +4 -0
- package/dist/trading/responses.d.ts +8 -2
- package/dist/validation/margin-accounts.d.ts +1 -1
- package/dist/validation/margin-accounts.js +1 -1
- package/dist/validation/trading.d.ts +8 -0
- package/dist/validation/trading.js +42 -0
- 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/coverage.d.ts +1 -0
- package/dist/wire/coverage.js +0 -0
- package/dist/wire/index.d.ts +14 -0
- package/dist/wire/index.js +0 -0
- package/dist/wire/schema.d.ts +8419 -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
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;
|
|
@@ -315,6 +321,10 @@ export interface UserProfile {
|
|
|
315
321
|
maker_fee_bps: number;
|
|
316
322
|
/** Account creation timestamp (ISO string) */
|
|
317
323
|
created_at: string;
|
|
324
|
+
/** Additional taker fee in basis points contributed by the application (if any) */
|
|
325
|
+
application_taker_fee_bps?: number;
|
|
326
|
+
/** Additional maker fee in basis points contributed by the application (if any) */
|
|
327
|
+
application_maker_fee_bps?: number;
|
|
318
328
|
}
|
|
319
329
|
/**
|
|
320
330
|
* Profile API interface.
|
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 */
|
|
@@ -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
|
@@ -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;
|
|
@@ -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;
|
|
@@ -8,7 +8,7 @@ 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
|
|
11
|
+
export declare const EnsureParentMarginAccountSchema: z.ZodOptional<z.ZodObject<{
|
|
12
12
|
label: z.ZodOptional<z.ZodString>;
|
|
13
13
|
collateralAsset: z.ZodOptional<z.ZodString>;
|
|
14
14
|
}, z.core.$strip>>;
|
|
@@ -11,7 +11,7 @@ export const ListMarginAccountsSchema = PaginationSchema.extend({
|
|
|
11
11
|
state: z.string().trim().min(1, "State cannot be empty").optional(),
|
|
12
12
|
tradingPairId: UUIDSchema.optional(),
|
|
13
13
|
});
|
|
14
|
-
export const
|
|
14
|
+
export const EnsureParentMarginAccountSchema = z
|
|
15
15
|
.object({
|
|
16
16
|
label: z.string().trim().min(1, "Label cannot be empty").optional(),
|
|
17
17
|
collateralAsset: z.string().trim().min(1, "Collateral asset cannot be empty").optional(),
|
|
@@ -101,6 +101,8 @@ export declare const PlaceLimitOrderSchema: z.ZodObject<{
|
|
|
101
101
|
FOK: "FOK";
|
|
102
102
|
}>>;
|
|
103
103
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
104
|
+
marginBucketId: z.ZodOptional<z.ZodUUID>;
|
|
105
|
+
marginBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
104
106
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
105
107
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
106
108
|
LONG: "LONG";
|
|
@@ -156,6 +158,8 @@ export declare const PlaceMarketOrderSchema: z.ZodObject<{
|
|
|
156
158
|
}>>;
|
|
157
159
|
slippageTolerance: z.ZodOptional<z.ZodNumber>;
|
|
158
160
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
161
|
+
marginBucketId: z.ZodOptional<z.ZodUUID>;
|
|
162
|
+
marginBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
159
163
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
160
164
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
161
165
|
LONG: "LONG";
|
|
@@ -349,6 +353,8 @@ export declare const BatchCreateOrderItemSchema: z.ZodObject<{
|
|
|
349
353
|
FOK: "FOK";
|
|
350
354
|
}>>;
|
|
351
355
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
356
|
+
marginBucketId: z.ZodOptional<z.ZodUUID>;
|
|
357
|
+
marginBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
352
358
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
353
359
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
354
360
|
LONG: "LONG";
|
|
@@ -389,6 +395,8 @@ export declare const BatchCreateOrdersSchema: z.ZodObject<{
|
|
|
389
395
|
FOK: "FOK";
|
|
390
396
|
}>>;
|
|
391
397
|
marginAccountId: z.ZodOptional<z.ZodUUID>;
|
|
398
|
+
marginBucketId: z.ZodOptional<z.ZodUUID>;
|
|
399
|
+
marginBucketCollateral: z.ZodOptional<z.ZodString>;
|
|
392
400
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
393
401
|
positionSide: z.ZodOptional<z.ZodEnum<{
|
|
394
402
|
LONG: "LONG";
|
|
@@ -117,6 +117,8 @@ export const PlaceLimitOrderSchema = z
|
|
|
117
117
|
expirationDate: ISO8601DateSchema.optional(),
|
|
118
118
|
timeInForce: TimeInForceSchema.optional(),
|
|
119
119
|
marginAccountId: UUIDSchema.optional(),
|
|
120
|
+
marginBucketId: UUIDSchema.optional(),
|
|
121
|
+
marginBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
120
122
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
121
123
|
positionSide: PositionSideSchema.optional(),
|
|
122
124
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
@@ -145,6 +147,18 @@ export const PlaceLimitOrderSchema = z
|
|
|
145
147
|
.refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
|
|
146
148
|
message: "Parent TP/SL cannot be attached to reduceOnly orders",
|
|
147
149
|
path: ["options", "reduceOnly"],
|
|
150
|
+
})
|
|
151
|
+
.refine((data) => data.options?.marginBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
152
|
+
message: "marginBucketCollateral is only supported for MARGIN orders",
|
|
153
|
+
path: ["options", "tradingMode"],
|
|
154
|
+
})
|
|
155
|
+
.refine((data) => data.options?.marginBucketCollateral === undefined || data.options?.marginBucketId === undefined, {
|
|
156
|
+
message: "marginBucketCollateral creates a new bucket and cannot be combined with marginBucketId",
|
|
157
|
+
path: ["options", "marginBucketId"],
|
|
158
|
+
})
|
|
159
|
+
.refine((data) => data.options?.marginBucketCollateral === undefined || data.options?.reduceOnly !== true, {
|
|
160
|
+
message: "reduceOnly orders cannot create a new margin bucket",
|
|
161
|
+
path: ["options", "reduceOnly"],
|
|
148
162
|
});
|
|
149
163
|
/**
|
|
150
164
|
* Place Market Order validation schema
|
|
@@ -159,6 +173,8 @@ export const PlaceMarketOrderSchema = z
|
|
|
159
173
|
tradingMode: TradingModeSchema.optional(),
|
|
160
174
|
slippageTolerance: SlippageToleranceSchema,
|
|
161
175
|
marginAccountId: UUIDSchema.optional(),
|
|
176
|
+
marginBucketId: UUIDSchema.optional(),
|
|
177
|
+
marginBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
162
178
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
163
179
|
positionSide: PositionSideSchema.optional(),
|
|
164
180
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
@@ -187,6 +203,18 @@ export const PlaceMarketOrderSchema = z
|
|
|
187
203
|
.refine((data) => !hasParentTpSl(data.options) || data.options?.reduceOnly !== true, {
|
|
188
204
|
message: "Parent TP/SL cannot be attached to reduceOnly orders",
|
|
189
205
|
path: ["options", "reduceOnly"],
|
|
206
|
+
})
|
|
207
|
+
.refine((data) => data.options?.marginBucketCollateral === undefined || data.options?.tradingMode === "MARGIN", {
|
|
208
|
+
message: "marginBucketCollateral is only supported for MARGIN orders",
|
|
209
|
+
path: ["options", "tradingMode"],
|
|
210
|
+
})
|
|
211
|
+
.refine((data) => data.options?.marginBucketCollateral === undefined || data.options?.marginBucketId === undefined, {
|
|
212
|
+
message: "marginBucketCollateral creates a new bucket and cannot be combined with marginBucketId",
|
|
213
|
+
path: ["options", "marginBucketId"],
|
|
214
|
+
})
|
|
215
|
+
.refine((data) => data.options?.marginBucketCollateral === undefined || data.options?.reduceOnly !== true, {
|
|
216
|
+
message: "reduceOnly orders cannot create a new margin bucket",
|
|
217
|
+
path: ["options", "reduceOnly"],
|
|
190
218
|
});
|
|
191
219
|
/**
|
|
192
220
|
* Cancel Order validation schema
|
|
@@ -303,6 +331,8 @@ export const BatchCreateOrderItemSchema = z
|
|
|
303
331
|
expirationDate: ISO8601DateSchema.optional(),
|
|
304
332
|
timeInForce: TimeInForceSchema.optional(),
|
|
305
333
|
marginAccountId: UUIDSchema.optional(),
|
|
334
|
+
marginBucketId: UUIDSchema.optional(),
|
|
335
|
+
marginBucketCollateral: PositiveDecimalStringSchema.optional(),
|
|
306
336
|
strategyKey: z.string().min(1).max(128).optional(),
|
|
307
337
|
positionSide: PositionSideSchema.optional(),
|
|
308
338
|
leverage: PositiveDecimalStringSchema.optional(),
|
|
@@ -315,6 +345,18 @@ export const BatchCreateOrderItemSchema = z
|
|
|
315
345
|
.refine((data) => data.orderType !== "MARKET" || data.price === undefined, {
|
|
316
346
|
message: "Price must not be provided for MARKET orders",
|
|
317
347
|
path: ["price"],
|
|
348
|
+
})
|
|
349
|
+
.refine((data) => data.marginBucketCollateral === undefined || data.tradingMode === "MARGIN", {
|
|
350
|
+
message: "marginBucketCollateral is only supported for MARGIN orders",
|
|
351
|
+
path: ["tradingMode"],
|
|
352
|
+
})
|
|
353
|
+
.refine((data) => data.marginBucketCollateral === undefined || data.marginBucketId === undefined, {
|
|
354
|
+
message: "marginBucketCollateral creates a new bucket and cannot be combined with marginBucketId",
|
|
355
|
+
path: ["marginBucketId"],
|
|
356
|
+
})
|
|
357
|
+
.refine((data) => data.marginBucketCollateral === undefined || data.reduceOnly !== true, {
|
|
358
|
+
message: "reduceOnly orders cannot create a new margin bucket",
|
|
359
|
+
path: ["reduceOnly"],
|
|
318
360
|
})
|
|
319
361
|
.refine((data) => data.tradingMode !== "MARGIN" || data.positionSide !== undefined, {
|
|
320
362
|
message: "positionSide is required for MARGIN orders",
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whitelist Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public whitelist (waitlist) application endpoint. Wire shapes
|
|
5
|
+
* are snake_case.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This endpoint is **public (unauthenticated)** and creates an inactive
|
|
8
|
+
* user pending manual approval — it is an onboarding/waitlist submission, not a
|
|
9
|
+
* trading operation.
|
|
10
|
+
*/
|
|
11
|
+
import type { BaseAPI } from "../api";
|
|
12
|
+
/** Body for a whitelist application. */
|
|
13
|
+
export interface SubmitWhitelistRequest {
|
|
14
|
+
/** Applicant wallet address (0x-prefixed, 40 hex chars) */
|
|
15
|
+
wallet_address: string;
|
|
16
|
+
/** Applicant email address */
|
|
17
|
+
email: string;
|
|
18
|
+
/** Applicant Twitter/X username (1-15 chars) */
|
|
19
|
+
twitter_username?: string;
|
|
20
|
+
/** Applicant Telegram username (5-32 chars) */
|
|
21
|
+
telegram_username?: string;
|
|
22
|
+
}
|
|
23
|
+
/** Response to a whitelist application. */
|
|
24
|
+
export interface SubmitWhitelistResponse {
|
|
25
|
+
/** Human-readable status message */
|
|
26
|
+
message: string;
|
|
27
|
+
/** Created user UUID (pending approval) */
|
|
28
|
+
user_id: string | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Whitelist API interface. The submit endpoint is public (no auth required).
|
|
32
|
+
*/
|
|
33
|
+
export interface WhitelistAPI extends BaseAPI {
|
|
34
|
+
/**
|
|
35
|
+
* Submits a whitelist (waitlist) application.
|
|
36
|
+
*
|
|
37
|
+
* Public/unauthenticated. The server validates and de-duplicates by wallet
|
|
38
|
+
* address and email, creating an inactive user pending approval.
|
|
39
|
+
*
|
|
40
|
+
* @param body - Applicant details
|
|
41
|
+
* @returns Promise resolving to the status message and created user id
|
|
42
|
+
*/
|
|
43
|
+
submit(body: SubmitWhitelistRequest): Promise<SubmitWhitelistResponse>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whitelist Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the public whitelist (waitlist) application endpoint. Wire shapes
|
|
5
|
+
* are snake_case.
|
|
6
|
+
*
|
|
7
|
+
* NOTE: This endpoint is **public (unauthenticated)** and creates an inactive
|
|
8
|
+
* user pending manual approval — it is an onboarding/waitlist submission, not a
|
|
9
|
+
* trading operation.
|
|
10
|
+
*/
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compile-time helpers that tie the hand-written ergonomic SDK types to the
|
|
3
|
+
* generated wire schema in `./schema.ts`.
|
|
4
|
+
*
|
|
5
|
+
* Everything here lives purely at the type level — there is no runtime output —
|
|
6
|
+
* so a field the OpenAPI spec gains but an ergonomic type forgot to declare
|
|
7
|
+
* becomes a `tsc` error. This is the type-checking half of the MON-1476 drift
|
|
8
|
+
* tripwire (the other half is the CI fail-on-diff check on the generated
|
|
9
|
+
* `schema.ts`). See `./README.md` for how to register a new type.
|
|
10
|
+
*/
|
|
11
|
+
import type { components } from "./schema";
|
|
12
|
+
/** All schema component types generated from the OpenAPI spec. */
|
|
13
|
+
export type WireSchemas = components["schemas"];
|
|
14
|
+
/** A single generated wire schema, addressed by its OpenAPI component name. */
|
|
15
|
+
export type WireSchema<K extends keyof WireSchemas> = WireSchemas[K];
|
|
16
|
+
/** Strip every `_` from a string-literal type: `a_b_c` -> `abc`. */
|
|
17
|
+
type StripUnderscores<S extends string> = S extends `${infer Head}_${infer Tail}` ? `${Head}${StripUnderscores<Tail>}` : S;
|
|
18
|
+
/**
|
|
19
|
+
* Canonical form of a field name: lower-cased and underscore-free, so that
|
|
20
|
+
* snake_case (`available_balance`) and camelCase (`availableBalance`) names
|
|
21
|
+
* collapse to the same key. This lets the coverage check ignore the casing
|
|
22
|
+
* convention a given ergonomic domain happens to use.
|
|
23
|
+
*
|
|
24
|
+
* Caveat: names that differ only by case (e.g. `T` vs `t`) collapse together —
|
|
25
|
+
* do not register types that rely on such a distinction.
|
|
26
|
+
*/
|
|
27
|
+
type CanonicalKey<S extends string> = Lowercase<StripUnderscores<S>>;
|
|
28
|
+
/** Re-key an object type by the canonical form of each of its string keys. */
|
|
29
|
+
type CanonicalKeys<T> = {
|
|
30
|
+
[K in keyof T as K extends string ? CanonicalKey<K> : never]: true;
|
|
31
|
+
};
|
|
32
|
+
/** Canonical wire field names that the ergonomic type `Ergo` does not declare. */
|
|
33
|
+
export type MissingWireFields<Ergo, Wire> = Exclude<keyof CanonicalKeys<Wire>, keyof CanonicalKeys<Ergo>>;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves to `true` when `Ergo` declares every field the wire schema `Wire`
|
|
36
|
+
* has (comparing canonical names, so casing/underscore style is irrelevant and
|
|
37
|
+
* ergonomic enrichments — extra fields, bigint/branded value types — are
|
|
38
|
+
* allowed). Otherwise resolves to an error object naming the missing fields, so
|
|
39
|
+
* a failing {@link Expect} points straight at the drift.
|
|
40
|
+
*/
|
|
41
|
+
export type WireCovered<Ergo, Wire> = [MissingWireFields<Ergo, Wire>] extends [never] ? true : {
|
|
42
|
+
__MISSING_WIRE_FIELDS__: MissingWireFields<Ergo, Wire>;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Assertion sink. `Expect<WireCovered<Ergo, Wire>>` is a type alias that only
|
|
46
|
+
* type-checks when its argument is exactly `true`, emitting no runtime code:
|
|
47
|
+
*
|
|
48
|
+
* type _Balance = Expect<WireCovered<AccountBalance, WireSchema<"AccountBalance">>>;
|
|
49
|
+
*
|
|
50
|
+
* If `WireCovered` resolves to the error object, `T extends true` fails and
|
|
51
|
+
* `tsc` reports the missing wire fields at this line.
|
|
52
|
+
*/
|
|
53
|
+
export type Expect<T extends true> = T;
|
|
54
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated wire-types layer (MON-1476 drift tripwire).
|
|
3
|
+
*
|
|
4
|
+
* `schema.ts` is generated from `docs/src/proto-openapi/api/openapi.yaml` by
|
|
5
|
+
* `make ts-wire-gen` — do not edit it by hand. This barrel re-exports the
|
|
6
|
+
* generated `paths` / `components` / `operations` interfaces plus the
|
|
7
|
+
* {@link WireSchema} / {@link WireCovered} helpers the ergonomic types use to
|
|
8
|
+
* stay in sync with the spec.
|
|
9
|
+
*
|
|
10
|
+
* Consumers import the raw spec types from the `@0xmonaco/types/wire` subpath;
|
|
11
|
+
* the ergonomic types in the rest of the package are the supported surface.
|
|
12
|
+
*/
|
|
13
|
+
export type { Expect, MissingWireFields, WireCovered, WireSchema, WireSchemas } from "./assert";
|
|
14
|
+
export type { components, operations, paths } from "./schema";
|
|
File without changes
|