@0xmonaco/types 0.8.10 → 0.8.11

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 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; // Network preset: "local", "development", "staging", or "mainnet"
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
- type Network = "mainnet" | "development" | "staging" | "local";
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`: Network type ("mainnet" | "development" | "staging" | "local")
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
@@ -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;
@@ -34,6 +34,8 @@ export interface TradingPair {
34
34
  quote_icon_url: string;
35
35
  /** Market type (e.g. SPOT) */
36
36
  market_type: string;
37
+ /** Asset-class category: crypto, equities, or commodities */
38
+ category: string;
37
39
  /** Whether the market is active */
38
40
  is_active: boolean;
39
41
  /** Maker fee in basis points */
@@ -126,6 +128,8 @@ export interface GetTradingPairsParams {
126
128
  quote_token?: string;
127
129
  /** Filter by active status */
128
130
  is_active?: boolean;
131
+ /** Filter by asset-class category (crypto, equities, commodities) */
132
+ category?: string;
129
133
  }
130
134
  /**
131
135
  * Response for listing trading pairs with pagination
@@ -155,6 +159,8 @@ export interface GetScreenerParams {
155
159
  market_type?: string;
156
160
  /** Filter by active status */
157
161
  is_active?: boolean;
162
+ /** Filter by asset-class category (crypto, equities, commodities) */
163
+ category?: string;
158
164
  }
159
165
  /**
160
166
  * One UTC-day bucket in a pair's 7-day screener snapshot
@@ -197,6 +203,12 @@ export interface ScreenerItem {
197
203
  price_change_percent_7d: string | null;
198
204
  /** Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
199
205
  snapshot_7d: ScreenerSnapshotPoint[];
206
+ /** Asset-class category: crypto, equities, or commodities */
207
+ category: string;
208
+ /** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
209
+ total_quote_volume_ltd: string;
210
+ /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
211
+ total_trade_count_ltd: number;
200
212
  }
201
213
  /**
202
214
  * Paginated screener response, sorted by quote_volume_24h desc (nulls last)
@@ -240,6 +252,21 @@ export interface MarketMetadata {
240
252
  price_change_percent_24h: string | null;
241
253
  /** Unix timestamp (ms) when market started trading (null if not available) */
242
254
  market_initialization_timestamp: number | null;
255
+ /** Life-to-date cumulative base-token volume since inception ("0" if no trades yet) */
256
+ total_base_volume_ltd: string;
257
+ /** Life-to-date cumulative quote-token volume since inception ("0" if no trades yet) */
258
+ total_quote_volume_ltd: string;
259
+ /** Life-to-date cumulative number of trades since inception (0 if no trades yet) */
260
+ total_trade_count_ltd: number;
261
+ }
262
+ /**
263
+ * Exchange-wide life-to-date cumulative statistics across all trading pairs.
264
+ */
265
+ export interface MarketStats {
266
+ /** Life-to-date cumulative quote-token (notional) volume summed across all pairs */
267
+ total_quote_volume_ltd: string;
268
+ /** Life-to-date cumulative number of trades summed across all pairs */
269
+ total_trade_count_ltd: number;
243
270
  }
244
271
  export interface RiskTier {
245
272
  notional_floor: string;
@@ -364,6 +391,12 @@ export interface MarketAPI extends BaseAPI {
364
391
  * @returns Promise resolving to the paginated screener response
365
392
  */
366
393
  getScreener(params?: GetScreenerParams): Promise<GetScreenerResponse>;
394
+ /**
395
+ * Fetch exchange-wide life-to-date cumulative statistics across all trading
396
+ * pairs: total quote-token (notional) volume and total number of trades.
397
+ * @returns Promise resolving to the global market stats
398
+ */
399
+ getMarketStats(): Promise<MarketStats>;
367
400
  /**
368
401
  * Fetch historical candlestick data for a trading pair.
369
402
  *
@@ -44,6 +44,10 @@ export declare const DepositSchema: z.ZodObject<{
44
44
  assetId: z.ZodUUID;
45
45
  amount: z.ZodUnion<readonly [z.ZodString, z.ZodBigInt]>;
46
46
  autoWait: z.ZodOptional<z.ZodBoolean>;
47
+ target: z.ZodOptional<z.ZodEnum<{
48
+ spot: "spot";
49
+ margin: "margin";
50
+ }>>;
47
51
  }, z.core.$strip>;
48
52
  /**
49
53
  * Withdraw validation schema.
@@ -57,6 +57,8 @@ export const DepositSchema = z.object({
57
57
  assetId: UUIDSchema,
58
58
  amount: PositiveBigIntStringSchema,
59
59
  autoWait: z.boolean().optional(),
60
+ // Destination ledger: "spot" (default) or "margin" to route into margin collateral.
61
+ target: z.enum(["spot", "margin"]).optional(),
60
62
  });
61
63
  /**
62
64
  * Withdraw validation schema.
@@ -5,6 +5,15 @@
5
5
  */
6
6
  import type { BaseAPI } from "../api/index";
7
7
  import type { Balance, TransactionResult, WithdrawResult } from "./responses";
8
+ /**
9
+ * Destination ledger for a deposit.
10
+ * - `"spot"` (default): credit the spot/main wallet — unchanged behavior.
11
+ * - `"margin"`: route the deposit straight into the parent margin account's
12
+ * collateral (auto-creating the account if it does not exist yet). A deposit
13
+ * that cannot be routed to margin (unsupported asset, etc.) safely falls back
14
+ * to spot — funds are never lost.
15
+ */
16
+ export type DepositTarget = "spot" | "margin";
8
17
  /**
9
18
  * Vault API interface.
10
19
  * Provides methods for managing token deposits and withdrawals.
@@ -24,9 +33,12 @@ export interface VaultAPI extends BaseAPI {
24
33
  * @param assetId - Asset identifier (UUID) to deposit
25
34
  * @param amount - Amount to deposit
26
35
  * @param autoWait - Whether to automatically wait for transaction confirmation (defaults to true)
36
+ * @param target - Destination ledger: `"spot"` (default) or `"margin"` to
37
+ * route the deposit into the parent margin account's collateral. Margin
38
+ * deposits that cannot be routed fall back to spot.
27
39
  * @returns Promise resolving to the transaction result
28
40
  */
29
- deposit(assetId: string, amount: bigint, autoWait?: boolean): Promise<TransactionResult>;
41
+ deposit(assetId: string, amount: bigint, autoWait?: boolean, target?: DepositTarget): Promise<TransactionResult>;
30
42
  /**
31
43
  * Initiates a withdrawal: allocates a `withdrawalIndex` via the API Gateway,
32
44
  * receives pre-signed calldata for `executeSignedWithdrawal(...)`, and
@@ -10,6 +10,6 @@
10
10
  * hand-written SDK surface. CI regenerates it and fails on a diff, identical to
11
11
  * the `schema.ts` wire-types tripwire (MON-1476), so it can never go stale.
12
12
  */
13
- export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "authenticate_backend", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_chart", "get_portfolio_stats", "get_position", "get_position_risk", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_auto_margin_order_risk", "simulate_fees", "simulate_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_to_auto_margin_account", "transfer_collateral_to_margin_account", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
13
+ export declare const OPERATION_IDS: readonly ["add_position_margin", "attach_position_tp_sl", "authenticate_backend", "batch_cancel_all", "batch_cancel_all_by_pair", "batch_cancel_orders", "batch_create_orders", "batch_replace_orders", "cancel_conditional_order", "cancel_order", "close_position", "create_challenge", "create_delegated_session", "create_order", "create_sub_account_limit", "delete_sub_account_limit", "get_application_config", "get_application_stats", "get_available_collateral", "get_candles", "get_funding_state", "get_index_price", "get_margin_account_movements", "get_margin_account_summary", "get_mark_price", "get_market_metadata", "get_market_stats", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_perp_market_config", "get_perp_market_summary", "get_portfolio_chart", "get_portfolio_stats", "get_position", "get_position_risk", "get_screener", "get_sub_account_limits", "get_trade_by_id", "get_trades", "get_trading_pair_by_id", "get_user_balance_by_asset", "get_user_balances", "get_user_movements", "get_user_profile", "get_user_trades", "get_withdrawal", "health_check", "initiate_withdrawal", "list_application_balances", "list_application_movements", "list_application_orders", "list_application_users", "list_conditional_orders", "list_delegated_agent_owners", "list_delegated_agents", "list_funding_history", "list_funding_payments", "list_margin_accounts", "list_position_history", "list_positions", "list_sub_accounts_with_balances", "list_trading_pairs", "mint_tokens", "reduce_position_margin", "refresh_session", "replace_order", "revoke_delegated_agent", "revoke_session", "simulate_auto_margin_order_risk", "simulate_fees", "simulate_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_to_auto_margin_account", "transfer_collateral_to_margin_account", "update_sub_account_limit", "upsert_delegated_agent", "verify_signature"];
14
14
  /** Union of every OpenAPI operationId in the spec. */
15
15
  export type OperationId = (typeof OPERATION_IDS)[number];
@@ -37,6 +37,7 @@ export const OPERATION_IDS = [
37
37
  "get_margin_account_summary",
38
38
  "get_mark_price",
39
39
  "get_market_metadata",
40
+ "get_market_stats",
40
41
  "get_open_interest",
41
42
  "get_order_by_id",
42
43
  "get_orderbook_snapshot",
@@ -1089,6 +1089,30 @@ export interface paths {
1089
1089
  patch?: never;
1090
1090
  trace?: never;
1091
1091
  };
1092
+ "/api/v1/market/stats": {
1093
+ parameters: {
1094
+ query?: never;
1095
+ header?: never;
1096
+ path?: never;
1097
+ cookie?: never;
1098
+ };
1099
+ /**
1100
+ * Market Stats
1101
+ * @description Market Stats
1102
+ *
1103
+ * Exchange-wide life-to-date (since-inception) cumulative totals across all
1104
+ * trading pairs: total quote-token volume and total number of trades. No
1105
+ * auth required.
1106
+ */
1107
+ get: operations["get_market_stats"];
1108
+ put?: never;
1109
+ post?: never;
1110
+ delete?: never;
1111
+ options?: never;
1112
+ head?: never;
1113
+ patch?: never;
1114
+ trace?: never;
1115
+ };
1092
1116
  "/api/v1/orderbook/{trading_pair_id}": {
1093
1117
  parameters: {
1094
1118
  query?: never;
@@ -2788,6 +2812,13 @@ export interface components {
2788
2812
  wallet_available?: string | null;
2789
2813
  wallet_locked?: string | null;
2790
2814
  margin_transferable?: string | null;
2815
+ /**
2816
+ * @description Free collateral currently held in the user's parent margin account for this
2817
+ * asset (equity minus initial margin required), i.e. collateral already inside
2818
+ * margin and available to open new positions or transfer back out. Absent when
2819
+ * the user has no margin account yet.
2820
+ */
2821
+ margin_available_collateral?: string | null;
2791
2822
  };
2792
2823
  GetBalanceByAssetResponse: {
2793
2824
  /** @description Token contract address */
@@ -3024,6 +3055,34 @@ export interface components {
3024
3055
  * @example 95400.00
3025
3056
  */
3026
3057
  index_price?: string | null;
3058
+ /**
3059
+ * @description Life-to-date cumulative base-token volume (since market inception); "0" for a pair with no trades yet
3060
+ * @example 123456.78900000
3061
+ */
3062
+ total_base_volume_ltd?: string | null;
3063
+ /**
3064
+ * @description Life-to-date cumulative quote-token volume (since market inception); "0" for a pair with no trades yet
3065
+ * @example 9123456789.50
3066
+ */
3067
+ total_quote_volume_ltd?: string | null;
3068
+ /**
3069
+ * @description Life-to-date cumulative number of trades (since market inception); 0 for a pair with no trades yet
3070
+ * @example 482931
3071
+ */
3072
+ total_trade_count_ltd?: string | null;
3073
+ };
3074
+ /** @description Exchange-wide life-to-date cumulative market statistics across all trading pairs. */
3075
+ GetMarketStatsResponse: {
3076
+ /**
3077
+ * @description Life-to-date cumulative quote-token (notional) volume summed across all trading pairs
3078
+ * @example 48217365920.75
3079
+ */
3080
+ total_quote_volume_ltd?: string | null;
3081
+ /**
3082
+ * @description Life-to-date cumulative number of trades summed across all trading pairs
3083
+ * @example 19284736
3084
+ */
3085
+ total_trade_count_ltd?: string | null;
3027
3086
  };
3028
3087
  GetMovementsResponse: {
3029
3088
  movements?: components["schemas"]["LedgerMovement"][] | null;
@@ -4428,6 +4487,21 @@ export interface components {
4428
4487
  price_change_percent_7d?: string | null;
4429
4488
  /** @description Up to 7 UTC-day buckets (oldest first); empty when <1 day of history */
4430
4489
  snapshot_7d?: components["schemas"]["ScreenerSnapshotPoint"][] | null;
4490
+ /**
4491
+ * @description Asset-class category: crypto, equities, or commodities
4492
+ * @example crypto
4493
+ */
4494
+ category?: string | null;
4495
+ /**
4496
+ * @description Life-to-date cumulative quote-token volume (since market inception); "0" for a pair with no trades yet
4497
+ * @example 9123456789.50
4498
+ */
4499
+ total_quote_volume_ltd?: string | null;
4500
+ /**
4501
+ * @description Life-to-date cumulative number of trades (since market inception); 0 for a pair with no trades yet
4502
+ * @example 482931
4503
+ */
4504
+ total_trade_count_ltd?: string | null;
4431
4505
  };
4432
4506
  /** @description One UTC-day bucket in a pair's 7-day snapshot. */
4433
4507
  ScreenerSnapshotPoint: {
@@ -4838,6 +4912,11 @@ export interface components {
4838
4912
  * @example 20
4839
4913
  */
4840
4914
  max_leverage?: string | null;
4915
+ /**
4916
+ * @description Asset-class category: crypto, equities, or commodities
4917
+ * @example crypto
4918
+ */
4919
+ category?: string | null;
4841
4920
  };
4842
4921
  TransferCollateralFromMarginAccountRequest: {
4843
4922
  /** @description Margin account UUID whose current isolated bucket releases collateral. */
@@ -6908,6 +6987,7 @@ export interface operations {
6908
6987
  base_token?: string;
6909
6988
  quote_token?: string;
6910
6989
  is_active?: boolean;
6990
+ category?: string;
6911
6991
  };
6912
6992
  header?: never;
6913
6993
  path?: never;
@@ -7250,6 +7330,7 @@ export interface operations {
7250
7330
  /** @description Filter by market type */
7251
7331
  market_type?: "SPOT" | "MARGIN";
7252
7332
  is_active?: boolean;
7333
+ category?: string;
7253
7334
  };
7254
7335
  header?: never;
7255
7336
  path?: never;
@@ -7282,6 +7363,33 @@ export interface operations {
7282
7363
  };
7283
7364
  };
7284
7365
  };
7366
+ get_market_stats: {
7367
+ parameters: {
7368
+ query?: never;
7369
+ header?: never;
7370
+ path?: never;
7371
+ cookie?: never;
7372
+ };
7373
+ requestBody?: never;
7374
+ responses: {
7375
+ /** @description OK */
7376
+ 200: {
7377
+ headers: {
7378
+ [name: string]: unknown;
7379
+ };
7380
+ content: {
7381
+ "application/json": components["schemas"]["GetMarketStatsResponse"];
7382
+ };
7383
+ };
7384
+ /** @description Internal server error */
7385
+ 500: {
7386
+ headers: {
7387
+ [name: string]: unknown;
7388
+ };
7389
+ content?: never;
7390
+ };
7391
+ };
7392
+ };
7285
7393
  get_orderbook_snapshot: {
7286
7394
  parameters: {
7287
7395
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "0.8.10",
3
+ "version": "0.8.11",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -20,7 +20,7 @@
20
20
  "lint": "biome lint ."
21
21
  },
22
22
  "dependencies": {
23
- "@0xmonaco/contracts": "0.8.10",
23
+ "@0xmonaco/contracts": "0.8.11",
24
24
  "zod": "^4.1.12"
25
25
  },
26
26
  "peerDependencies": {