@0xmonaco/types 0.5.8 → 0.6.0
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 +1 -1
- package/dist/api/index.d.ts +0 -1
- package/dist/api/index.js +0 -1
- package/dist/applications/index.d.ts +0 -1
- package/dist/applications/index.js +0 -1
- package/dist/applications/responses.d.ts +0 -1
- package/dist/applications/responses.js +0 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.js +0 -1
- package/dist/auth/responses.d.ts +0 -1
- package/dist/auth/responses.js +0 -1
- package/dist/contracts/balances.d.ts +0 -1
- package/dist/contracts/balances.js +0 -1
- package/dist/contracts/index.d.ts +0 -1
- package/dist/contracts/index.js +0 -1
- package/dist/fees/index.d.ts +0 -1
- package/dist/fees/index.js +0 -1
- package/dist/fees/responses.d.ts +0 -1
- package/dist/fees/responses.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/market/index.d.ts +0 -1
- package/dist/market/index.js +0 -1
- package/dist/profile/index.d.ts +137 -13
- package/dist/profile/index.js +0 -1
- package/dist/sdk/index.d.ts +0 -1
- package/dist/sdk/index.js +0 -1
- package/dist/sdk/network.d.ts +0 -1
- package/dist/sdk/network.js +0 -1
- package/dist/trading/index.d.ts +1 -1
- package/dist/trading/index.js +1 -1
- package/dist/trading/orders.d.ts +10 -5
- package/dist/trading/orders.js +4 -1
- package/dist/trading/responses.d.ts +0 -1
- package/dist/trading/responses.js +0 -1
- package/dist/validation/common.d.ts +0 -1
- package/dist/validation/common.js +0 -1
- package/dist/validation/index.d.ts +0 -1
- package/dist/validation/index.js +0 -1
- package/dist/validation/market.d.ts +0 -1
- package/dist/validation/market.js +0 -1
- package/dist/validation/profile.d.ts +11 -14
- package/dist/validation/profile.js +11 -8
- package/dist/validation/trading.d.ts +1 -1
- package/dist/validation/trading.js +2 -2
- package/dist/validation/vault.d.ts +0 -1
- package/dist/validation/vault.js +0 -1
- package/dist/vault/index.d.ts +0 -1
- package/dist/vault/index.js +0 -1
- package/dist/vault/responses.d.ts +0 -1
- package/dist/vault/responses.js +0 -1
- package/dist/websocket/base.d.ts +0 -1
- package/dist/websocket/base.js +0 -1
- package/dist/websocket/clients/orderbook-client.d.ts +0 -1
- package/dist/websocket/clients/orderbook-client.js +0 -1
- package/dist/websocket/events/balance-events.d.ts +0 -1
- package/dist/websocket/events/balance-events.js +0 -1
- package/dist/websocket/events/index.d.ts +0 -1
- package/dist/websocket/events/index.js +0 -1
- package/dist/websocket/events/movement-events.d.ts +0 -1
- package/dist/websocket/events/movement-events.js +0 -1
- package/dist/websocket/events/ohlcv-events.d.ts +0 -1
- package/dist/websocket/events/ohlcv-events.js +0 -1
- package/dist/websocket/events/orderbook-events.d.ts +0 -1
- package/dist/websocket/events/orderbook-events.js +0 -1
- package/dist/websocket/events/orders-events.d.ts +0 -1
- package/dist/websocket/events/orders-events.js +0 -1
- package/dist/websocket/events/trade-events.d.ts +0 -1
- package/dist/websocket/events/trade-events.js +0 -1
- package/dist/websocket/index.d.ts +0 -1
- package/dist/websocket/index.js +0 -1
- package/package.json +1 -1
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js.map +0 -1
- package/dist/applications/index.d.ts.map +0 -1
- package/dist/applications/index.js.map +0 -1
- package/dist/applications/responses.d.ts.map +0 -1
- package/dist/applications/responses.js.map +0 -1
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/responses.d.ts.map +0 -1
- package/dist/auth/responses.js.map +0 -1
- package/dist/contracts/balances.d.ts.map +0 -1
- package/dist/contracts/balances.js.map +0 -1
- package/dist/contracts/index.d.ts.map +0 -1
- package/dist/contracts/index.js.map +0 -1
- package/dist/fees/index.d.ts.map +0 -1
- package/dist/fees/index.js.map +0 -1
- package/dist/fees/responses.d.ts.map +0 -1
- package/dist/fees/responses.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/market/index.d.ts.map +0 -1
- package/dist/market/index.js.map +0 -1
- package/dist/profile/index.d.ts.map +0 -1
- package/dist/profile/index.js.map +0 -1
- package/dist/sdk/index.d.ts.map +0 -1
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/network.d.ts.map +0 -1
- package/dist/sdk/network.js.map +0 -1
- package/dist/trading/index.d.ts.map +0 -1
- package/dist/trading/index.js.map +0 -1
- package/dist/trading/orders.d.ts.map +0 -1
- package/dist/trading/orders.js.map +0 -1
- package/dist/trading/responses.d.ts.map +0 -1
- package/dist/trading/responses.js.map +0 -1
- package/dist/validation/common.d.ts.map +0 -1
- package/dist/validation/common.js.map +0 -1
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/market.d.ts.map +0 -1
- package/dist/validation/market.js.map +0 -1
- package/dist/validation/profile.d.ts.map +0 -1
- package/dist/validation/profile.js.map +0 -1
- package/dist/validation/trading.d.ts.map +0 -1
- package/dist/validation/trading.js.map +0 -1
- package/dist/validation/vault.d.ts.map +0 -1
- package/dist/validation/vault.js.map +0 -1
- package/dist/vault/index.d.ts.map +0 -1
- package/dist/vault/index.js.map +0 -1
- package/dist/vault/responses.d.ts.map +0 -1
- package/dist/vault/responses.js.map +0 -1
- package/dist/websocket/base.d.ts.map +0 -1
- package/dist/websocket/base.js.map +0 -1
- package/dist/websocket/clients/orderbook-client.d.ts.map +0 -1
- package/dist/websocket/clients/orderbook-client.js.map +0 -1
- package/dist/websocket/events/balance-events.d.ts.map +0 -1
- package/dist/websocket/events/balance-events.js.map +0 -1
- package/dist/websocket/events/index.d.ts.map +0 -1
- package/dist/websocket/events/index.js.map +0 -1
- package/dist/websocket/events/movement-events.d.ts.map +0 -1
- package/dist/websocket/events/movement-events.js.map +0 -1
- package/dist/websocket/events/ohlcv-events.d.ts.map +0 -1
- package/dist/websocket/events/ohlcv-events.js.map +0 -1
- package/dist/websocket/events/orderbook-events.d.ts.map +0 -1
- package/dist/websocket/events/orderbook-events.js.map +0 -1
- package/dist/websocket/events/orders-events.d.ts.map +0 -1
- package/dist/websocket/events/orders-events.js.map +0 -1
- package/dist/websocket/events/trade-events.d.ts.map +0 -1
- package/dist/websocket/events/trade-events.js.map +0 -1
- package/dist/websocket/index.d.ts.map +0 -1
- package/dist/websocket/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -169,7 +169,7 @@ interface TradingAPI extends BaseAPI {
|
|
|
169
169
|
// Trading types
|
|
170
170
|
type OrderSide = "BUY" | "SELL";
|
|
171
171
|
type OrderType = "LIMIT" | "MARKET";
|
|
172
|
-
type OrderStatus = "SUBMITTED" | "PARTIALLY_FILLED" | "FILLED" | "SETTLED" | "CANCELLED" | "REJECTED" | "EXPIRED";
|
|
172
|
+
type OrderStatus = "SUBMITTED" | "PARTIALLY_FILLED" | "FILLED" | "SETTLED_ON_CHAIN" | "SETTLED" | "CANCELLED" | "REJECTED" | "EXPIRED";
|
|
173
173
|
type TradingMode = "SPOT";
|
|
174
174
|
type TimeInForce = "GTC" | "IOC" | "FOK"; // GTC: Good Till Cancel, IOC: Immediate or Cancel, FOK: Fill or Kill
|
|
175
175
|
|
package/dist/api/index.d.ts
CHANGED
package/dist/api/index.js
CHANGED
package/dist/auth/index.d.ts
CHANGED
package/dist/auth/index.js
CHANGED
package/dist/auth/responses.d.ts
CHANGED
package/dist/auth/responses.js
CHANGED
package/dist/contracts/index.js
CHANGED
package/dist/fees/index.d.ts
CHANGED
package/dist/fees/index.js
CHANGED
package/dist/fees/responses.d.ts
CHANGED
package/dist/fees/responses.js
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/market/index.d.ts
CHANGED
package/dist/market/index.js
CHANGED
package/dist/profile/index.d.ts
CHANGED
|
@@ -87,13 +87,6 @@ export type LedgerEntryType = "CREDIT" | "DEBIT" | "LOCK" | "UNLOCK" | "FEE";
|
|
|
87
87
|
* Describes the reason/source of the movement.
|
|
88
88
|
*/
|
|
89
89
|
export type TransactionType = "DEPOSIT" | "WITHDRAWAL" | "TRADE" | "FEE" | "FUNDING" | "LIQUIDATION" | "INTEREST" | "REWARD";
|
|
90
|
-
/**
|
|
91
|
-
* Data source for movements queries.
|
|
92
|
-
* - `hot_storage`: From Redis cache (real-time, fast) — default
|
|
93
|
-
* - `cold_storage`: From PostgreSQL (historical, paginated)
|
|
94
|
-
* - `both`: Combined from both sources
|
|
95
|
-
*/
|
|
96
|
-
export type MovementsDataSource = "hot_storage" | "cold_storage" | "both";
|
|
97
90
|
/**
|
|
98
91
|
* Query parameters for getting user movements
|
|
99
92
|
*/
|
|
@@ -108,8 +101,6 @@ export interface GetUserMovementsParams {
|
|
|
108
101
|
transaction_type?: TransactionType;
|
|
109
102
|
/** Filter by asset ID (UUID) */
|
|
110
103
|
asset_id?: string;
|
|
111
|
-
/** Data source: "hot_storage" (fast, real-time), "cold_storage" (historical), or "both" (hybrid). Default: "hot_storage" */
|
|
112
|
-
source?: MovementsDataSource;
|
|
113
104
|
}
|
|
114
105
|
/**
|
|
115
106
|
* Query parameters for getting user balances
|
|
@@ -140,8 +131,6 @@ export interface GetPaginatedUserMovementsResponse {
|
|
|
140
131
|
total_count: number;
|
|
141
132
|
/** Total number of pages */
|
|
142
133
|
total_pages: number;
|
|
143
|
-
/** Data source used for this response */
|
|
144
|
-
source?: MovementsDataSource;
|
|
145
134
|
}
|
|
146
135
|
/**
|
|
147
136
|
* Response from getting user balances
|
|
@@ -206,6 +195,104 @@ export interface AccountBalance {
|
|
|
206
195
|
/** Locked balance in raw format (wei) */
|
|
207
196
|
locked_balance_raw: string;
|
|
208
197
|
}
|
|
198
|
+
/**
|
|
199
|
+
* A single user trade execution.
|
|
200
|
+
*/
|
|
201
|
+
export interface UserTrade {
|
|
202
|
+
/** Trade unique identifier */
|
|
203
|
+
trade_id: string;
|
|
204
|
+
/** Trading pair identifier (UUID) */
|
|
205
|
+
trading_pair_id: string;
|
|
206
|
+
/** Execution price (as string to preserve precision) */
|
|
207
|
+
price: string;
|
|
208
|
+
/** Executed quantity (as string to preserve precision) */
|
|
209
|
+
quantity: string;
|
|
210
|
+
/** Quote volume (price * quantity, as string to preserve precision) */
|
|
211
|
+
quote_volume: string;
|
|
212
|
+
/** Side of the trade */
|
|
213
|
+
side: OrderSide;
|
|
214
|
+
/** Fee paid for this trade (as string to preserve precision) */
|
|
215
|
+
fee: string;
|
|
216
|
+
/** Timestamp when the trade was executed (ISO string) */
|
|
217
|
+
executed_at: string;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Query parameters for getting user trades
|
|
221
|
+
*/
|
|
222
|
+
export interface GetUserTradesParams {
|
|
223
|
+
/** Page number (starts from 1) */
|
|
224
|
+
page?: number;
|
|
225
|
+
/** Number of items per page (max 100) */
|
|
226
|
+
limit?: number;
|
|
227
|
+
/** Filter by trading pair ID (UUID) */
|
|
228
|
+
trading_pair_id?: string;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Response from getting user trades
|
|
232
|
+
*/
|
|
233
|
+
export interface GetUserTradesResponse {
|
|
234
|
+
/** List of user trades */
|
|
235
|
+
trades: UserTrade[];
|
|
236
|
+
/** Current page number */
|
|
237
|
+
page: number;
|
|
238
|
+
/** Items per page */
|
|
239
|
+
limit: number;
|
|
240
|
+
/** Total number of trades */
|
|
241
|
+
total_count: number;
|
|
242
|
+
/** Total number of pages */
|
|
243
|
+
total_pages: number;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Time period for portfolio stats and chart queries.
|
|
247
|
+
*/
|
|
248
|
+
export type PortfolioPeriod = "24h" | "7d" | "30d" | "all";
|
|
249
|
+
/**
|
|
250
|
+
* Metric for portfolio chart queries.
|
|
251
|
+
*/
|
|
252
|
+
export type PortfolioMetric = "volume" | "pnl";
|
|
253
|
+
/**
|
|
254
|
+
* A single data point in a portfolio chart time series.
|
|
255
|
+
*/
|
|
256
|
+
export interface PortfolioChartPoint {
|
|
257
|
+
/** ISO 8601 timestamp for the bucket */
|
|
258
|
+
timestamp: string;
|
|
259
|
+
/** Metric value for the bucket (as string to preserve precision) */
|
|
260
|
+
value: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Portfolio chart time series response.
|
|
264
|
+
* Returned by the /api/v1/accounts/me/portfolio/chart endpoint.
|
|
265
|
+
*/
|
|
266
|
+
export interface PortfolioChartResponse {
|
|
267
|
+
/** The metric returned ("volume" | "pnl") */
|
|
268
|
+
metric: PortfolioMetric;
|
|
269
|
+
/** The period requested */
|
|
270
|
+
period: PortfolioPeriod;
|
|
271
|
+
/** Bucketed time series data points */
|
|
272
|
+
data: PortfolioChartPoint[];
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Portfolio statistics for the authenticated user over a given period.
|
|
276
|
+
* Returned by the /api/v1/accounts/me/portfolio endpoint.
|
|
277
|
+
*/
|
|
278
|
+
export interface PortfolioStats {
|
|
279
|
+
/** Realized profit and loss (sum of CREDIT minus DEBIT from TRADE ledger entries) */
|
|
280
|
+
pnl: string;
|
|
281
|
+
/** Total trading volume (sum of quote_volume from trades) */
|
|
282
|
+
volume: string;
|
|
283
|
+
/** Maximum peak-to-trough drawdown on running PnL */
|
|
284
|
+
max_drawdown: string;
|
|
285
|
+
/** Total number of orders placed */
|
|
286
|
+
total_orders: number;
|
|
287
|
+
/** Total number of trades executed */
|
|
288
|
+
total_trades: number;
|
|
289
|
+
/** Total fees paid */
|
|
290
|
+
fees_paid: string;
|
|
291
|
+
/** Ratio of profitable trades to total trades */
|
|
292
|
+
win_loss_ratio: string;
|
|
293
|
+
/** Total equity in USDC terms (sum of all spot balances) */
|
|
294
|
+
total_equity: string;
|
|
295
|
+
}
|
|
209
296
|
/**
|
|
210
297
|
* User profile information returned by the /api/v1/accounts/me endpoint.
|
|
211
298
|
*/
|
|
@@ -220,6 +307,10 @@ export interface UserProfile {
|
|
|
220
307
|
account_type: string;
|
|
221
308
|
/** Whether the user can withdraw funds */
|
|
222
309
|
can_withdraw: boolean;
|
|
310
|
+
/** Taker fee rate in basis points */
|
|
311
|
+
taker_fee_bps: number;
|
|
312
|
+
/** Maker fee rate in basis points */
|
|
313
|
+
maker_fee_bps: number;
|
|
223
314
|
/** Account creation timestamp (ISO string) */
|
|
224
315
|
created_at: string;
|
|
225
316
|
}
|
|
@@ -249,7 +340,6 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
249
340
|
* @param params.entry_type - Filter by entry type (CREDIT, DEBIT, LOCK, UNLOCK, FEE)
|
|
250
341
|
* @param params.transaction_type - Filter by transaction type (DEPOSIT, WITHDRAWAL, TRADE, FEE, FUNDING, LIQUIDATION, INTEREST, REWARD)
|
|
251
342
|
* @param params.asset_id - Filter by asset ID (UUID)
|
|
252
|
-
* @param params.source - Data source: "hot_storage", "cold_storage", or "both" (default: "hot_storage")
|
|
253
343
|
* @returns Promise resolving to paginated movements response
|
|
254
344
|
*/
|
|
255
345
|
getPaginatedUserMovements(params?: GetUserMovementsParams): Promise<GetPaginatedUserMovementsResponse>;
|
|
@@ -275,5 +365,39 @@ export interface ProfileAPI extends BaseAPI {
|
|
|
275
365
|
* @returns Promise resolving to the account balance for the asset
|
|
276
366
|
*/
|
|
277
367
|
getUserBalanceByAssetId(assetId: string): Promise<AccountBalance>;
|
|
368
|
+
/**
|
|
369
|
+
* Get the current user's portfolio statistics for a given time period.
|
|
370
|
+
*
|
|
371
|
+
* Fetches aggregate stats from the /api/v1/accounts/me/portfolio endpoint.
|
|
372
|
+
* Requires a valid access token to be set.
|
|
373
|
+
*
|
|
374
|
+
* @param period - Time period to scope the stats ("24h" | "7d" | "30d" | "all")
|
|
375
|
+
* @returns Promise resolving to the user's portfolio statistics
|
|
376
|
+
*/
|
|
377
|
+
getPortfolioStats(period: PortfolioPeriod): Promise<PortfolioStats>;
|
|
378
|
+
/**
|
|
379
|
+
* Get the current user's portfolio chart time series for a given period and metric.
|
|
380
|
+
*
|
|
381
|
+
* Fetches bucketed time series data from the /api/v1/accounts/me/portfolio/chart endpoint.
|
|
382
|
+
* Requires a valid access token to be set.
|
|
383
|
+
*
|
|
384
|
+
* @param period - Time period ("24h" | "7d" | "30d" | "all")
|
|
385
|
+
* @param metric - Metric to chart ("volume" | "pnl")
|
|
386
|
+
* @returns Promise resolving to the portfolio chart response
|
|
387
|
+
*/
|
|
388
|
+
getPortfolioChart(period: PortfolioPeriod, metric: PortfolioMetric): Promise<PortfolioChartResponse>;
|
|
389
|
+
/**
|
|
390
|
+
* Get the current user's trade history with pagination.
|
|
391
|
+
*
|
|
392
|
+
* Fetches the user's executed trades from the /api/v1/accounts/trades endpoint.
|
|
393
|
+
* Requires a valid access token to be set.
|
|
394
|
+
*
|
|
395
|
+
* @param params - Optional query parameters for pagination and filtering
|
|
396
|
+
* @param params.page - Page number (starts from 1)
|
|
397
|
+
* @param params.limit - Number of items per page (max 100)
|
|
398
|
+
* @param params.trading_pair_id - Filter by trading pair ID (UUID)
|
|
399
|
+
* @returns Promise resolving to paginated trades response
|
|
400
|
+
* @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.
|
|
401
|
+
*/
|
|
402
|
+
getUserTrades(params?: GetUserTradesParams): Promise<GetUserTradesResponse>;
|
|
278
403
|
}
|
|
279
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/profile/index.js
CHANGED
package/dist/sdk/index.d.ts
CHANGED
package/dist/sdk/index.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.js.map
|
package/dist/sdk/network.d.ts
CHANGED
package/dist/sdk/network.js
CHANGED
package/dist/trading/index.d.ts
CHANGED
|
@@ -108,5 +108,5 @@ export interface TradingAPI extends BaseAPI {
|
|
|
108
108
|
getOrder(orderId: string): Promise<GetOrderResponse>;
|
|
109
109
|
}
|
|
110
110
|
export type { Order, OrderRole, OrderSide, OrderStatus, OrderType, TimeInForce, TradingMode, } from "./orders";
|
|
111
|
+
export { ORDER_STATUS_VALUES } from "./orders";
|
|
111
112
|
export type { BatchCancelError, BatchCancelOrdersResponse, BatchCancelResult, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchCreateResult, BatchError, BatchReplaceOrderParams, BatchReplaceOrdersResponse, BatchReplaceResult, CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, MatchResult, ReplaceOrderResponse, UpdatedFields, } from "./responses";
|
|
112
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/trading/index.js
CHANGED
package/dist/trading/orders.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* This represents the complete order information as returned by the API.
|
|
9
9
|
*
|
|
10
10
|
* @remarks
|
|
11
|
-
* Order lifecycle statuses: `SUBMITTED` → (`PARTIALLY_FILLED`) → `FILLED` → `
|
|
11
|
+
* Order lifecycle statuses: `SUBMITTED` → (`PARTIALLY_FILLED`) → `FILLED` → `SETTLED_ON_CHAIN`
|
|
12
|
+
* Legacy backends may still emit `SETTLED`.
|
|
12
13
|
* Orders can transition to `CANCELLED`, `REJECTED`, or `EXPIRED` at various stages.
|
|
13
14
|
* Fee fields are only populated after order fills occur.
|
|
14
15
|
*
|
|
@@ -78,19 +79,24 @@ export type OrderSide = "BUY" | "SELL";
|
|
|
78
79
|
* - TRAILING_STOP: Stop order that trails the market price
|
|
79
80
|
*/
|
|
80
81
|
export type OrderType = "LIMIT" | "MARKET";
|
|
82
|
+
/**
|
|
83
|
+
* Source-of-truth order status values used by runtime validation schemas.
|
|
84
|
+
*/
|
|
85
|
+
export declare const ORDER_STATUS_VALUES: readonly ["SUBMITTED", "PARTIALLY_FILLED", "FILLED", "SETTLED_ON_CHAIN", "SETTLED", "CANCELLED", "REJECTED", "EXPIRED"];
|
|
81
86
|
/**
|
|
82
87
|
* Order status for different order states
|
|
83
88
|
*
|
|
84
89
|
* Order lifecycle progression:
|
|
85
90
|
* - SUBMITTED: Order submitted to the matching engine for processing
|
|
86
91
|
* - PARTIALLY_FILLED: Order has been partially executed
|
|
87
|
-
* - FILLED: Order has been completely executed
|
|
88
|
-
* -
|
|
92
|
+
* - FILLED: Order has been completely executed (pre-commit)
|
|
93
|
+
* - SETTLED_ON_CHAIN: Order settlement has been finalized on-chain
|
|
94
|
+
* - SETTLED: Legacy settled status from older backend versions
|
|
89
95
|
* - CANCELLED: Order was canceled by user or system
|
|
90
96
|
* - REJECTED: Order was rejected due to validation failure
|
|
91
97
|
* - EXPIRED: Order expired based on time constraints
|
|
92
98
|
*/
|
|
93
|
-
export type OrderStatus =
|
|
99
|
+
export type OrderStatus = (typeof ORDER_STATUS_VALUES)[number];
|
|
94
100
|
/**
|
|
95
101
|
* Trading mode
|
|
96
102
|
*/
|
|
@@ -103,4 +109,3 @@ export type TradingMode = "SPOT" | "MARGIN";
|
|
|
103
109
|
* - GTD: Good Till Date - remains active until specified expiration date
|
|
104
110
|
*/
|
|
105
111
|
export type TimeInForce = "GTC" | "IOC" | "FOK" | "GTD";
|
|
106
|
-
//# sourceMappingURL=orders.d.ts.map
|
package/dist/trading/orders.js
CHANGED
|
@@ -3,4 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Types for trading operations and order management.
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Source-of-truth order status values used by runtime validation schemas.
|
|
8
|
+
*/
|
|
9
|
+
export const ORDER_STATUS_VALUES = ["SUBMITTED", "PARTIALLY_FILLED", "FILLED", "SETTLED_ON_CHAIN", "SETTLED", "CANCELLED", "REJECTED", "EXPIRED"];
|
package/dist/validation/index.js
CHANGED
|
@@ -28,14 +28,6 @@ export declare const TransactionTypeSchema: z.ZodEnum<{
|
|
|
28
28
|
INTEREST: "INTEREST";
|
|
29
29
|
REWARD: "REWARD";
|
|
30
30
|
}>;
|
|
31
|
-
/**
|
|
32
|
-
* Movements data source validation
|
|
33
|
-
*/
|
|
34
|
-
export declare const MovementsDataSourceSchema: z.ZodEnum<{
|
|
35
|
-
hot_storage: "hot_storage";
|
|
36
|
-
cold_storage: "cold_storage";
|
|
37
|
-
both: "both";
|
|
38
|
-
}>;
|
|
39
31
|
/**
|
|
40
32
|
* Get User Movements validation schema
|
|
41
33
|
*
|
|
@@ -63,10 +55,15 @@ export declare const GetUserMovementsSchema: z.ZodObject<{
|
|
|
63
55
|
REWARD: "REWARD";
|
|
64
56
|
}>>;
|
|
65
57
|
asset_id: z.ZodOptional<z.ZodUUID>;
|
|
66
|
-
source: z.ZodOptional<z.ZodEnum<{
|
|
67
|
-
hot_storage: "hot_storage";
|
|
68
|
-
cold_storage: "cold_storage";
|
|
69
|
-
both: "both";
|
|
70
|
-
}>>;
|
|
71
58
|
}, z.core.$strip>;
|
|
72
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Get User Trades validation schema
|
|
61
|
+
*
|
|
62
|
+
* Validates parameters for fetching paginated user trades.
|
|
63
|
+
* All fields are optional — an empty object or undefined is valid.
|
|
64
|
+
*/
|
|
65
|
+
export declare const GetUserTradesSchema: z.ZodObject<{
|
|
66
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
trading_pair_id: z.ZodOptional<z.ZodUUID>;
|
|
69
|
+
}, z.core.$strip>;
|
|
@@ -18,12 +18,6 @@ export const LedgerEntryTypeSchema = z.enum(["CREDIT", "DEBIT", "LOCK", "UNLOCK"
|
|
|
18
18
|
export const TransactionTypeSchema = z.enum(["DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", "REWARD"], {
|
|
19
19
|
message: 'Transaction type must be "DEPOSIT", "WITHDRAWAL", "TRADE", "FEE", "FUNDING", "LIQUIDATION", "INTEREST", or "REWARD"',
|
|
20
20
|
});
|
|
21
|
-
/**
|
|
22
|
-
* Movements data source validation
|
|
23
|
-
*/
|
|
24
|
-
export const MovementsDataSourceSchema = z.enum(["hot_storage", "cold_storage", "both"], {
|
|
25
|
-
message: 'Data source must be "hot_storage", "cold_storage", or "both"',
|
|
26
|
-
});
|
|
27
21
|
/**
|
|
28
22
|
* Get User Movements validation schema
|
|
29
23
|
*
|
|
@@ -36,6 +30,15 @@ export const GetUserMovementsSchema = z.object({
|
|
|
36
30
|
entry_type: LedgerEntryTypeSchema.optional(),
|
|
37
31
|
transaction_type: TransactionTypeSchema.optional(),
|
|
38
32
|
asset_id: UUIDSchema.optional(),
|
|
39
|
-
source: MovementsDataSourceSchema.optional(),
|
|
40
33
|
});
|
|
41
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Get User Trades validation schema
|
|
36
|
+
*
|
|
37
|
+
* Validates parameters for fetching paginated user trades.
|
|
38
|
+
* All fields are optional — an empty object or undefined is valid.
|
|
39
|
+
*/
|
|
40
|
+
export const GetUserTradesSchema = z.object({
|
|
41
|
+
page: z.number().int("Page must be an integer").min(1, "Page must be at least 1").optional(),
|
|
42
|
+
limit: z.number().int("Limit must be an integer").min(1, "Limit must be at least 1").max(100, "Limit cannot exceed 100").optional(),
|
|
43
|
+
trading_pair_id: UUIDSchema.optional(),
|
|
44
|
+
});
|
|
@@ -123,6 +123,7 @@ export declare const GetPaginatedOrdersSchema: z.ZodObject<{
|
|
|
123
123
|
SUBMITTED: "SUBMITTED";
|
|
124
124
|
PARTIALLY_FILLED: "PARTIALLY_FILLED";
|
|
125
125
|
FILLED: "FILLED";
|
|
126
|
+
SETTLED_ON_CHAIN: "SETTLED_ON_CHAIN";
|
|
126
127
|
SETTLED: "SETTLED";
|
|
127
128
|
CANCELLED: "CANCELLED";
|
|
128
129
|
REJECTED: "REJECTED";
|
|
@@ -226,4 +227,3 @@ export declare const BatchReplaceOrdersSchema: z.ZodObject<{
|
|
|
226
227
|
useMasterBalance: z.ZodOptional<z.ZodBoolean>;
|
|
227
228
|
}, z.core.$strip>>;
|
|
228
229
|
}, z.core.$strip>;
|
|
229
|
-
//# sourceMappingURL=trading.d.ts.map
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Provides clear, actionable error messages for invalid parameters.
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
|
+
import { ORDER_STATUS_VALUES } from "../trading/orders";
|
|
8
9
|
/**
|
|
9
10
|
* Order side validation
|
|
10
11
|
*/
|
|
@@ -118,7 +119,7 @@ export const ReplaceOrderSchema = z.object({
|
|
|
118
119
|
* - page_size: number (default: 10, max: 100)
|
|
119
120
|
*/
|
|
120
121
|
export const GetPaginatedOrdersSchema = z.object({
|
|
121
|
-
status: z.enum(
|
|
122
|
+
status: z.enum(ORDER_STATUS_VALUES).optional(),
|
|
122
123
|
trading_pair: UUIDSchema.optional(),
|
|
123
124
|
page: z.number().int().min(1, "Page must be at least 1").optional(),
|
|
124
125
|
page_size: z.number().int().min(1, "Page size must be at least 1").max(100, "Page size cannot exceed 100").optional(),
|
|
@@ -189,4 +190,3 @@ export const BatchReplaceOrderItemSchema = z
|
|
|
189
190
|
export const BatchReplaceOrdersSchema = z.object({
|
|
190
191
|
orders: z.array(BatchReplaceOrderItemSchema).min(1, "At least one order is required"),
|
|
191
192
|
});
|
|
192
|
-
//# sourceMappingURL=trading.js.map
|
package/dist/validation/vault.js
CHANGED
package/dist/vault/index.d.ts
CHANGED
package/dist/vault/index.js
CHANGED
package/dist/vault/responses.js
CHANGED
package/dist/websocket/base.d.ts
CHANGED
package/dist/websocket/base.js
CHANGED