@0xmonaco/core 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.
- package/dist/api/fees/api.d.ts +25 -1
- package/dist/api/fees/api.js +33 -1
- package/dist/coverage.d.ts +1 -0
- package/dist/coverage.js +1 -0
- package/package.json +3 -3
package/dist/api/fees/api.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/api/fees/api.js
CHANGED
|
@@ -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
|
}
|
package/dist/coverage.d.ts
CHANGED
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.
|
|
3
|
+
"version": "0.8.18",
|
|
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.
|
|
27
|
-
"@0xmonaco/types": "0.8.
|
|
26
|
+
"@0xmonaco/contracts": "0.8.18",
|
|
27
|
+
"@0xmonaco/types": "0.8.18",
|
|
28
28
|
"@noble/curves": "^1.9.1",
|
|
29
29
|
"@noble/hashes": "^1.8.0",
|
|
30
30
|
"http-status-codes": "^2.3.0"
|