@0xmonaco/types 0.8.10 → 0.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/applications/responses.d.ts +5 -4
- package/dist/auth/responses.d.ts +2 -1
- package/dist/contracts/balances.d.ts +1 -1
- package/dist/delegated-agents/index.d.ts +3 -2
- package/dist/margin-accounts/index.d.ts +44 -5
- package/dist/market/index.d.ts +44 -7
- package/dist/positions/index.d.ts +23 -1
- package/dist/profile/index.d.ts +7 -4
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sub-accounts/index.d.ts +3 -2
- package/dist/trading/index.d.ts +4 -4
- package/dist/trading/responses.d.ts +6 -6
- package/dist/validation/margin-accounts.d.ts +44 -2
- package/dist/validation/margin-accounts.js +32 -6
- package/dist/validation/positions.d.ts +4 -0
- package/dist/validation/positions.js +4 -0
- package/dist/validation/trading.d.ts +8 -8
- package/dist/validation/trading.js +27 -27
- package/dist/validation/vault.d.ts +8 -0
- package/dist/validation/vault.js +3 -0
- package/dist/vault/index.d.ts +46 -13
- package/dist/vault/responses.d.ts +50 -12
- package/dist/websocket/events/balance-events.d.ts +2 -1
- package/dist/websocket/events/movement-events.d.ts +2 -1
- package/dist/wire/operations.d.ts +1 -1
- package/dist/wire/operations.js +9 -2
- package/dist/wire/schema.d.ts +522 -64
- package/dist/withdrawals/index.d.ts +27 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ import { MonacoSDK, SDKConfig } from "@0xmonaco/types";
|
|
|
22
22
|
// SDK configuration
|
|
23
23
|
interface SDKConfig {
|
|
24
24
|
walletClient?: WalletClient; // Wallet client for signing operations
|
|
25
|
-
network: Network; //
|
|
25
|
+
network: Network; // Use "staging" for public testnet or "mainnet" for production
|
|
26
26
|
seiRpcUrl: string; // RPC URL for Sei blockchain interactions
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -293,7 +293,7 @@ Types for network configuration:
|
|
|
293
293
|
```typescript
|
|
294
294
|
import { Network, NetworkEndpoints } from "@0xmonaco/types";
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
const publicNetwork: Network = "staging";
|
|
297
297
|
|
|
298
298
|
interface NetworkEndpoints {
|
|
299
299
|
rpcUrl: string;
|
|
@@ -301,13 +301,15 @@ interface NetworkEndpoints {
|
|
|
301
301
|
}
|
|
302
302
|
```
|
|
303
303
|
|
|
304
|
+
For public integrations, use `"staging"` or `"mainnet"`.
|
|
305
|
+
|
|
304
306
|
## Type Reference
|
|
305
307
|
|
|
306
308
|
### SDK Types
|
|
307
309
|
|
|
308
310
|
- `MonacoSDK`: Main SDK interface with all API modules
|
|
309
311
|
- `SDKConfig`: Configuration options for the Monaco SDK
|
|
310
|
-
- `Network`:
|
|
312
|
+
- `Network`: SDK network preset type. Public integrations should use `"staging"` or `"mainnet"`.
|
|
311
313
|
- `AuthState`: Authentication state information
|
|
312
314
|
|
|
313
315
|
### Vault Types
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* backend-authenticated application reporting endpoints. Reporting types use
|
|
6
6
|
* the wire shape (snake_case); optional fields are `null` rather than omitted.
|
|
7
7
|
*/
|
|
8
|
+
import type { Address } from "viem";
|
|
8
9
|
/**
|
|
9
10
|
* Response to an application configuration request.
|
|
10
11
|
*/
|
|
@@ -18,7 +19,7 @@ export interface ApplicationConfigResponse {
|
|
|
18
19
|
/** Webhook URL for receiving events (optional) */
|
|
19
20
|
webhookUrl?: string;
|
|
20
21
|
/** Vault contract address */
|
|
21
|
-
vaultContractAddress:
|
|
22
|
+
vaultContractAddress: Address;
|
|
22
23
|
/** Application client ID, embedded in on-chain deposit calls */
|
|
23
24
|
clientId: string;
|
|
24
25
|
}
|
|
@@ -66,7 +67,7 @@ export interface AppUser {
|
|
|
66
67
|
/** User UUID */
|
|
67
68
|
id: string;
|
|
68
69
|
/** Wallet address */
|
|
69
|
-
address:
|
|
70
|
+
address: Address;
|
|
70
71
|
/** Display username */
|
|
71
72
|
username: string | null;
|
|
72
73
|
/** Account type: master or sub */
|
|
@@ -117,7 +118,7 @@ export interface AppMovement {
|
|
|
117
118
|
/** Reference type */
|
|
118
119
|
reference_type: string | null;
|
|
119
120
|
/** Token address */
|
|
120
|
-
token:
|
|
121
|
+
token: Address;
|
|
121
122
|
/** Type of transaction */
|
|
122
123
|
transaction_type: string;
|
|
123
124
|
/** Blockchain transaction hash */
|
|
@@ -148,7 +149,7 @@ export interface AppBalance {
|
|
|
148
149
|
/** Token symbol */
|
|
149
150
|
symbol: string | null;
|
|
150
151
|
/** Token address */
|
|
151
|
-
token:
|
|
152
|
+
token: Address;
|
|
152
153
|
/** Total balance */
|
|
153
154
|
total_balance: string;
|
|
154
155
|
/** Balance last update timestamp (ISO 8601) */
|
package/dist/auth/responses.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Response types for authentication operations.
|
|
5
5
|
*/
|
|
6
|
+
import type { Address } from "viem";
|
|
6
7
|
/**
|
|
7
8
|
* Response to a challenge request.
|
|
8
9
|
*/
|
|
@@ -18,7 +19,7 @@ export interface User {
|
|
|
18
19
|
/** Unique identifier for the user */
|
|
19
20
|
id: string;
|
|
20
21
|
/** Wallet address of the user */
|
|
21
|
-
address:
|
|
22
|
+
address: Address;
|
|
22
23
|
/** Username of the user */
|
|
23
24
|
username?: string;
|
|
24
25
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
1
2
|
import type { BaseAPI } from "../api";
|
|
2
3
|
export type DelegatedAgentAction = "CREATE_ORDER" | "CANCEL_ORDER" | "REPLACE_ORDER" | "create_order" | "cancel_order" | "replace_order";
|
|
3
4
|
export interface UpsertDelegatedAgentRequest {
|
|
@@ -16,7 +17,7 @@ export interface UpsertDelegatedAgentRequest {
|
|
|
16
17
|
export interface DelegatedAgent {
|
|
17
18
|
id: string;
|
|
18
19
|
owner_user_id: string;
|
|
19
|
-
agent_address:
|
|
20
|
+
agent_address: Address;
|
|
20
21
|
name?: string;
|
|
21
22
|
is_active: boolean;
|
|
22
23
|
expires_at?: string;
|
|
@@ -56,7 +57,7 @@ export interface CreateDelegatedSessionResponse {
|
|
|
56
57
|
expires_at: number;
|
|
57
58
|
delegation_id: string;
|
|
58
59
|
owner_user_id: string;
|
|
59
|
-
agent_address:
|
|
60
|
+
agent_address: Address;
|
|
60
61
|
}
|
|
61
62
|
export interface DelegatedAgentsAPI extends BaseAPI {
|
|
62
63
|
upsertDelegatedAgent(request: UpsertDelegatedAgentRequest): Promise<DelegatedAgent>;
|
|
@@ -3,7 +3,7 @@ import type { OrderSide, OrderType, PositionSide } from "../trading";
|
|
|
3
3
|
export interface MarginAccountSummary {
|
|
4
4
|
margin_account_id: string;
|
|
5
5
|
label?: string;
|
|
6
|
-
|
|
6
|
+
risk_bucket_id?: string;
|
|
7
7
|
margin_mode?: "ISOLATED" | "CROSS";
|
|
8
8
|
trading_pair_id?: string;
|
|
9
9
|
strategy_key?: string;
|
|
@@ -41,6 +41,13 @@ export interface GetAvailableCollateralResponse {
|
|
|
41
41
|
wallet_available: string;
|
|
42
42
|
wallet_locked: string;
|
|
43
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;
|
|
44
51
|
}
|
|
45
52
|
export interface TransferCollateralRequest {
|
|
46
53
|
asset: string;
|
|
@@ -48,10 +55,18 @@ export interface TransferCollateralRequest {
|
|
|
48
55
|
tradingPairId?: string;
|
|
49
56
|
strategyKey?: string;
|
|
50
57
|
}
|
|
51
|
-
export interface
|
|
58
|
+
export interface TransferCollateralToParentMarginAccountRequest {
|
|
59
|
+
asset: string;
|
|
60
|
+
amount: string;
|
|
61
|
+
}
|
|
62
|
+
export interface TransferCollateralToRiskBucketRequest extends TransferCollateralToParentMarginAccountRequest {
|
|
52
63
|
tradingPairId: string;
|
|
53
64
|
strategyKey?: string;
|
|
54
65
|
}
|
|
66
|
+
export interface TransferCollateralFromParentMarginAccountRequest {
|
|
67
|
+
asset: string;
|
|
68
|
+
amount: string;
|
|
69
|
+
}
|
|
55
70
|
export interface TransferCollateralResponse {
|
|
56
71
|
movement_id: string;
|
|
57
72
|
margin_account_id: string;
|
|
@@ -92,7 +107,7 @@ export interface SimulateOrderRiskRequest {
|
|
|
92
107
|
leverage: string;
|
|
93
108
|
reduceOnly?: boolean;
|
|
94
109
|
}
|
|
95
|
-
export interface
|
|
110
|
+
export interface SimulateRiskBucketOrderRiskRequest extends SimulateOrderRiskRequest {
|
|
96
111
|
strategyKey?: string;
|
|
97
112
|
}
|
|
98
113
|
export interface SimulateOrderRiskResponse {
|
|
@@ -109,12 +124,36 @@ export interface SimulateOrderRiskResponse {
|
|
|
109
124
|
}
|
|
110
125
|
export interface MarginAccountsAPI extends BaseAPI {
|
|
111
126
|
listMarginAccounts(params?: ListMarginAccountsParams): Promise<ListMarginAccountsResponse>;
|
|
127
|
+
getParentMarginAccountSummary(params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated Prefer getParentMarginAccountSummary(). Parent margin account ids
|
|
130
|
+
* are auto-resolved for the authenticated wallet/application scope.
|
|
131
|
+
*/
|
|
112
132
|
getMarginAccountSummary(marginAccountId: string, params?: GetMarginAccountSummaryParams): Promise<MarginAccountSummary>;
|
|
113
133
|
getAvailableCollateral(params?: GetAvailableCollateralParams): Promise<GetAvailableCollateralResponse>;
|
|
134
|
+
/**
|
|
135
|
+
* @deprecated Prefer transferCollateralToParentMarginAccount() or
|
|
136
|
+
* transferCollateralToRiskBucket().
|
|
137
|
+
*/
|
|
114
138
|
transferCollateralToMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
115
|
-
|
|
139
|
+
transferCollateralToParentMarginAccount(request: TransferCollateralToParentMarginAccountRequest): Promise<TransferCollateralResponse>;
|
|
140
|
+
transferCollateralToRiskBucket(request: TransferCollateralToRiskBucketRequest): Promise<TransferCollateralResponse>;
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated Prefer transferCollateralFromParentMarginAccount().
|
|
143
|
+
*/
|
|
116
144
|
transferCollateralFromMarginAccount(marginAccountId: string, request: TransferCollateralRequest): Promise<TransferCollateralResponse>;
|
|
145
|
+
transferCollateralFromParentMarginAccount(request: TransferCollateralFromParentMarginAccountRequest): Promise<TransferCollateralResponse>;
|
|
146
|
+
getParentMarginAccountMovements(params?: GetMarginAccountMovementsParams): Promise<GetMarginAccountMovementsResponse>;
|
|
147
|
+
/**
|
|
148
|
+
* @deprecated Prefer getParentMarginAccountMovements(). Parent margin account ids
|
|
149
|
+
* are auto-resolved for the authenticated wallet/application scope.
|
|
150
|
+
*/
|
|
117
151
|
getMarginAccountMovements(marginAccountId: string, params?: GetMarginAccountMovementsParams): Promise<GetMarginAccountMovementsResponse>;
|
|
152
|
+
simulateParentMarginOrderRisk(request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
153
|
+
/**
|
|
154
|
+
* @deprecated Prefer simulateParentMarginOrderRisk(). Parent margin account ids
|
|
155
|
+
* are auto-resolved for the authenticated wallet/application scope.
|
|
156
|
+
*/
|
|
118
157
|
simulateOrderRisk(marginAccountId: string, request: SimulateOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
119
|
-
|
|
158
|
+
simulateRiskBucketOrderRisk(request: SimulateRiskBucketOrderRiskRequest): Promise<SimulateOrderRiskResponse>;
|
|
120
159
|
}
|
package/dist/market/index.d.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for market data operations including trading pair metadata and OHLCV data.
|
|
5
5
|
*/
|
|
6
|
+
import type { Address } from "viem";
|
|
6
7
|
import type { BaseAPI } from "../api";
|
|
8
|
+
import type { TradingMode } from "../trading";
|
|
7
9
|
/**
|
|
8
10
|
* Trading pair metadata
|
|
9
11
|
*/
|
|
@@ -21,9 +23,9 @@ export interface TradingPair {
|
|
|
21
23
|
/** Quote asset ID (UUID) */
|
|
22
24
|
quote_asset_id: string;
|
|
23
25
|
/** Base token contract address */
|
|
24
|
-
base_token_contract:
|
|
26
|
+
base_token_contract: Address;
|
|
25
27
|
/** Quote token contract address */
|
|
26
|
-
quote_token_contract:
|
|
28
|
+
quote_token_contract: Address;
|
|
27
29
|
/** Base token decimals */
|
|
28
30
|
base_decimals: number;
|
|
29
31
|
/** Base token icon URL */
|
|
@@ -32,8 +34,10 @@ export interface TradingPair {
|
|
|
32
34
|
quote_decimals: number;
|
|
33
35
|
/** Quote token icon URL */
|
|
34
36
|
quote_icon_url: string;
|
|
35
|
-
/** Market type (
|
|
36
|
-
market_type:
|
|
37
|
+
/** Market type (SPOT or MARGIN) */
|
|
38
|
+
market_type: TradingMode;
|
|
39
|
+
/** Asset-class category: crypto, equities, commodities, or fx */
|
|
40
|
+
category: string;
|
|
37
41
|
/** Whether the market is active */
|
|
38
42
|
is_active: boolean;
|
|
39
43
|
/** Maker fee in basis points */
|
|
@@ -119,13 +123,15 @@ export interface GetTradingPairsParams {
|
|
|
119
123
|
/** Number of items per page (max 100) */
|
|
120
124
|
page_size?: number;
|
|
121
125
|
/** Filter by market type (SPOT, MARGIN) */
|
|
122
|
-
market_type?:
|
|
126
|
+
market_type?: TradingMode;
|
|
123
127
|
/** Filter by base token symbol */
|
|
124
128
|
base_token?: string;
|
|
125
129
|
/** Filter by quote token symbol */
|
|
126
130
|
quote_token?: string;
|
|
127
131
|
/** Filter by active status */
|
|
128
132
|
is_active?: boolean;
|
|
133
|
+
/** Filter by asset-class category (crypto, equities, commodities, fx) */
|
|
134
|
+
category?: string;
|
|
129
135
|
}
|
|
130
136
|
/**
|
|
131
137
|
* Response for listing trading pairs with pagination
|
|
@@ -152,9 +158,11 @@ export interface GetScreenerParams {
|
|
|
152
158
|
/** Items per page (min 1, max 100, default 50) */
|
|
153
159
|
page_size?: number;
|
|
154
160
|
/** Filter by market type: SPOT or MARGIN */
|
|
155
|
-
market_type?:
|
|
161
|
+
market_type?: TradingMode;
|
|
156
162
|
/** Filter by active status */
|
|
157
163
|
is_active?: boolean;
|
|
164
|
+
/** Filter by asset-class category (crypto, equities, commodities, fx) */
|
|
165
|
+
category?: string;
|
|
158
166
|
}
|
|
159
167
|
/**
|
|
160
168
|
* One UTC-day bucket in a pair's 7-day screener snapshot
|
|
@@ -197,6 +205,12 @@ export interface ScreenerItem {
|
|
|
197
205
|
price_change_percent_7d: string | null;
|
|
198
206
|
/** Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
|
|
199
207
|
snapshot_7d: ScreenerSnapshotPoint[];
|
|
208
|
+
/** Asset-class category: crypto, equities, commodities, or fx */
|
|
209
|
+
category: string;
|
|
210
|
+
/** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
|
|
211
|
+
total_quote_volume_ltd: string;
|
|
212
|
+
/** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
|
|
213
|
+
total_trade_count_ltd: number;
|
|
200
214
|
}
|
|
201
215
|
/**
|
|
202
216
|
* Paginated screener response, sorted by quote_volume_24h desc (nulls last)
|
|
@@ -240,6 +254,21 @@ export interface MarketMetadata {
|
|
|
240
254
|
price_change_percent_24h: string | null;
|
|
241
255
|
/** Unix timestamp (ms) when market started trading (null if not available) */
|
|
242
256
|
market_initialization_timestamp: number | null;
|
|
257
|
+
/** Life-to-date cumulative base-token volume since inception ("0" if no trades yet) */
|
|
258
|
+
total_base_volume_ltd: string;
|
|
259
|
+
/** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
|
|
260
|
+
total_quote_volume_ltd: string;
|
|
261
|
+
/** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
|
|
262
|
+
total_trade_count_ltd: number;
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Exchange-wide life-to-date cumulative statistics across all trading pairs.
|
|
266
|
+
*/
|
|
267
|
+
export interface MarketStats {
|
|
268
|
+
/** Life-to-date cumulative quote-token (notional) volume summed across all pairs */
|
|
269
|
+
total_quote_volume_ltd: string;
|
|
270
|
+
/** Life-to-date cumulative number of trades summed across all pairs */
|
|
271
|
+
total_trade_count_ltd: number;
|
|
243
272
|
}
|
|
244
273
|
export interface RiskTier {
|
|
245
274
|
notional_floor: string;
|
|
@@ -354,9 +383,11 @@ export interface MarketAPI extends BaseAPI {
|
|
|
354
383
|
/**
|
|
355
384
|
* Fetch metadata for a single trading pair by its symbol (e.g. BTC-USDC).
|
|
356
385
|
* @param symbol - Trading pair symbol
|
|
386
|
+
* @param marketType - Optional market type filter (e.g. "SPOT", "MARGIN") to
|
|
387
|
+
* disambiguate a symbol that exists in more than one market
|
|
357
388
|
* @returns Promise resolving to trading pair or undefined if not found
|
|
358
389
|
*/
|
|
359
|
-
getTradingPairBySymbol(symbol: string): Promise<TradingPair | undefined>;
|
|
390
|
+
getTradingPairBySymbol(symbol: string, marketType?: TradingMode): Promise<TradingPair | undefined>;
|
|
360
391
|
/**
|
|
361
392
|
* Fetch the paginated market screener: per-pair price/volume/change windows
|
|
362
393
|
* (1h, 24h, 7d) plus a 7-day daily snapshot, sorted by 24h quote volume.
|
|
@@ -364,6 +395,12 @@ export interface MarketAPI extends BaseAPI {
|
|
|
364
395
|
* @returns Promise resolving to the paginated screener response
|
|
365
396
|
*/
|
|
366
397
|
getScreener(params?: GetScreenerParams): Promise<GetScreenerResponse>;
|
|
398
|
+
/**
|
|
399
|
+
* Fetch exchange-wide life-to-date cumulative statistics across all trading
|
|
400
|
+
* pairs: total quote-token (notional) volume and total number of trades.
|
|
401
|
+
* @returns Promise resolving to the global market stats
|
|
402
|
+
*/
|
|
403
|
+
getMarketStats(): Promise<MarketStats>;
|
|
367
404
|
/**
|
|
368
405
|
* Fetch historical candlestick data for a trading pair.
|
|
369
406
|
*
|
|
@@ -5,7 +5,7 @@ export type ClosePositionType = "MARKET" | "LIMIT" | "IOC";
|
|
|
5
5
|
export interface Position {
|
|
6
6
|
position_id: string;
|
|
7
7
|
margin_account_id: string;
|
|
8
|
-
|
|
8
|
+
risk_bucket_id?: string;
|
|
9
9
|
trading_pair_id: string;
|
|
10
10
|
side: PositionSide;
|
|
11
11
|
size: string;
|
|
@@ -48,6 +48,27 @@ export interface ClosePositionResponse {
|
|
|
48
48
|
message: string;
|
|
49
49
|
submitted_quantity: string;
|
|
50
50
|
}
|
|
51
|
+
export interface BatchCloseAllRequest {
|
|
52
|
+
tradingPairId?: string;
|
|
53
|
+
slippageToleranceBps?: number;
|
|
54
|
+
}
|
|
55
|
+
export interface BatchCloseError {
|
|
56
|
+
code: string;
|
|
57
|
+
message: string;
|
|
58
|
+
}
|
|
59
|
+
export interface BatchCloseResult {
|
|
60
|
+
position_id: string;
|
|
61
|
+
close_order_id?: string;
|
|
62
|
+
status?: string;
|
|
63
|
+
submitted_quantity?: string;
|
|
64
|
+
error?: BatchCloseError;
|
|
65
|
+
}
|
|
66
|
+
export interface BatchCloseAllResponse {
|
|
67
|
+
total_requested: number;
|
|
68
|
+
total_closed: number;
|
|
69
|
+
total_failed: number;
|
|
70
|
+
results: BatchCloseResult[];
|
|
71
|
+
}
|
|
51
72
|
export interface PositionRisk {
|
|
52
73
|
position_id: string;
|
|
53
74
|
mark_price: string;
|
|
@@ -121,6 +142,7 @@ export interface PositionsAPI extends BaseAPI {
|
|
|
121
142
|
listPositions(params?: ListPositionsParams): Promise<ListPositionsResponse>;
|
|
122
143
|
getPosition(positionId: string): Promise<GetPositionResponse>;
|
|
123
144
|
closePosition(positionId: string, request: ClosePositionRequest): Promise<ClosePositionResponse>;
|
|
145
|
+
batchCloseAllPositions(request?: BatchCloseAllRequest): Promise<BatchCloseAllResponse>;
|
|
124
146
|
getPositionRisk(positionId: string): Promise<PositionRisk>;
|
|
125
147
|
addPositionMargin(positionId: string, request: AddPositionMarginRequest): Promise<PositionMarginResponse>;
|
|
126
148
|
reducePositionMargin(positionId: string, request: ReducePositionMarginRequest): Promise<PositionMarginResponse>;
|
package/dist/profile/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for user profile operations including fetching user profile data.
|
|
5
5
|
*/
|
|
6
|
+
import type { Address } from "viem";
|
|
6
7
|
import type { BaseAPI } from "../api";
|
|
7
8
|
import type { OrderSide, OrderStatus, OrderType, TimeInForce } from "../trading";
|
|
8
9
|
/**
|
|
@@ -15,7 +16,7 @@ export interface ProfileMovement {
|
|
|
15
16
|
/** Movement type */
|
|
16
17
|
type: "deposit" | "withdrawal" | "trade" | "transfer" | string;
|
|
17
18
|
/** Token address */
|
|
18
|
-
token:
|
|
19
|
+
token: Address;
|
|
19
20
|
/** Amount of the movement (as string to preserve precision) */
|
|
20
21
|
amount: string;
|
|
21
22
|
/** Movement timestamp (ISO string) */
|
|
@@ -43,7 +44,7 @@ export interface LedgerMovement {
|
|
|
43
44
|
/** Transaction amount in raw format (wei) */
|
|
44
45
|
amount_raw: string;
|
|
45
46
|
/** Token contract address */
|
|
46
|
-
token:
|
|
47
|
+
token: Address;
|
|
47
48
|
/** Token symbol */
|
|
48
49
|
symbol: string | null;
|
|
49
50
|
/** Token decimals */
|
|
@@ -187,7 +188,7 @@ export interface AccountBalance {
|
|
|
187
188
|
/** Asset ID (UUID for API calls) */
|
|
188
189
|
asset_id: string;
|
|
189
190
|
/** Token address */
|
|
190
|
-
token:
|
|
191
|
+
token: Address;
|
|
191
192
|
/** Token symbol */
|
|
192
193
|
symbol: string | null;
|
|
193
194
|
/** Decimal places for the token */
|
|
@@ -202,6 +203,8 @@ export interface AccountBalance {
|
|
|
202
203
|
available_balance_raw: string;
|
|
203
204
|
/** Locked balance in raw format (wei) */
|
|
204
205
|
locked_balance_raw: string;
|
|
206
|
+
/** Total balance (available + locked) in raw format (wei) */
|
|
207
|
+
total_balance_raw: string;
|
|
205
208
|
}
|
|
206
209
|
/**
|
|
207
210
|
* A single user trade execution.
|
|
@@ -369,7 +372,7 @@ export interface UserProfile {
|
|
|
369
372
|
/** Unique identifier for the user */
|
|
370
373
|
id: string;
|
|
371
374
|
/** Wallet address of the user */
|
|
372
|
-
address:
|
|
375
|
+
address: Address;
|
|
373
376
|
/** Username of the user (can be null) */
|
|
374
377
|
username: string | null;
|
|
375
378
|
/** Account type (e.g., "master") */
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PublicClient, TransactionReceipt, WalletClient } from "viem";
|
|
1
|
+
import type { Address, PublicClient, TransactionReceipt, WalletClient } from "viem";
|
|
2
2
|
import type { ApplicationsAPI } from "../applications";
|
|
3
3
|
import type { AuthAPI, AuthState, SessionCredentials } from "../auth/index";
|
|
4
4
|
import type { DelegatedAgentsAPI } from "../delegated-agents";
|
|
@@ -157,7 +157,7 @@ export interface MonacoSDK {
|
|
|
157
157
|
/** Check connection status */
|
|
158
158
|
isConnected(): boolean;
|
|
159
159
|
/** Get the current account address */
|
|
160
|
-
getAccountAddress():
|
|
160
|
+
getAccountAddress(): Address;
|
|
161
161
|
/** Get the current network ('mainnet' or 'testnet') */
|
|
162
162
|
getNetwork(): Network;
|
|
163
163
|
/** Get the current chain ID */
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* permission (enforced server-side). Wire shapes are snake_case; optional
|
|
8
8
|
* fields are `null` rather than omitted.
|
|
9
9
|
*/
|
|
10
|
+
import type { Address } from "viem";
|
|
10
11
|
import type { BaseAPI } from "../api";
|
|
11
12
|
import type { AccountBalance } from "../profile";
|
|
12
13
|
/**
|
|
@@ -16,7 +17,7 @@ export interface SubAccount {
|
|
|
16
17
|
/** Sub-account UUID */
|
|
17
18
|
id: string;
|
|
18
19
|
/** Sub-account wallet address */
|
|
19
|
-
address:
|
|
20
|
+
address: Address;
|
|
20
21
|
/** Sub-account display username */
|
|
21
22
|
username: string | null;
|
|
22
23
|
/** Whether the sub-account is allowed to withdraw */
|
|
@@ -35,7 +36,7 @@ export interface SubAccountLimit {
|
|
|
35
36
|
/** Sub-account UUID this limit applies to */
|
|
36
37
|
sub_account_id: string;
|
|
37
38
|
/** Token contract address */
|
|
38
|
-
token:
|
|
39
|
+
token: Address;
|
|
39
40
|
/** Maximum daily spending limit in token units */
|
|
40
41
|
daily_limit: string | null;
|
|
41
42
|
/** Amount used today against the limit */
|
package/dist/trading/index.d.ts
CHANGED
|
@@ -29,8 +29,8 @@ export interface TradingAPI extends BaseAPI {
|
|
|
29
29
|
expirationDate?: string;
|
|
30
30
|
timeInForce?: TimeInForce;
|
|
31
31
|
marginAccountId?: string;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
riskBucketId?: string;
|
|
33
|
+
riskBucketCollateral?: string;
|
|
34
34
|
strategyKey?: string;
|
|
35
35
|
positionSide?: PositionSide;
|
|
36
36
|
leverage?: string;
|
|
@@ -52,8 +52,8 @@ export interface TradingAPI extends BaseAPI {
|
|
|
52
52
|
tradingMode?: TradingMode;
|
|
53
53
|
slippageTolerance?: number;
|
|
54
54
|
marginAccountId?: string;
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
riskBucketId?: string;
|
|
56
|
+
riskBucketCollateral?: string;
|
|
57
57
|
strategyKey?: string;
|
|
58
58
|
positionSide?: PositionSide;
|
|
59
59
|
leverage?: string;
|
|
@@ -74,8 +74,8 @@ export interface CreateOrderResponse {
|
|
|
74
74
|
match_result?: MatchResult;
|
|
75
75
|
/** Resolved margin account ID for margin/perp orders */
|
|
76
76
|
margin_account_id?: string;
|
|
77
|
-
/** Resolved isolated
|
|
78
|
-
|
|
77
|
+
/** Resolved isolated risk bucket ID for risk-bucket-scoped margin orders */
|
|
78
|
+
risk_bucket_id?: string;
|
|
79
79
|
/** Client strategy key carried for compatibility */
|
|
80
80
|
strategy_key?: string;
|
|
81
81
|
/** Delegated agent ID when submitted through a delegated session */
|
|
@@ -288,10 +288,10 @@ export interface BatchCreateOrderParams {
|
|
|
288
288
|
timeInForce?: Extract<TimeInForce, "GTC" | "IOC" | "FOK">;
|
|
289
289
|
/** Margin account UUID for margin/perp orders */
|
|
290
290
|
marginAccountId?: string;
|
|
291
|
-
/** Existing isolated
|
|
292
|
-
|
|
293
|
-
/** Collateral to allocate into a new isolated
|
|
294
|
-
|
|
291
|
+
/** Existing isolated risk bucket UUID for risk-bucket-scoped margin orders */
|
|
292
|
+
riskBucketId?: string;
|
|
293
|
+
/** Collateral to allocate into a new isolated risk bucket */
|
|
294
|
+
riskBucketCollateral?: string;
|
|
295
295
|
/** Client strategy key carried for compatibility */
|
|
296
296
|
strategyKey?: string;
|
|
297
297
|
/** Position side for margin/perp orders */
|
|
@@ -12,6 +12,9 @@ export declare const GetMarginAccountSummarySchema: z.ZodObject<{
|
|
|
12
12
|
marginAccountId: z.ZodUUID;
|
|
13
13
|
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
|
+
export declare const GetParentMarginAccountSummarySchema: z.ZodOptional<z.ZodObject<{
|
|
16
|
+
tradingPairId: z.ZodOptional<z.ZodUUID>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
15
18
|
export declare const GetAvailableCollateralSchema: z.ZodOptional<z.ZodObject<{
|
|
16
19
|
asset: z.ZodOptional<z.ZodString>;
|
|
17
20
|
}, z.core.$strip>>;
|
|
@@ -24,7 +27,13 @@ export declare const TransferCollateralSchema: z.ZodObject<{
|
|
|
24
27
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
25
28
|
}, z.core.$strip>;
|
|
26
29
|
}, z.core.$strip>;
|
|
27
|
-
export declare const
|
|
30
|
+
export declare const TransferCollateralToParentMarginAccountSchema: z.ZodObject<{
|
|
31
|
+
request: z.ZodObject<{
|
|
32
|
+
asset: z.ZodString;
|
|
33
|
+
amount: z.ZodString;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const TransferCollateralToRiskBucketSchema: z.ZodObject<{
|
|
28
37
|
request: z.ZodObject<{
|
|
29
38
|
asset: z.ZodString;
|
|
30
39
|
amount: z.ZodString;
|
|
@@ -32,12 +41,23 @@ export declare const TransferCollateralToAutoMarginAccountSchema: z.ZodObject<{
|
|
|
32
41
|
strategyKey: z.ZodOptional<z.ZodString>;
|
|
33
42
|
}, z.core.$strip>;
|
|
34
43
|
}, z.core.$strip>;
|
|
44
|
+
export declare const TransferCollateralFromParentMarginAccountSchema: z.ZodObject<{
|
|
45
|
+
request: z.ZodObject<{
|
|
46
|
+
asset: z.ZodString;
|
|
47
|
+
amount: z.ZodString;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
}, z.core.$strip>;
|
|
35
50
|
export declare const GetMarginAccountMovementsSchema: z.ZodObject<{
|
|
36
51
|
page: z.ZodOptional<z.ZodNumber>;
|
|
37
52
|
page_size: z.ZodOptional<z.ZodNumber>;
|
|
38
53
|
marginAccountId: z.ZodUUID;
|
|
39
54
|
movement_type: z.ZodOptional<z.ZodString>;
|
|
40
55
|
}, z.core.$strip>;
|
|
56
|
+
export declare const GetParentMarginAccountMovementsSchema: z.ZodOptional<z.ZodObject<{
|
|
57
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
page_size: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
movement_type: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
41
61
|
export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
42
62
|
marginAccountId: z.ZodUUID;
|
|
43
63
|
request: z.ZodObject<{
|
|
@@ -61,7 +81,29 @@ export declare const SimulateOrderRiskSchema: z.ZodObject<{
|
|
|
61
81
|
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
62
82
|
}, z.core.$strict>;
|
|
63
83
|
}, z.core.$strip>;
|
|
64
|
-
export declare const
|
|
84
|
+
export declare const SimulateParentMarginOrderRiskSchema: z.ZodObject<{
|
|
85
|
+
request: z.ZodObject<{
|
|
86
|
+
tradingPairId: z.ZodUUID;
|
|
87
|
+
side: z.ZodEnum<{
|
|
88
|
+
BUY: "BUY";
|
|
89
|
+
SELL: "SELL";
|
|
90
|
+
}>;
|
|
91
|
+
positionSide: z.ZodEnum<{
|
|
92
|
+
LONG: "LONG";
|
|
93
|
+
SHORT: "SHORT";
|
|
94
|
+
NONE: "NONE";
|
|
95
|
+
}>;
|
|
96
|
+
orderType: z.ZodEnum<{
|
|
97
|
+
LIMIT: "LIMIT";
|
|
98
|
+
MARKET: "MARKET";
|
|
99
|
+
}>;
|
|
100
|
+
price: z.ZodOptional<z.ZodString>;
|
|
101
|
+
quantity: z.ZodString;
|
|
102
|
+
leverage: z.ZodString;
|
|
103
|
+
reduceOnly: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
export declare const SimulateRiskBucketOrderRiskSchema: z.ZodObject<{
|
|
65
107
|
request: z.ZodObject<{
|
|
66
108
|
side: z.ZodEnum<{
|
|
67
109
|
BUY: "BUY";
|