@0xmonaco/core 1.0.98 → 1.0.99

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.
@@ -2,7 +2,8 @@
2
2
  * Fees API Implementation
3
3
  *
4
4
  * Handles fee simulation and calculation operations.
5
- * All operations use JWT authentication and go through the API Gateway.
5
+ * Every operation except `getFeeSchedule` is session-key authenticated;
6
+ * `getFeeSchedule` is a public read and sends no credentials.
6
7
  *
7
8
  * This class provides a complete interface for fee-related operations on the Monaco protocol,
8
9
  * including simulating fees before placing orders.
@@ -21,7 +22,7 @@
21
22
  * });
22
23
  * ```
23
24
  */
24
- import type { FeesAPI, GetMyFeeTierParams, GetMyFeeTierResponse, SimulateFeeParams, SimulateFeeResponse } from "@0xmonaco/types";
25
+ import type { FeesAPI, GetFeeScheduleResponse, GetMyFeeTierParams, GetMyFeeTierResponse, SimulateFeeParams, SimulateFeeResponse } from "@0xmonaco/types";
25
26
  import { BaseAPI } from "../base";
26
27
  export declare class FeesAPIImpl extends BaseAPI implements FeesAPI {
27
28
  /**
@@ -96,4 +97,25 @@ export declare class FeesAPIImpl extends BaseAPI implements FeesAPI {
96
97
  * ```
97
98
  */
98
99
  getMyFeeTier(params: GetMyFeeTierParams): Promise<GetMyFeeTierResponse>;
100
+ /**
101
+ * Get a trading pair's fee tier schedule. Public: sends no credentials, so it
102
+ * works before sign-in.
103
+ *
104
+ * Returns the pair's Monaco fee schedule ordered by tier level: each row's
105
+ * weighted 14-day volume threshold and its maker/taker fee in basis points
106
+ * (a negative maker fee is a rebate). Your own tier and rate come from
107
+ * {@link FeesAPIImpl.getMyFeeTier}.
108
+ *
109
+ * @param tradingPairId - Trading pair whose fee schedule to return
110
+ * @returns Promise resolving to the pair's fee tier schedule
111
+ *
112
+ * @example
113
+ * ```typescript
114
+ * const { feeSchedule } = await feesAPI.getFeeSchedule("123e4567-e89b-12d3-a456-426614174000");
115
+ * for (const row of feeSchedule) {
116
+ * console.log(`Tier ${row.tierLevel}: maker ${row.makerFeeBps} bps, taker ${row.takerFeeBps} bps`);
117
+ * }
118
+ * ```
119
+ */
120
+ getFeeSchedule(tradingPairId: string): Promise<GetFeeScheduleResponse>;
99
121
  }
@@ -2,7 +2,8 @@
2
2
  * Fees API Implementation
3
3
  *
4
4
  * Handles fee simulation and calculation operations.
5
- * All operations use JWT authentication and go through the API Gateway.
5
+ * Every operation except `getFeeSchedule` is session-key authenticated;
6
+ * `getFeeSchedule` is a public read and sends no credentials.
6
7
  *
7
8
  * This class provides a complete interface for fee-related operations on the Monaco protocol,
8
9
  * including simulating fees before placing orders.
@@ -21,7 +22,7 @@
21
22
  * });
22
23
  * ```
23
24
  */
24
- import { GetMyFeeTierParamsSchema, SimulateFeeParamsSchema, validate } from "@0xmonaco/types";
25
+ import { GetFeeScheduleParamsSchema, GetMyFeeTierParamsSchema, SimulateFeeParamsSchema, validate } from "@0xmonaco/types";
25
26
  import { BaseAPI } from "../base";
26
27
  export class FeesAPIImpl extends BaseAPI {
27
28
  /**
@@ -122,4 +123,30 @@ export class FeesAPIImpl extends BaseAPI {
122
123
  method: "GET",
123
124
  });
124
125
  }
126
+ /**
127
+ * Get a trading pair's fee tier schedule. Public: sends no credentials, so it
128
+ * works before sign-in.
129
+ *
130
+ * Returns the pair's Monaco fee schedule ordered by tier level: each row's
131
+ * weighted 14-day volume threshold and its maker/taker fee in basis points
132
+ * (a negative maker fee is a rebate). Your own tier and rate come from
133
+ * {@link FeesAPIImpl.getMyFeeTier}.
134
+ *
135
+ * @param tradingPairId - Trading pair whose fee schedule to return
136
+ * @returns Promise resolving to the pair's fee tier schedule
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * const { feeSchedule } = await feesAPI.getFeeSchedule("123e4567-e89b-12d3-a456-426614174000");
141
+ * for (const row of feeSchedule) {
142
+ * console.log(`Tier ${row.tierLevel}: maker ${row.makerFeeBps} bps, taker ${row.takerFeeBps} bps`);
143
+ * }
144
+ * ```
145
+ */
146
+ async getFeeSchedule(tradingPairId) {
147
+ const validatedParams = validate(GetFeeScheduleParamsSchema, { tradingPairId });
148
+ const searchParams = new URLSearchParams();
149
+ searchParams.append("tradingPairId", validatedParams.tradingPairId);
150
+ return await this.makePublicRequest(`/api/v1/fees/schedule?${searchParams.toString()}`);
151
+ }
125
152
  }
