@0xmonaco/types 0.7.6 → 0.7.7
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/package.json +2 -2
- package/dist/api/index.d.ts +0 -18
- package/dist/api/index.js +0 -6
- package/dist/applications/index.d.ts +0 -23
- package/dist/applications/index.js +0 -5
- package/dist/applications/responses.d.ts +0 -22
- package/dist/applications/responses.js +0 -5
- package/dist/auth/index.d.ts +0 -81
- package/dist/auth/index.js +0 -6
- package/dist/auth/responses.d.ts +0 -67
- package/dist/auth/responses.js +0 -5
- package/dist/contracts/balances.d.ts +0 -43
- package/dist/contracts/balances.js +0 -5
- package/dist/contracts/index.d.ts +0 -27
- package/dist/contracts/index.js +0 -5
- package/dist/fees/index.d.ts +0 -39
- package/dist/fees/index.js +0 -6
- package/dist/fees/responses.d.ts +0 -54
- package/dist/fees/responses.js +0 -86
- package/dist/index.d.ts +0 -20
- package/dist/index.js +0 -21
- package/dist/margin-accounts/index.d.ts +0 -110
- package/dist/margin-accounts/index.js +0 -0
- package/dist/market/index.d.ts +0 -312
- package/dist/market/index.js +0 -5
- package/dist/positions/index.d.ts +0 -128
- package/dist/positions/index.js +0 -0
- package/dist/profile/index.d.ts +0 -405
- package/dist/profile/index.js +0 -5
- package/dist/sdk/index.d.ts +0 -131
- package/dist/sdk/index.js +0 -0
- package/dist/sdk/network.d.ts +0 -25
- package/dist/sdk/network.js +0 -5
- package/dist/trading/index.d.ts +0 -132
- package/dist/trading/index.js +0 -6
- package/dist/trading/orders.d.ts +0 -137
- package/dist/trading/orders.js +0 -9
- package/dist/trading/responses.d.ts +0 -347
- package/dist/trading/responses.js +0 -5
- package/dist/validation/common.d.ts +0 -179
- package/dist/validation/common.js +0 -199
- package/dist/validation/index.d.ts +0 -22
- package/dist/validation/index.js +0 -24
- package/dist/validation/margin-accounts.d.ts +0 -55
- package/dist/validation/margin-accounts.js +0 -59
- package/dist/validation/market.d.ts +0 -214
- package/dist/validation/market.js +0 -225
- package/dist/validation/positions.d.ts +0 -89
- package/dist/validation/positions.js +0 -93
- package/dist/validation/profile.d.ts +0 -69
- package/dist/validation/profile.js +0 -44
- package/dist/validation/trading.d.ts +0 -350
- package/dist/validation/trading.js +0 -313
- package/dist/validation/vault.d.ts +0 -66
- package/dist/validation/vault.js +0 -79
- package/dist/vault/index.d.ts +0 -84
- package/dist/vault/index.js +0 -5
- package/dist/vault/responses.d.ts +0 -51
- package/dist/vault/responses.js +0 -5
- package/dist/websocket/base.d.ts +0 -31
- package/dist/websocket/base.js +0 -5
- package/dist/websocket/clients/orderbook-client.d.ts +0 -14
- package/dist/websocket/clients/orderbook-client.js +0 -3
- package/dist/websocket/events/balance-events.d.ts +0 -48
- package/dist/websocket/events/balance-events.js +0 -6
- package/dist/websocket/events/conditional-order-events.d.ts +0 -33
- package/dist/websocket/events/conditional-order-events.js +0 -0
- package/dist/websocket/events/index.d.ts +0 -7
- package/dist/websocket/events/index.js +0 -7
- package/dist/websocket/events/movement-events.d.ts +0 -64
- package/dist/websocket/events/movement-events.js +0 -6
- package/dist/websocket/events/ohlcv-events.d.ts +0 -31
- package/dist/websocket/events/ohlcv-events.js +0 -5
- package/dist/websocket/events/orderbook-events.d.ts +0 -72
- package/dist/websocket/events/orderbook-events.js +0 -5
- package/dist/websocket/events/orders-events.d.ts +0 -284
- package/dist/websocket/events/orders-events.js +0 -0
- package/dist/websocket/events/trade-events.d.ts +0 -34
- package/dist/websocket/events/trade-events.js +0 -5
- package/dist/websocket/index.d.ts +0 -8
- package/dist/websocket/index.js +0 -8
package/dist/profile/index.d.ts
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Profile Types
|
|
3
|
-
*
|
|
4
|
-
* Types for user profile operations including fetching user profile data.
|
|
5
|
-
*/
|
|
6
|
-
import type { BaseAPI } from "../api";
|
|
7
|
-
import type { OrderSide, OrderStatus, OrderType, TimeInForce } from "../trading";
|
|
8
|
-
/**
|
|
9
|
-
* Account movement/transaction information.
|
|
10
|
-
* Represents transactions/movements returned in the profile's recent_movements array.
|
|
11
|
-
*/
|
|
12
|
-
export interface ProfileMovement {
|
|
13
|
-
/** Movement identifier */
|
|
14
|
-
id: string;
|
|
15
|
-
/** Movement type */
|
|
16
|
-
type: "deposit" | "withdrawal" | "trade" | "transfer" | string;
|
|
17
|
-
/** Token address */
|
|
18
|
-
token: string;
|
|
19
|
-
/** Amount of the movement (as string to preserve precision) */
|
|
20
|
-
amount: string;
|
|
21
|
-
/** Movement timestamp (ISO string) */
|
|
22
|
-
timestamp: string;
|
|
23
|
-
/** Transaction hash if applicable */
|
|
24
|
-
hash?: string;
|
|
25
|
-
/** Movement status */
|
|
26
|
-
status: "pending" | "confirmed" | "failed" | string;
|
|
27
|
-
/** Optional description of the movement */
|
|
28
|
-
description?: string;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Ledger movement from the movement's endpoint.
|
|
32
|
-
* More detailed than ProfileMovement with balance tracking.
|
|
33
|
-
*/
|
|
34
|
-
export interface LedgerMovement {
|
|
35
|
-
/** Movement unique identifier */
|
|
36
|
-
id: string;
|
|
37
|
-
/** Type of entry (Credit, Debit) */
|
|
38
|
-
entry_type: string;
|
|
39
|
-
/** Type of transaction (Deposit, Withdrawal, Trade, etc.) */
|
|
40
|
-
transaction_type: string;
|
|
41
|
-
/** Transaction amount (normalized, human-readable) */
|
|
42
|
-
amount: string;
|
|
43
|
-
/** Transaction amount in raw format (wei) */
|
|
44
|
-
amount_raw: string;
|
|
45
|
-
/** Token contract address */
|
|
46
|
-
token: string;
|
|
47
|
-
/** Token symbol */
|
|
48
|
-
symbol: string | null;
|
|
49
|
-
/** Token decimals */
|
|
50
|
-
decimals: number;
|
|
51
|
-
/** Balance before this transaction (normalized) */
|
|
52
|
-
balance_before: string | null;
|
|
53
|
-
/** Balance before in raw format (wei) */
|
|
54
|
-
balance_before_raw: string | null;
|
|
55
|
-
/** Balance after this transaction (normalized) */
|
|
56
|
-
balance_after: string | null;
|
|
57
|
-
/** Balance after in raw format (wei) */
|
|
58
|
-
balance_after_raw: string | null;
|
|
59
|
-
/** Locked balance before transaction (normalized) */
|
|
60
|
-
locked_before: string | null;
|
|
61
|
-
/** Locked balance before in raw format (wei) */
|
|
62
|
-
locked_before_raw: string | null;
|
|
63
|
-
/** Locked balance after transaction (normalized) */
|
|
64
|
-
locked_after: string | null;
|
|
65
|
-
/** Locked balance after in raw format (wei) */
|
|
66
|
-
locked_after_raw: string | null;
|
|
67
|
-
/** Reference identifier for related operations */
|
|
68
|
-
reference_id: string | null;
|
|
69
|
-
/** Reference type */
|
|
70
|
-
reference_type: string | null;
|
|
71
|
-
/** Human readable description */
|
|
72
|
-
description: string | null;
|
|
73
|
-
/** Blockchain transaction hash */
|
|
74
|
-
tx_hash: string | null;
|
|
75
|
-
/** Blockchain block number */
|
|
76
|
-
block_number: number | null;
|
|
77
|
-
/** Transaction timestamp */
|
|
78
|
-
created_at: string | null;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Ledger entry type for filtering movements.
|
|
82
|
-
* Describes the direction/nature of the balance change.
|
|
83
|
-
*/
|
|
84
|
-
export type LedgerEntryType = "CREDIT" | "DEBIT" | "LOCK" | "UNLOCK" | "FEE";
|
|
85
|
-
/**
|
|
86
|
-
* Transaction type for filtering movements.
|
|
87
|
-
* Describes the reason/source of the movement.
|
|
88
|
-
*/
|
|
89
|
-
export type TransactionType = "DEPOSIT" | "WITHDRAWAL" | "TRADE" | "FEE" | "FUNDING" | "LIQUIDATION" | "INTEREST" | "REWARD";
|
|
90
|
-
/**
|
|
91
|
-
* Query parameters for getting user movements
|
|
92
|
-
*/
|
|
93
|
-
export interface GetUserMovementsParams {
|
|
94
|
-
/** Page number (starts from 1) */
|
|
95
|
-
page?: number;
|
|
96
|
-
/** Number of items per page (max 100) */
|
|
97
|
-
page_size?: number;
|
|
98
|
-
/** Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE) */
|
|
99
|
-
entry_type?: LedgerEntryType;
|
|
100
|
-
/** Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD) */
|
|
101
|
-
transaction_type?: TransactionType;
|
|
102
|
-
/** Filter by asset ID (UUID) */
|
|
103
|
-
asset_id?: string;
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Query parameters for getting user balances
|
|
107
|
-
*/
|
|
108
|
-
export interface GetUserBalancesParams {
|
|
109
|
-
/** Page number (starts from 1) */
|
|
110
|
-
page?: number;
|
|
111
|
-
/** Number of items per page (max 100) */
|
|
112
|
-
page_size?: number;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Response from getting user movements
|
|
116
|
-
*/
|
|
117
|
-
export interface GetPaginatedUserMovementsResponse {
|
|
118
|
-
/**
|
|
119
|
-
* Latest movements from Redis cache (real-time, instant updates).
|
|
120
|
-
* These are the most recent movements that may not yet be in PostgreSQL.
|
|
121
|
-
* Only populated on page 1; empty for subsequent pages.
|
|
122
|
-
*/
|
|
123
|
-
latest_movements?: LedgerMovement[];
|
|
124
|
-
/** All movements from PostgreSQL (historical, paginated) */
|
|
125
|
-
movements: LedgerMovement[];
|
|
126
|
-
/** Current page number */
|
|
127
|
-
page: number;
|
|
128
|
-
/** Items per page */
|
|
129
|
-
page_size: number;
|
|
130
|
-
/** Total number of movements in PostgreSQL */
|
|
131
|
-
total: number;
|
|
132
|
-
/** Total number of pages */
|
|
133
|
-
total_pages: number;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Response from getting user balances
|
|
137
|
-
*/
|
|
138
|
-
export interface GetUserBalancesResponse {
|
|
139
|
-
/** List of token balances for the user */
|
|
140
|
-
balances: AccountBalance[];
|
|
141
|
-
/** Total number of balances */
|
|
142
|
-
total: number;
|
|
143
|
-
/** Items per page */
|
|
144
|
-
page_size: number;
|
|
145
|
-
/** Current page number */
|
|
146
|
-
page: number;
|
|
147
|
-
/** Total number of pages */
|
|
148
|
-
total_pages: number;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Order information for recent orders.
|
|
152
|
-
* Represents orders returned in the profile's recent_orders array.
|
|
153
|
-
*/
|
|
154
|
-
export interface ProfileOrder {
|
|
155
|
-
/** Order identifier */
|
|
156
|
-
id: string;
|
|
157
|
-
/** Trading pair symbol (e.g., "ETH-USD") */
|
|
158
|
-
symbol: string;
|
|
159
|
-
/** Order side */
|
|
160
|
-
side: OrderSide;
|
|
161
|
-
/** Order type */
|
|
162
|
-
order_type: OrderType;
|
|
163
|
-
/** Order price (null for market orders) */
|
|
164
|
-
price: string | null;
|
|
165
|
-
/** Order quantity */
|
|
166
|
-
quantity: string;
|
|
167
|
-
/** Order status */
|
|
168
|
-
status: OrderStatus;
|
|
169
|
-
/** Time in force */
|
|
170
|
-
time_in_force?: TimeInForce;
|
|
171
|
-
/** Order creation timestamp (ISO string) */
|
|
172
|
-
created_at: string;
|
|
173
|
-
/** Order last update timestamp (ISO string) */
|
|
174
|
-
updated_at?: string;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Account balance for a specific token.
|
|
178
|
-
* Returned by the single balance lookup endpoint.
|
|
179
|
-
*/
|
|
180
|
-
export interface AccountBalance {
|
|
181
|
-
/** Asset ID (UUID for API calls) */
|
|
182
|
-
asset_id: string;
|
|
183
|
-
/** Token address */
|
|
184
|
-
token: string;
|
|
185
|
-
/** Token symbol */
|
|
186
|
-
symbol: string | null;
|
|
187
|
-
/** Decimal places for the token */
|
|
188
|
-
decimals: number;
|
|
189
|
-
/** Available balance for trading (normalized) */
|
|
190
|
-
available_balance: string;
|
|
191
|
-
/** Locked balance (in orders or pending operations, normalized) */
|
|
192
|
-
locked_balance: string;
|
|
193
|
-
/** Total balance (available + locked + margin collateral, normalized) */
|
|
194
|
-
total_balance: string;
|
|
195
|
-
/** Available balance in raw format (wei) */
|
|
196
|
-
available_balance_raw: string;
|
|
197
|
-
/** Locked balance in raw format (wei) */
|
|
198
|
-
locked_balance_raw: string;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* A single user trade execution.
|
|
202
|
-
*/
|
|
203
|
-
export interface UserTrade {
|
|
204
|
-
/** Trade unique identifier */
|
|
205
|
-
trade_id: string;
|
|
206
|
-
/** Trading pair identifier (UUID) */
|
|
207
|
-
trading_pair_id: string;
|
|
208
|
-
/** Execution price (as string to preserve precision) */
|
|
209
|
-
price: string;
|
|
210
|
-
/** Executed quantity (as string to preserve precision) */
|
|
211
|
-
quantity: string;
|
|
212
|
-
/** Quote volume (price * quantity, as string to preserve precision) */
|
|
213
|
-
quote_volume: string;
|
|
214
|
-
/** Side of the trade */
|
|
215
|
-
side: OrderSide;
|
|
216
|
-
/** Fee paid for this trade (as string to preserve precision) */
|
|
217
|
-
fee: string;
|
|
218
|
-
/** Timestamp when the trade was executed (ISO string) */
|
|
219
|
-
executed_at: string;
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Query parameters for getting user trades
|
|
223
|
-
*/
|
|
224
|
-
export interface GetUserTradesParams {
|
|
225
|
-
/** Page number (starts from 1) */
|
|
226
|
-
page?: number;
|
|
227
|
-
/** Number of items per page (max 100) */
|
|
228
|
-
page_size?: number;
|
|
229
|
-
/** Filter by trading pair ID (UUID) */
|
|
230
|
-
trading_pair_id?: string;
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Response from getting user trades
|
|
234
|
-
*/
|
|
235
|
-
export interface GetUserTradesResponse {
|
|
236
|
-
/** List of user trades */
|
|
237
|
-
trades: UserTrade[];
|
|
238
|
-
/** Current page number */
|
|
239
|
-
page: number;
|
|
240
|
-
/** Items per page */
|
|
241
|
-
page_size: number;
|
|
242
|
-
/** Total number of trades */
|
|
243
|
-
total: number;
|
|
244
|
-
/** Total number of pages */
|
|
245
|
-
total_pages: number;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Time period for portfolio stats and chart queries.
|
|
249
|
-
*/
|
|
250
|
-
export type PortfolioPeriod = "24h" | "7d" | "30d" | "all";
|
|
251
|
-
/**
|
|
252
|
-
* Metric for portfolio chart queries.
|
|
253
|
-
*/
|
|
254
|
-
export type PortfolioMetric = "volume" | "pnl";
|
|
255
|
-
/**
|
|
256
|
-
* A single data point in a portfolio chart time series.
|
|
257
|
-
*/
|
|
258
|
-
export interface PortfolioChartPoint {
|
|
259
|
-
/** ISO 8601 timestamp for the bucket */
|
|
260
|
-
timestamp: string;
|
|
261
|
-
/** Metric value for the bucket (as string to preserve precision) */
|
|
262
|
-
value: string;
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Portfolio chart time series response.
|
|
266
|
-
* Returned by the /api/v1/accounts/me/portfolio/chart endpoint.
|
|
267
|
-
*/
|
|
268
|
-
export interface PortfolioChartResponse {
|
|
269
|
-
/** The metric returned ("volume" | "pnl") */
|
|
270
|
-
metric: PortfolioMetric;
|
|
271
|
-
/** The period requested */
|
|
272
|
-
period: PortfolioPeriod;
|
|
273
|
-
/** Bucketed time series data points */
|
|
274
|
-
data: PortfolioChartPoint[];
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Portfolio statistics for the authenticated user over a given period.
|
|
278
|
-
* Returned by the /api/v1/accounts/me/portfolio endpoint.
|
|
279
|
-
*/
|
|
280
|
-
export interface PortfolioStats {
|
|
281
|
-
/** Realized profit and loss (sum of CREDIT minus DEBIT from TRADE ledger entries) */
|
|
282
|
-
pnl: string;
|
|
283
|
-
/** Total trading volume (sum of quote_volume from trades) */
|
|
284
|
-
volume: string;
|
|
285
|
-
/** Maximum peak-to-trough drawdown on running PnL */
|
|
286
|
-
max_drawdown: string;
|
|
287
|
-
/** Total number of orders placed */
|
|
288
|
-
total_orders: number;
|
|
289
|
-
/** Total number of trades executed */
|
|
290
|
-
total_trades: number;
|
|
291
|
-
/** Total fees paid */
|
|
292
|
-
fees_paid: string;
|
|
293
|
-
/** Ratio of profitable trades to total trades */
|
|
294
|
-
win_loss_ratio: string;
|
|
295
|
-
/** Total equity in USDC terms (sum of all spot balances) */
|
|
296
|
-
total_equity: string;
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* User profile information returned by the /api/v1/accounts/me endpoint.
|
|
300
|
-
*/
|
|
301
|
-
export interface UserProfile {
|
|
302
|
-
/** Unique identifier for the user */
|
|
303
|
-
id: string;
|
|
304
|
-
/** Wallet address of the user */
|
|
305
|
-
address: string;
|
|
306
|
-
/** Username of the user (can be null) */
|
|
307
|
-
username: string | null;
|
|
308
|
-
/** Account type (e.g., "master") */
|
|
309
|
-
account_type: string;
|
|
310
|
-
/** Whether the user can withdraw funds */
|
|
311
|
-
can_withdraw: boolean;
|
|
312
|
-
/** Taker fee rate in basis points */
|
|
313
|
-
taker_fee_bps: number;
|
|
314
|
-
/** Maker fee rate in basis points */
|
|
315
|
-
maker_fee_bps: number;
|
|
316
|
-
/** Account creation timestamp (ISO string) */
|
|
317
|
-
created_at: string;
|
|
318
|
-
}
|
|
319
|
-
/**
|
|
320
|
-
* Profile API interface.
|
|
321
|
-
* Provides methods for fetching and managing user profile information.
|
|
322
|
-
*/
|
|
323
|
-
export interface ProfileAPI extends BaseAPI {
|
|
324
|
-
/**
|
|
325
|
-
* Get the current user's profile information.
|
|
326
|
-
*
|
|
327
|
-
* Fetches the profile data for the authenticated user using the /api/v1/accounts/me endpoint.
|
|
328
|
-
* Requires a valid access token to be set.
|
|
329
|
-
*
|
|
330
|
-
* @returns Promise resolving to the user's profile information
|
|
331
|
-
*/
|
|
332
|
-
getProfile(): Promise<UserProfile>;
|
|
333
|
-
/**
|
|
334
|
-
* Get the current user's ledger movements (transaction history) with pagination.
|
|
335
|
-
*
|
|
336
|
-
* Fetches the user's transaction history from the /api/v1/accounts/movements endpoint.
|
|
337
|
-
* Requires a valid access token to be set.
|
|
338
|
-
*
|
|
339
|
-
* @param params - Optional query parameters for pagination and filtering
|
|
340
|
-
* @param params.page - Page number (starts from 1)
|
|
341
|
-
* @param params.limit - Number of items per page (max 100)
|
|
342
|
-
* @param params.entry_type - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
|
|
343
|
-
* @param params.transaction_type - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)
|
|
344
|
-
* @param params.asset_id - Filter by asset ID (UUID)
|
|
345
|
-
* @returns Promise resolving to paginated movements response
|
|
346
|
-
*/
|
|
347
|
-
getPaginatedUserMovements(params?: GetUserMovementsParams): Promise<GetPaginatedUserMovementsResponse>;
|
|
348
|
-
/**
|
|
349
|
-
* Get the current user's token balances with pagination.
|
|
350
|
-
*
|
|
351
|
-
* Fetches the user's token balances from the /api/v1/accounts/balances endpoint.
|
|
352
|
-
* Requires a valid access token to be set.
|
|
353
|
-
*
|
|
354
|
-
* @param params - Optional query parameters for pagination
|
|
355
|
-
* @param params.limit - Number of items to return
|
|
356
|
-
* @param params.offset - Number of items to skip
|
|
357
|
-
* @returns Promise resolving to paginated balances response
|
|
358
|
-
*/
|
|
359
|
-
getUserBalances(params?: GetUserBalancesParams): Promise<GetUserBalancesResponse>;
|
|
360
|
-
/**
|
|
361
|
-
* Get the current user's balance for a specific asset.
|
|
362
|
-
*
|
|
363
|
-
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{asset_id} endpoint.
|
|
364
|
-
* Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
|
|
365
|
-
*
|
|
366
|
-
* @param assetId - The asset identifier (UUID)
|
|
367
|
-
* @returns Promise resolving to the account balance for the asset
|
|
368
|
-
*/
|
|
369
|
-
getUserBalanceByAssetId(assetId: string): Promise<AccountBalance>;
|
|
370
|
-
/**
|
|
371
|
-
* Get the current user's portfolio statistics for a given time period.
|
|
372
|
-
*
|
|
373
|
-
* Fetches aggregate stats from the /api/v1/accounts/me/portfolio endpoint.
|
|
374
|
-
* Requires a valid access token to be set.
|
|
375
|
-
*
|
|
376
|
-
* @param period - Time period to scope the stats ("24h" | "7d" | "30d" | "all")
|
|
377
|
-
* @returns Promise resolving to the user's portfolio statistics
|
|
378
|
-
*/
|
|
379
|
-
getPortfolioStats(period: PortfolioPeriod): Promise<PortfolioStats>;
|
|
380
|
-
/**
|
|
381
|
-
* Get the current user's portfolio chart time series for a given period and metric.
|
|
382
|
-
*
|
|
383
|
-
* Fetches bucketed time series data from the /api/v1/accounts/me/portfolio/chart endpoint.
|
|
384
|
-
* Requires a valid access token to be set.
|
|
385
|
-
*
|
|
386
|
-
* @param period - Time period ("24h" | "7d" | "30d" | "all")
|
|
387
|
-
* @param metric - Metric to chart ("volume" | "pnl")
|
|
388
|
-
* @returns Promise resolving to the portfolio chart response
|
|
389
|
-
*/
|
|
390
|
-
getPortfolioChart(period: PortfolioPeriod, metric: PortfolioMetric): Promise<PortfolioChartResponse>;
|
|
391
|
-
/**
|
|
392
|
-
* Get the current user's trade history with pagination.
|
|
393
|
-
*
|
|
394
|
-
* Fetches the user's executed trades from the /api/v1/accounts/trades endpoint.
|
|
395
|
-
* Requires a valid access token to be set.
|
|
396
|
-
*
|
|
397
|
-
* @param params - Optional query parameters for pagination and filtering
|
|
398
|
-
* @param params.page - Page number (starts from 1)
|
|
399
|
-
* @param params.limit - Number of items per page (max 100)
|
|
400
|
-
* @param params.trading_pair_id - Filter by trading pair ID (UUID)
|
|
401
|
-
* @returns Promise resolving to paginated trades response
|
|
402
|
-
* @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
|
-
*/
|
|
404
|
-
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
405
|
-
}
|
package/dist/profile/index.js
DELETED
package/dist/sdk/index.d.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import type { PublicClient, TransactionReceipt, WalletClient } from "viem";
|
|
2
|
-
import type { ApplicationsAPI } from "../applications";
|
|
3
|
-
import type { AuthAPI, AuthState } from "../auth/index";
|
|
4
|
-
import type { FeesAPI } from "../fees";
|
|
5
|
-
import type { MarginAccountsAPI } from "../margin-accounts";
|
|
6
|
-
import type { Interval, MarketAPI } from "../market";
|
|
7
|
-
import type { PositionsAPI } from "../positions";
|
|
8
|
-
import type { ProfileAPI } from "../profile";
|
|
9
|
-
import type { TradingAPI, TradingMode } from "../trading";
|
|
10
|
-
import type { VaultAPI } from "../vault";
|
|
11
|
-
import type { ConditionalOrderEvent, OHLCVEvent, OrderbookEvent, OrderbookQuotationMode, OrderEvent, TradeEvent, UserBalanceEvent, UserMovementEvent } from "../websocket";
|
|
12
|
-
import type { Network } from "./network";
|
|
13
|
-
/**
|
|
14
|
-
* Configuration options for the Monaco SDK.
|
|
15
|
-
*
|
|
16
|
-
* The SDK requires a wallet client for signing operations and an RPC URL.
|
|
17
|
-
*/
|
|
18
|
-
export interface SDKConfig {
|
|
19
|
-
/** Wallet client for signing operations (optional - can be set later via setWalletClient) */
|
|
20
|
-
walletClient?: WalletClient;
|
|
21
|
-
/**
|
|
22
|
-
* Network to use. Must be one of the preset networks: "local", "development", "staging", "mainnet".
|
|
23
|
-
*
|
|
24
|
-
* Each network maps to a default API URL:
|
|
25
|
-
* - "local": http://localhost:8080
|
|
26
|
-
* - "development": https://develop.apimonaco.xyz
|
|
27
|
-
* - "staging": https://staging.apimonaco.xyz
|
|
28
|
-
* - "mainnet": https://api.monaco.xyz
|
|
29
|
-
*
|
|
30
|
-
* Only "mainnet" uses the Sei mainnet chain. All other networks use Sei testnet.
|
|
31
|
-
*/
|
|
32
|
-
network: Network;
|
|
33
|
-
/** RPC URL for Sei blockchain interactions */
|
|
34
|
-
seiRpcUrl: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Core SDK interface providing access to all Monaco functionality.
|
|
38
|
-
*/
|
|
39
|
-
export interface MonacoSDK {
|
|
40
|
-
/** Applications operations API */
|
|
41
|
-
applications: ApplicationsAPI;
|
|
42
|
-
/** Auth operations API */
|
|
43
|
-
auth: AuthAPI;
|
|
44
|
-
/** Fees operations API */
|
|
45
|
-
fees: FeesAPI;
|
|
46
|
-
/** Vault operations API */
|
|
47
|
-
vault: VaultAPI;
|
|
48
|
-
/** Trading operations API */
|
|
49
|
-
trading: TradingAPI;
|
|
50
|
-
/** Market metadata API */
|
|
51
|
-
market: MarketAPI;
|
|
52
|
-
/** Margin account operations API */
|
|
53
|
-
marginAccounts: MarginAccountsAPI;
|
|
54
|
-
/** Perp position operations API */
|
|
55
|
-
positions: PositionsAPI;
|
|
56
|
-
/** Profile operations API */
|
|
57
|
-
profile: ProfileAPI;
|
|
58
|
-
/** Orderbook REST API for fetching orderbook snapshots */
|
|
59
|
-
orderbook: {
|
|
60
|
-
getOrderbook: (tradingPairId: string, options?: {
|
|
61
|
-
/** Number of price levels to return (max 100). Defaults to 10. */
|
|
62
|
-
depth?: number;
|
|
63
|
-
/** Trading mode: 'Spot' or 'Margin'. Defaults to 'Spot'. */
|
|
64
|
-
tradingMode?: TradingMode;
|
|
65
|
-
/** Price grouping magnitude. Valid values: 0.0001, 0.001, 0.01, 0.1, 1, 10, 100, 1000, 10000. */
|
|
66
|
-
magnitude?: number;
|
|
67
|
-
/** Quantity denomination: 'BASE' or 'QUOTE'. When 'QUOTE' type, quantities are multiplied by the quote price. */
|
|
68
|
-
denomination?: OrderbookQuotationMode;
|
|
69
|
-
}) => Promise<OrderbookEvent>;
|
|
70
|
-
};
|
|
71
|
-
/** Trades REST API for fetching historical trades */
|
|
72
|
-
trades: {
|
|
73
|
-
getTrades: (tradingPairId: string, options?: {
|
|
74
|
-
/** Page number (starts from 1, default: 1) */
|
|
75
|
-
page?: number;
|
|
76
|
-
/** Maximum number of records to return (default: 25, max: 100) */
|
|
77
|
-
page_size?: number;
|
|
78
|
-
}) => Promise<TradeEvent[]>;
|
|
79
|
-
};
|
|
80
|
-
/** WebSocket client for real-time data (orders, orderbook, ohlcv) */
|
|
81
|
-
ws: {
|
|
82
|
-
connect: () => Promise<void>;
|
|
83
|
-
disconnect: () => void;
|
|
84
|
-
isConnected: () => boolean;
|
|
85
|
-
getStatus: () => "connected" | "connecting" | "disconnected" | "reconnecting";
|
|
86
|
-
setToken: (token: string) => void;
|
|
87
|
-
orders: (tradingPairId: string, tradingMode: TradingMode, handler: (event: OrderEvent) => void) => () => void;
|
|
88
|
-
orderbook: (tradingPairId: string, tradingMode: TradingMode, magnitude: number, quotationMode: OrderbookQuotationMode, handler: (event: OrderbookEvent) => void) => () => void;
|
|
89
|
-
ohlcv: (tradingPairId: string, tradingMode: TradingMode, interval: Interval, handler: (event: OHLCVEvent) => void) => () => void;
|
|
90
|
-
trades: (tradingPairId: string, handler: (event: TradeEvent) => void) => () => void;
|
|
91
|
-
movements: (handler: (event: UserMovementEvent) => void) => () => void;
|
|
92
|
-
userOrders: (handler: (event: OrderEvent) => void) => () => void;
|
|
93
|
-
balances: (handler: (event: UserBalanceEvent) => void) => () => void;
|
|
94
|
-
conditionalOrders: (handler: (event: ConditionalOrderEvent) => void, tradingPairId?: string) => () => void;
|
|
95
|
-
};
|
|
96
|
-
/** Wallet client for all blockchain operations (undefined until set) */
|
|
97
|
-
walletClient: WalletClient | undefined;
|
|
98
|
-
/** Public client for read-only blockchain operations */
|
|
99
|
-
publicClient: PublicClient;
|
|
100
|
-
/**
|
|
101
|
-
* Complete authentication flow
|
|
102
|
-
* @param clientId - The client ID for authentication
|
|
103
|
-
* @param options - Optional configuration for login
|
|
104
|
-
*/
|
|
105
|
-
login(clientId: string, options?: {
|
|
106
|
-
connectWebSocket?: boolean;
|
|
107
|
-
}): Promise<AuthState>;
|
|
108
|
-
/** Log out the user */
|
|
109
|
-
logout(): Promise<void>;
|
|
110
|
-
/** Refresh the access token */
|
|
111
|
-
refreshAuth(): Promise<AuthState>;
|
|
112
|
-
/** Get the current authentication state */
|
|
113
|
-
getAuthState(): AuthState | undefined;
|
|
114
|
-
/** Check if the user is authenticated */
|
|
115
|
-
isAuthenticated(): boolean;
|
|
116
|
-
/** Check connection status */
|
|
117
|
-
isConnected(): boolean;
|
|
118
|
-
/** Get the current account address */
|
|
119
|
-
getAccountAddress(): string;
|
|
120
|
-
/** Get the current network ('mainnet' or 'testnet') */
|
|
121
|
-
getNetwork(): Network;
|
|
122
|
-
/** Get the current chain ID */
|
|
123
|
-
getChainId(): number;
|
|
124
|
-
/** Wait for a transaction to be confirmed */
|
|
125
|
-
waitForTransaction(hash: string, confirmations?: number, timeout?: number): Promise<TransactionReceipt>;
|
|
126
|
-
/** Set the wallet client (for React SDK to update when wagmi becomes available) */
|
|
127
|
-
setWalletClient(walletClient: WalletClient): void;
|
|
128
|
-
/** Set the authentication state directly (useful for restoring cached tokens) */
|
|
129
|
-
setAuthState(authState: AuthState): void;
|
|
130
|
-
}
|
|
131
|
-
export type { Network, NetworkEndpoints } from "./network";
|
package/dist/sdk/index.js
DELETED
|
File without changes
|
package/dist/sdk/network.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Network Types
|
|
3
|
-
*
|
|
4
|
-
* Network configuration and endpoint types for the Monaco SDK.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Supported network types for the Monaco SDK.
|
|
8
|
-
*
|
|
9
|
-
* Must be one of the preset networks:
|
|
10
|
-
* - "local": http://localhost:8080
|
|
11
|
-
* - "development": https://develop.apimonaco.xyz
|
|
12
|
-
* - "staging": https://staging.apimonaco.xyz
|
|
13
|
-
* - "mainnet": https://api.monaco.xyz
|
|
14
|
-
*/
|
|
15
|
-
export type Network = "mainnet" | "development" | "staging" | "local";
|
|
16
|
-
/**
|
|
17
|
-
* Network endpoint configuration for the Monaco SDK.
|
|
18
|
-
*
|
|
19
|
-
* Contains the RPC URL and API URL for each supported network.
|
|
20
|
-
* WebSocket connections use the API URL with /ws endpoint and the access token is passed as a query parameter.
|
|
21
|
-
*/
|
|
22
|
-
export interface NetworkEndpoints {
|
|
23
|
-
rpcUrl: string;
|
|
24
|
-
apiUrl: string;
|
|
25
|
-
}
|