@0xmonaco/core 0.8.16 → 0.8.19

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.
@@ -21,7 +21,7 @@
21
21
  * });
22
22
  * ```
23
23
  */
24
- import type { FeesAPI, SimulateFeeParams, SimulateFeeResponse } from "@0xmonaco/types";
24
+ import type { FeesAPI, GetMyFeeTierParams, GetMyFeeTierResponse, SimulateFeeParams, SimulateFeeResponse } from "@0xmonaco/types";
25
25
  import { BaseAPI } from "../base";
26
26
  export declare class FeesAPIImpl extends BaseAPI implements FeesAPI {
27
27
  /**
@@ -69,4 +69,28 @@ export declare class FeesAPIImpl extends BaseAPI implements FeesAPI {
69
69
  * ```
70
70
  */
71
71
  simulateFees(params: SimulateFeeParams): Promise<SimulateFeeResponse>;
72
+ /**
73
+ * Get the caller's current fee tier, rolling 14-day volumes, and a pair's schedule.
74
+ *
75
+ * Returns the caller's resolved tier (1–6) and weighted 14-day volume (with the
76
+ * spot/perp breakdown), the volume still needed to reach the next tier, and the
77
+ * requested pair's six-row fee schedule.
78
+ *
79
+ * @param params - Parameters for the lookup
80
+ * @param params.tradingPairId - Trading pair whose fee schedule to return
81
+ * @returns Promise resolving to the caller's tier and the pair's schedule
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * const tier = await feesAPI.getMyFeeTier({
86
+ * tradingPairId: "123e4567-e89b-12d3-a456-426614174000",
87
+ * });
88
+ * console.log(`Current tier: ${tier.currentTierLevel}`);
89
+ * console.log(`14d volume: ${tier.weightedVolume14d}`);
90
+ * for (const row of tier.feeSchedule) {
91
+ * console.log(`Tier ${row.tierLevel}: taker ${row.takerFeeBps} bps`);
92
+ * }
93
+ * ```
94
+ */
95
+ getMyFeeTier(params: GetMyFeeTierParams): Promise<GetMyFeeTierResponse>;
72
96
  }
@@ -21,7 +21,7 @@
21
21
  * });
22
22
  * ```
23
23
  */
24
- import { SimulateFeeParamsSchema, validate } from "@0xmonaco/types";
24
+ import { GetMyFeeTierParamsSchema, SimulateFeeParamsSchema, validate } from "@0xmonaco/types";
25
25
  import { BaseAPI } from "../base";
26
26
  export class FeesAPIImpl extends BaseAPI {
27
27
  /**
@@ -87,4 +87,36 @@ export class FeesAPIImpl extends BaseAPI {
87
87
  method: "GET",
88
88
  });
89
89
  }
90
+ /**
91
+ * Get the caller's current fee tier, rolling 14-day volumes, and a pair's schedule.
92
+ *
93
+ * Returns the caller's resolved tier (1–6) and weighted 14-day volume (with the
94
+ * spot/perp breakdown), the volume still needed to reach the next tier, and the
95
+ * requested pair's six-row fee schedule.
96
+ *
97
+ * @param params - Parameters for the lookup
98
+ * @param params.tradingPairId - Trading pair whose fee schedule to return
99
+ * @returns Promise resolving to the caller's tier and the pair's schedule
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * const tier = await feesAPI.getMyFeeTier({
104
+ * tradingPairId: "123e4567-e89b-12d3-a456-426614174000",
105
+ * });
106
+ * console.log(`Current tier: ${tier.currentTierLevel}`);
107
+ * console.log(`14d volume: ${tier.weightedVolume14d}`);
108
+ * for (const row of tier.feeSchedule) {
109
+ * console.log(`Tier ${row.tierLevel}: taker ${row.takerFeeBps} bps`);
110
+ * }
111
+ * ```
112
+ */
113
+ async getMyFeeTier(params) {
114
+ const validatedParams = validate(GetMyFeeTierParamsSchema, params);
115
+ const searchParams = new URLSearchParams();
116
+ searchParams.append("tradingPairId", validatedParams.tradingPairId);
117
+ const endpoint = `/api/v1/fees/tier?${searchParams.toString()}`;
118
+ return await this.makeAuthenticatedRequest(endpoint, {
119
+ method: "GET",
120
+ });
121
+ }
90
122
  }
@@ -58,6 +58,8 @@ export class MarginAccountsAPIImpl extends BaseAPI {
58
58
  amount: request.amount,
59
59
  tradingPairId: request.tradingPairId,
60
60
  strategyKey: request.strategyKey,
61
+ marginMode: request.marginMode,
62
+ selectedTradingPairIds: request.selectedTradingPairIds,
61
63
  }),
62
64
  });
63
65
  }
