@0xmonaco/types 0.8.5 → 0.8.7-develop.0f12336
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/api/index.d.ts +13 -5
- package/dist/api/index.js +1 -1
- 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 +213 -2
- package/dist/applications/responses.js +3 -1
- package/dist/auth/index.d.ts +29 -31
- package/dist/auth/index.js +2 -2
- package/dist/auth/responses.d.ts +25 -21
- package/dist/contracts/balances.d.ts +1 -1
- package/dist/delegated-agents/index.d.ts +35 -18
- package/dist/faucet/index.d.ts +54 -0
- package/dist/faucet/index.js +10 -0
- package/dist/fees/index.d.ts +4 -4
- package/dist/fees/responses.d.ts +17 -17
- package/dist/fees/responses.js +20 -20
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/margin-accounts/index.d.ts +91 -55
- package/dist/market/index.d.ts +214 -94
- package/dist/positions/index.d.ts +67 -44
- package/dist/profile/index.d.ts +157 -67
- package/dist/sdk/index.d.ts +43 -5
- package/dist/sub-accounts/index.d.ts +146 -0
- package/dist/sub-accounts/index.js +9 -0
- package/dist/trading/index.d.ts +8 -8
- package/dist/trading/orders.d.ts +20 -20
- package/dist/trading/responses.d.ts +82 -101
- package/dist/validation/margin-accounts.d.ts +53 -13
- package/dist/validation/margin-accounts.js +38 -14
- package/dist/validation/market.d.ts +1 -1
- package/dist/validation/market.js +1 -1
- package/dist/validation/positions.d.ts +11 -7
- package/dist/validation/positions.js +10 -6
- package/dist/validation/profile.d.ts +13 -6
- package/dist/validation/profile.js +13 -6
- package/dist/validation/trading.d.ts +17 -42
- package/dist/validation/trading.js +51 -42
- 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/whitelist/index.d.ts +44 -0
- package/dist/whitelist/index.js +10 -0
- package/dist/wire/assert.d.ts +54 -0
- package/dist/wire/assert.js +0 -0
- package/dist/wire/audit.d.ts +47 -0
- package/dist/wire/audit.js +43 -0
- package/dist/wire/coverage.d.ts +1 -0
- package/dist/wire/coverage.js +0 -0
- package/dist/wire/index.d.ts +21 -0
- package/dist/wire/index.js +2 -0
- package/dist/wire/operations.d.ts +15 -0
- package/dist/wire/operations.js +101 -0
- package/dist/wire/schema.d.ts +8930 -0
- package/dist/wire/schema.js +4 -0
- package/dist/withdrawals/index.d.ts +114 -0
- package/dist/withdrawals/index.js +0 -0
- package/package.json +6 -2
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) */
|
|
@@ -35,47 +36,53 @@ export interface LedgerMovement {
|
|
|
35
36
|
/** Movement unique identifier */
|
|
36
37
|
id: string;
|
|
37
38
|
/** Type of entry (Credit, Debit) */
|
|
38
|
-
|
|
39
|
+
entryType: string;
|
|
39
40
|
/** Type of transaction (Deposit, Withdrawal, Trade, etc.) */
|
|
40
|
-
|
|
41
|
+
transactionType: string;
|
|
41
42
|
/** Transaction amount (normalized, human-readable) */
|
|
42
43
|
amount: string;
|
|
43
44
|
/** Transaction amount in raw format (wei) */
|
|
44
|
-
|
|
45
|
+
amountRaw: string;
|
|
45
46
|
/** Token contract address */
|
|
46
|
-
token:
|
|
47
|
+
token: Address;
|
|
47
48
|
/** Token symbol */
|
|
48
49
|
symbol: string | null;
|
|
49
50
|
/** Token decimals */
|
|
50
51
|
decimals: number;
|
|
51
52
|
/** Balance before this transaction (normalized) */
|
|
52
|
-
|
|
53
|
+
balanceBefore: string | null;
|
|
53
54
|
/** Balance before in raw format (wei) */
|
|
54
|
-
|
|
55
|
+
balanceBeforeRaw: string | null;
|
|
55
56
|
/** Balance after this transaction (normalized) */
|
|
56
|
-
|
|
57
|
+
balanceAfter: string | null;
|
|
57
58
|
/** Balance after in raw format (wei) */
|
|
58
|
-
|
|
59
|
+
balanceAfterRaw: string | null;
|
|
59
60
|
/** Locked balance before transaction (normalized) */
|
|
60
|
-
|
|
61
|
+
lockedBefore: string | null;
|
|
61
62
|
/** Locked balance before in raw format (wei) */
|
|
62
|
-
|
|
63
|
+
lockedBeforeRaw: string | null;
|
|
63
64
|
/** Locked balance after transaction (normalized) */
|
|
64
|
-
|
|
65
|
+
lockedAfter: string | null;
|
|
65
66
|
/** Locked balance after in raw format (wei) */
|
|
66
|
-
|
|
67
|
+
lockedAfterRaw: string | null;
|
|
67
68
|
/** Reference identifier for related operations */
|
|
68
|
-
|
|
69
|
+
referenceId: string | null;
|
|
69
70
|
/** Reference type */
|
|
70
|
-
|
|
71
|
+
referenceType: string | null;
|
|
71
72
|
/** Human readable description */
|
|
72
73
|
description: string | null;
|
|
73
74
|
/** Blockchain transaction hash */
|
|
74
|
-
|
|
75
|
+
txHash: string | null;
|
|
75
76
|
/** Blockchain block number */
|
|
76
|
-
|
|
77
|
+
blockNumber: number | null;
|
|
77
78
|
/** Transaction timestamp */
|
|
78
|
-
|
|
79
|
+
createdAt: string | null;
|
|
80
|
+
/** Asset UUID this movement affects */
|
|
81
|
+
assetId?: string | null;
|
|
82
|
+
/** User UUID who owns this movement */
|
|
83
|
+
userId?: string | null;
|
|
84
|
+
/** Balance UUID this movement affects */
|
|
85
|
+
balanceId?: string | null;
|
|
79
86
|
}
|
|
80
87
|
/**
|
|
81
88
|
* Ledger entry type for filtering movements.
|
|
@@ -94,13 +101,13 @@ export interface GetUserMovementsParams {
|
|
|
94
101
|
/** Page number (starts from 1) */
|
|
95
102
|
page?: number;
|
|
96
103
|
/** Number of items per page (max 100) */
|
|
97
|
-
|
|
104
|
+
pageSize?: number;
|
|
98
105
|
/** Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE) */
|
|
99
|
-
|
|
106
|
+
entryType?: LedgerEntryType;
|
|
100
107
|
/** Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD) */
|
|
101
|
-
|
|
108
|
+
transactionType?: TransactionType;
|
|
102
109
|
/** Filter by asset ID (UUID) */
|
|
103
|
-
|
|
110
|
+
assetId?: string;
|
|
104
111
|
}
|
|
105
112
|
/**
|
|
106
113
|
* Query parameters for getting user balances
|
|
@@ -109,14 +116,14 @@ export interface GetUserBalancesParams {
|
|
|
109
116
|
/** Page number (starts from 1) */
|
|
110
117
|
page?: number;
|
|
111
118
|
/** Number of items per page (max 100) */
|
|
112
|
-
|
|
119
|
+
pageSize?: number;
|
|
113
120
|
}
|
|
114
121
|
/**
|
|
115
122
|
* Response from getting user movements
|
|
116
123
|
*/
|
|
117
124
|
export interface GetPaginatedUserMovementsResponse {
|
|
118
125
|
/**
|
|
119
|
-
* Latest movements from
|
|
126
|
+
* Latest movements from the live engine cache (real-time, instant updates).
|
|
120
127
|
* These are the most recent movements that may not yet be in PostgreSQL.
|
|
121
128
|
* Only populated on page 1; empty for subsequent pages.
|
|
122
129
|
*/
|
|
@@ -126,11 +133,11 @@ export interface GetPaginatedUserMovementsResponse {
|
|
|
126
133
|
/** Current page number */
|
|
127
134
|
page: number;
|
|
128
135
|
/** Items per page */
|
|
129
|
-
|
|
136
|
+
pageSize: number;
|
|
130
137
|
/** Total number of movements in PostgreSQL */
|
|
131
138
|
total: number;
|
|
132
139
|
/** Total number of pages */
|
|
133
|
-
|
|
140
|
+
totalPages: number;
|
|
134
141
|
}
|
|
135
142
|
/**
|
|
136
143
|
* Response from getting user balances
|
|
@@ -141,11 +148,11 @@ export interface GetUserBalancesResponse {
|
|
|
141
148
|
/** Total number of balances */
|
|
142
149
|
total: number;
|
|
143
150
|
/** Items per page */
|
|
144
|
-
|
|
151
|
+
pageSize: number;
|
|
145
152
|
/** Current page number */
|
|
146
153
|
page: number;
|
|
147
154
|
/** Total number of pages */
|
|
148
|
-
|
|
155
|
+
totalPages: number;
|
|
149
156
|
}
|
|
150
157
|
/**
|
|
151
158
|
* Order information for recent orders.
|
|
@@ -159,7 +166,7 @@ export interface ProfileOrder {
|
|
|
159
166
|
/** Order side */
|
|
160
167
|
side: OrderSide;
|
|
161
168
|
/** Order type */
|
|
162
|
-
|
|
169
|
+
orderType: OrderType;
|
|
163
170
|
/** Order price (null for market orders) */
|
|
164
171
|
price: string | null;
|
|
165
172
|
/** Order quantity */
|
|
@@ -167,11 +174,11 @@ export interface ProfileOrder {
|
|
|
167
174
|
/** Order status */
|
|
168
175
|
status: OrderStatus;
|
|
169
176
|
/** Time in force */
|
|
170
|
-
|
|
177
|
+
timeInForce?: TimeInForce;
|
|
171
178
|
/** Order creation timestamp (ISO string) */
|
|
172
|
-
|
|
179
|
+
createdAt: string;
|
|
173
180
|
/** Order last update timestamp (ISO string) */
|
|
174
|
-
|
|
181
|
+
updatedAt?: string;
|
|
175
182
|
}
|
|
176
183
|
/**
|
|
177
184
|
* Account balance for a specific token.
|
|
@@ -179,44 +186,46 @@ export interface ProfileOrder {
|
|
|
179
186
|
*/
|
|
180
187
|
export interface AccountBalance {
|
|
181
188
|
/** Asset ID (UUID for API calls) */
|
|
182
|
-
|
|
189
|
+
assetId: string;
|
|
183
190
|
/** Token address */
|
|
184
|
-
token:
|
|
191
|
+
token: Address;
|
|
185
192
|
/** Token symbol */
|
|
186
193
|
symbol: string | null;
|
|
187
194
|
/** Decimal places for the token */
|
|
188
195
|
decimals: number;
|
|
189
196
|
/** Available balance for trading (normalized) */
|
|
190
|
-
|
|
197
|
+
availableBalance: string;
|
|
191
198
|
/** Locked balance (in orders or pending operations, normalized) */
|
|
192
|
-
|
|
193
|
-
/** Total balance (available + locked
|
|
194
|
-
|
|
199
|
+
lockedBalance: string;
|
|
200
|
+
/** Total balance (available + locked, normalized) */
|
|
201
|
+
totalBalance: string;
|
|
195
202
|
/** Available balance in raw format (wei) */
|
|
196
|
-
|
|
203
|
+
availableBalanceRaw: string;
|
|
197
204
|
/** Locked balance in raw format (wei) */
|
|
198
|
-
|
|
205
|
+
lockedBalanceRaw: string;
|
|
206
|
+
/** Total balance (available + locked) in raw format (wei) */
|
|
207
|
+
totalBalanceRaw: string;
|
|
199
208
|
}
|
|
200
209
|
/**
|
|
201
210
|
* A single user trade execution.
|
|
202
211
|
*/
|
|
203
212
|
export interface UserTrade {
|
|
204
213
|
/** Trade unique identifier */
|
|
205
|
-
|
|
214
|
+
tradeId: string;
|
|
206
215
|
/** Trading pair identifier (UUID) */
|
|
207
|
-
|
|
216
|
+
tradingPairId: string;
|
|
208
217
|
/** Execution price (as string to preserve precision) */
|
|
209
218
|
price: string;
|
|
210
219
|
/** Executed quantity (as string to preserve precision) */
|
|
211
220
|
quantity: string;
|
|
212
221
|
/** Quote volume (price * quantity, as string to preserve precision) */
|
|
213
|
-
|
|
222
|
+
quoteVolume: string;
|
|
214
223
|
/** Side of the trade */
|
|
215
224
|
side: OrderSide;
|
|
216
225
|
/** Fee paid for this trade (as string to preserve precision) */
|
|
217
226
|
fee: string;
|
|
218
227
|
/** Timestamp when the trade was executed (ISO string) */
|
|
219
|
-
|
|
228
|
+
executedAt: string;
|
|
220
229
|
}
|
|
221
230
|
/**
|
|
222
231
|
* Query parameters for getting user trades
|
|
@@ -225,9 +234,9 @@ export interface GetUserTradesParams {
|
|
|
225
234
|
/** Page number (starts from 1) */
|
|
226
235
|
page?: number;
|
|
227
236
|
/** Number of items per page (max 100) */
|
|
228
|
-
|
|
237
|
+
pageSize?: number;
|
|
229
238
|
/** Filter by trading pair ID (UUID) */
|
|
230
|
-
|
|
239
|
+
tradingPairId?: string;
|
|
231
240
|
}
|
|
232
241
|
/**
|
|
233
242
|
* Response from getting user trades
|
|
@@ -238,11 +247,72 @@ export interface GetUserTradesResponse {
|
|
|
238
247
|
/** Current page number */
|
|
239
248
|
page: number;
|
|
240
249
|
/** Items per page */
|
|
241
|
-
|
|
250
|
+
pageSize: number;
|
|
242
251
|
/** Total number of trades */
|
|
243
252
|
total: number;
|
|
244
253
|
/** Total number of pages */
|
|
245
|
-
|
|
254
|
+
totalPages: number;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Direction of a funding payment from the user's perspective.
|
|
258
|
+
*/
|
|
259
|
+
export type FundingDirection = "PAID" | "RECEIVED";
|
|
260
|
+
/**
|
|
261
|
+
* A single funding payment settled against a margin position.
|
|
262
|
+
*/
|
|
263
|
+
export interface FundingPayment {
|
|
264
|
+
/** Funding payment unique identifier (UUID) */
|
|
265
|
+
id: string;
|
|
266
|
+
/** Margin position identifier (UUID) */
|
|
267
|
+
positionId: string;
|
|
268
|
+
/** Margin account identifier (UUID) */
|
|
269
|
+
marginAccountId: string;
|
|
270
|
+
/** Trading pair identifier (UUID) */
|
|
271
|
+
tradingPairId: string;
|
|
272
|
+
/** Funding rate applied for the epoch (as string to preserve precision) */
|
|
273
|
+
fundingRate: string;
|
|
274
|
+
/** Absolute position size at settlement (as string to preserve precision) */
|
|
275
|
+
positionSize: string;
|
|
276
|
+
/** Signed funding amount; positive means paid, negative means received (as string) */
|
|
277
|
+
paymentAmount: string;
|
|
278
|
+
/** Funding direction for the user */
|
|
279
|
+
direction: FundingDirection;
|
|
280
|
+
/** Funding window start timestamp (ISO 8601), if known */
|
|
281
|
+
periodStart?: string;
|
|
282
|
+
/** Funding window end timestamp (ISO 8601), if known */
|
|
283
|
+
periodEnd?: string;
|
|
284
|
+
/** Funding payment creation timestamp (ISO 8601), if known */
|
|
285
|
+
createdAt?: string;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Query parameters for listing funding payments.
|
|
289
|
+
*/
|
|
290
|
+
export interface ListFundingPaymentsParams {
|
|
291
|
+
/** Page number (starts from 1) */
|
|
292
|
+
page?: number;
|
|
293
|
+
/** Number of items per page (max 100) */
|
|
294
|
+
pageSize?: number;
|
|
295
|
+
/** Filter by trading pair ID (UUID) */
|
|
296
|
+
tradingPairId?: string;
|
|
297
|
+
/** Filter by margin position ID (UUID) */
|
|
298
|
+
positionId?: string;
|
|
299
|
+
/** Filter by margin account ID (UUID) */
|
|
300
|
+
marginAccountId?: string;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Response from listing funding payments.
|
|
304
|
+
*/
|
|
305
|
+
export interface ListFundingPaymentsResponse {
|
|
306
|
+
/** List of funding payment records */
|
|
307
|
+
records: FundingPayment[];
|
|
308
|
+
/** Current page number */
|
|
309
|
+
page: number;
|
|
310
|
+
/** Items per page */
|
|
311
|
+
pageSize: number;
|
|
312
|
+
/** Total number of matching records */
|
|
313
|
+
total: number;
|
|
314
|
+
/** Total number of pages */
|
|
315
|
+
totalPages: number;
|
|
246
316
|
}
|
|
247
317
|
/**
|
|
248
318
|
* Time period for portfolio stats and chart queries.
|
|
@@ -280,20 +350,20 @@ export interface PortfolioChartResponse {
|
|
|
280
350
|
export interface PortfolioStats {
|
|
281
351
|
/** Realized profit and loss (sum of CREDIT minus DEBIT from TRADE ledger entries) */
|
|
282
352
|
pnl: string;
|
|
283
|
-
/** Total trading volume (sum of
|
|
353
|
+
/** Total trading volume (sum of quoteVolume from trades) */
|
|
284
354
|
volume: string;
|
|
285
355
|
/** Maximum peak-to-trough drawdown on running PnL */
|
|
286
|
-
|
|
356
|
+
maxDrawdown: string;
|
|
287
357
|
/** Total number of orders placed */
|
|
288
|
-
|
|
358
|
+
totalOrders: number;
|
|
289
359
|
/** Total number of trades executed */
|
|
290
|
-
|
|
360
|
+
totalTrades: number;
|
|
291
361
|
/** Total fees paid */
|
|
292
|
-
|
|
362
|
+
feesPaid: string;
|
|
293
363
|
/** Ratio of profitable trades to total trades */
|
|
294
|
-
|
|
364
|
+
winLossRatio: string;
|
|
295
365
|
/** Total equity in USDC terms (sum of all spot balances) */
|
|
296
|
-
|
|
366
|
+
totalEquity: string;
|
|
297
367
|
}
|
|
298
368
|
/**
|
|
299
369
|
* User profile information returned by the /api/v1/accounts/me endpoint.
|
|
@@ -302,19 +372,23 @@ export interface UserProfile {
|
|
|
302
372
|
/** Unique identifier for the user */
|
|
303
373
|
id: string;
|
|
304
374
|
/** Wallet address of the user */
|
|
305
|
-
address:
|
|
375
|
+
address: Address;
|
|
306
376
|
/** Username of the user (can be null) */
|
|
307
377
|
username: string | null;
|
|
308
378
|
/** Account type (e.g., "master") */
|
|
309
|
-
|
|
379
|
+
accountType: string;
|
|
310
380
|
/** Whether the user can withdraw funds */
|
|
311
|
-
|
|
381
|
+
canWithdraw: boolean;
|
|
312
382
|
/** Taker fee rate in basis points */
|
|
313
|
-
|
|
383
|
+
takerFeeBps: number;
|
|
314
384
|
/** Maker fee rate in basis points */
|
|
315
|
-
|
|
385
|
+
makerFeeBps: number;
|
|
316
386
|
/** Account creation timestamp (ISO string) */
|
|
317
|
-
|
|
387
|
+
createdAt: string;
|
|
388
|
+
/** Additional taker fee in basis points contributed by the application (if any) */
|
|
389
|
+
applicationTakerFeeBps?: number;
|
|
390
|
+
/** Additional maker fee in basis points contributed by the application (if any) */
|
|
391
|
+
applicationMakerFeeBps?: number;
|
|
318
392
|
}
|
|
319
393
|
/**
|
|
320
394
|
* Profile API interface.
|
|
@@ -339,9 +413,9 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
339
413
|
* @param params - Optional query parameters for pagination and filtering
|
|
340
414
|
* @param params.page - Page number (starts from 1)
|
|
341
415
|
* @param params.limit - Number of items per page (max 100)
|
|
342
|
-
* @param params.
|
|
343
|
-
* @param params.
|
|
344
|
-
* @param params.
|
|
416
|
+
* @param params.entryType - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
|
|
417
|
+
* @param params.transactionType - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)
|
|
418
|
+
* @param params.assetId - Filter by asset ID (UUID)
|
|
345
419
|
* @returns Promise resolving to paginated movements response
|
|
346
420
|
*/
|
|
347
421
|
getPaginatedUserMovements(params?: GetUserMovementsParams): Promise<GetPaginatedUserMovementsResponse>;
|
|
@@ -360,7 +434,7 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
360
434
|
/**
|
|
361
435
|
* Get the current user's balance for a specific asset.
|
|
362
436
|
*
|
|
363
|
-
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{
|
|
437
|
+
* Fetches the user's balance for a specific asset from the /api/v1/accounts/balances/{assetId} endpoint.
|
|
364
438
|
* Requires a valid access token to be set. If no balance exists for a valid asset, returns zero balances.
|
|
365
439
|
*
|
|
366
440
|
* @param assetId - The asset identifier (UUID)
|
|
@@ -397,9 +471,25 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
397
471
|
* @param params - Optional query parameters for pagination and filtering
|
|
398
472
|
* @param params.page - Page number (starts from 1)
|
|
399
473
|
* @param params.limit - Number of items per page (max 100)
|
|
400
|
-
* @param params.
|
|
474
|
+
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
401
475
|
* @returns Promise resolving to paginated trades response
|
|
402
|
-
* @throws ValidationError If pagination params (page/limit) are invalid or
|
|
476
|
+
* @throws ValidationError If pagination params (page/limit) are invalid or tradingPairId is not a valid UUID; this may occur before any network request.
|
|
403
477
|
*/
|
|
404
478
|
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
479
|
+
/**
|
|
480
|
+
* List the current user's funding payment history with pagination and filters.
|
|
481
|
+
*
|
|
482
|
+
* Fetches funding payments from the /api/v1/accounts/funding-payments endpoint.
|
|
483
|
+
* Requires a valid access token to be set.
|
|
484
|
+
*
|
|
485
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
486
|
+
* @param params.page - Page number (starts from 1)
|
|
487
|
+
* @param params.pageSize - Number of items per page (max 100)
|
|
488
|
+
* @param params.tradingPairId - Filter by trading pair ID (UUID)
|
|
489
|
+
* @param params.positionId - Filter by margin position ID (UUID)
|
|
490
|
+
* @param params.marginAccountId - Filter by margin account ID (UUID)
|
|
491
|
+
* @returns Promise resolving to paginated funding payments response
|
|
492
|
+
* @throws ValidationError If pagination params or a UUID filter are invalid; this may occur before any network request.
|
|
493
|
+
*/
|
|
494
|
+
listFundingPayments(params?: ListFundingPaymentsParams): Promise<ListFundingPaymentsResponse>;
|
|
405
495
|
}
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
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
|
-
import type { AuthAPI, AuthState } from "../auth/index";
|
|
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.
|
|
@@ -29,10 +33,27 @@ export interface SDKConfig {
|
|
|
29
33
|
* - "mainnet": https://api.monaco.xyz
|
|
30
34
|
*
|
|
31
35
|
* Only "mainnet" uses the Sei mainnet chain. All other networks use Sei testnet.
|
|
36
|
+
* `network` always selects the chain; supply {@link apiUrl} / {@link wsUrl}
|
|
37
|
+
* to point the SDK at a gateway that the preset URL doesn't cover.
|
|
32
38
|
*/
|
|
33
39
|
network: Network;
|
|
34
40
|
/** RPC URL for Sei blockchain interactions */
|
|
35
41
|
seiRpcUrl: string;
|
|
42
|
+
/**
|
|
43
|
+
* Override the API gateway base URL. When set, the SDK sends all HTTP
|
|
44
|
+
* requests here instead of the {@link network} preset's default URL. Use for
|
|
45
|
+
* self-hosted gateways or e2e/dev stacks reachable only by a custom host
|
|
46
|
+
* (e.g. Docker DNS `http://api-gateway:8080`). `network` still selects the
|
|
47
|
+
* chain. Must be a valid absolute URL.
|
|
48
|
+
*/
|
|
49
|
+
apiUrl?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Override the WebSocket base URL. When set, the SDK connects here instead of
|
|
52
|
+
* the {@link network} preset's default WS URL. Pair with {@link apiUrl} when
|
|
53
|
+
* the WS service is reachable at a different host than the API gateway
|
|
54
|
+
* (e.g. Docker DNS `ws://ws-api:8080/ws`). Must be a valid absolute URL.
|
|
55
|
+
*/
|
|
56
|
+
wsUrl?: string;
|
|
36
57
|
}
|
|
37
58
|
/**
|
|
38
59
|
* Core SDK interface providing access to all Monaco functionality.
|
|
@@ -48,6 +69,8 @@ export interface MonacoSDK {
|
|
|
48
69
|
delegatedAgents: DelegatedAgentsAPI;
|
|
49
70
|
/** Vault operations API */
|
|
50
71
|
vault: VaultAPI;
|
|
72
|
+
/** Low-level withdrawals API (initiate + fetch signed calldata) */
|
|
73
|
+
withdrawals: WithdrawalsAPI;
|
|
51
74
|
/** Trading operations API */
|
|
52
75
|
trading: TradingAPI;
|
|
53
76
|
/** Market metadata API */
|
|
@@ -56,6 +79,12 @@ export interface MonacoSDK {
|
|
|
56
79
|
marginAccounts: MarginAccountsAPI;
|
|
57
80
|
/** Perp position operations API */
|
|
58
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;
|
|
59
88
|
/** Profile operations API */
|
|
60
89
|
profile: ProfileAPI;
|
|
61
90
|
/** Orderbook REST API for fetching orderbook snapshots */
|
|
@@ -77,7 +106,7 @@ export interface MonacoSDK {
|
|
|
77
106
|
/** Page number (starts from 1, default: 1) */
|
|
78
107
|
page?: number;
|
|
79
108
|
/** Maximum number of records to return (default: 25, max: 100) */
|
|
80
|
-
|
|
109
|
+
pageSize?: number;
|
|
81
110
|
}) => Promise<TradeEvent[]>;
|
|
82
111
|
};
|
|
83
112
|
/** WebSocket client for real-time data (orders, orderbook, ohlcv) */
|
|
@@ -86,7 +115,7 @@ export interface MonacoSDK {
|
|
|
86
115
|
disconnect: () => void;
|
|
87
116
|
isConnected: () => boolean;
|
|
88
117
|
getStatus: () => "connected" | "connecting" | "disconnected" | "reconnecting";
|
|
89
|
-
|
|
118
|
+
setSessionKeypair: (credentials: SessionCredentials | undefined) => void;
|
|
90
119
|
orders: (tradingPairId: string, tradingMode: TradingMode, handler: (event: OrderEvent) => void) => () => void;
|
|
91
120
|
orderbook: (tradingPairId: string, tradingMode: TradingMode, magnitude: number, quotationMode: OrderbookQuotationMode, handler: (event: OrderbookEvent) => void) => () => void;
|
|
92
121
|
ohlcv: (tradingPairId: string, tradingMode: TradingMode, interval: Interval, handler: (event: OHLCVEvent) => void) => () => void;
|
|
@@ -108,6 +137,15 @@ export interface MonacoSDK {
|
|
|
108
137
|
login(clientId: string, options?: {
|
|
109
138
|
connectWebSocket?: boolean;
|
|
110
139
|
}): Promise<AuthState>;
|
|
140
|
+
/**
|
|
141
|
+
* Create and adopt an owner-scoped delegated session.
|
|
142
|
+
*
|
|
143
|
+
* The current authenticated session must belong to an agent wallet that has
|
|
144
|
+
* an active delegation from `ownerUserId`. On success, the SDK signs
|
|
145
|
+
* subsequent requests with the delegated session keypair, so account reads
|
|
146
|
+
* and trading calls operate on the owner while preserving agent attribution.
|
|
147
|
+
*/
|
|
148
|
+
loginAsDelegatedOwner(ownerUserId: string): Promise<AuthState>;
|
|
111
149
|
/** Log out the user */
|
|
112
150
|
logout(): Promise<void>;
|
|
113
151
|
/** Refresh the access token */
|
|
@@ -119,7 +157,7 @@ export interface MonacoSDK {
|
|
|
119
157
|
/** Check connection status */
|
|
120
158
|
isConnected(): boolean;
|
|
121
159
|
/** Get the current account address */
|
|
122
|
-
getAccountAddress():
|
|
160
|
+
getAccountAddress(): Address;
|
|
123
161
|
/** Get the current network ('mainnet' or 'testnet') */
|
|
124
162
|
getNetwork(): Network;
|
|
125
163
|
/** Get the current chain ID */
|
|
@@ -0,0 +1,146 @@
|
|
|
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 { Address } from "viem";
|
|
11
|
+
import type { BaseAPI } from "../api";
|
|
12
|
+
import type { AccountBalance } from "../profile";
|
|
13
|
+
/**
|
|
14
|
+
* A sub-account owned by the authenticated master account, with its balances.
|
|
15
|
+
*/
|
|
16
|
+
export interface SubAccount {
|
|
17
|
+
/** Sub-account UUID */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Sub-account wallet address */
|
|
20
|
+
address: Address;
|
|
21
|
+
/** Sub-account display username */
|
|
22
|
+
username: string | null;
|
|
23
|
+
/** Whether the sub-account is allowed to withdraw */
|
|
24
|
+
canWithdraw: boolean;
|
|
25
|
+
/** Account creation timestamp (ISO 8601) */
|
|
26
|
+
createdAt: string;
|
|
27
|
+
/** Per-asset balances held by the sub-account */
|
|
28
|
+
balances: AccountBalance[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A per-asset spending limit on a sub-account.
|
|
32
|
+
*/
|
|
33
|
+
export interface SubAccountLimit {
|
|
34
|
+
/** Limit UUID */
|
|
35
|
+
id: string;
|
|
36
|
+
/** Sub-account UUID this limit applies to */
|
|
37
|
+
subAccountId: string;
|
|
38
|
+
/** Token contract address */
|
|
39
|
+
token: Address;
|
|
40
|
+
/** Maximum daily spending limit in token units */
|
|
41
|
+
dailyLimit: string | null;
|
|
42
|
+
/** Amount used today against the limit */
|
|
43
|
+
usedToday: string;
|
|
44
|
+
/** Limit creation timestamp (ISO 8601) */
|
|
45
|
+
createdAt: string;
|
|
46
|
+
/** Last update timestamp (ISO 8601) */
|
|
47
|
+
updatedAt: string | null;
|
|
48
|
+
/** Master account UUID that owns this sub-account */
|
|
49
|
+
masterAccountId: string;
|
|
50
|
+
/** Maximum amount allowed in token units */
|
|
51
|
+
maxAmount: string;
|
|
52
|
+
/** Last reset timestamp for the daily limit (ISO 8601) */
|
|
53
|
+
lastResetAt: string | null;
|
|
54
|
+
/** Whether the limit is active */
|
|
55
|
+
isActive: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Body for creating a sub-account limit.
|
|
59
|
+
*/
|
|
60
|
+
export interface CreateSubAccountLimitRequest {
|
|
61
|
+
/** Sub-account UUID to create the limit for */
|
|
62
|
+
subAccountId: string;
|
|
63
|
+
/** Asset UUID to limit */
|
|
64
|
+
assetId: string;
|
|
65
|
+
/** Maximum amount allowed in token units */
|
|
66
|
+
maxAmount: string;
|
|
67
|
+
/** Maximum daily spending limit in token units */
|
|
68
|
+
dailyLimit?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Body for updating a sub-account limit. The sub-account and asset are taken
|
|
72
|
+
* from the path; all body fields are optional (partial update).
|
|
73
|
+
*/
|
|
74
|
+
export interface UpdateSubAccountLimitBody {
|
|
75
|
+
/** New maximum amount allowed in token units */
|
|
76
|
+
maxAmount?: string;
|
|
77
|
+
/** New maximum daily spending limit in token units */
|
|
78
|
+
dailyLimit?: string;
|
|
79
|
+
/** Whether the limit is active */
|
|
80
|
+
isActive?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/** Paginated list of the master account's sub-accounts. */
|
|
83
|
+
export interface ListSubAccountsResponse {
|
|
84
|
+
subAccounts: SubAccount[];
|
|
85
|
+
/** Total number of sub-accounts */
|
|
86
|
+
total: number;
|
|
87
|
+
}
|
|
88
|
+
/** Response wrapping a single created limit. */
|
|
89
|
+
export interface CreateSubAccountLimitResponse {
|
|
90
|
+
limit: SubAccountLimit;
|
|
91
|
+
}
|
|
92
|
+
/** Response wrapping a single updated limit. */
|
|
93
|
+
export interface UpdateSubAccountLimitResponse {
|
|
94
|
+
limit: SubAccountLimit;
|
|
95
|
+
}
|
|
96
|
+
/** Response wrapping a sub-account's limits. */
|
|
97
|
+
export interface GetSubAccountLimitsResponse {
|
|
98
|
+
limits: SubAccountLimit[];
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Sub-accounts API interface.
|
|
102
|
+
*
|
|
103
|
+
* `list` and `getLimits` need only session auth; `createLimit`, `updateLimit`,
|
|
104
|
+
* and `deleteLimit` additionally require the master account to hold the
|
|
105
|
+
* `ManageSubAccounts` permission (enforced server-side — a non-master or
|
|
106
|
+
* unpermissioned caller gets a 403).
|
|
107
|
+
*/
|
|
108
|
+
export interface SubAccountsAPI extends BaseAPI {
|
|
109
|
+
/**
|
|
110
|
+
* Lists the authenticated master account's sub-accounts with balances.
|
|
111
|
+
*
|
|
112
|
+
* @returns Promise resolving to the sub-accounts and total count
|
|
113
|
+
*/
|
|
114
|
+
list(): Promise<ListSubAccountsResponse>;
|
|
115
|
+
/**
|
|
116
|
+
* Creates a per-asset spending limit on a sub-account.
|
|
117
|
+
*
|
|
118
|
+
* @param body - Sub-account, asset, max amount, and optional daily limit
|
|
119
|
+
* @returns Promise resolving to the created limit
|
|
120
|
+
*/
|
|
121
|
+
createLimit(body: CreateSubAccountLimitRequest): Promise<CreateSubAccountLimitResponse>;
|
|
122
|
+
/**
|
|
123
|
+
* Gets the limits configured for a sub-account.
|
|
124
|
+
*
|
|
125
|
+
* @param subAccountId - Sub-account UUID
|
|
126
|
+
* @returns Promise resolving to the sub-account's limits
|
|
127
|
+
*/
|
|
128
|
+
getLimits(subAccountId: string): Promise<GetSubAccountLimitsResponse>;
|
|
129
|
+
/**
|
|
130
|
+
* Updates a sub-account's per-asset limit (partial update).
|
|
131
|
+
*
|
|
132
|
+
* @param subAccountId - Sub-account UUID
|
|
133
|
+
* @param assetId - Asset UUID
|
|
134
|
+
* @param body - Fields to update
|
|
135
|
+
* @returns Promise resolving to the updated limit
|
|
136
|
+
*/
|
|
137
|
+
updateLimit(subAccountId: string, assetId: string, body: UpdateSubAccountLimitBody): Promise<UpdateSubAccountLimitResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Deletes a sub-account's per-asset limit.
|
|
140
|
+
*
|
|
141
|
+
* @param subAccountId - Sub-account UUID
|
|
142
|
+
* @param assetId - Asset UUID
|
|
143
|
+
* @returns Promise resolving when the limit is deleted
|
|
144
|
+
*/
|
|
145
|
+
deleteLimit(subAccountId: string, assetId: string): Promise<void>;
|
|
146
|
+
}
|