@0xmonaco/types 0.8.16 → 0.8.18

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.
@@ -4,7 +4,7 @@
4
4
  * Types for fees operations including fee simulation.
5
5
  */
6
6
  import type { BaseAPI } from "../api/index";
7
- import type { SimulateFeeParams, SimulateFeeResponse } from "./responses";
7
+ import type { GetMyFeeTierParams, GetMyFeeTierResponse, SimulateFeeParams, SimulateFeeResponse } from "./responses";
8
8
  /**
9
9
  * Fees API interface.
10
10
  * Provides methods for simulating and calculating trading fees.
@@ -34,6 +34,28 @@ export interface FeesAPI extends BaseAPI {
34
34
  * ```
35
35
  */
36
36
  simulateFees(params: SimulateFeeParams): Promise<SimulateFeeResponse>;
37
+ /**
38
+ * Get the caller's current fee tier, rolling 14-day volumes, and a pair's schedule.
39
+ *
40
+ * Returns the caller's resolved tier (1–6) and weighted 14-day volume (with the
41
+ * spot/perp breakdown), the volume still needed to reach the next tier, and the
42
+ * requested pair's six-row fee schedule (threshold plus maker/taker bps).
43
+ *
44
+ * @param params - Parameters for the lookup
45
+ * @param params.tradingPairId - Trading pair whose fee schedule to return
46
+ * @returns Promise resolving to the caller's tier and the pair's schedule
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * const tier = await feesAPI.getMyFeeTier({
51
+ * tradingPairId: "123e4567-e89b-12d3-a456-426614174000",
52
+ * });
53
+ * console.log(`Current tier: ${tier.currentTierLevel}`);
54
+ * console.log(`14d volume: ${tier.weightedVolume14d}`);
55
+ * console.log(`To next tier: ${tier.volumeToNextTier ?? "already at top tier"}`);
56
+ * ```
57
+ */
58
+ getMyFeeTier(params: GetMyFeeTierParams): Promise<GetMyFeeTierResponse>;
37
59
  }
38
- export type { SimulateFeeParams, SimulateFeeResponse } from "./responses";
39
- export { SimulateFeeParamsSchema, SimulateFeeResponseSchema } from "./responses";
60
+ export type { FeeTierScheduleRow, GetMyFeeTierParams, GetMyFeeTierResponse, SimulateFeeParams, SimulateFeeResponse, } from "./responses";
61
+ export { FeeTierScheduleRowSchema, GetMyFeeTierParamsSchema, GetMyFeeTierResponseSchema, SimulateFeeParamsSchema, SimulateFeeResponseSchema, } from "./responses";
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * Types for fees operations including fee simulation.
5
5
  */
6
- export { SimulateFeeParamsSchema, SimulateFeeResponseSchema } from "./responses";
6
+ export { FeeTierScheduleRowSchema, GetMyFeeTierParamsSchema, GetMyFeeTierResponseSchema, SimulateFeeParamsSchema, SimulateFeeResponseSchema, } from "./responses";
@@ -52,3 +52,50 @@ export type SimulateFeeParams = z.infer<typeof SimulateFeeParamsSchema>;
52
52
  * @remarks Type is inferred from SimulateFeeResponseSchema
53
53
  */
54
54
  export type SimulateFeeResponse = z.infer<typeof SimulateFeeResponseSchema>;
55
+ /**
56
+ * Zod schema for the parameters of a "my fee tier" lookup
57
+ */
58
+ export declare const GetMyFeeTierParamsSchema: z.ZodObject<{
59
+ tradingPairId: z.ZodString;
60
+ }, z.core.$strip>;
61
+ /**
62
+ * Zod schema for one row of a pair's fee-tier schedule
63
+ */
64
+ export declare const FeeTierScheduleRowSchema: z.ZodObject<{
65
+ tierLevel: z.ZodNumber;
66
+ minVolumeThreshold: z.ZodString;
67
+ makerFeeBps: z.ZodString;
68
+ takerFeeBps: z.ZodString;
69
+ }, z.core.$strip>;
70
+ /**
71
+ * Zod schema for the "my fee tier" response
72
+ */
73
+ export declare const GetMyFeeTierResponseSchema: z.ZodObject<{
74
+ currentTierLevel: z.ZodNumber;
75
+ weightedVolume14d: z.ZodString;
76
+ spotVolume14d: z.ZodString;
77
+ perpVolume14d: z.ZodString;
78
+ volumeToNextTier: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
+ nextTierLevel: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
80
+ feeSchedule: z.ZodArray<z.ZodObject<{
81
+ tierLevel: z.ZodNumber;
82
+ minVolumeThreshold: z.ZodString;
83
+ makerFeeBps: z.ZodString;
84
+ takerFeeBps: z.ZodString;
85
+ }, z.core.$strip>>;
86
+ }, z.core.$strip>;
87
+ /**
88
+ * Parameters for a "my fee tier" lookup
89
+ * @remarks Type is inferred from GetMyFeeTierParamsSchema
90
+ */
91
+ export type GetMyFeeTierParams = z.infer<typeof GetMyFeeTierParamsSchema>;
92
+ /**
93
+ * One row of a pair's fee-tier schedule
94
+ * @remarks Type is inferred from FeeTierScheduleRowSchema
95
+ */
96
+ export type FeeTierScheduleRow = z.infer<typeof FeeTierScheduleRowSchema>;
97
+ /**
98
+ * The caller's current fee tier, rolling 14-day volumes, and a pair's schedule
99
+ * @remarks Type is inferred from GetMyFeeTierResponseSchema
100
+ */
101
+ export type GetMyFeeTierResponse = z.infer<typeof GetMyFeeTierResponseSchema>;
@@ -84,3 +84,42 @@ export const SimulateFeeResponseSchema = z.object({
84
84
  /** Slippage tolerance used in the calculation, echoed back for MARKET orders (null for LIMIT orders) */
85
85
  slippageToleranceBps: z.number().nullable(),
86
86
  });
