@crypticdot/defituna-api 1.10.16 → 3.0.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.
package/dist/index.cjs ADDED
@@ -0,0 +1,1718 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/index.ts
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ LeaderboardPeriod: () => LeaderboardPeriod,
23
+ LeaderboardSortBy: () => LeaderboardSortBy,
24
+ LimitOrderStatus: () => LimitOrderStatus,
25
+ LpPositionsHistoryQueryFilter: () => LpPositionsHistoryQueryFilter,
26
+ NotificationAction: () => NotificationAction,
27
+ NotificationEntity: () => NotificationEntity,
28
+ OrderHistoryStatus: () => OrderHistoryStatus,
29
+ OrderHistoryType: () => OrderHistoryType,
30
+ OrderHistoryUIDirection: () => OrderHistoryUIDirection,
31
+ PoolProvider: () => PoolProvider,
32
+ PoolSubscriptionTopic: () => PoolSubscriptionTopic,
33
+ StakingPositionActionType: () => StakingPositionActionType,
34
+ TradeHistoryAction: () => TradeHistoryAction,
35
+ TradeHistoryUIDirection: () => TradeHistoryUIDirection,
36
+ TunaLpPositionAutoCompound: () => TunaLpPositionAutoCompound,
37
+ TunaLpPositionAutoCompounding: () => TunaLpPositionAutoCompounding,
38
+ TunaLpPositionLimitOrderSwap: () => TunaLpPositionLimitOrderSwap,
39
+ TunaLpPositionRebalance: () => TunaLpPositionRebalance,
40
+ TunaLpPositionsActionType: () => TunaLpPositionsActionType,
41
+ TunaPositionDtoState: () => TunaPositionDtoState,
42
+ TunaPositionMarketMaker: () => TunaPositionMarketMaker,
43
+ TunaPositionPoolToken: () => TunaPositionPoolToken,
44
+ TunaSpotPositionDtoState: () => TunaSpotPositionDtoState,
45
+ WalletSubscriptionTopic: () => WalletSubscriptionTopic,
46
+ eventIsInitialMessage: () => eventIsInitialMessage,
47
+ eventIsLendingPosition: () => eventIsLendingPosition,
48
+ eventIsOrderHistory: () => eventIsOrderHistory,
49
+ eventIsPoolSwap: () => eventIsPoolSwap,
50
+ eventIsStakingPosition: () => eventIsStakingPosition,
51
+ eventIsStateSnapshot: () => eventIsStateSnapshot,
52
+ eventIsTradeHistory: () => eventIsTradeHistory,
53
+ getCloseSpotPositionQuote: () => getCloseSpotPositionQuote,
54
+ getDecreaseSpotPositionQuote: () => getDecreaseSpotPositionQuote,
55
+ getFeesStats: () => getFeesStats,
56
+ getFusionFeesStats: () => getFusionFeesStats,
57
+ getGetCloseSpotPositionQuoteUrl: () => getGetCloseSpotPositionQuoteUrl,
58
+ getGetDecreaseSpotPositionQuoteUrl: () => getGetDecreaseSpotPositionQuoteUrl,
59
+ getGetFeesStatsUrl: () => getGetFeesStatsUrl,
60
+ getGetFusionFeesStatsUrl: () => getGetFusionFeesStatsUrl,
61
+ getGetIncreaseSpotPositionQuoteUrl: () => getGetIncreaseSpotPositionQuoteUrl,
62
+ getGetLendingPositionUrl: () => getGetLendingPositionUrl,
63
+ getGetLendingPositionsUrl: () => getGetLendingPositionsUrl,
64
+ getGetLimitOrderQuoteByInputUrl: () => getGetLimitOrderQuoteByInputUrl,
65
+ getGetLimitOrderQuoteByOutputUrl: () => getGetLimitOrderQuoteByOutputUrl,
66
+ getGetLimitOrderUrl: () => getGetLimitOrderUrl,
67
+ getGetLimitOrdersUrl: () => getGetLimitOrdersUrl,
68
+ getGetLpPositionActionsUrl: () => getGetLpPositionActionsUrl,
69
+ getGetLpPositionsUrl: () => getGetLpPositionsUrl,
70
+ getGetLpSpotLeaderboardUrl: () => getGetLpSpotLeaderboardUrl,
71
+ getGetMarketUrl: () => getGetMarketUrl,
72
+ getGetMarketsUrl: () => getGetMarketsUrl,
73
+ getGetMintUrl: () => getGetMintUrl,
74
+ getGetMintsUrl: () => getGetMintsUrl,
75
+ getGetOraclePriceUrl: () => getGetOraclePriceUrl,
76
+ getGetOraclePricesUrl: () => getGetOraclePricesUrl,
77
+ getGetOrderHistoryUrl: () => getGetOrderHistoryUrl,
78
+ getGetPoolCandlesUrl: () => getGetPoolCandlesUrl,
79
+ getGetPoolOrderBookUrl: () => getGetPoolOrderBookUrl,
80
+ getGetPoolSwapsUrl: () => getGetPoolSwapsUrl,
81
+ getGetPoolTicksUrl: () => getGetPoolTicksUrl,
82
+ getGetPoolUrl: () => getGetPoolUrl,
83
+ getGetPoolsUrl: () => getGetPoolsUrl,
84
+ getGetPositionsStatsUrl: () => getGetPositionsStatsUrl,
85
+ getGetPositionsTotalUrl: () => getGetPositionsTotalUrl,
86
+ getGetSpotPositionUrl: () => getGetSpotPositionUrl,
87
+ getGetSpotPositionsUrl: () => getGetSpotPositionsUrl,
88
+ getGetStakingLeaderboardUrl: () => getGetStakingLeaderboardUrl,
89
+ getGetStakingRevenueStatsUrl: () => getGetStakingRevenueStatsUrl,
90
+ getGetStakingTreasuryUrl: () => getGetStakingTreasuryUrl,
91
+ getGetSwapQuoteByInputUrl: () => getGetSwapQuoteByInputUrl,
92
+ getGetSwapQuoteByOutputUrl: () => getGetSwapQuoteByOutputUrl,
93
+ getGetTradableAmountUrl: () => getGetTradableAmountUrl,
94
+ getGetTradeHistoryUrl: () => getGetTradeHistoryUrl,
95
+ getGetTunaPositionUrl: () => getGetTunaPositionUrl,
96
+ getGetTunaPositionsUrl: () => getGetTunaPositionsUrl,
97
+ getGetUserStakingPositionHistoryUrl: () => getGetUserStakingPositionHistoryUrl,
98
+ getGetUserStakingPositionUrl: () => getGetUserStakingPositionUrl,
99
+ getGetVaultHistoryUrl: () => getGetVaultHistoryUrl,
100
+ getGetVaultUrl: () => getGetVaultUrl,
101
+ getGetVaultsUrl: () => getGetVaultsUrl,
102
+ getIncreaseSpotPositionQuote: () => getIncreaseSpotPositionQuote,
103
+ getLendingPosition: () => getLendingPosition,
104
+ getLendingPositions: () => getLendingPositions,
105
+ getLimitOrder: () => getLimitOrder,
106
+ getLimitOrderQuoteByInput: () => getLimitOrderQuoteByInput,
107
+ getLimitOrderQuoteByOutput: () => getLimitOrderQuoteByOutput,
108
+ getLimitOrders: () => getLimitOrders,
109
+ getLpPositionActions: () => getLpPositionActions,
110
+ getLpPositions: () => getLpPositions,
111
+ getLpSpotLeaderboard: () => getLpSpotLeaderboard,
112
+ getMarket: () => getMarket,
113
+ getMarkets: () => getMarkets,
114
+ getMint: () => getMint,
115
+ getMints: () => getMints,
116
+ getOraclePrice: () => getOraclePrice,
117
+ getOraclePrices: () => getOraclePrices,
118
+ getOrderHistory: () => getOrderHistory,
119
+ getPool: () => getPool,
120
+ getPoolCandles: () => getPoolCandles,
121
+ getPoolOrderBook: () => getPoolOrderBook,
122
+ getPoolSwaps: () => getPoolSwaps,
123
+ getPoolTicks: () => getPoolTicks,
124
+ getPools: () => getPools,
125
+ getPositionsStats: () => getPositionsStats,
126
+ getPositionsTotal: () => getPositionsTotal,
127
+ getSpotPosition: () => getSpotPosition,
128
+ getSpotPositions: () => getSpotPositions,
129
+ getSseUpdatesStream: () => getSseUpdatesStream,
130
+ getSseUrl: () => getSseUrl,
131
+ getStakingLeaderboard: () => getStakingLeaderboard,
132
+ getStakingRevenueStats: () => getStakingRevenueStats,
133
+ getStakingTreasury: () => getStakingTreasury,
134
+ getSwapQuoteByInput: () => getSwapQuoteByInput,
135
+ getSwapQuoteByOutput: () => getSwapQuoteByOutput,
136
+ getTradableAmount: () => getTradableAmount,
137
+ getTradeHistory: () => getTradeHistory,
138
+ getTunaPosition: () => getTunaPosition,
139
+ getTunaPositions: () => getTunaPositions,
140
+ getUpdateStreamSubscriptionUrl: () => getUpdateStreamSubscriptionUrl,
141
+ getUserStakingPosition: () => getUserStakingPosition,
142
+ getUserStakingPositionHistory: () => getUserStakingPositionHistory,
143
+ getVault: () => getVault,
144
+ getVaultHistory: () => getVaultHistory,
145
+ getVaults: () => getVaults,
146
+ setTunaBaseUrl: () => setTunaBaseUrl,
147
+ sse: () => sse,
148
+ unwrap: () => unwrap,
149
+ updateStreamSubscription: () => updateStreamSubscription
150
+ });
151
+ module.exports = __toCommonJS(index_exports);
152
+
153
+ // src/baseUrl.ts
154
+ var baseUrl = "https://api.defituna.com/api";
155
+ function setTunaBaseUrl(url) {
156
+ baseUrl = url.replace(/\/$/, "");
157
+ }
158
+ function resolveTunaUrl(url, init) {
159
+ const resolvedBaseUrl = init?.baseUrl?.replace(/\/$/, "") ?? baseUrl;
160
+ const fullUrl = resolvedBaseUrl && !url.startsWith("http") ? `${resolvedBaseUrl}${url.startsWith("/") ? "" : "/"}${url}` : url;
161
+ return fullUrl;
162
+ }
163
+
164
+ // src/customFetch.ts
165
+ var snakeToCamel = (s) => s.replace(/_([a-z0-9])/g, (_, c) => c.toUpperCase());
166
+ var camelToSnake = (s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`);
167
+ var isPlainObject = (v) => !!v && typeof v === "object" && Object.getPrototypeOf(v) === Object.prototype;
168
+ function mapKeysDeep(value, keyMap, onValue) {
169
+ const patched = onValue ? onValue(value) : value;
170
+ if (Array.isArray(patched)) {
171
+ return patched.map((x, _i) => mapKeysDeep(x, keyMap, onValue));
172
+ }
173
+ if (isPlainObject(patched)) {
174
+ const out = {};
175
+ for (const [k, v] of Object.entries(patched)) {
176
+ const nk = keyMap(k);
177
+ out[nk] = mapKeysDeep(v, keyMap, onValue);
178
+ }
179
+ return out;
180
+ }
181
+ return patched;
182
+ }
183
+ var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
184
+ var INT_STRING_RE = /^-?\d+$/;
185
+ function reviveScalars(v) {
186
+ if (typeof v !== "string") return v;
187
+ if (ISO_DATE_RE.test(v)) {
188
+ const d = new Date(v);
189
+ if (!Number.isNaN(d.getTime())) return d;
190
+ }
191
+ if (INT_STRING_RE.test(v)) {
192
+ try {
193
+ return BigInt(v);
194
+ } catch {
195
+ }
196
+ }
197
+ return v;
198
+ }
199
+ function normalizeResponseJson(raw) {
200
+ const revived = mapKeysDeep(raw, (k) => k, reviveScalars);
201
+ return mapKeysDeep(revived, snakeToCamel);
202
+ }
203
+ function normalizeRequestBody(body) {
204
+ return mapKeysDeep(body, camelToSnake);
205
+ }
206
+ function modifyQuery(url) {
207
+ const u = new URL(url);
208
+ const params = u.searchParams;
209
+ const grouped = /* @__PURE__ */ new Map();
210
+ for (const [key, value] of params.entries()) {
211
+ if (!grouped.has(key)) {
212
+ grouped.set(key, []);
213
+ }
214
+ grouped.get(key).push(value);
215
+ }
216
+ const newParams = new URLSearchParams();
217
+ for (const [key, values] of grouped.entries()) {
218
+ const snakeKey = camelToSnake(key);
219
+ newParams.set(snakeKey, values.join(","));
220
+ }
221
+ u.search = newParams.toString();
222
+ return u.toString();
223
+ }
224
+ async function customFetch(url, init) {
225
+ const fullUrl = resolveTunaUrl(url, init);
226
+ const finalInit = { ...init };
227
+ if (finalInit.body && typeof finalInit.body === "object" && !(finalInit.body instanceof FormData)) {
228
+ const snaked = normalizeRequestBody(finalInit.body);
229
+ finalInit.body = JSON.stringify(snaked);
230
+ finalInit.headers = {
231
+ "content-type": "application/json",
232
+ ...finalInit.headers || {}
233
+ };
234
+ }
235
+ const fullUrlWithQuery = modifyQuery(fullUrl);
236
+ const res = await fetch(fullUrlWithQuery, finalInit);
237
+ const text = await res.text();
238
+ let data = void 0;
239
+ try {
240
+ const raw = JSON.parse(text);
241
+ data = normalizeResponseJson(raw);
242
+ } catch {
243
+ }
244
+ return { status: res.status, data };
245
+ }
246
+
247
+ // src/gen/defiTunaAPI.ts
248
+ var LeaderboardPeriod = {
249
+ week: "week"
250
+ };
251
+ var LeaderboardSortBy = {
252
+ profit: "profit",
253
+ percent: "percent"
254
+ };
255
+ var LimitOrderStatus = {
256
+ open: "open",
257
+ partiallyFilled: "partially_filled",
258
+ filled: "filled",
259
+ complete: "complete",
260
+ cancelled: "cancelled"
261
+ };
262
+ var LpPositionsHistoryQueryFilter = {
263
+ opened: "opened",
264
+ closed: "closed",
265
+ all: "all"
266
+ };
267
+ var NotificationAction = {
268
+ create: "create",
269
+ update: "update"
270
+ };
271
+ var NotificationEntity = {
272
+ initialMessage: "initial_message",
273
+ poolSwap: "pool_swap",
274
+ orderBook: "order_book",
275
+ oraclePrice: "oracle_price",
276
+ market: "market",
277
+ tunaPosition: "tuna_position",
278
+ tunaSpotPosition: "tuna_spot_position",
279
+ stakingPosition: "staking_position",
280
+ lendingPosition: "lending_position",
281
+ fusionLimitOrder: "fusion_limit_order",
282
+ tradeHistoryEntry: "trade_history_entry",
283
+ orderHistoryEntry: "order_history_entry",
284
+ stateSnapshot: "state_snapshot"
285
+ };
286
+ var OrderHistoryStatus = {
287
+ open: "open",
288
+ partiallyFilled: "partially_filled",
289
+ filled: "filled",
290
+ cancelled: "cancelled",
291
+ claimed: "claimed",
292
+ rejected: "rejected"
293
+ };
294
+ var OrderHistoryType = {
295
+ market: "market",
296
+ limit: "limit",
297
+ takeProfitMarket: "take_profit_market",
298
+ stopLossMarket: "stop_loss_market",
299
+ liquidationMarket: "liquidation_market"
300
+ };
301
+ var OrderHistoryUIDirection = {
302
+ buy: "buy",
303
+ sell: "sell",
304
+ long: "long",
305
+ short: "short"
306
+ };
307
+ var PoolProvider = {
308
+ orca: "orca",
309
+ fusion: "fusion"
310
+ };
311
+ var PoolSubscriptionTopic = {
312
+ poolSwaps: "pool_swaps",
313
+ orderBook: "order_book",
314
+ poolPrices: "pool_prices"
315
+ };
316
+ var StakingPositionActionType = {
317
+ stake: "stake",
318
+ unstake: "unstake",
319
+ withdraw: "withdraw",
320
+ claimRewards: "claim_rewards",
321
+ compoundRewards: "compound_rewards"
322
+ };
323
+ var TradeHistoryAction = {
324
+ swap: "swap",
325
+ limitOrderFill: "limit_order_fill",
326
+ positionIncrease: "position_increase",
327
+ positionDecrease: "position_decrease",
328
+ takeProfit: "take_profit",
329
+ stopLoss: "stop_loss",
330
+ liquidation: "liquidation"
331
+ };
332
+ var TradeHistoryUIDirection = {
333
+ buy: "buy",
334
+ sell: "sell",
335
+ openLong: "open_long",
336
+ closeLong: "close_long",
337
+ openShort: "open_short",
338
+ closeShort: "close_short"
339
+ };
340
+ var TunaLpPositionAutoCompound = {
341
+ noAutoCompound: "no_auto_compound",
342
+ autoCompound: "auto_compound",
343
+ autoCompoundWithLeverage: "auto_compound_with_leverage"
344
+ };
345
+ var TunaLpPositionAutoCompounding = {
346
+ withLeverage: "with_leverage",
347
+ withoutLeverage: "without_leverage"
348
+ };
349
+ var TunaLpPositionLimitOrderSwap = {
350
+ noSwap: "no_swap",
351
+ swapToTokenA: "swap_to_token_a",
352
+ swapToTokenB: "swap_to_token_b"
353
+ };
354
+ var TunaLpPositionRebalance = {
355
+ noRebalance: "no_rebalance",
356
+ autoRebalance: "auto_rebalance"
357
+ };
358
+ var TunaLpPositionsActionType = {
359
+ openPosition: "open_position",
360
+ closePosition: "close_position",
361
+ increaseLiquidity: "increase_liquidity",
362
+ decreaseLiquidity: "decrease_liquidity",
363
+ repayDebt: "repay_debt",
364
+ liquidate: "liquidate",
365
+ executeLimitOrder: "execute_limit_order",
366
+ collectFees: "collect_fees",
367
+ collectRewards: "collect_rewards",
368
+ collectAndCompoundFees: "collect_and_compound_fees",
369
+ rebalancePosition: "rebalance_position",
370
+ setLimitOrders: "set_limit_orders",
371
+ setFlags: "set_flags",
372
+ setRebalanceThreshold: "set_rebalance_threshold"
373
+ };
374
+ var TunaPositionDtoState = {
375
+ open: "open",
376
+ liquidated: "liquidated",
377
+ closedByLimitOrder: "closed_by_limit_order",
378
+ closed: "closed"
379
+ };
380
+ var TunaPositionMarketMaker = {
381
+ fusion: "fusion",
382
+ orca: "orca"
383
+ };
384
+ var TunaPositionPoolToken = {
385
+ a: "a",
386
+ b: "b"
387
+ };
388
+ var TunaSpotPositionDtoState = {
389
+ open: "open",
390
+ closed: "closed"
391
+ };
392
+ var WalletSubscriptionTopic = {
393
+ tunaPositions: "tuna_positions",
394
+ tunaSpotPositions: "tuna_spot_positions",
395
+ lendingPositions: "lending_positions",
396
+ fusionLimitOrders: "fusion_limit_orders",
397
+ stakingPosition: "staking_position",
398
+ tradeHistory: "trade_history",
399
+ orderHistory: "order_history"
400
+ };
401
+ var getGetLpSpotLeaderboardUrl = (params) => {
402
+ const normalizedParams = new URLSearchParams();
403
+ Object.entries(params || {}).forEach(([key, value]) => {
404
+ if (value !== void 0) {
405
+ normalizedParams.append(key, value === null ? "null" : value.toString());
406
+ }
407
+ });
408
+ const stringifiedParams = normalizedParams.toString();
409
+ return stringifiedParams.length > 0 ? `/v1/lp-spot-leaderboard?${stringifiedParams}` : `/v1/lp-spot-leaderboard`;
410
+ };
411
+ var getLpSpotLeaderboard = async (params, options) => {
412
+ return customFetch(
413
+ getGetLpSpotLeaderboardUrl(params),
414
+ {
415
+ ...options,
416
+ method: "GET"
417
+ }
418
+ );
419
+ };
420
+ var getGetMarketsUrl = () => {
421
+ return `/v1/markets`;
422
+ };
423
+ var getMarkets = async (options) => {
424
+ return customFetch(
425
+ getGetMarketsUrl(),
426
+ {
427
+ ...options,
428
+ method: "GET"
429
+ }
430
+ );
431
+ };
432
+ var getGetMarketUrl = (marketAddress) => {
433
+ return `/v1/markets/${marketAddress}`;
434
+ };
435
+ var getMarket = async (marketAddress, options) => {
436
+ return customFetch(
437
+ getGetMarketUrl(marketAddress),
438
+ {
439
+ ...options,
440
+ method: "GET"
441
+ }
442
+ );
443
+ };
444
+ var getGetMintsUrl = () => {
445
+ return `/v1/mints`;
446
+ };
447
+ var getMints = async (options) => {
448
+ return customFetch(
449
+ getGetMintsUrl(),
450
+ {
451
+ ...options,
452
+ method: "GET"
453
+ }
454
+ );
455
+ };
456
+ var getGetMintUrl = (mintAddress) => {
457
+ return `/v1/mints/${mintAddress}`;
458
+ };
459
+ var getMint = async (mintAddress, options) => {
460
+ return customFetch(
461
+ getGetMintUrl(mintAddress),
462
+ {
463
+ ...options,
464
+ method: "GET"
465
+ }
466
+ );
467
+ };
468
+ var getGetOraclePricesUrl = () => {
469
+ return `/v1/oracle-prices`;
470
+ };
471
+ var getOraclePrices = async (options) => {
472
+ return customFetch(
473
+ getGetOraclePricesUrl(),
474
+ {
475
+ ...options,
476
+ method: "GET"
477
+ }
478
+ );
479
+ };
480
+ var getGetOraclePriceUrl = (mintAddress) => {
481
+ return `/v1/oracle-prices/${mintAddress}`;
482
+ };
483
+ var getOraclePrice = async (mintAddress, options) => {
484
+ return customFetch(
485
+ getGetOraclePriceUrl(mintAddress),
486
+ {
487
+ ...options,
488
+ method: "GET"
489
+ }
490
+ );
491
+ };
492
+ var getGetPoolsUrl = (params) => {
493
+ const normalizedParams = new URLSearchParams();
494
+ Object.entries(params || {}).forEach(([key, value]) => {
495
+ if (value !== void 0) {
496
+ normalizedParams.append(key, value === null ? "null" : value.toString());
497
+ }
498
+ });
499
+ const stringifiedParams = normalizedParams.toString();
500
+ return stringifiedParams.length > 0 ? `/v1/pools?${stringifiedParams}` : `/v1/pools`;
501
+ };
502
+ var getPools = async (params, options) => {
503
+ return customFetch(
504
+ getGetPoolsUrl(params),
505
+ {
506
+ ...options,
507
+ method: "GET"
508
+ }
509
+ );
510
+ };
511
+ var getGetPoolUrl = (poolAddress) => {
512
+ return `/v1/pools/${poolAddress}`;
513
+ };
514
+ var getPool = async (poolAddress, options) => {
515
+ return customFetch(
516
+ getGetPoolUrl(poolAddress),
517
+ {
518
+ ...options,
519
+ method: "GET"
520
+ }
521
+ );
522
+ };
523
+ var getGetPoolCandlesUrl = (poolAddress, params) => {
524
+ const normalizedParams = new URLSearchParams();
525
+ Object.entries(params || {}).forEach(([key, value]) => {
526
+ if (value !== void 0) {
527
+ normalizedParams.append(key, value === null ? "null" : value instanceof Date ? value.toISOString() : value.toString());
528
+ }
529
+ });
530
+ const stringifiedParams = normalizedParams.toString();
531
+ return stringifiedParams.length > 0 ? `/v1/pools/${poolAddress}/candles?${stringifiedParams}` : `/v1/pools/${poolAddress}/candles`;
532
+ };
533
+ var getPoolCandles = async (poolAddress, params, options) => {
534
+ return customFetch(
535
+ getGetPoolCandlesUrl(poolAddress, params),
536
+ {
537
+ ...options,
538
+ method: "GET"
539
+ }
540
+ );
541
+ };
542
+ var getGetPoolOrderBookUrl = (poolAddress, params) => {
543
+ const normalizedParams = new URLSearchParams();
544
+ Object.entries(params || {}).forEach(([key, value]) => {
545
+ if (value !== void 0) {
546
+ normalizedParams.append(key, value === null ? "null" : value.toString());
547
+ }
548
+ });
549
+ const stringifiedParams = normalizedParams.toString();
550
+ return stringifiedParams.length > 0 ? `/v1/pools/${poolAddress}/order-book?${stringifiedParams}` : `/v1/pools/${poolAddress}/order-book`;
551
+ };
552
+ var getPoolOrderBook = async (poolAddress, params, options) => {
553
+ return customFetch(
554
+ getGetPoolOrderBookUrl(poolAddress, params),
555
+ {
556
+ ...options,
557
+ method: "GET"
558
+ }
559
+ );
560
+ };
561
+ var getGetPoolSwapsUrl = (poolAddress) => {
562
+ return `/v1/pools/${poolAddress}/swaps`;
563
+ };
564
+ var getPoolSwaps = async (poolAddress, options) => {
565
+ return customFetch(
566
+ getGetPoolSwapsUrl(poolAddress),
567
+ {
568
+ ...options,
569
+ method: "GET"
570
+ }
571
+ );
572
+ };
573
+ var getGetPoolTicksUrl = (poolAddress) => {
574
+ return `/v1/pools/${poolAddress}/ticks`;
575
+ };
576
+ var getPoolTicks = async (poolAddress, options) => {
577
+ return customFetch(
578
+ getGetPoolTicksUrl(poolAddress),
579
+ {
580
+ ...options,
581
+ method: "GET"
582
+ }
583
+ );
584
+ };
585
+ var getGetCloseSpotPositionQuoteUrl = (params) => {
586
+ const normalizedParams = new URLSearchParams();
587
+ Object.entries(params || {}).forEach(([key, value]) => {
588
+ if (value !== void 0) {
589
+ normalizedParams.append(key, value === null ? "null" : value.toString());
590
+ }
591
+ });
592
+ const stringifiedParams = normalizedParams.toString();
593
+ return stringifiedParams.length > 0 ? `/v1/quotes/close-spot-position?${stringifiedParams}` : `/v1/quotes/close-spot-position`;
594
+ };
595
+ var getCloseSpotPositionQuote = async (params, options) => {
596
+ return customFetch(
597
+ getGetCloseSpotPositionQuoteUrl(params),
598
+ {
599
+ ...options,
600
+ method: "GET"
601
+ }
602
+ );
603
+ };
604
+ var getGetDecreaseSpotPositionQuoteUrl = (params) => {
605
+ const normalizedParams = new URLSearchParams();
606
+ Object.entries(params || {}).forEach(([key, value]) => {
607
+ if (value !== void 0) {
608
+ normalizedParams.append(key, value === null ? "null" : value.toString());
609
+ }
610
+ });
611
+ const stringifiedParams = normalizedParams.toString();
612
+ return stringifiedParams.length > 0 ? `/v1/quotes/decrease-spot-position?${stringifiedParams}` : `/v1/quotes/decrease-spot-position`;
613
+ };
614
+ var getDecreaseSpotPositionQuote = async (params, options) => {
615
+ return customFetch(
616
+ getGetDecreaseSpotPositionQuoteUrl(params),
617
+ {
618
+ ...options,
619
+ method: "GET"
620
+ }
621
+ );
622
+ };
623
+ var getGetIncreaseSpotPositionQuoteUrl = (params) => {
624
+ const normalizedParams = new URLSearchParams();
625
+ Object.entries(params || {}).forEach(([key, value]) => {
626
+ if (value !== void 0) {
627
+ normalizedParams.append(key, value === null ? "null" : value.toString());
628
+ }
629
+ });
630
+ const stringifiedParams = normalizedParams.toString();
631
+ return stringifiedParams.length > 0 ? `/v1/quotes/increase-spot-position?${stringifiedParams}` : `/v1/quotes/increase-spot-position`;
632
+ };
633
+ var getIncreaseSpotPositionQuote = async (params, options) => {
634
+ return customFetch(
635
+ getGetIncreaseSpotPositionQuoteUrl(params),
636
+ {
637
+ ...options,
638
+ method: "GET"
639
+ }
640
+ );
641
+ };
642
+ var getGetLimitOrderQuoteByInputUrl = (params) => {
643
+ const normalizedParams = new URLSearchParams();
644
+ Object.entries(params || {}).forEach(([key, value]) => {
645
+ if (value !== void 0) {
646
+ normalizedParams.append(key, value === null ? "null" : value.toString());
647
+ }
648
+ });
649
+ const stringifiedParams = normalizedParams.toString();
650
+ return stringifiedParams.length > 0 ? `/v1/quotes/limit-order-by-input?${stringifiedParams}` : `/v1/quotes/limit-order-by-input`;
651
+ };
652
+ var getLimitOrderQuoteByInput = async (params, options) => {
653
+ return customFetch(
654
+ getGetLimitOrderQuoteByInputUrl(params),
655
+ {
656
+ ...options,
657
+ method: "GET"
658
+ }
659
+ );
660
+ };
661
+ var getGetLimitOrderQuoteByOutputUrl = (params) => {
662
+ const normalizedParams = new URLSearchParams();
663
+ Object.entries(params || {}).forEach(([key, value]) => {
664
+ if (value !== void 0) {
665
+ normalizedParams.append(key, value === null ? "null" : value.toString());
666
+ }
667
+ });
668
+ const stringifiedParams = normalizedParams.toString();
669
+ return stringifiedParams.length > 0 ? `/v1/quotes/limit-order-by-output?${stringifiedParams}` : `/v1/quotes/limit-order-by-output`;
670
+ };
671
+ var getLimitOrderQuoteByOutput = async (params, options) => {
672
+ return customFetch(
673
+ getGetLimitOrderQuoteByOutputUrl(params),
674
+ {
675
+ ...options,
676
+ method: "GET"
677
+ }
678
+ );
679
+ };
680
+ var getGetSwapQuoteByInputUrl = (params) => {
681
+ const normalizedParams = new URLSearchParams();
682
+ Object.entries(params || {}).forEach(([key, value]) => {
683
+ if (value !== void 0) {
684
+ normalizedParams.append(key, value === null ? "null" : value.toString());
685
+ }
686
+ });
687
+ const stringifiedParams = normalizedParams.toString();
688
+ return stringifiedParams.length > 0 ? `/v1/quotes/swap-by-input?${stringifiedParams}` : `/v1/quotes/swap-by-input`;
689
+ };
690
+ var getSwapQuoteByInput = async (params, options) => {
691
+ return customFetch(
692
+ getGetSwapQuoteByInputUrl(params),
693
+ {
694
+ ...options,
695
+ method: "GET"
696
+ }
697
+ );
698
+ };
699
+ var getGetSwapQuoteByOutputUrl = (params) => {
700
+ const normalizedParams = new URLSearchParams();
701
+ Object.entries(params || {}).forEach(([key, value]) => {
702
+ if (value !== void 0) {
703
+ normalizedParams.append(key, value === null ? "null" : value.toString());
704
+ }
705
+ });
706
+ const stringifiedParams = normalizedParams.toString();
707
+ return stringifiedParams.length > 0 ? `/v1/quotes/swap-by-output?${stringifiedParams}` : `/v1/quotes/swap-by-output`;
708
+ };
709
+ var getSwapQuoteByOutput = async (params, options) => {
710
+ return customFetch(
711
+ getGetSwapQuoteByOutputUrl(params),
712
+ {
713
+ ...options,
714
+ method: "GET"
715
+ }
716
+ );
717
+ };
718
+ var getGetTradableAmountUrl = (params) => {
719
+ const normalizedParams = new URLSearchParams();
720
+ Object.entries(params || {}).forEach(([key, value]) => {
721
+ if (value !== void 0) {
722
+ normalizedParams.append(key, value === null ? "null" : value.toString());
723
+ }
724
+ });
725
+ const stringifiedParams = normalizedParams.toString();
726
+ return stringifiedParams.length > 0 ? `/v1/quotes/tradable-amount?${stringifiedParams}` : `/v1/quotes/tradable-amount`;
727
+ };
728
+ var getTradableAmount = async (params, options) => {
729
+ return customFetch(
730
+ getGetTradableAmountUrl(params),
731
+ {
732
+ ...options,
733
+ method: "GET"
734
+ }
735
+ );
736
+ };
737
+ var getGetStakingLeaderboardUrl = (params) => {
738
+ const normalizedParams = new URLSearchParams();
739
+ Object.entries(params || {}).forEach(([key, value]) => {
740
+ if (value !== void 0) {
741
+ normalizedParams.append(key, value === null ? "null" : value.toString());
742
+ }
743
+ });
744
+ const stringifiedParams = normalizedParams.toString();
745
+ return stringifiedParams.length > 0 ? `/v1/staking/leaderboard?${stringifiedParams}` : `/v1/staking/leaderboard`;
746
+ };
747
+ var getStakingLeaderboard = async (params, options) => {
748
+ return customFetch(
749
+ getGetStakingLeaderboardUrl(params),
750
+ {
751
+ ...options,
752
+ method: "GET"
753
+ }
754
+ );
755
+ };
756
+ var getGetStakingTreasuryUrl = () => {
757
+ return `/v1/staking/treasury`;
758
+ };
759
+ var getStakingTreasury = async (options) => {
760
+ return customFetch(
761
+ getGetStakingTreasuryUrl(),
762
+ {
763
+ ...options,
764
+ method: "GET"
765
+ }
766
+ );
767
+ };
768
+ var getGetFeesStatsUrl = (params) => {
769
+ const normalizedParams = new URLSearchParams();
770
+ Object.entries(params || {}).forEach(([key, value]) => {
771
+ if (value !== void 0) {
772
+ normalizedParams.append(key, value === null ? "null" : value instanceof Date ? value.toISOString() : value.toString());
773
+ }
774
+ });
775
+ const stringifiedParams = normalizedParams.toString();
776
+ return stringifiedParams.length > 0 ? `/v1/stats/fees?${stringifiedParams}` : `/v1/stats/fees`;
777
+ };
778
+ var getFeesStats = async (params, options) => {
779
+ return customFetch(
780
+ getGetFeesStatsUrl(params),
781
+ {
782
+ ...options,
783
+ method: "GET"
784
+ }
785
+ );
786
+ };
787
+ var getGetFusionFeesStatsUrl = (params) => {
788
+ const normalizedParams = new URLSearchParams();
789
+ Object.entries(params || {}).forEach(([key, value]) => {
790
+ if (value !== void 0) {
791
+ normalizedParams.append(key, value === null ? "null" : value instanceof Date ? value.toISOString() : value.toString());
792
+ }
793
+ });
794
+ const stringifiedParams = normalizedParams.toString();
795
+ return stringifiedParams.length > 0 ? `/v1/stats/fusion-fees?${stringifiedParams}` : `/v1/stats/fusion-fees`;
796
+ };
797
+ var getFusionFeesStats = async (params, options) => {
798
+ return customFetch(
799
+ getGetFusionFeesStatsUrl(params),
800
+ {
801
+ ...options,
802
+ method: "GET"
803
+ }
804
+ );
805
+ };
806
+ var getGetPositionsStatsUrl = (params) => {
807
+ const normalizedParams = new URLSearchParams();
808
+ Object.entries(params || {}).forEach(([key, value]) => {
809
+ if (value !== void 0) {
810
+ normalizedParams.append(key, value === null ? "null" : value instanceof Date ? value.toISOString() : value.toString());
811
+ }
812
+ });
813
+ const stringifiedParams = normalizedParams.toString();
814
+ return stringifiedParams.length > 0 ? `/v1/stats/positions?${stringifiedParams}` : `/v1/stats/positions`;
815
+ };
816
+ var getPositionsStats = async (params, options) => {
817
+ return customFetch(
818
+ getGetPositionsStatsUrl(params),
819
+ {
820
+ ...options,
821
+ method: "GET"
822
+ }
823
+ );
824
+ };
825
+ var getGetPositionsTotalUrl = () => {
826
+ return `/v1/stats/positions/total`;
827
+ };
828
+ var getPositionsTotal = async (options) => {
829
+ return customFetch(
830
+ getGetPositionsTotalUrl(),
831
+ {
832
+ ...options,
833
+ method: "GET"
834
+ }
835
+ );
836
+ };
837
+ var getGetStakingRevenueStatsUrl = (params) => {
838
+ const normalizedParams = new URLSearchParams();
839
+ Object.entries(params || {}).forEach(([key, value]) => {
840
+ if (value !== void 0) {
841
+ normalizedParams.append(key, value === null ? "null" : value.toString());
842
+ }
843
+ });
844
+ const stringifiedParams = normalizedParams.toString();
845
+ return stringifiedParams.length > 0 ? `/v1/stats/staking/revenue?${stringifiedParams}` : `/v1/stats/staking/revenue`;
846
+ };
847
+ var getStakingRevenueStats = async (params, options) => {
848
+ return customFetch(
849
+ getGetStakingRevenueStatsUrl(params),
850
+ {
851
+ ...options,
852
+ method: "GET"
853
+ }
854
+ );
855
+ };
856
+ var getSseUrl = () => {
857
+ return `/v1/streams/sse`;
858
+ };
859
+ var sse = async (options) => {
860
+ return customFetch(
861
+ getSseUrl(),
862
+ {
863
+ ...options,
864
+ method: "GET"
865
+ }
866
+ );
867
+ };
868
+ var getUpdateStreamSubscriptionUrl = (streamId) => {
869
+ return `/v1/streams/${streamId}/subscription`;
870
+ };
871
+ var updateStreamSubscription = async (streamId, subscriptionOptions, options) => {
872
+ return customFetch(
873
+ getUpdateStreamSubscriptionUrl(streamId),
874
+ {
875
+ ...options,
876
+ method: "PUT",
877
+ headers: { "Content-Type": "application/json", ...options?.headers },
878
+ body: JSON.stringify(
879
+ subscriptionOptions
880
+ )
881
+ }
882
+ );
883
+ };
884
+ var getGetLendingPositionsUrl = (userAddress) => {
885
+ return `/v1/users/${userAddress}/lending-positions`;
886
+ };
887
+ var getLendingPositions = async (userAddress, options) => {
888
+ return customFetch(
889
+ getGetLendingPositionsUrl(userAddress),
890
+ {
891
+ ...options,
892
+ method: "GET"
893
+ }
894
+ );
895
+ };
896
+ var getGetLendingPositionUrl = (userAddress, lendingPositionAddress) => {
897
+ return `/v1/users/${userAddress}/lending-positions/${lendingPositionAddress}`;
898
+ };
899
+ var getLendingPosition = async (userAddress, lendingPositionAddress, options) => {
900
+ return customFetch(
901
+ getGetLendingPositionUrl(userAddress, lendingPositionAddress),
902
+ {
903
+ ...options,
904
+ method: "GET"
905
+ }
906
+ );
907
+ };
908
+ var getGetLimitOrdersUrl = (userAddress, params) => {
909
+ const normalizedParams = new URLSearchParams();
910
+ Object.entries(params || {}).forEach(([key, value]) => {
911
+ const explodeParameters = ["pool", "status"];
912
+ if (Array.isArray(value) && explodeParameters.includes(key)) {
913
+ value.forEach((v) => {
914
+ normalizedParams.append(key, v === null ? "null" : v.toString());
915
+ });
916
+ return;
917
+ }
918
+ if (value !== void 0) {
919
+ normalizedParams.append(key, value === null ? "null" : value.toString());
920
+ }
921
+ });
922
+ const stringifiedParams = normalizedParams.toString();
923
+ return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/limit-orders?${stringifiedParams}` : `/v1/users/${userAddress}/limit-orders`;
924
+ };
925
+ var getLimitOrders = async (userAddress, params, options) => {
926
+ return customFetch(
927
+ getGetLimitOrdersUrl(userAddress, params),
928
+ {
929
+ ...options,
930
+ method: "GET"
931
+ }
932
+ );
933
+ };
934
+ var getGetLimitOrderUrl = (userAddress, limitOrderAddress) => {
935
+ return `/v1/users/${userAddress}/limit-orders/${limitOrderAddress}`;
936
+ };
937
+ var getLimitOrder = async (userAddress, limitOrderAddress, options) => {
938
+ return customFetch(
939
+ getGetLimitOrderUrl(userAddress, limitOrderAddress),
940
+ {
941
+ ...options,
942
+ method: "GET"
943
+ }
944
+ );
945
+ };
946
+ var getGetLpPositionsUrl = (userAddress, params) => {
947
+ const normalizedParams = new URLSearchParams();
948
+ Object.entries(params || {}).forEach(([key, value]) => {
949
+ if (value !== void 0) {
950
+ normalizedParams.append(key, value === null ? "null" : value instanceof Date ? value.toISOString() : value.toString());
951
+ }
952
+ });
953
+ const stringifiedParams = normalizedParams.toString();
954
+ return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/lp-positions?${stringifiedParams}` : `/v1/users/${userAddress}/lp-positions`;
955
+ };
956
+ var getLpPositions = async (userAddress, params, options) => {
957
+ return customFetch(
958
+ getGetLpPositionsUrl(userAddress, params),
959
+ {
960
+ ...options,
961
+ method: "GET"
962
+ }
963
+ );
964
+ };
965
+ var getGetLpPositionActionsUrl = (userAddress, positionAddress) => {
966
+ return `/v1/users/${userAddress}/lp-positions/${positionAddress}/actions`;
967
+ };
968
+ var getLpPositionActions = async (userAddress, positionAddress, options) => {
969
+ return customFetch(
970
+ getGetLpPositionActionsUrl(userAddress, positionAddress),
971
+ {
972
+ ...options,
973
+ method: "GET"
974
+ }
975
+ );
976
+ };
977
+ var getGetOrderHistoryUrl = (userAddress, params) => {
978
+ const normalizedParams = new URLSearchParams();
979
+ Object.entries(params || {}).forEach(([key, value]) => {
980
+ const explodeParameters = ["pool", "orderType", "uiDirection"];
981
+ if (Array.isArray(value) && explodeParameters.includes(key)) {
982
+ value.forEach((v) => {
983
+ normalizedParams.append(key, v === null ? "null" : v.toString());
984
+ });
985
+ return;
986
+ }
987
+ if (value !== void 0) {
988
+ normalizedParams.append(key, value === null ? "null" : value.toString());
989
+ }
990
+ });
991
+ const stringifiedParams = normalizedParams.toString();
992
+ return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/order-history?${stringifiedParams}` : `/v1/users/${userAddress}/order-history`;
993
+ };
994
+ var getOrderHistory = async (userAddress, params, options) => {
995
+ return customFetch(
996
+ getGetOrderHistoryUrl(userAddress, params),
997
+ {
998
+ ...options,
999
+ method: "GET"
1000
+ }
1001
+ );
1002
+ };
1003
+ var getGetSpotPositionsUrl = (userAddress) => {
1004
+ return `/v1/users/${userAddress}/spot-positions`;
1005
+ };
1006
+ var getSpotPositions = async (userAddress, options) => {
1007
+ return customFetch(
1008
+ getGetSpotPositionsUrl(userAddress),
1009
+ {
1010
+ ...options,
1011
+ method: "GET"
1012
+ }
1013
+ );
1014
+ };
1015
+ var getGetSpotPositionUrl = (userAddress, spotPositionAddress) => {
1016
+ return `/v1/users/${userAddress}/spot-positions/${spotPositionAddress}`;
1017
+ };
1018
+ var getSpotPosition = async (userAddress, spotPositionAddress, options) => {
1019
+ return customFetch(
1020
+ getGetSpotPositionUrl(userAddress, spotPositionAddress),
1021
+ {
1022
+ ...options,
1023
+ method: "GET"
1024
+ }
1025
+ );
1026
+ };
1027
+ var getGetUserStakingPositionUrl = (userAddress) => {
1028
+ return `/v1/users/${userAddress}/staking-position`;
1029
+ };
1030
+ var getUserStakingPosition = async (userAddress, options) => {
1031
+ return customFetch(
1032
+ getGetUserStakingPositionUrl(userAddress),
1033
+ {
1034
+ ...options,
1035
+ method: "GET"
1036
+ }
1037
+ );
1038
+ };
1039
+ var getGetUserStakingPositionHistoryUrl = (userAddress) => {
1040
+ return `/v1/users/${userAddress}/staking-position/history`;
1041
+ };
1042
+ var getUserStakingPositionHistory = async (userAddress, options) => {
1043
+ return customFetch(
1044
+ getGetUserStakingPositionHistoryUrl(userAddress),
1045
+ {
1046
+ ...options,
1047
+ method: "GET"
1048
+ }
1049
+ );
1050
+ };
1051
+ var getGetTradeHistoryUrl = (userAddress, params) => {
1052
+ const normalizedParams = new URLSearchParams();
1053
+ Object.entries(params || {}).forEach(([key, value]) => {
1054
+ const explodeParameters = ["pool", "action", "uiDirection"];
1055
+ if (Array.isArray(value) && explodeParameters.includes(key)) {
1056
+ value.forEach((v) => {
1057
+ normalizedParams.append(key, v === null ? "null" : v.toString());
1058
+ });
1059
+ return;
1060
+ }
1061
+ if (value !== void 0) {
1062
+ normalizedParams.append(key, value === null ? "null" : value.toString());
1063
+ }
1064
+ });
1065
+ const stringifiedParams = normalizedParams.toString();
1066
+ return stringifiedParams.length > 0 ? `/v1/users/${userAddress}/trade-history?${stringifiedParams}` : `/v1/users/${userAddress}/trade-history`;
1067
+ };
1068
+ var getTradeHistory = async (userAddress, params, options) => {
1069
+ return customFetch(
1070
+ getGetTradeHistoryUrl(userAddress, params),
1071
+ {
1072
+ ...options,
1073
+ method: "GET"
1074
+ }
1075
+ );
1076
+ };
1077
+ var getGetTunaPositionsUrl = (userAddress) => {
1078
+ return `/v1/users/${userAddress}/tuna-positions`;
1079
+ };
1080
+ var getTunaPositions = async (userAddress, options) => {
1081
+ return customFetch(
1082
+ getGetTunaPositionsUrl(userAddress),
1083
+ {
1084
+ ...options,
1085
+ method: "GET"
1086
+ }
1087
+ );
1088
+ };
1089
+ var getGetTunaPositionUrl = (userAddress, positionAddress) => {
1090
+ return `/v1/users/${userAddress}/tuna-positions/${positionAddress}`;
1091
+ };
1092
+ var getTunaPosition = async (userAddress, positionAddress, options) => {
1093
+ return customFetch(
1094
+ getGetTunaPositionUrl(userAddress, positionAddress),
1095
+ {
1096
+ ...options,
1097
+ method: "GET"
1098
+ }
1099
+ );
1100
+ };
1101
+ var getGetVaultsUrl = () => {
1102
+ return `/v1/vaults`;
1103
+ };
1104
+ var getVaults = async (options) => {
1105
+ return customFetch(
1106
+ getGetVaultsUrl(),
1107
+ {
1108
+ ...options,
1109
+ method: "GET"
1110
+ }
1111
+ );
1112
+ };
1113
+ var getGetVaultUrl = (vaultAddress) => {
1114
+ return `/v1/vaults/${vaultAddress}`;
1115
+ };
1116
+ var getVault = async (vaultAddress, options) => {
1117
+ return customFetch(
1118
+ getGetVaultUrl(vaultAddress),
1119
+ {
1120
+ ...options,
1121
+ method: "GET"
1122
+ }
1123
+ );
1124
+ };
1125
+ var getGetVaultHistoryUrl = (vaultAddress, params) => {
1126
+ const normalizedParams = new URLSearchParams();
1127
+ Object.entries(params || {}).forEach(([key, value]) => {
1128
+ if (value !== void 0) {
1129
+ normalizedParams.append(key, value === null ? "null" : value.toString());
1130
+ }
1131
+ });
1132
+ const stringifiedParams = normalizedParams.toString();
1133
+ return stringifiedParams.length > 0 ? `/v1/vaults/${vaultAddress}/history?${stringifiedParams}` : `/v1/vaults/${vaultAddress}/history`;
1134
+ };
1135
+ var getVaultHistory = async (vaultAddress, params, options) => {
1136
+ return customFetch(
1137
+ getGetVaultHistoryUrl(vaultAddress, params),
1138
+ {
1139
+ ...options,
1140
+ method: "GET"
1141
+ }
1142
+ );
1143
+ };
1144
+
1145
+ // src/unwrap.ts
1146
+ function unwrapData(data) {
1147
+ if (data && typeof data === "object" && "data" in data && Object.keys(data).length === 1) {
1148
+ return data.data;
1149
+ }
1150
+ return data;
1151
+ }
1152
+ async function unwrap(promise) {
1153
+ const res = await promise;
1154
+ if (res.status != 200) {
1155
+ throw {
1156
+ status: res.status
1157
+ };
1158
+ }
1159
+ return unwrapData(res.data);
1160
+ }
1161
+
1162
+ // ../../node_modules/.pnpm/eventsource-parser@3.0.2/node_modules/eventsource-parser/dist/index.js
1163
+ var ParseError = class extends Error {
1164
+ constructor(message, options) {
1165
+ super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
1166
+ }
1167
+ };
1168
+ function noop(_arg) {
1169
+ }
1170
+ function createParser(callbacks) {
1171
+ if (typeof callbacks == "function")
1172
+ throw new TypeError(
1173
+ "`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
1174
+ );
1175
+ const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
1176
+ let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
1177
+ function feed(newChunk) {
1178
+ const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
1179
+ for (const line of complete)
1180
+ parseLine(line);
1181
+ incompleteLine = incomplete, isFirstChunk = false;
1182
+ }
1183
+ function parseLine(line) {
1184
+ if (line === "") {
1185
+ dispatchEvent();
1186
+ return;
1187
+ }
1188
+ if (line.startsWith(":")) {
1189
+ onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
1190
+ return;
1191
+ }
1192
+ const fieldSeparatorIndex = line.indexOf(":");
1193
+ if (fieldSeparatorIndex !== -1) {
1194
+ const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
1195
+ processField(field, value, line);
1196
+ return;
1197
+ }
1198
+ processField(line, "", line);
1199
+ }
1200
+ function processField(field, value, line) {
1201
+ switch (field) {
1202
+ case "event":
1203
+ eventType = value;
1204
+ break;
1205
+ case "data":
1206
+ data = `${data}${value}
1207
+ `;
1208
+ break;
1209
+ case "id":
1210
+ id = value.includes("\0") ? void 0 : value;
1211
+ break;
1212
+ case "retry":
1213
+ /^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
1214
+ new ParseError(`Invalid \`retry\` value: "${value}"`, {
1215
+ type: "invalid-retry",
1216
+ value,
1217
+ line
1218
+ })
1219
+ );
1220
+ break;
1221
+ default:
1222
+ onError(
1223
+ new ParseError(
1224
+ `Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
1225
+ { type: "unknown-field", field, value, line }
1226
+ )
1227
+ );
1228
+ break;
1229
+ }
1230
+ }
1231
+ function dispatchEvent() {
1232
+ data.length > 0 && onEvent({
1233
+ id,
1234
+ event: eventType || void 0,
1235
+ // If the data buffer's last character is a U+000A LINE FEED (LF) character,
1236
+ // then remove the last character from the data buffer.
1237
+ data: data.endsWith(`
1238
+ `) ? data.slice(0, -1) : data
1239
+ }), id = void 0, data = "", eventType = "";
1240
+ }
1241
+ function reset(options = {}) {
1242
+ incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
1243
+ }
1244
+ return { feed, reset };
1245
+ }
1246
+ function splitLines(chunk) {
1247
+ const lines = [];
1248
+ let incompleteLine = "", searchIndex = 0;
1249
+ for (; searchIndex < chunk.length; ) {
1250
+ const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
1251
+ `, searchIndex);
1252
+ let lineEnd = -1;
1253
+ if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
1254
+ incompleteLine = chunk.slice(searchIndex);
1255
+ break;
1256
+ } else {
1257
+ const line = chunk.slice(searchIndex, lineEnd);
1258
+ lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
1259
+ ` && searchIndex++;
1260
+ }
1261
+ }
1262
+ return [lines, incompleteLine];
1263
+ }
1264
+
1265
+ // ../../node_modules/.pnpm/eventsource@3.0.7/node_modules/eventsource/dist/index.js
1266
+ var ErrorEvent = class extends Event {
1267
+ /**
1268
+ * Constructs a new `ErrorEvent` instance. This is typically not called directly,
1269
+ * but rather emitted by the `EventSource` object when an error occurs.
1270
+ *
1271
+ * @param type - The type of the event (should be "error")
1272
+ * @param errorEventInitDict - Optional properties to include in the error event
1273
+ */
1274
+ constructor(type, errorEventInitDict) {
1275
+ var _a, _b;
1276
+ super(type), this.code = (_a = errorEventInitDict == null ? void 0 : errorEventInitDict.code) != null ? _a : void 0, this.message = (_b = errorEventInitDict == null ? void 0 : errorEventInitDict.message) != null ? _b : void 0;
1277
+ }
1278
+ /**
1279
+ * Node.js "hides" the `message` and `code` properties of the `ErrorEvent` instance,
1280
+ * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
1281
+ * we explicitly include the properties in the `inspect` method.
1282
+ *
1283
+ * This is automatically called by Node.js when you `console.log` an instance of this class.
1284
+ *
1285
+ * @param _depth - The current depth
1286
+ * @param options - The options passed to `util.inspect`
1287
+ * @param inspect - The inspect function to use (prevents having to import it from `util`)
1288
+ * @returns A string representation of the error
1289
+ */
1290
+ [Symbol.for("nodejs.util.inspect.custom")](_depth, options, inspect) {
1291
+ return inspect(inspectableError(this), options);
1292
+ }
1293
+ /**
1294
+ * Deno "hides" the `message` and `code` properties of the `ErrorEvent` instance,
1295
+ * when it is `console.log`'ed. This makes it harder to debug errors. To ease debugging,
1296
+ * we explicitly include the properties in the `inspect` method.
1297
+ *
1298
+ * This is automatically called by Deno when you `console.log` an instance of this class.
1299
+ *
1300
+ * @param inspect - The inspect function to use (prevents having to import it from `util`)
1301
+ * @param options - The options passed to `Deno.inspect`
1302
+ * @returns A string representation of the error
1303
+ */
1304
+ [Symbol.for("Deno.customInspect")](inspect, options) {
1305
+ return inspect(inspectableError(this), options);
1306
+ }
1307
+ };
1308
+ function syntaxError(message) {
1309
+ const DomException = globalThis.DOMException;
1310
+ return typeof DomException == "function" ? new DomException(message, "SyntaxError") : new SyntaxError(message);
1311
+ }
1312
+ function flattenError(err) {
1313
+ return err instanceof Error ? "errors" in err && Array.isArray(err.errors) ? err.errors.map(flattenError).join(", ") : "cause" in err && err.cause instanceof Error ? `${err}: ${flattenError(err.cause)}` : err.message : `${err}`;
1314
+ }
1315
+ function inspectableError(err) {
1316
+ return {
1317
+ type: err.type,
1318
+ message: err.message,
1319
+ code: err.code,
1320
+ defaultPrevented: err.defaultPrevented,
1321
+ cancelable: err.cancelable,
1322
+ timeStamp: err.timeStamp
1323
+ };
1324
+ }
1325
+ var __typeError = (msg) => {
1326
+ throw TypeError(msg);
1327
+ };
1328
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
1329
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
1330
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1331
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
1332
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
1333
+ var _readyState;
1334
+ var _url;
1335
+ var _redirectUrl;
1336
+ var _withCredentials;
1337
+ var _fetch;
1338
+ var _reconnectInterval;
1339
+ var _reconnectTimer;
1340
+ var _lastEventId;
1341
+ var _controller;
1342
+ var _parser;
1343
+ var _onError;
1344
+ var _onMessage;
1345
+ var _onOpen;
1346
+ var _EventSource_instances;
1347
+ var connect_fn;
1348
+ var _onFetchResponse;
1349
+ var _onFetchError;
1350
+ var getRequestOptions_fn;
1351
+ var _onEvent;
1352
+ var _onRetryChange;
1353
+ var failConnection_fn;
1354
+ var scheduleReconnect_fn;
1355
+ var _reconnect;
1356
+ var EventSource = class extends EventTarget {
1357
+ constructor(url, eventSourceInitDict) {
1358
+ var _a, _b;
1359
+ super(), __privateAdd(this, _EventSource_instances), this.CONNECTING = 0, this.OPEN = 1, this.CLOSED = 2, __privateAdd(this, _readyState), __privateAdd(this, _url), __privateAdd(this, _redirectUrl), __privateAdd(this, _withCredentials), __privateAdd(this, _fetch), __privateAdd(this, _reconnectInterval), __privateAdd(this, _reconnectTimer), __privateAdd(this, _lastEventId, null), __privateAdd(this, _controller), __privateAdd(this, _parser), __privateAdd(this, _onError, null), __privateAdd(this, _onMessage, null), __privateAdd(this, _onOpen, null), __privateAdd(this, _onFetchResponse, async (response) => {
1360
+ var _a2;
1361
+ __privateGet(this, _parser).reset();
1362
+ const { body, redirected, status, headers } = response;
1363
+ if (status === 204) {
1364
+ __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, "Server sent HTTP 204, not reconnecting", 204), this.close();
1365
+ return;
1366
+ }
1367
+ if (redirected ? __privateSet(this, _redirectUrl, new URL(response.url)) : __privateSet(this, _redirectUrl, void 0), status !== 200) {
1368
+ __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, `Non-200 status code (${status})`, status);
1369
+ return;
1370
+ }
1371
+ if (!(headers.get("content-type") || "").startsWith("text/event-stream")) {
1372
+ __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, 'Invalid content type, expected "text/event-stream"', status);
1373
+ return;
1374
+ }
1375
+ if (__privateGet(this, _readyState) === this.CLOSED)
1376
+ return;
1377
+ __privateSet(this, _readyState, this.OPEN);
1378
+ const openEvent = new Event("open");
1379
+ if ((_a2 = __privateGet(this, _onOpen)) == null || _a2.call(this, openEvent), this.dispatchEvent(openEvent), typeof body != "object" || !body || !("getReader" in body)) {
1380
+ __privateMethod(this, _EventSource_instances, failConnection_fn).call(this, "Invalid response body, expected a web ReadableStream", status), this.close();
1381
+ return;
1382
+ }
1383
+ const decoder = new TextDecoder(), reader = body.getReader();
1384
+ let open = true;
1385
+ do {
1386
+ const { done, value } = await reader.read();
1387
+ value && __privateGet(this, _parser).feed(decoder.decode(value, { stream: !done })), done && (open = false, __privateGet(this, _parser).reset(), __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this));
1388
+ } while (open);
1389
+ }), __privateAdd(this, _onFetchError, (err) => {
1390
+ __privateSet(this, _controller, void 0), !(err.name === "AbortError" || err.type === "aborted") && __privateMethod(this, _EventSource_instances, scheduleReconnect_fn).call(this, flattenError(err));
1391
+ }), __privateAdd(this, _onEvent, (event) => {
1392
+ typeof event.id == "string" && __privateSet(this, _lastEventId, event.id);
1393
+ const messageEvent = new MessageEvent(event.event || "message", {
1394
+ data: event.data,
1395
+ origin: __privateGet(this, _redirectUrl) ? __privateGet(this, _redirectUrl).origin : __privateGet(this, _url).origin,
1396
+ lastEventId: event.id || ""
1397
+ });
1398
+ __privateGet(this, _onMessage) && (!event.event || event.event === "message") && __privateGet(this, _onMessage).call(this, messageEvent), this.dispatchEvent(messageEvent);
1399
+ }), __privateAdd(this, _onRetryChange, (value) => {
1400
+ __privateSet(this, _reconnectInterval, value);
1401
+ }), __privateAdd(this, _reconnect, () => {
1402
+ __privateSet(this, _reconnectTimer, void 0), __privateGet(this, _readyState) === this.CONNECTING && __privateMethod(this, _EventSource_instances, connect_fn).call(this);
1403
+ });
1404
+ try {
1405
+ if (url instanceof URL)
1406
+ __privateSet(this, _url, url);
1407
+ else if (typeof url == "string")
1408
+ __privateSet(this, _url, new URL(url, getBaseURL()));
1409
+ else
1410
+ throw new Error("Invalid URL");
1411
+ } catch {
1412
+ throw syntaxError("An invalid or illegal string was specified");
1413
+ }
1414
+ __privateSet(this, _parser, createParser({
1415
+ onEvent: __privateGet(this, _onEvent),
1416
+ onRetry: __privateGet(this, _onRetryChange)
1417
+ })), __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _reconnectInterval, 3e3), __privateSet(this, _fetch, (_a = eventSourceInitDict == null ? void 0 : eventSourceInitDict.fetch) != null ? _a : globalThis.fetch), __privateSet(this, _withCredentials, (_b = eventSourceInitDict == null ? void 0 : eventSourceInitDict.withCredentials) != null ? _b : false), __privateMethod(this, _EventSource_instances, connect_fn).call(this);
1418
+ }
1419
+ /**
1420
+ * Returns the state of this EventSource object's connection. It can have the values described below.
1421
+ *
1422
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState)
1423
+ *
1424
+ * Note: typed as `number` instead of `0 | 1 | 2` for compatibility with the `EventSource` interface,
1425
+ * defined in the TypeScript `dom` library.
1426
+ *
1427
+ * @public
1428
+ */
1429
+ get readyState() {
1430
+ return __privateGet(this, _readyState);
1431
+ }
1432
+ /**
1433
+ * Returns the URL providing the event stream.
1434
+ *
1435
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url)
1436
+ *
1437
+ * @public
1438
+ */
1439
+ get url() {
1440
+ return __privateGet(this, _url).href;
1441
+ }
1442
+ /**
1443
+ * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise.
1444
+ *
1445
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials)
1446
+ */
1447
+ get withCredentials() {
1448
+ return __privateGet(this, _withCredentials);
1449
+ }
1450
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */
1451
+ get onerror() {
1452
+ return __privateGet(this, _onError);
1453
+ }
1454
+ set onerror(value) {
1455
+ __privateSet(this, _onError, value);
1456
+ }
1457
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */
1458
+ get onmessage() {
1459
+ return __privateGet(this, _onMessage);
1460
+ }
1461
+ set onmessage(value) {
1462
+ __privateSet(this, _onMessage, value);
1463
+ }
1464
+ /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */
1465
+ get onopen() {
1466
+ return __privateGet(this, _onOpen);
1467
+ }
1468
+ set onopen(value) {
1469
+ __privateSet(this, _onOpen, value);
1470
+ }
1471
+ addEventListener(type, listener, options) {
1472
+ const listen = listener;
1473
+ super.addEventListener(type, listen, options);
1474
+ }
1475
+ removeEventListener(type, listener, options) {
1476
+ const listen = listener;
1477
+ super.removeEventListener(type, listen, options);
1478
+ }
1479
+ /**
1480
+ * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED.
1481
+ *
1482
+ * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close)
1483
+ *
1484
+ * @public
1485
+ */
1486
+ close() {
1487
+ __privateGet(this, _reconnectTimer) && clearTimeout(__privateGet(this, _reconnectTimer)), __privateGet(this, _readyState) !== this.CLOSED && (__privateGet(this, _controller) && __privateGet(this, _controller).abort(), __privateSet(this, _readyState, this.CLOSED), __privateSet(this, _controller, void 0));
1488
+ }
1489
+ };
1490
+ _readyState = /* @__PURE__ */ new WeakMap(), _url = /* @__PURE__ */ new WeakMap(), _redirectUrl = /* @__PURE__ */ new WeakMap(), _withCredentials = /* @__PURE__ */ new WeakMap(), _fetch = /* @__PURE__ */ new WeakMap(), _reconnectInterval = /* @__PURE__ */ new WeakMap(), _reconnectTimer = /* @__PURE__ */ new WeakMap(), _lastEventId = /* @__PURE__ */ new WeakMap(), _controller = /* @__PURE__ */ new WeakMap(), _parser = /* @__PURE__ */ new WeakMap(), _onError = /* @__PURE__ */ new WeakMap(), _onMessage = /* @__PURE__ */ new WeakMap(), _onOpen = /* @__PURE__ */ new WeakMap(), _EventSource_instances = /* @__PURE__ */ new WeakSet(), /**
1491
+ * Connect to the given URL and start receiving events
1492
+ *
1493
+ * @internal
1494
+ */
1495
+ connect_fn = function() {
1496
+ __privateSet(this, _readyState, this.CONNECTING), __privateSet(this, _controller, new AbortController()), __privateGet(this, _fetch)(__privateGet(this, _url), __privateMethod(this, _EventSource_instances, getRequestOptions_fn).call(this)).then(__privateGet(this, _onFetchResponse)).catch(__privateGet(this, _onFetchError));
1497
+ }, _onFetchResponse = /* @__PURE__ */ new WeakMap(), _onFetchError = /* @__PURE__ */ new WeakMap(), /**
1498
+ * Get request options for the `fetch()` request
1499
+ *
1500
+ * @returns The request options
1501
+ * @internal
1502
+ */
1503
+ getRequestOptions_fn = function() {
1504
+ var _a;
1505
+ const init = {
1506
+ // [spec] Let `corsAttributeState` be `Anonymous`…
1507
+ // [spec] …will have their mode set to "cors"…
1508
+ mode: "cors",
1509
+ redirect: "follow",
1510
+ headers: { Accept: "text/event-stream", ...__privateGet(this, _lastEventId) ? { "Last-Event-ID": __privateGet(this, _lastEventId) } : void 0 },
1511
+ cache: "no-store",
1512
+ signal: (_a = __privateGet(this, _controller)) == null ? void 0 : _a.signal
1513
+ };
1514
+ return "window" in globalThis && (init.credentials = this.withCredentials ? "include" : "same-origin"), init;
1515
+ }, _onEvent = /* @__PURE__ */ new WeakMap(), _onRetryChange = /* @__PURE__ */ new WeakMap(), /**
1516
+ * Handles the process referred to in the EventSource specification as "failing a connection".
1517
+ *
1518
+ * @param error - The error causing the connection to fail
1519
+ * @param code - The HTTP status code, if available
1520
+ * @internal
1521
+ */
1522
+ failConnection_fn = function(message, code) {
1523
+ var _a;
1524
+ __privateGet(this, _readyState) !== this.CLOSED && __privateSet(this, _readyState, this.CLOSED);
1525
+ const errorEvent = new ErrorEvent("error", { code, message });
1526
+ (_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent);
1527
+ }, /**
1528
+ * Schedules a reconnection attempt against the EventSource endpoint.
1529
+ *
1530
+ * @param message - The error causing the connection to fail
1531
+ * @param code - The HTTP status code, if available
1532
+ * @internal
1533
+ */
1534
+ scheduleReconnect_fn = function(message, code) {
1535
+ var _a;
1536
+ if (__privateGet(this, _readyState) === this.CLOSED)
1537
+ return;
1538
+ __privateSet(this, _readyState, this.CONNECTING);
1539
+ const errorEvent = new ErrorEvent("error", { code, message });
1540
+ (_a = __privateGet(this, _onError)) == null || _a.call(this, errorEvent), this.dispatchEvent(errorEvent), __privateSet(this, _reconnectTimer, setTimeout(__privateGet(this, _reconnect), __privateGet(this, _reconnectInterval)));
1541
+ }, _reconnect = /* @__PURE__ */ new WeakMap(), /**
1542
+ * ReadyState representing an EventSource currently trying to connect
1543
+ *
1544
+ * @public
1545
+ */
1546
+ EventSource.CONNECTING = 0, /**
1547
+ * ReadyState representing an EventSource connection that is open (eg connected)
1548
+ *
1549
+ * @public
1550
+ */
1551
+ EventSource.OPEN = 1, /**
1552
+ * ReadyState representing an EventSource connection that is closed (eg disconnected)
1553
+ *
1554
+ * @public
1555
+ */
1556
+ EventSource.CLOSED = 2;
1557
+ function getBaseURL() {
1558
+ const doc = "document" in globalThis ? globalThis.document : void 0;
1559
+ return doc && typeof doc == "object" && "baseURI" in doc && typeof doc.baseURI == "string" ? doc.baseURI : void 0;
1560
+ }
1561
+
1562
+ // src/sse.ts
1563
+ var getSseUpdatesStream = async () => {
1564
+ const url = resolveTunaUrl(getSseUrl());
1565
+ return new EventSource(url);
1566
+ };
1567
+ function eventIsInitialMessage(event) {
1568
+ return !("entity" in event) || "entity" in event && event.entity === NotificationEntity.initialMessage;
1569
+ }
1570
+ function eventIsPoolSwap(event) {
1571
+ return "entity" in event && event.entity === NotificationEntity.poolSwap;
1572
+ }
1573
+ function eventIsStakingPosition(event) {
1574
+ return "entity" in event && event.entity === NotificationEntity.stakingPosition;
1575
+ }
1576
+ function eventIsLendingPosition(event) {
1577
+ return "entity" in event && event.entity === NotificationEntity.lendingPosition;
1578
+ }
1579
+ function eventIsTradeHistory(event) {
1580
+ return "entity" in event && event.entity === NotificationEntity.tradeHistoryEntry;
1581
+ }
1582
+ function eventIsOrderHistory(event) {
1583
+ return "entity" in event && event.entity === NotificationEntity.orderHistoryEntry;
1584
+ }
1585
+ function eventIsStateSnapshot(event) {
1586
+ return "entity" in event && event.entity === NotificationEntity.stateSnapshot;
1587
+ }
1588
+ // Annotate the CommonJS export names for ESM import in node:
1589
+ 0 && (module.exports = {
1590
+ LeaderboardPeriod,
1591
+ LeaderboardSortBy,
1592
+ LimitOrderStatus,
1593
+ LpPositionsHistoryQueryFilter,
1594
+ NotificationAction,
1595
+ NotificationEntity,
1596
+ OrderHistoryStatus,
1597
+ OrderHistoryType,
1598
+ OrderHistoryUIDirection,
1599
+ PoolProvider,
1600
+ PoolSubscriptionTopic,
1601
+ StakingPositionActionType,
1602
+ TradeHistoryAction,
1603
+ TradeHistoryUIDirection,
1604
+ TunaLpPositionAutoCompound,
1605
+ TunaLpPositionAutoCompounding,
1606
+ TunaLpPositionLimitOrderSwap,
1607
+ TunaLpPositionRebalance,
1608
+ TunaLpPositionsActionType,
1609
+ TunaPositionDtoState,
1610
+ TunaPositionMarketMaker,
1611
+ TunaPositionPoolToken,
1612
+ TunaSpotPositionDtoState,
1613
+ WalletSubscriptionTopic,
1614
+ eventIsInitialMessage,
1615
+ eventIsLendingPosition,
1616
+ eventIsOrderHistory,
1617
+ eventIsPoolSwap,
1618
+ eventIsStakingPosition,
1619
+ eventIsStateSnapshot,
1620
+ eventIsTradeHistory,
1621
+ getCloseSpotPositionQuote,
1622
+ getDecreaseSpotPositionQuote,
1623
+ getFeesStats,
1624
+ getFusionFeesStats,
1625
+ getGetCloseSpotPositionQuoteUrl,
1626
+ getGetDecreaseSpotPositionQuoteUrl,
1627
+ getGetFeesStatsUrl,
1628
+ getGetFusionFeesStatsUrl,
1629
+ getGetIncreaseSpotPositionQuoteUrl,
1630
+ getGetLendingPositionUrl,
1631
+ getGetLendingPositionsUrl,
1632
+ getGetLimitOrderQuoteByInputUrl,
1633
+ getGetLimitOrderQuoteByOutputUrl,
1634
+ getGetLimitOrderUrl,
1635
+ getGetLimitOrdersUrl,
1636
+ getGetLpPositionActionsUrl,
1637
+ getGetLpPositionsUrl,
1638
+ getGetLpSpotLeaderboardUrl,
1639
+ getGetMarketUrl,
1640
+ getGetMarketsUrl,
1641
+ getGetMintUrl,
1642
+ getGetMintsUrl,
1643
+ getGetOraclePriceUrl,
1644
+ getGetOraclePricesUrl,
1645
+ getGetOrderHistoryUrl,
1646
+ getGetPoolCandlesUrl,
1647
+ getGetPoolOrderBookUrl,
1648
+ getGetPoolSwapsUrl,
1649
+ getGetPoolTicksUrl,
1650
+ getGetPoolUrl,
1651
+ getGetPoolsUrl,
1652
+ getGetPositionsStatsUrl,
1653
+ getGetPositionsTotalUrl,
1654
+ getGetSpotPositionUrl,
1655
+ getGetSpotPositionsUrl,
1656
+ getGetStakingLeaderboardUrl,
1657
+ getGetStakingRevenueStatsUrl,
1658
+ getGetStakingTreasuryUrl,
1659
+ getGetSwapQuoteByInputUrl,
1660
+ getGetSwapQuoteByOutputUrl,
1661
+ getGetTradableAmountUrl,
1662
+ getGetTradeHistoryUrl,
1663
+ getGetTunaPositionUrl,
1664
+ getGetTunaPositionsUrl,
1665
+ getGetUserStakingPositionHistoryUrl,
1666
+ getGetUserStakingPositionUrl,
1667
+ getGetVaultHistoryUrl,
1668
+ getGetVaultUrl,
1669
+ getGetVaultsUrl,
1670
+ getIncreaseSpotPositionQuote,
1671
+ getLendingPosition,
1672
+ getLendingPositions,
1673
+ getLimitOrder,
1674
+ getLimitOrderQuoteByInput,
1675
+ getLimitOrderQuoteByOutput,
1676
+ getLimitOrders,
1677
+ getLpPositionActions,
1678
+ getLpPositions,
1679
+ getLpSpotLeaderboard,
1680
+ getMarket,
1681
+ getMarkets,
1682
+ getMint,
1683
+ getMints,
1684
+ getOraclePrice,
1685
+ getOraclePrices,
1686
+ getOrderHistory,
1687
+ getPool,
1688
+ getPoolCandles,
1689
+ getPoolOrderBook,
1690
+ getPoolSwaps,
1691
+ getPoolTicks,
1692
+ getPools,
1693
+ getPositionsStats,
1694
+ getPositionsTotal,
1695
+ getSpotPosition,
1696
+ getSpotPositions,
1697
+ getSseUpdatesStream,
1698
+ getSseUrl,
1699
+ getStakingLeaderboard,
1700
+ getStakingRevenueStats,
1701
+ getStakingTreasury,
1702
+ getSwapQuoteByInput,
1703
+ getSwapQuoteByOutput,
1704
+ getTradableAmount,
1705
+ getTradeHistory,
1706
+ getTunaPosition,
1707
+ getTunaPositions,
1708
+ getUpdateStreamSubscriptionUrl,
1709
+ getUserStakingPosition,
1710
+ getUserStakingPositionHistory,
1711
+ getVault,
1712
+ getVaultHistory,
1713
+ getVaults,
1714
+ setTunaBaseUrl,
1715
+ sse,
1716
+ unwrap,
1717
+ updateStreamSubscription
1718
+ });