@@ -130,6 +132,8 @@ export class MarginAccountsAPIImpl extends BaseAPI {
130
132
  body: JSON.stringify({
131
133
  tradingPairId: request.tradingPairId,
132
134
  strategyKey: request.strategyKey,
135
+ marginMode: request.marginMode,
136
+ selectedTradingPairIds: request.selectedTradingPairIds,
133
137
  side: request.side,
134
138
  positionSide: request.positionSide,
135
139
  orderType: request.orderType,
@@ -21,7 +21,7 @@
21
21
  * );
22
22
  * ```
23
23
  */
24
- import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, OrderSide, ParentTpSlLegParams, PositionSide, ReplaceOrderResponse, TimeInForce, TradingAPI, TradingMode } from "@0xmonaco/types";
24
+ import type { BatchCancelOrdersResponse, BatchCreateOrderParams, BatchCreateOrdersResponse, BatchReplaceOrderParams, BatchReplaceOrdersResponse, CancelConditionalOrderResponse, CancelOrderResponse, CreateOrderResponse, GetOrderResponse, GetPaginatedOrdersParams, GetPaginatedOrdersResponse, ListConditionalOrdersParams, ListConditionalOrdersResponse, MarginMode, OrderSide, ParentTpSlLegParams, PositionSide, ReplaceOrderResponse, TimeInForce, TradingAPI, TradingMode } from "@0xmonaco/types";
25
25
  import { BaseAPI } from "../base";
26
26
  export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
27
27
  /**
@@ -80,6 +80,7 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
80
80
  expirationDate?: string;
81
81
  timeInForce?: TimeInForce;
82
82
  marginAccountId?: string;
83
+ marginMode?: MarginMode;
83
84
  riskBucketId?: string;
84
85
  riskBucketCollateral?: string;
85
86
  strategyKey?: string;
@@ -134,6 +135,7 @@ export declare class TradingAPIImpl extends BaseAPI implements TradingAPI {
134
135
  tradingMode?: TradingMode;
135
136
  slippageTolerance?: number;
136
137
  marginAccountId?: string;
138
+ marginMode?: MarginMode;
137
139
  riskBucketId?: string;
138
140
  riskBucketCollateral?: string;
139
141
  strategyKey?: string;
@@ -107,6 +107,7 @@ export class TradingAPIImpl extends BaseAPI {
107
107
  expirationDate: options?.expirationDate,
108
108
  timeInForce: options?.timeInForce,
109
109
  marginAccountId: options?.marginAccountId,
110
+ marginMode: options?.marginMode,
110
111
  riskBucketId: options?.riskBucketId,
111
112
  riskBucketCollateral: options?.riskBucketCollateral,
112
113
  strategyKey: options?.strategyKey,
@@ -179,6 +180,7 @@ export class TradingAPIImpl extends BaseAPI {
179
180
  quantity,
180
181
  tradingMode: options?.tradingMode || "SPOT",
181
182
  marginAccountId: options?.marginAccountId,
183
+ marginMode: options?.marginMode,
182
184
  riskBucketId: options?.riskBucketId,
183
185
  riskBucketCollateral: options?.riskBucketCollateral,
184
186
  strategyKey: options?.strategyKey,
@@ -344,6 +346,7 @@ export class TradingAPIImpl extends BaseAPI {
344
346
  expirationDate: order.expirationDate,
345
347
  timeInForce: order.timeInForce,
346
348
  marginAccountId: order.marginAccountId,
349
+ marginMode: order.marginMode,
347
350
  riskBucketId: order.riskBucketId,
348
351
  riskBucketCollateral: order.riskBucketCollateral,
349
352
  strategyKey: order.strategyKey,
@@ -27,6 +27,7 @@ export declare const COVERED: {
27
27
  get_mark_price: string;
28
28
  get_market_metadata: string;
29
29
  get_market_stats: string;
30
+ get_my_fee_tier: string;
30
31
  get_open_interest: string;
31
32
  get_order_by_id: string;
32
33
  get_orderbook_snapshot: string;
package/dist/coverage.js CHANGED
@@ -27,6 +27,7 @@ export const COVERED = {
27
27
  get_mark_price: "getMarkPrice",
28
28
  get_market_metadata: "getMarketMetadata",
29
29
  get_market_stats: "getMarketStats",
30
+ get_my_fee_tier: "getMyFeeTier",
30
31
  get_open_interest: "getOpenInterest",
31
32
  get_order_by_id: "getOrder",
32
33
  get_orderbook_snapshot: "getOrderbook",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/core",
3
- "version": "0.8.16",
3
+ "version": "0.8.19",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,8 +23,8 @@
23
23
  "viem": "^2.45.2"
24
24
  },
25
25
  "dependencies": {
26
- "@0xmonaco/contracts": "0.8.16",
27
- "@0xmonaco/types": "0.8.16",
26
+ "@0xmonaco/contracts": "0.8.19",
27
+ "@0xmonaco/types": "0.8.19",
28
28
  "@noble/curves": "^1.9.1",
29
29
  "@noble/hashes": "^1.8.0",
30
30
  "http-status-codes": "^2.3.0"