87
+ /**
88
+ * Zod schema for the parameters of a "my fee tier" lookup
89
+ */
90
+ export const GetMyFeeTierParamsSchema = z.object({
91
+ /** Trading pair ID whose six-row fee schedule to return */
92
+ tradingPairId: z.string().trim().min(1, "Trading pair ID is required and cannot be empty"),
93
+ });
94
+ /**
95
+ * Zod schema for one row of a pair's fee-tier schedule
96
+ */
97
+ export const FeeTierScheduleRowSchema = z.object({
98
+ /** Tier level, 1 (lowest volume) through 6 (highest) */
99
+ tierLevel: z.number().int(),
100
+ /** Weighted 14-day volume floor for this tier, in quote/USD units */
101
+ minVolumeThreshold: z.string(),
102
+ /** Maker fee in human basis points; negative is a rebate */
103
+ makerFeeBps: z.string(),
104
+ /** Taker fee in human basis points */
105
+ takerFeeBps: z.string(),
106
+ });
107
+ /**
108
+ * Zod schema for the "my fee tier" response
109
+ */
110
+ export const GetMyFeeTierResponseSchema = z.object({
111
+ /** Caller's resolved tier (1–6) from stored weighted 14-day volume */
112
+ currentTierLevel: z.number().int(),
113
+ /** Caller's weighted 14-day volume (perp + 2.5× spot) */
114
+ weightedVolume14d: z.string(),
115
+ /** Caller's rolling 14-day spot volume */
116
+ spotVolume14d: z.string(),
117
+ /** Caller's rolling 14-day perp volume */
118
+ perpVolume14d: z.string(),
119
+ /** Additional weighted volume needed to reach the next tier; absent at tier 6 */
120
+ volumeToNextTier: z.string().nullable().optional(),
121
+ /** Next tier level; absent when already at tier 6 */
122
+ nextTierLevel: z.number().int().nullable().optional(),
123
+ /** Six-row fee schedule for the requested pair, ascending by tier */
124
+ feeSchedule: z.array(FeeTierScheduleRowSchema),
125
+ });
@@ -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_close_all_positions", "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_parent_margin_account_movements", "get_parent_margin_account_summary", "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_pending_withdrawals", "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_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "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_close_all_positions", "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_my_fee_tier", "get_open_interest", "get_order_by_id", "get_orderbook_snapshot", "get_orders", "get_parent_margin_account_movements", "get_parent_margin_account_summary", "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_pending_withdrawals", "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_fees", "simulate_order_risk", "simulate_parent_margin_order_risk", "simulate_risk_bucket_order_risk", "submit_whitelist", "transfer_collateral_from_margin_account", "transfer_collateral_from_parent_margin_account", "transfer_collateral_to_margin_account", "transfer_collateral_to_parent_margin_account", "transfer_collateral_to_risk_bucket", "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];
@@ -39,6 +39,7 @@ export const OPERATION_IDS = [
39
39
  "get_mark_price",
40
40
  "get_market_metadata",
41
41
  "get_market_stats",
42
+ "get_my_fee_tier",
42
43
  "get_open_interest",
43
44
  "get_order_by_id",
44
45
  "get_orderbook_snapshot",
@@ -704,6 +704,26 @@ export interface paths {
704
704
  patch?: never;
705
705
  trace?: never;
706
706
  };
707
+ "/api/v1/fees/tier": {
708
+ parameters: {
709
+ query?: never;
710
+ header?: never;
711
+ path?: never;
712
+ cookie?: never;
713
+ };
714
+ /**
715
+ * Get my fee tier and pair schedule
716
+ * @description Return the caller's current fee tier, rolling 14-day volumes, and a pair's schedule.
717
+ */
718
+ get: operations["get_my_fee_tier"];
719
+ put?: never;
720
+ post?: never;
721
+ delete?: never;
722
+ options?: never;
723
+ head?: never;
724
+ patch?: never;
725
+ trace?: never;
726
+ };
707
727
  "/api/v1/margin/accounts": {
708
728
  parameters: {
709
729
  query?: never;
@@ -2884,6 +2904,29 @@ export interface components {
2884
2904
  */
2885
2905
  error?: string | null;
2886
2906
  };
2907
+ FeeTierScheduleRow: {
2908
+ /**
2909
+ * Format: int32
2910
+ * @description Tier level 1 (lowest volume) through 6 (highest)
2911
+ * @example 1
2912
+ */
2913
+ tierLevel?: number | null;
2914
+ /**
2915
+ * @description Weighted 14-day volume floor for this tier, in quote/USD units
2916
+ * @example 5000000
2917
+ */
2918
+ minVolumeThreshold?: string | null;
2919
+ /**
2920
+ * @description Maker fee in human basis points; negative is a rebate
2921
+ * @example -1.15
2922
+ */
2923
+ makerFeeBps?: string | null;
2924
+ /**
2925
+ * @description Taker fee in human basis points
2926
+ * @example 6.5
2927
+ */
2928
+ takerFeeBps?: string | null;
2929
+ };
2887
2930
  FundingPaymentRecord: {
2888
2931
  /**
2889
2932
  * Format: uuid
@@ -3292,6 +3335,42 @@ export interface components {
3292
3335
  */
3293
3336
  totalPages?: number | null;
3294
3337
  };
3338
+ GetMyFeeTierResponse: {
3339
+ /**
3340
+ * Format: int32
3341
+ * @description Caller's resolved tier (1–6) from stored weighted 14-day volume
3342
+ * @example 2
3343
+ */
3344
+ currentTierLevel?: number | null;
3345
+ /**
3346
+ * @description Caller's weighted 14-day volume (perp + 2.5× spot)
3347
+ * @example 7500000
3348
+ */
3349
+ weightedVolume14d?: string | null;
3350
+ /**
3351
+ * @description Caller's rolling 14-day spot volume
3352
+ * @example 1000000
3353
+ */
3354
+ spotVolume14d?: string | null;
3355
+ /**
3356
+ * @description Caller's rolling 14-day perp volume
3357
+ * @example 5000000
3358
+ */
3359
+ perpVolume14d?: string | null;
3360
+ /**
3361
+ * @description Additional weighted volume needed to reach the next tier; omitted at tier 6
3362
+ * @example 17500000
3363
+ */
3364
+ volumeToNextTier?: string | null;
3365
+ /**
3366
+ * Format: int32
3367
+ * @description Next tier level when not already at 6
3368
+ * @example 3
3369
+ */
3370
+ nextTierLevel?: number | null;
3371
+ /** @description Six-row fee schedule for the requested pair, ascending by tier */
3372
+ feeSchedule?: components["schemas"]["FeeTierScheduleRow"][] | null;
3373
+ };
3295
3374
  /** @description Latest public open interest for a trading pair. */
3296
3375
  GetOpenInterestResponse: {
3297
3376
  /**
@@ -7013,6 +7092,57 @@ export interface operations {
7013
7092
  };
7014
7093
  };
7015
7094
  };
7095
+ get_my_fee_tier: {
7096
+ parameters: {
7097
+ query?: {
7098
+ /** @description Trading pair identifier (UUID) */
7099
+ tradingPairId?: string;
7100
+ };
7101
+ header?: never;
7102
+ path?: never;
7103
+ cookie?: never;
7104
+ };
7105
+ requestBody?: never;
7106
+ responses: {
7107
+ /** @description OK */
7108
+ 200: {
7109
+ headers: {
7110
+ [name: string]: unknown;
7111
+ };
7112
+ content: {
7113
+ "application/json": components["schemas"]["GetMyFeeTierResponse"];
7114
+ };
7115
+ };
7116
+ /** @description Bad request (invalid trading pair id) */
7117
+ 400: {
7118
+ headers: {
7119
+ [name: string]: unknown;
7120
+ };
7121
+ content?: never;
7122
+ };
7123
+ /** @description Authentication required */
7124
+ 401: {
7125
+ headers: {
7126
+ [name: string]: unknown;
7127
+ };
7128
+ content?: never;
7129
+ };
7130
+ /** @description Trading pair or fee schedule not found */
7131
+ 404: {
7132
+ headers: {
7133
+ [name: string]: unknown;
7134
+ };
7135
+ content?: never;
7136
+ };
7137
+ /** @description Internal server error */
7138
+ 500: {
7139
+ headers: {
7140
+ [name: string]: unknown;
7141
+ };
7142
+ content?: never;
7143
+ };
7144
+ };
7145
+ };
7016
7146
  list_margin_accounts: {
7017
7147
  parameters: {
7018
7148
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/types",
3
- "version": "0.8.16",
3
+ "version": "0.8.18",
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.16",
23
+ "@0xmonaco/contracts": "0.8.18",
24
24
  "zod": "^4.1.12"
25
25
  },
26
26
  "peerDependencies": {