@nadohq/nuanze-client 0.41.0

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.
Files changed (102) hide show
  1. package/README.md +72 -0
  2. package/dist/NuanzeClient-BUjoXpWV.cjs +327 -0
  3. package/dist/NuanzeClient-BUjoXpWV.cjs.map +1 -0
  4. package/dist/NuanzeClient.cjs +4 -0
  5. package/dist/NuanzeClient.d.cts +229 -0
  6. package/dist/NuanzeClient.d.cts.map +1 -0
  7. package/dist/NuanzeClient.d.ts +229 -0
  8. package/dist/NuanzeClient.d.ts.map +1 -0
  9. package/dist/NuanzeClient.js +293 -0
  10. package/dist/NuanzeClient.js.map +1 -0
  11. package/dist/NuanzeServerFailureError-B9EhXPyW.d.cts +29 -0
  12. package/dist/NuanzeServerFailureError-B9EhXPyW.d.cts.map +1 -0
  13. package/dist/NuanzeServerFailureError-DqWaKEMA.d.ts +29 -0
  14. package/dist/NuanzeServerFailureError-DqWaKEMA.d.ts.map +1 -0
  15. package/dist/clientModelTypes-A-D7ER-p.d.ts +932 -0
  16. package/dist/clientModelTypes-A-D7ER-p.d.ts.map +1 -0
  17. package/dist/clientModelTypes-BLPA-e3V.d.cts +932 -0
  18. package/dist/clientModelTypes-BLPA-e3V.d.cts.map +1 -0
  19. package/dist/clientTypes-DdpinbkS.d.ts +642 -0
  20. package/dist/clientTypes-DdpinbkS.d.ts.map +1 -0
  21. package/dist/clientTypes-Du2RLy4W.d.cts +642 -0
  22. package/dist/clientTypes-Du2RLy4W.d.cts.map +1 -0
  23. package/dist/dataMappers.cjs +688 -0
  24. package/dist/dataMappers.cjs.map +1 -0
  25. package/dist/dataMappers.d.cts +159 -0
  26. package/dist/dataMappers.d.cts.map +1 -0
  27. package/dist/dataMappers.d.ts +159 -0
  28. package/dist/dataMappers.d.ts.map +1 -0
  29. package/dist/dataMappers.js +650 -0
  30. package/dist/dataMappers.js.map +1 -0
  31. package/dist/endpoints.cjs +18 -0
  32. package/dist/endpoints.cjs.map +1 -0
  33. package/dist/endpoints.d.cts +14 -0
  34. package/dist/endpoints.d.cts.map +1 -0
  35. package/dist/endpoints.d.ts +14 -0
  36. package/dist/endpoints.d.ts.map +1 -0
  37. package/dist/endpoints.js +17 -0
  38. package/dist/endpoints.js.map +1 -0
  39. package/dist/index.cjs +79 -0
  40. package/dist/index.d.cts +10 -0
  41. package/dist/index.d.ts +10 -0
  42. package/dist/index.js +9 -0
  43. package/dist/nuanzeErrorCodes-CWCTWh2k.d.cts +14 -0
  44. package/dist/nuanzeErrorCodes-CWCTWh2k.d.cts.map +1 -0
  45. package/dist/nuanzeErrorCodes-Dh6juim0.d.ts +14 -0
  46. package/dist/nuanzeErrorCodes-Dh6juim0.d.ts.map +1 -0
  47. package/dist/serverModelTypes-D-vS_7uc.d.ts +377 -0
  48. package/dist/serverModelTypes-D-vS_7uc.d.ts.map +1 -0
  49. package/dist/serverModelTypes-DZDxdIzz.d.cts +377 -0
  50. package/dist/serverModelTypes-DZDxdIzz.d.cts.map +1 -0
  51. package/dist/serverQueryTypes-BBIFZZ36.d.cts +240 -0
  52. package/dist/serverQueryTypes-BBIFZZ36.d.cts.map +1 -0
  53. package/dist/serverQueryTypes-e7HWmE8t.d.ts +240 -0
  54. package/dist/serverQueryTypes-e7HWmE8t.d.ts.map +1 -0
  55. package/dist/types/NuanzeServerFailureError.cjs +21 -0
  56. package/dist/types/NuanzeServerFailureError.cjs.map +1 -0
  57. package/dist/types/NuanzeServerFailureError.d.cts +2 -0
  58. package/dist/types/NuanzeServerFailureError.d.ts +2 -0
  59. package/dist/types/NuanzeServerFailureError.js +20 -0
  60. package/dist/types/NuanzeServerFailureError.js.map +1 -0
  61. package/dist/types/clientModelTypes.cjs +236 -0
  62. package/dist/types/clientModelTypes.cjs.map +1 -0
  63. package/dist/types/clientModelTypes.d.cts +2 -0
  64. package/dist/types/clientModelTypes.d.ts +2 -0
  65. package/dist/types/clientModelTypes.js +208 -0
  66. package/dist/types/clientModelTypes.js.map +1 -0
  67. package/dist/types/clientTypes.cjs +0 -0
  68. package/dist/types/clientTypes.d.cts +2 -0
  69. package/dist/types/clientTypes.d.ts +2 -0
  70. package/dist/types/clientTypes.js +1 -0
  71. package/dist/types/index.cjs +36 -0
  72. package/dist/types/index.d.cts +7 -0
  73. package/dist/types/index.d.ts +7 -0
  74. package/dist/types/index.js +5 -0
  75. package/dist/types/nuanzeErrorCodes.cjs +32 -0
  76. package/dist/types/nuanzeErrorCodes.cjs.map +1 -0
  77. package/dist/types/nuanzeErrorCodes.d.cts +2 -0
  78. package/dist/types/nuanzeErrorCodes.d.ts +2 -0
  79. package/dist/types/nuanzeErrorCodes.js +31 -0
  80. package/dist/types/nuanzeErrorCodes.js.map +1 -0
  81. package/dist/types/serverModelTypes.cjs +0 -0
  82. package/dist/types/serverModelTypes.d.cts +2 -0
  83. package/dist/types/serverModelTypes.d.ts +2 -0
  84. package/dist/types/serverModelTypes.js +1 -0
  85. package/dist/types/serverQueryTypes.cjs +15 -0
  86. package/dist/types/serverQueryTypes.cjs.map +1 -0
  87. package/dist/types/serverQueryTypes.d.cts +2 -0
  88. package/dist/types/serverQueryTypes.d.ts +2 -0
  89. package/dist/types/serverQueryTypes.js +14 -0
  90. package/dist/types/serverQueryTypes.js.map +1 -0
  91. package/package.json +54 -0
  92. package/src/NuanzeClient.ts +556 -0
  93. package/src/dataMappers.ts +889 -0
  94. package/src/endpoints.ts +14 -0
  95. package/src/index.ts +4 -0
  96. package/src/types/NuanzeServerFailureError.ts +36 -0
  97. package/src/types/clientModelTypes.ts +1085 -0
  98. package/src/types/clientTypes.ts +719 -0
  99. package/src/types/index.ts +6 -0
  100. package/src/types/nuanzeErrorCodes.ts +31 -0
  101. package/src/types/serverModelTypes.ts +422 -0
  102. package/src/types/serverQueryTypes.ts +298 -0
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # `@nadohq/nuanze-client`
2
+
3
+ HTTP client for the Nuanze public analytics API. Serves markets, wallets, trades, candles, collateral flows,
4
+ positioning, and globally ranked current open positions. Read-only and credential-free, so unlike the other
5
+ service clients it takes no wallet client or linked signer.
6
+
7
+ [Full SDK Documentation](https://nadohq.github.io/nado-typescript-sdk/index.html)
8
+
9
+ ## Usage
10
+
11
+ ```ts
12
+ import { NuanzeClient, NUANZE_CLIENT_ENDPOINTS } from '@nadohq/nuanze-client';
13
+
14
+ const nuanze = new NuanzeClient({
15
+ url: NUANZE_CLIENT_ENDPOINTS.inkMainnet,
16
+ });
17
+
18
+ const { markets, asOf } = await nuanze.getMarkets({ venue: 'perp' });
19
+ ```
20
+
21
+ It is also available on a `NadoClient` context, configured from the chain env like the other service clients:
22
+
23
+ ```ts
24
+ const markets = await nadoClient.context.nuanzeClient.getMarkets();
25
+ ```
26
+
27
+ Nuanze runs a single public deployment that serves mainnet data, so every entry in
28
+ `NUANZE_CLIENT_ENDPOINTS` points at the same host.
29
+
30
+ ## API Surface
31
+
32
+ Each method maps one-to-one onto a public operation. Most are GET; `getFollowedLeaderboard` is a
33
+ non-mutating POST whose body carries the followed set:
34
+
35
+ - `getNews`
36
+ - `getMarkets`
37
+ - `getMarketByTicker`
38
+ - `getFundingRates`
39
+ - `getLeaderboard`
40
+ - `getPlatformSummary`
41
+ - `getFollowedLeaderboard`
42
+ - `getWalletSummary`
43
+ - `getWalletPositions`
44
+ - `getMarketTrades`
45
+ - `getMarketCandles`
46
+ - `getWalletTrades`
47
+ - `getWalletPnl`
48
+ - `getWalletPnlSeries`
49
+ - `getCollateralFlows`
50
+ - `getCollateralFlowSummary`
51
+ - `getCollateralFlowSeries`
52
+ - `getMarketPositioning`
53
+ - `getMarketPositions`
54
+ - `getOpenPositions`
55
+
56
+ Decimal fields are mapped to `BigNumber`; timestamps stay UTC ISO 8601 strings, matching the API contract.
57
+
58
+ ## Errors
59
+
60
+ Failures arrive as `NuanzeServerFailureError`, carrying `errorCode` (comparable against
61
+ `NUANZE_ERROR_CODES`), `httpStatus`, and the `requestId` to quote when reporting the failure.
62
+
63
+ ## Rate Limits
64
+
65
+ The API meters a weighted token bucket per client IP and reports its state in the `RateLimit-Limit`,
66
+ `RateLimit-Remaining`, and `RateLimit-Reset` response headers. The client never retries, sleeps, or
67
+ self-throttles; add an interceptor on `nuanze.axiosInstance` to observe the headers or to apply per-request
68
+ timeouts and cancellation.
69
+
70
+ ## License
71
+
72
+ ISC
@@ -0,0 +1,327 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
+ key = keys[i];
11
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
+ get: ((k) => from[k]).bind(null, key),
13
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
+ });
15
+ }
16
+ return to;
17
+ };
18
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ value: mod,
20
+ enumerable: true
21
+ }) : target, mod));
22
+ //#endregion
23
+ const require_dataMappers = require("./dataMappers.cjs");
24
+ const require_types_NuanzeServerFailureError = require("./types/NuanzeServerFailureError.cjs");
25
+ const require_types_serverQueryTypes = require("./types/serverQueryTypes.cjs");
26
+ let axios = require("axios");
27
+ axios = __toESM(axios, 1);
28
+ //#region src/NuanzeClient.ts
29
+ /**
30
+ * Client for the Nuanze public analytics API: markets, wallets, trades, candles, collateral flows,
31
+ * and positioning.
32
+ *
33
+ * Read-only and credential-free, so unlike the other service clients it takes no wallet client or
34
+ * linked signer. It also sends no `x-nado-client-type` header: Nuanze is a public API that does not
35
+ * attribute traffic per client, and its `Access-Control-Allow-Headers` does not list the header, so
36
+ * sending it would fail CORS preflight in the browser. Most operations are GET;
37
+ * {@link NuanzeClient.getFollowedLeaderboard} is a non-mutating POST whose body carries a followed
38
+ * set larger than a query string can reliably hold. The API meters a weighted token bucket per
39
+ * client IP and reports its state in the `RateLimit-Limit`, `RateLimit-Remaining`, and
40
+ * `RateLimit-Reset` response headers; add an interceptor on {@link axiosInstance} to observe them.
41
+ */
42
+ var NuanzeClient = class {
43
+ constructor(opts) {
44
+ this.opts = opts;
45
+ this.axiosInstance = axios.default.create({
46
+ withCredentials: false,
47
+ validateStatus: () => true,
48
+ paramsSerializer: { indexes: null }
49
+ });
50
+ }
51
+ /**
52
+ * Lists published editorial stories, sorted by `publishedAt` descending then `id` descending.
53
+ * The opaque cursor is exclusive and bound to normalized filters. Raw article ingestion, scoring,
54
+ * queue, and newsdesk fields are excluded.
55
+ *
56
+ * @throws {NuanzeServerFailureError} With `BAD_REQUEST`, `INVALID_CURSOR`, or
57
+ * `CURSOR_FILTER_MISMATCH` when filters or the cursor are invalid.
58
+ */
59
+ async getNews(params = {}) {
60
+ return require_dataMappers.mapNuanzeNewsResponse(await this.getJson("/news", params));
61
+ }
62
+ /**
63
+ * Gets the active market universe, ordered by `productId` ascending. Never truncated, so `count`
64
+ * always equals the length of `markets`. Market metadata refreshes about every five minutes and
65
+ * prices about every minute.
66
+ *
67
+ * @throws {NuanzeServerFailureError} With error code `BAD_REQUEST` if a filter value is not a
68
+ * documented venue or tradability state.
69
+ */
70
+ async getMarkets(params = {}) {
71
+ return require_dataMappers.mapNuanzeMarketsResponse(await this.getJson("/markets", params));
72
+ }
73
+ /**
74
+ * Resolves a market by ticker. Lookup is case-insensitive and accepts canonical tickers or
75
+ * legacy source symbols. An explicit unavailable venue returns `MARKET_NOT_FOUND`. With no
76
+ * venue, `strictVenue=true` returns `AMBIGUOUS_MARKET` for multi-venue assets; otherwise the
77
+ * primary venue is used.
78
+ *
79
+ * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`, or
80
+ * `BAD_REQUEST` on invalid selectors, and `MARKET_NOT_FOUND` when the ticker does not resolve.
81
+ */
82
+ async getMarketByTicker(params) {
83
+ const { ticker, ...query } = params;
84
+ return require_dataMappers.mapNuanzeMarketByTickerResponse(await this.getJson(`/markets/${encodeURIComponent(ticker)}`, query));
85
+ }
86
+ /**
87
+ * Lists the latest funding observation per active perpetual market, refreshed about every five
88
+ * minutes.
89
+ *
90
+ * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if a filter value is invalid.
91
+ */
92
+ async getFundingRates(params = {}) {
93
+ return require_dataMappers.mapNuanzeFundingRatesResponse(await this.getJson("/funding/rates", params));
94
+ }
95
+ /**
96
+ * Gets the account PnL leaderboard. Equity-basis account PnL includes realized and unrealized
97
+ * movement plus funding and is not realized PnL. All-time analytics cost five rate-limit units.
98
+ *
99
+ * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if a filter value is invalid.
100
+ */
101
+ async getLeaderboard(params = {}) {
102
+ return require_dataMappers.mapNuanzeLeaderboardResponse(await this.getJson("/leaderboard", params));
103
+ }
104
+ /**
105
+ * Gets platform activity summary from five-minute aggregates.
106
+ *
107
+ * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if the window is not a documented value.
108
+ */
109
+ async getPlatformSummary(params = {}) {
110
+ return require_dataMappers.mapNuanzePlatformSummaryResponse(await this.getJson("/platform/summary", params));
111
+ }
112
+ /**
113
+ * Gets leaderboard stats for a set of followed subaccounts. POST rather than GET so the body can
114
+ * carry up to 300 `subaccountHex` values. The response preserves request order. Subaccounts with
115
+ * no data in the window are backfilled with `pnl: null`, `globalRank: null`, zero counts, and an
116
+ * empty `productIds`. Costs five rate-limit units. The response is not cached.
117
+ *
118
+ * @throws {NuanzeServerFailureError} With `INVALID_SUBACCOUNT` if a hex is not 32-byte
119
+ * 0x-prefixed, and `BAD_REQUEST` if the set is empty, exceeds 300, or `timeframe` is not a
120
+ * documented value.
121
+ */
122
+ async getFollowedLeaderboard(params) {
123
+ return require_dataMappers.mapNuanzeFollowedLeaderboardResponse(await this.postJson("/wallets/leaderboard", params));
124
+ }
125
+ /**
126
+ * Gets replica-backed wallet analytics. Without `subaccountName`, latest cumulative values are
127
+ * selected per known subaccount and then summed. The response is a snapshot and does not claim
128
+ * live health, withdrawable collateral, open-order, or signer state.
129
+ *
130
+ * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,
131
+ * and `WALLET_NOT_FOUND` when the address has no wallet data.
132
+ */
133
+ async getWalletSummary(params) {
134
+ const { address, ...query } = params;
135
+ return require_dataMappers.mapNuanzeWalletSummaryResponse(await this.getJson(`/wallets/${encodeURIComponent(address)}`, query));
136
+ }
137
+ /**
138
+ * Lists at most 500 current replica position rows across all known subaccounts by default. Rows
139
+ * remain per subaccount. Spot rows are excluded unless `includeSpot=true`. This is not an
140
+ * execution-grade live feed.
141
+ *
142
+ * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,
143
+ * and `WALLET_NOT_FOUND` when the address has no wallet data.
144
+ */
145
+ async getWalletPositions(params) {
146
+ const { address, ...query } = params;
147
+ return require_dataMappers.mapNuanzeWalletPositionsResponse(await this.getJson(`/wallets/${encodeURIComponent(address)}/positions`, query));
148
+ }
149
+ /**
150
+ * Lists market trades: one taker-side row per match, sorted by `matchedAt` then `id` descending.
151
+ * The exclusive cursor is bound to operation and normalized filters. `from` is inclusive and
152
+ * `to` exclusive. Wallet identity is absent.
153
+ *
154
+ * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`,
155
+ * `INVALID_CURSOR`, `CURSOR_FILTER_MISMATCH`, `RANGE_TOO_LARGE`, or `BAD_REQUEST` on invalid
156
+ * input, and `MARKET_NOT_FOUND` when the ticker does not resolve.
157
+ */
158
+ async getMarketTrades(params) {
159
+ const { ticker, ...query } = params;
160
+ return require_dataMappers.mapNuanzeMarketTradesResponse(await this.getJson(`/markets/${encodeURIComponent(ticker)}/trades`, query));
161
+ }
162
+ /**
163
+ * Lists market candles. Source storage is 1h; 4h and 1d are UTC-aligned rollups and missing bars
164
+ * are not interpolated. The newest `limit` matching bars are selected and returned
165
+ * oldest-to-newest, at most 750, with no pagination. A current bucket has `complete=false`.
166
+ *
167
+ * @throws {NuanzeServerFailureError} With `UNSUPPORTED_INTERVAL`, `RANGE_TOO_LARGE`,
168
+ * `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`, or `BAD_REQUEST` on invalid input, and
169
+ * `MARKET_NOT_FOUND` when the ticker does not resolve.
170
+ */
171
+ async getMarketCandles(params) {
172
+ const { ticker, ...query } = params;
173
+ return require_dataMappers.mapNuanzeMarketCandlesResponse(await this.getJson(`/markets/${encodeURIComponent(ticker)}/candles`, query));
174
+ }
175
+ /**
176
+ * Lists wallet-owned maker and taker execution rows, sorted by `matchedAt` then `id` descending.
177
+ * The cursor is exclusive and filter-bound. `from` is inclusive and `to` exclusive.
178
+ *
179
+ * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS`, `INVALID_CURSOR`,
180
+ * `CURSOR_FILTER_MISMATCH`, `RANGE_TOO_LARGE`, or `BAD_REQUEST` on invalid input, and
181
+ * `WALLET_NOT_FOUND` when the address has no wallet data.
182
+ */
183
+ async getWalletTrades(params) {
184
+ const { address, ...query } = params;
185
+ return require_dataMappers.mapNuanzeWalletTradesResponse(await this.getJson(`/wallets/${encodeURIComponent(address)}/trades`, query));
186
+ }
187
+ /**
188
+ * Gets wallet account PnL. 24h is rolling and uses hourly snapshots with a daily fallback
189
+ * baseline. Longer windows use daily snapshots; `all` starts at earliest coverage. PnL includes
190
+ * realized and unrealized movement plus funding.
191
+ *
192
+ * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,
193
+ * and `WALLET_NOT_FOUND` when the address has no wallet data.
194
+ */
195
+ async getWalletPnl(params) {
196
+ const { address, ...query } = params;
197
+ return require_dataMappers.mapNuanzeWalletPnlResponse(await this.getJson(`/wallets/${encodeURIComponent(address)}/pnl`, query));
198
+ }
199
+ /**
200
+ * Gets a wallet account series of at most 1,000 deterministically sampled points ordered by
201
+ * timestamp. Series contain a boundary anchor and a carried-forward request-time tip; synthetic
202
+ * points are identified. Latest buckets may be provisional.
203
+ *
204
+ * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,
205
+ * and `WALLET_NOT_FOUND` when the address has no wallet data.
206
+ */
207
+ async getWalletPnlSeries(params) {
208
+ const { address, ...query } = params;
209
+ return require_dataMappers.mapNuanzeWalletPnlSeriesResponse(await this.getJson(`/wallets/${encodeURIComponent(address)}/pnl/series`, query));
210
+ }
211
+ /**
212
+ * Lists public collateral events, sorted by timestamp then `id` descending. Repeated `productId`
213
+ * uses OR semantics. `minUsd` excludes unvalued events; without it unvalued events remain.
214
+ *
215
+ * @throws {NuanzeServerFailureError} With `BAD_REQUEST`, `INVALID_CURSOR`, or
216
+ * `CURSOR_FILTER_MISMATCH` when filters or the cursor are invalid.
217
+ */
218
+ async getCollateralFlows(params = {}) {
219
+ return require_dataMappers.mapNuanzeCollateralFlowsResponse(await this.getJson("/flows", params));
220
+ }
221
+ /**
222
+ * Gets collateral flow aggregates: deposited, withdrawn, net, and gross, with valuation coverage
223
+ * and a prior equal-window comparison. `all` has no prior window.
224
+ *
225
+ * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if a filter value is invalid.
226
+ */
227
+ async getCollateralFlowSummary(params = {}) {
228
+ return require_dataMappers.mapNuanzeCollateralFlowSummaryResponse(await this.getJson("/flows/summary", params));
229
+ }
230
+ /**
231
+ * Gets collateral flow series of at most 1,000 UTC buckets. Allowed timeframe/bucket pairs are
232
+ * 24h/hour, 7d/hour or day (default hour), 30d/day, and all/day.
233
+ *
234
+ * @throws {NuanzeServerFailureError} With `UNSUPPORTED_BUCKET` or `BAD_REQUEST` when the pair or
235
+ * filters are invalid.
236
+ */
237
+ async getCollateralFlowSeries(params = {}) {
238
+ return require_dataMappers.mapNuanzeCollateralFlowSeriesResponse(await this.getJson("/flows/series", params));
239
+ }
240
+ /**
241
+ * Gets privacy-preserving aggregate positioning for an active perpetual. Cross and isolated legs
242
+ * are summed within owner/subaccount/product before direction classification. Every cell requires
243
+ * at least 20 distinct contributing owners. No identity, individual position, entry price, PnL,
244
+ * margin, or leverage fields are returned. This operation costs five rate-limit units.
245
+ *
246
+ * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`, or
247
+ * `BAD_REQUEST` on invalid input, and `MARKET_NOT_FOUND` when the ticker does not resolve to a
248
+ * perp.
249
+ */
250
+ async getMarketPositioning(params) {
251
+ const { ticker, ...query } = params;
252
+ return require_dataMappers.mapNuanzeMarketPositioningResponse(await this.getJson(`/markets/${encodeURIComponent(ticker)}/positioning`, query));
253
+ }
254
+ /**
255
+ * Lists open perpetual position legs for the resolved market. Results default to absolute
256
+ * notional descending and can be ordered by signed unrealized PnL or absolute base amount in
257
+ * either direction. Spot markets are not supported. Legs below $10 absolute notional are excluded.
258
+ * Wallet addresses and signed exact base amounts are returned.
259
+ *
260
+ * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`,
261
+ * `INVALID_CURSOR`, `CURSOR_FILTER_MISMATCH`, or `BAD_REQUEST` on invalid input, and
262
+ * `MARKET_NOT_FOUND` when the ticker does not resolve to a perp.
263
+ */
264
+ async getMarketPositions(params) {
265
+ const { ticker, ...query } = params;
266
+ return require_dataMappers.mapNuanzeMarketPositionsResponse(await this.getJson(`/markets/${encodeURIComponent(ticker)}/positions`, query));
267
+ }
268
+ /**
269
+ * Lists current open perpetual position legs across every market by signed unrealized PnL.
270
+ * Descending returns the largest gainers and ascending returns the largest losers. This is a
271
+ * latest indexed snapshot with no timeframe. Legs below $10 absolute notional are excluded.
272
+ * Each row includes market identity and its source snapshot timestamp. Costs five rate-limit
273
+ * units.
274
+ *
275
+ * @throws {NuanzeServerFailureError} With `INVALID_CURSOR`, `CURSOR_FILTER_MISMATCH`, or
276
+ * `BAD_REQUEST` when the query or cursor is invalid.
277
+ */
278
+ async getOpenPositions(params = {}) {
279
+ return require_dataMappers.mapNuanzeOpenPositionsResponse(await this.getJson("/positions", params));
280
+ }
281
+ /**
282
+ * Performs a GET against `{baseUrl}{path}` and classifies the status before returning the body.
283
+ */
284
+ async getJson(path, params) {
285
+ return this.requestJson("GET", path, { params });
286
+ }
287
+ /**
288
+ * Performs a POST against `{baseUrl}{path}` with a JSON body and classifies the status before
289
+ * returning the response. Used only for the non-mutating followed-leaderboard operation.
290
+ */
291
+ async postJson(path, data) {
292
+ return this.requestJson("POST", path, { data });
293
+ }
294
+ async requestJson(method, path, config = {}) {
295
+ const response = await this.axiosInstance.request({
296
+ method,
297
+ url: `${this.opts.url}${path}`,
298
+ ...config
299
+ });
300
+ this.checkResponseStatus(response);
301
+ return response.data;
302
+ }
303
+ /**
304
+ * Validates the HTTP status before interpreting the body. Nuanze maps every domain failure onto a
305
+ * non-2xx status carrying a failure envelope, so anything else is a transport-level error.
306
+ */
307
+ checkResponseStatus(response) {
308
+ if (response.status >= 200 && response.status < 300) return;
309
+ if (require_types_serverQueryTypes.isNuanzeServerFailureResponse(response.data)) throw new require_types_NuanzeServerFailureError.NuanzeServerFailureError(response.data, response.status);
310
+ throw new Error(`Unexpected response from Nuanze: ${response.status} ${response.statusText}. Data: ${JSON.stringify(response.data)}`);
311
+ }
312
+ };
313
+ //#endregion
314
+ Object.defineProperty(exports, "NuanzeClient", {
315
+ enumerable: true,
316
+ get: function() {
317
+ return NuanzeClient;
318
+ }
319
+ });
320
+ Object.defineProperty(exports, "__toESM", {
321
+ enumerable: true,
322
+ get: function() {
323
+ return __toESM;
324
+ }
325
+ });
326
+
327
+ //# sourceMappingURL=NuanzeClient-BUjoXpWV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NuanzeClient-BUjoXpWV.cjs","names":["mapNuanzeNewsResponse","mapNuanzeMarketsResponse","mapNuanzeMarketByTickerResponse","mapNuanzeFundingRatesResponse","mapNuanzeLeaderboardResponse","mapNuanzePlatformSummaryResponse","mapNuanzeFollowedLeaderboardResponse","mapNuanzeWalletSummaryResponse","mapNuanzeWalletPositionsResponse","mapNuanzeMarketTradesResponse","mapNuanzeMarketCandlesResponse","mapNuanzeWalletTradesResponse","mapNuanzeWalletPnlResponse","mapNuanzeWalletPnlSeriesResponse","mapNuanzeCollateralFlowsResponse","mapNuanzeCollateralFlowSummaryResponse","mapNuanzeCollateralFlowSeriesResponse","mapNuanzeMarketPositioningResponse","mapNuanzeMarketPositionsResponse","mapNuanzeOpenPositionsResponse","isNuanzeServerFailureResponse","NuanzeServerFailureError"],"sources":["../src/NuanzeClient.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosResponse } from 'axios';\nimport {\n mapNuanzeCollateralFlowSeriesResponse,\n mapNuanzeCollateralFlowSummaryResponse,\n mapNuanzeCollateralFlowsResponse,\n mapNuanzeFollowedLeaderboardResponse,\n mapNuanzeFundingRatesResponse,\n mapNuanzeLeaderboardResponse,\n mapNuanzeMarketByTickerResponse,\n mapNuanzeMarketCandlesResponse,\n mapNuanzeMarketPositioningResponse,\n mapNuanzeMarketPositionsResponse,\n mapNuanzeMarketTradesResponse,\n mapNuanzeMarketsResponse,\n mapNuanzeNewsResponse,\n mapNuanzeOpenPositionsResponse,\n mapNuanzePlatformSummaryResponse,\n mapNuanzeWalletPnlResponse,\n mapNuanzeWalletPnlSeriesResponse,\n mapNuanzeWalletPositionsResponse,\n mapNuanzeWalletSummaryResponse,\n mapNuanzeWalletTradesResponse,\n} from './dataMappers';\nimport {\n GetNuanzeCollateralFlowSeriesParams,\n GetNuanzeCollateralFlowSeriesResponse,\n GetNuanzeCollateralFlowSummaryParams,\n GetNuanzeCollateralFlowSummaryResponse,\n GetNuanzeCollateralFlowsParams,\n GetNuanzeCollateralFlowsResponse,\n GetNuanzeFollowedLeaderboardParams,\n GetNuanzeFollowedLeaderboardResponse,\n GetNuanzeFundingRatesParams,\n GetNuanzeFundingRatesResponse,\n GetNuanzeLeaderboardParams,\n GetNuanzeLeaderboardResponse,\n GetNuanzeMarketByTickerParams,\n GetNuanzeMarketByTickerResponse,\n GetNuanzeMarketCandlesParams,\n GetNuanzeMarketCandlesResponse,\n GetNuanzeMarketPositioningParams,\n GetNuanzeMarketPositioningResponse,\n GetNuanzeMarketPositionsParams,\n GetNuanzeMarketPositionsResponse,\n GetNuanzeMarketTradesParams,\n GetNuanzeMarketTradesResponse,\n GetNuanzeMarketsParams,\n GetNuanzeMarketsResponse,\n GetNuanzeNewsParams,\n GetNuanzeNewsResponse,\n GetNuanzeOpenPositionsParams,\n GetNuanzeOpenPositionsResponse,\n GetNuanzePlatformSummaryParams,\n GetNuanzePlatformSummaryResponse,\n GetNuanzeWalletPnlParams,\n GetNuanzeWalletPnlResponse,\n GetNuanzeWalletPnlSeriesParams,\n GetNuanzeWalletPnlSeriesResponse,\n GetNuanzeWalletPositionsParams,\n GetNuanzeWalletPositionsResponse,\n GetNuanzeWalletSummaryParams,\n GetNuanzeWalletSummaryResponse,\n GetNuanzeWalletTradesParams,\n GetNuanzeWalletTradesResponse,\n} from './types/clientTypes';\nimport { NuanzeServerFailureError } from './types/NuanzeServerFailureError';\nimport { NuanzeServerMarketPositioningResponse } from './types/serverModelTypes';\nimport {\n NuanzeServerCollateralFlowSeriesResponse,\n NuanzeServerCollateralFlowSummaryResponse,\n NuanzeServerCollateralFlowsResponse,\n NuanzeServerFollowedLeaderboardResponse,\n NuanzeServerFundingRatesResponse,\n NuanzeServerLeaderboardResponse,\n NuanzeServerMarketByTickerResponse,\n NuanzeServerMarketCandlesResponse,\n NuanzeServerMarketPositionsResponse,\n NuanzeServerMarketTradesResponse,\n NuanzeServerMarketsResponse,\n NuanzeServerNewsResponse,\n NuanzeServerOpenPositionsResponse,\n NuanzeServerPlatformSummaryResponse,\n NuanzeServerWalletPnlResponse,\n NuanzeServerWalletPnlSeriesResponse,\n NuanzeServerWalletPositionsResponse,\n NuanzeServerWalletSummaryResponse,\n NuanzeServerWalletTradesResponse,\n isNuanzeServerFailureResponse,\n} from './types/serverQueryTypes';\n\n/**\n * Options for constructing a {@link NuanzeClient}.\n */\nexport interface NuanzeClientOpts {\n /**\n * Base URL of the Nuanze API, including the version segment, e.g. {@link NUANZE_CLIENT_ENDPOINTS}.\n */\n url: string;\n}\n\n/**\n * Client for the Nuanze public analytics API: markets, wallets, trades, candles, collateral flows,\n * and positioning.\n *\n * Read-only and credential-free, so unlike the other service clients it takes no wallet client or\n * linked signer. It also sends no `x-nado-client-type` header: Nuanze is a public API that does not\n * attribute traffic per client, and its `Access-Control-Allow-Headers` does not list the header, so\n * sending it would fail CORS preflight in the browser. Most operations are GET;\n * {@link NuanzeClient.getFollowedLeaderboard} is a non-mutating POST whose body carries a followed\n * set larger than a query string can reliably hold. The API meters a weighted token bucket per\n * client IP and reports its state in the `RateLimit-Limit`, `RateLimit-Remaining`, and\n * `RateLimit-Reset` response headers; add an interceptor on {@link axiosInstance} to observe them.\n */\nexport class NuanzeClient {\n readonly opts: NuanzeClientOpts;\n readonly axiosInstance: AxiosInstance;\n\n constructor(opts: NuanzeClientOpts) {\n this.opts = opts;\n this.axiosInstance = axios.create({\n // Nuanze is public and answers every origin with `Access-Control-Allow-Origin: *`, which\n // browsers reject for credentialed requests.\n withCredentials: false,\n // We have custom logic to validate response status and create an appropriate error\n validateStatus: () => true,\n // Repeatable `productId` must serialize as `productId=1&productId=2` (OpenAPI explode).\n paramsSerializer: { indexes: null },\n });\n }\n\n /**\n * Lists published editorial stories, sorted by `publishedAt` descending then `id` descending.\n * The opaque cursor is exclusive and bound to normalized filters. Raw article ingestion, scoring,\n * queue, and newsdesk fields are excluded.\n *\n * @throws {NuanzeServerFailureError} With `BAD_REQUEST`, `INVALID_CURSOR`, or\n * `CURSOR_FILTER_MISMATCH` when filters or the cursor are invalid.\n */\n async getNews(\n params: GetNuanzeNewsParams = {},\n ): Promise<GetNuanzeNewsResponse> {\n return mapNuanzeNewsResponse(\n await this.getJson<NuanzeServerNewsResponse>('/news', params),\n );\n }\n\n /**\n * Gets the active market universe, ordered by `productId` ascending. Never truncated, so `count`\n * always equals the length of `markets`. Market metadata refreshes about every five minutes and\n * prices about every minute.\n *\n * @throws {NuanzeServerFailureError} With error code `BAD_REQUEST` if a filter value is not a\n * documented venue or tradability state.\n */\n async getMarkets(\n params: GetNuanzeMarketsParams = {},\n ): Promise<GetNuanzeMarketsResponse> {\n return mapNuanzeMarketsResponse(\n await this.getJson<NuanzeServerMarketsResponse>('/markets', params),\n );\n }\n\n /**\n * Resolves a market by ticker. Lookup is case-insensitive and accepts canonical tickers or\n * legacy source symbols. An explicit unavailable venue returns `MARKET_NOT_FOUND`. With no\n * venue, `strictVenue=true` returns `AMBIGUOUS_MARKET` for multi-venue assets; otherwise the\n * primary venue is used.\n *\n * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`, or\n * `BAD_REQUEST` on invalid selectors, and `MARKET_NOT_FOUND` when the ticker does not resolve.\n */\n async getMarketByTicker(\n params: GetNuanzeMarketByTickerParams,\n ): Promise<GetNuanzeMarketByTickerResponse> {\n const { ticker, ...query } = params;\n return mapNuanzeMarketByTickerResponse(\n await this.getJson<NuanzeServerMarketByTickerResponse>(\n `/markets/${encodeURIComponent(ticker)}`,\n query,\n ),\n );\n }\n\n /**\n * Lists the latest funding observation per active perpetual market, refreshed about every five\n * minutes.\n *\n * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if a filter value is invalid.\n */\n async getFundingRates(\n params: GetNuanzeFundingRatesParams = {},\n ): Promise<GetNuanzeFundingRatesResponse> {\n return mapNuanzeFundingRatesResponse(\n await this.getJson<NuanzeServerFundingRatesResponse>(\n '/funding/rates',\n params,\n ),\n );\n }\n\n /**\n * Gets the account PnL leaderboard. Equity-basis account PnL includes realized and unrealized\n * movement plus funding and is not realized PnL. All-time analytics cost five rate-limit units.\n *\n * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if a filter value is invalid.\n */\n async getLeaderboard(\n params: GetNuanzeLeaderboardParams = {},\n ): Promise<GetNuanzeLeaderboardResponse> {\n return mapNuanzeLeaderboardResponse(\n await this.getJson<NuanzeServerLeaderboardResponse>(\n '/leaderboard',\n params,\n ),\n );\n }\n\n /**\n * Gets platform activity summary from five-minute aggregates.\n *\n * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if the window is not a documented value.\n */\n async getPlatformSummary(\n params: GetNuanzePlatformSummaryParams = {},\n ): Promise<GetNuanzePlatformSummaryResponse> {\n return mapNuanzePlatformSummaryResponse(\n await this.getJson<NuanzeServerPlatformSummaryResponse>(\n '/platform/summary',\n params,\n ),\n );\n }\n\n /**\n * Gets leaderboard stats for a set of followed subaccounts. POST rather than GET so the body can\n * carry up to 300 `subaccountHex` values. The response preserves request order. Subaccounts with\n * no data in the window are backfilled with `pnl: null`, `globalRank: null`, zero counts, and an\n * empty `productIds`. Costs five rate-limit units. The response is not cached.\n *\n * @throws {NuanzeServerFailureError} With `INVALID_SUBACCOUNT` if a hex is not 32-byte\n * 0x-prefixed, and `BAD_REQUEST` if the set is empty, exceeds 300, or `timeframe` is not a\n * documented value.\n */\n async getFollowedLeaderboard(\n params: GetNuanzeFollowedLeaderboardParams,\n ): Promise<GetNuanzeFollowedLeaderboardResponse> {\n return mapNuanzeFollowedLeaderboardResponse(\n await this.postJson<NuanzeServerFollowedLeaderboardResponse>(\n '/wallets/leaderboard',\n params,\n ),\n );\n }\n\n /**\n * Gets replica-backed wallet analytics. Without `subaccountName`, latest cumulative values are\n * selected per known subaccount and then summed. The response is a snapshot and does not claim\n * live health, withdrawable collateral, open-order, or signer state.\n *\n * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,\n * and `WALLET_NOT_FOUND` when the address has no wallet data.\n */\n async getWalletSummary(\n params: GetNuanzeWalletSummaryParams,\n ): Promise<GetNuanzeWalletSummaryResponse> {\n const { address, ...query } = params;\n return mapNuanzeWalletSummaryResponse(\n await this.getJson<NuanzeServerWalletSummaryResponse>(\n `/wallets/${encodeURIComponent(address)}`,\n query,\n ),\n );\n }\n\n /**\n * Lists at most 500 current replica position rows across all known subaccounts by default. Rows\n * remain per subaccount. Spot rows are excluded unless `includeSpot=true`. This is not an\n * execution-grade live feed.\n *\n * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,\n * and `WALLET_NOT_FOUND` when the address has no wallet data.\n */\n async getWalletPositions(\n params: GetNuanzeWalletPositionsParams,\n ): Promise<GetNuanzeWalletPositionsResponse> {\n const { address, ...query } = params;\n return mapNuanzeWalletPositionsResponse(\n await this.getJson<NuanzeServerWalletPositionsResponse>(\n `/wallets/${encodeURIComponent(address)}/positions`,\n query,\n ),\n );\n }\n\n /**\n * Lists market trades: one taker-side row per match, sorted by `matchedAt` then `id` descending.\n * The exclusive cursor is bound to operation and normalized filters. `from` is inclusive and\n * `to` exclusive. Wallet identity is absent.\n *\n * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`,\n * `INVALID_CURSOR`, `CURSOR_FILTER_MISMATCH`, `RANGE_TOO_LARGE`, or `BAD_REQUEST` on invalid\n * input, and `MARKET_NOT_FOUND` when the ticker does not resolve.\n */\n async getMarketTrades(\n params: GetNuanzeMarketTradesParams,\n ): Promise<GetNuanzeMarketTradesResponse> {\n const { ticker, ...query } = params;\n return mapNuanzeMarketTradesResponse(\n await this.getJson<NuanzeServerMarketTradesResponse>(\n `/markets/${encodeURIComponent(ticker)}/trades`,\n query,\n ),\n );\n }\n\n /**\n * Lists market candles. Source storage is 1h; 4h and 1d are UTC-aligned rollups and missing bars\n * are not interpolated. The newest `limit` matching bars are selected and returned\n * oldest-to-newest, at most 750, with no pagination. A current bucket has `complete=false`.\n *\n * @throws {NuanzeServerFailureError} With `UNSUPPORTED_INTERVAL`, `RANGE_TOO_LARGE`,\n * `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`, or `BAD_REQUEST` on invalid input, and\n * `MARKET_NOT_FOUND` when the ticker does not resolve.\n */\n async getMarketCandles(\n params: GetNuanzeMarketCandlesParams,\n ): Promise<GetNuanzeMarketCandlesResponse> {\n const { ticker, ...query } = params;\n return mapNuanzeMarketCandlesResponse(\n await this.getJson<NuanzeServerMarketCandlesResponse>(\n `/markets/${encodeURIComponent(ticker)}/candles`,\n query,\n ),\n );\n }\n\n /**\n * Lists wallet-owned maker and taker execution rows, sorted by `matchedAt` then `id` descending.\n * The cursor is exclusive and filter-bound. `from` is inclusive and `to` exclusive.\n *\n * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS`, `INVALID_CURSOR`,\n * `CURSOR_FILTER_MISMATCH`, `RANGE_TOO_LARGE`, or `BAD_REQUEST` on invalid input, and\n * `WALLET_NOT_FOUND` when the address has no wallet data.\n */\n async getWalletTrades(\n params: GetNuanzeWalletTradesParams,\n ): Promise<GetNuanzeWalletTradesResponse> {\n const { address, ...query } = params;\n return mapNuanzeWalletTradesResponse(\n await this.getJson<NuanzeServerWalletTradesResponse>(\n `/wallets/${encodeURIComponent(address)}/trades`,\n query,\n ),\n );\n }\n\n /**\n * Gets wallet account PnL. 24h is rolling and uses hourly snapshots with a daily fallback\n * baseline. Longer windows use daily snapshots; `all` starts at earliest coverage. PnL includes\n * realized and unrealized movement plus funding.\n *\n * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,\n * and `WALLET_NOT_FOUND` when the address has no wallet data.\n */\n async getWalletPnl(\n params: GetNuanzeWalletPnlParams,\n ): Promise<GetNuanzeWalletPnlResponse> {\n const { address, ...query } = params;\n return mapNuanzeWalletPnlResponse(\n await this.getJson<NuanzeServerWalletPnlResponse>(\n `/wallets/${encodeURIComponent(address)}/pnl`,\n query,\n ),\n );\n }\n\n /**\n * Gets a wallet account series of at most 1,000 deterministically sampled points ordered by\n * timestamp. Series contain a boundary anchor and a carried-forward request-time tip; synthetic\n * points are identified. Latest buckets may be provisional.\n *\n * @throws {NuanzeServerFailureError} With `INVALID_ADDRESS` or `BAD_REQUEST` on invalid input,\n * and `WALLET_NOT_FOUND` when the address has no wallet data.\n */\n async getWalletPnlSeries(\n params: GetNuanzeWalletPnlSeriesParams,\n ): Promise<GetNuanzeWalletPnlSeriesResponse> {\n const { address, ...query } = params;\n return mapNuanzeWalletPnlSeriesResponse(\n await this.getJson<NuanzeServerWalletPnlSeriesResponse>(\n `/wallets/${encodeURIComponent(address)}/pnl/series`,\n query,\n ),\n );\n }\n\n /**\n * Lists public collateral events, sorted by timestamp then `id` descending. Repeated `productId`\n * uses OR semantics. `minUsd` excludes unvalued events; without it unvalued events remain.\n *\n * @throws {NuanzeServerFailureError} With `BAD_REQUEST`, `INVALID_CURSOR`, or\n * `CURSOR_FILTER_MISMATCH` when filters or the cursor are invalid.\n */\n async getCollateralFlows(\n params: GetNuanzeCollateralFlowsParams = {},\n ): Promise<GetNuanzeCollateralFlowsResponse> {\n return mapNuanzeCollateralFlowsResponse(\n await this.getJson<NuanzeServerCollateralFlowsResponse>('/flows', params),\n );\n }\n\n /**\n * Gets collateral flow aggregates: deposited, withdrawn, net, and gross, with valuation coverage\n * and a prior equal-window comparison. `all` has no prior window.\n *\n * @throws {NuanzeServerFailureError} With `BAD_REQUEST` if a filter value is invalid.\n */\n async getCollateralFlowSummary(\n params: GetNuanzeCollateralFlowSummaryParams = {},\n ): Promise<GetNuanzeCollateralFlowSummaryResponse> {\n return mapNuanzeCollateralFlowSummaryResponse(\n await this.getJson<NuanzeServerCollateralFlowSummaryResponse>(\n '/flows/summary',\n params,\n ),\n );\n }\n\n /**\n * Gets collateral flow series of at most 1,000 UTC buckets. Allowed timeframe/bucket pairs are\n * 24h/hour, 7d/hour or day (default hour), 30d/day, and all/day.\n *\n * @throws {NuanzeServerFailureError} With `UNSUPPORTED_BUCKET` or `BAD_REQUEST` when the pair or\n * filters are invalid.\n */\n async getCollateralFlowSeries(\n params: GetNuanzeCollateralFlowSeriesParams = {},\n ): Promise<GetNuanzeCollateralFlowSeriesResponse> {\n return mapNuanzeCollateralFlowSeriesResponse(\n await this.getJson<NuanzeServerCollateralFlowSeriesResponse>(\n '/flows/series',\n params,\n ),\n );\n }\n\n /**\n * Gets privacy-preserving aggregate positioning for an active perpetual. Cross and isolated legs\n * are summed within owner/subaccount/product before direction classification. Every cell requires\n * at least 20 distinct contributing owners. No identity, individual position, entry price, PnL,\n * margin, or leverage fields are returned. This operation costs five rate-limit units.\n *\n * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`, or\n * `BAD_REQUEST` on invalid input, and `MARKET_NOT_FOUND` when the ticker does not resolve to a\n * perp.\n */\n async getMarketPositioning(\n params: GetNuanzeMarketPositioningParams,\n ): Promise<GetNuanzeMarketPositioningResponse> {\n const { ticker, ...query } = params;\n return mapNuanzeMarketPositioningResponse(\n await this.getJson<NuanzeServerMarketPositioningResponse>(\n `/markets/${encodeURIComponent(ticker)}/positioning`,\n query,\n ),\n );\n }\n\n /**\n * Lists open perpetual position legs for the resolved market. Results default to absolute\n * notional descending and can be ordered by signed unrealized PnL or absolute base amount in\n * either direction. Spot markets are not supported. Legs below $10 absolute notional are excluded.\n * Wallet addresses and signed exact base amounts are returned.\n *\n * @throws {NuanzeServerFailureError} With `AMBIGUOUS_MARKET`, `MARKET_SELECTOR_MISMATCH`,\n * `INVALID_CURSOR`, `CURSOR_FILTER_MISMATCH`, or `BAD_REQUEST` on invalid input, and\n * `MARKET_NOT_FOUND` when the ticker does not resolve to a perp.\n */\n async getMarketPositions(\n params: GetNuanzeMarketPositionsParams,\n ): Promise<GetNuanzeMarketPositionsResponse> {\n const { ticker, ...query } = params;\n return mapNuanzeMarketPositionsResponse(\n await this.getJson<NuanzeServerMarketPositionsResponse>(\n `/markets/${encodeURIComponent(ticker)}/positions`,\n query,\n ),\n );\n }\n\n /**\n * Lists current open perpetual position legs across every market by signed unrealized PnL.\n * Descending returns the largest gainers and ascending returns the largest losers. This is a\n * latest indexed snapshot with no timeframe. Legs below $10 absolute notional are excluded.\n * Each row includes market identity and its source snapshot timestamp. Costs five rate-limit\n * units.\n *\n * @throws {NuanzeServerFailureError} With `INVALID_CURSOR`, `CURSOR_FILTER_MISMATCH`, or\n * `BAD_REQUEST` when the query or cursor is invalid.\n */\n async getOpenPositions(\n params: GetNuanzeOpenPositionsParams = {},\n ): Promise<GetNuanzeOpenPositionsResponse> {\n return mapNuanzeOpenPositionsResponse(\n await this.getJson<NuanzeServerOpenPositionsResponse>(\n '/positions',\n params,\n ),\n );\n }\n\n /**\n * Performs a GET against `{baseUrl}{path}` and classifies the status before returning the body.\n */\n private async getJson<T>(path: string, params?: object): Promise<T> {\n return this.requestJson<T>('GET', path, { params });\n }\n\n /**\n * Performs a POST against `{baseUrl}{path}` with a JSON body and classifies the status before\n * returning the response. Used only for the non-mutating followed-leaderboard operation.\n */\n private async postJson<T>(path: string, data: object): Promise<T> {\n return this.requestJson<T>('POST', path, { data });\n }\n\n private async requestJson<T>(\n method: 'GET' | 'POST',\n path: string,\n config: { params?: object; data?: object } = {},\n ): Promise<T> {\n const response = await this.axiosInstance.request<T>({\n method,\n url: `${this.opts.url}${path}`,\n ...config,\n });\n this.checkResponseStatus(response);\n return response.data;\n }\n\n /**\n * Validates the HTTP status before interpreting the body. Nuanze maps every domain failure onto a\n * non-2xx status carrying a failure envelope, so anything else is a transport-level error.\n */\n private checkResponseStatus(response: AxiosResponse<unknown>) {\n if (response.status >= 200 && response.status < 300) {\n return;\n }\n if (isNuanzeServerFailureResponse(response.data)) {\n throw new NuanzeServerFailureError(response.data, response.status);\n }\n throw new Error(\n `Unexpected response from Nuanze: ${response.status} ${response.statusText}. Data: ${JSON.stringify(response.data)}`,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F;AACF"}
@@ -0,0 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_NuanzeClient = require("./NuanzeClient-BUjoXpWV.cjs");
3
+ require("./dataMappers.cjs");
4
+ exports.NuanzeClient = require_NuanzeClient.NuanzeClient;