@@ -911,8 +911,9 @@ function parseBalanceSnapshotItem(raw) {
911
911
  * `Option`s serialized without `skip_serializing_if`, so the key is always
912
912
  * present carrying `null`. The fields the server omits outright
913
913
  * (`clientOrderId`, `selfTradePreventionMode`, `parentOrderId`, `postOnly`,
914
- * `expirationDate`, `triggerPrice`, `positionSide`, `version` and `origin`) are
915
- * read as optional and spread in only when present.
914
+ * `expirationDate`, `triggerPrice`, `positionSide`, `version`, `origin`,
915
+ * `placementTakerFeeBps` and `placementMakerFeeBps`) are read as optional and
916
+ * spread in only when present.
916
917
  */
917
918
  function parseOrderSnapshotItem(raw) {
918
919
  if (!isRecord(raw)) {
@@ -931,6 +932,8 @@ function parseOrderSnapshotItem(raw) {
931
932
  const positionSide = readOptionalString(item, "positionSide");
932
933
  const version = readOptionalNumber(item, "version");
933
934
  const origin = readOptionalString(item, "origin");
935
+ const placementTakerFeeBps = readOptionalString(item, "placementTakerFeeBps");
936
+ const placementMakerFeeBps = readOptionalString(item, "placementMakerFeeBps");
934
937
  return {
935
938
  orderId: readString(item, "orderId"),
936
939
  userId: readString(item, "userId"),
@@ -982,6 +985,10 @@ function parseOrderSnapshotItem(raw) {
982
985
  // origin passes through rather than dropping the row, and absent stays
983
986
  // absent.
984
987
  ...(origin === undefined ? {} : { origin }),
988
+ // The Monaco fee rates fixed at placement. Omitted for an order placed
989
+ // before rates were stored, and absent must stay absent: never "0".
990
+ ...(placementTakerFeeBps === undefined ? {} : { placementTakerFeeBps }),
991
+ ...(placementMakerFeeBps === undefined ? {} : { placementMakerFeeBps }),
985
992
  };
986
993
  }
987
994
  /**
@@ -56,6 +56,7 @@ export declare const COVERED: {
56
56
  get_market_metadata: string;
57
57
  get_market_stats: string;
58
58
  get_my_fee_tier: string;
59
+ get_fee_schedule: string;
59
60
  get_pulse: string;
60
61
  get_region_status: string;
61
62
  list_managed_market_assignments: string;
package/dist/coverage.js CHANGED
@@ -56,6 +56,7 @@ export const COVERED = {
56
56
  get_market_metadata: "getMarketMetadata",
57
57
  get_market_stats: "getMarketStats",
58
58
  get_my_fee_tier: "getMyFeeTier",
59
+ get_fee_schedule: "getFeeSchedule",
59
60
  get_pulse: "pulse.getPulse",
60
61
  get_region_status: "compliance.getRegionStatus",
61
62
  list_managed_market_assignments: "managedMarkets.listAssignments",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/core",
3
- "version": "1.0.98",
3
+ "version": "1.0.99",
4
4
  "type": "module",
5
5
  "homepage": "https://docs.0xmonaco.com/sdk/typescript",
6
6
  "main": "./dist/index.js",
@@ -19,8 +19,8 @@
19
19
  "viem": "^2.45.2"
20
20
  },
21
21
  "dependencies": {
22
- "@0xmonaco/contracts": "1.0.98",
23
- "@0xmonaco/types": "1.0.98",
22
+ "@0xmonaco/contracts": "1.0.99",
23
+ "@0xmonaco/types": "1.0.99",
24
24
  "@noble/curves": "^2.4.0",
25
25
  "@noble/hashes": "^2.4.0",
26
26
  "http-status-codes": "^2.3.0"