@crypticdot/defituna-api 1.10.0 → 1.10.2

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.mjs CHANGED
@@ -11,6 +11,8 @@ import snakecaseKeys from "snakecase-keys";
11
11
  // src/client/schemas.ts
12
12
  var schemas_exports = {};
13
13
  __export(schemas_exports, {
14
+ AmountWithUsdSchema: () => AmountWithUsdSchema,
15
+ AmountWithoutUsdSchema: () => AmountWithoutUsdSchema,
14
16
  CloseSpotPositionQuote: () => CloseSpotPositionQuote,
15
17
  DecreaseSpotPositionQuote: () => DecreaseSpotPositionQuote,
16
18
  FeesStatsGroup: () => FeesStatsGroup,
@@ -76,6 +78,7 @@ __export(schemas_exports, {
76
78
  SwapQuoteByOutput: () => SwapQuoteByOutput,
77
79
  Tick: () => Tick,
78
80
  TokenOraclePrice: () => TokenOraclePrice,
81
+ TokensPnlSchema: () => TokensPnlSchema,
79
82
  TradableAmount: () => TradableAmount,
80
83
  TradeHistoryAction: () => TradeHistoryAction,
81
84
  TradeHistoryActionSchema: () => TradeHistoryActionSchema,
@@ -83,7 +86,6 @@ __export(schemas_exports, {
83
86
  TradeHistoryEntryNotification: () => TradeHistoryEntryNotification,
84
87
  TradeHistoryUIDirection: () => TradeHistoryUIDirection,
85
88
  TradeHistoryUIDirectionSchema: () => TradeHistoryUIDirectionSchema,
86
- TunaLpPosition: () => TunaLpPosition,
87
89
  TunaLpPositionAction: () => TunaLpPositionAction,
88
90
  TunaLpPositionActionClose: () => TunaLpPositionActionClose,
89
91
  TunaLpPositionActionCollectAndCompoundFees: () => TunaLpPositionActionCollectAndCompoundFees,
@@ -94,71 +96,61 @@ __export(schemas_exports, {
94
96
  TunaLpPositionActionOpen: () => TunaLpPositionActionOpen,
95
97
  TunaLpPositionActionParametersUpdate: () => TunaLpPositionActionParametersUpdate,
96
98
  TunaLpPositionActionRepayDebt: () => TunaLpPositionActionRepayDebt,
99
+ TunaLpPositionAutoCompounding: () => TunaLpPositionAutoCompounding,
100
+ TunaLpPositionAutoCompoundingSchema: () => TunaLpPositionAutoCompoundingSchema,
101
+ TunaLpPositionDtoSchema: () => TunaLpPositionDtoSchema,
102
+ TunaLpPositionFlagsSchema: () => TunaLpPositionFlagsSchema,
103
+ TunaLpPositionHistorical: () => TunaLpPositionHistorical,
97
104
  TunaLpPositionParameters: () => TunaLpPositionParameters,
98
105
  TunaLpPositionTokenPrices: () => TunaLpPositionTokenPrices,
99
106
  TunaLpPositionTransfer: () => TunaLpPositionTransfer,
100
107
  TunaLpPositionValue: () => TunaLpPositionValue,
101
- TunaPosition: () => TunaPosition,
108
+ TunaPositionLegacy: () => TunaPositionLegacy,
102
109
  TunaPositionNotification: () => TunaPositionNotification,
110
+ TunaPositionPoolSchema: () => TunaPositionPoolSchema,
111
+ TunaPositionPoolToken: () => TunaPositionPoolToken,
112
+ TunaPositionPoolTokenSchema: () => TunaPositionPoolTokenSchema,
103
113
  TunaPositionState: () => TunaPositionState,
104
114
  TunaPositionStateSchema: () => TunaPositionStateSchema,
115
+ TunaPositionTokenPnlSchema: () => TunaPositionTokenPnlSchema,
105
116
  TunaSpotPosition: () => TunaSpotPosition,
106
117
  TunaSpotPositionNotification: () => TunaSpotPositionNotification,
107
118
  TunaSpotPositionState: () => TunaSpotPositionState,
108
119
  TunaSpotPositionStateSchema: () => TunaSpotPositionStateSchema,
109
120
  UpdateStreamSubscriptionResult: () => UpdateStreamSubscriptionResult,
121
+ UsdPnlSchema: () => UsdPnlSchema,
110
122
  Vault: () => Vault,
111
123
  VaultHistoricalStats: () => VaultHistoricalStats,
112
124
  WalletSubscriptionTopic: () => WalletSubscriptionTopic,
113
125
  WalletSubscriptionTopicSchema: () => WalletSubscriptionTopicSchema
114
126
  });
127
+ import { z as z8 } from "zod";
128
+
129
+ // src/client/schemas/basic.ts
115
130
  import { z } from "zod";
116
- var amountWithoutUsd = z.object({
117
- amount: z.coerce.bigint()
118
- });
119
- var amountWithUsd = z.object({
131
+ var AmountWithUsdSchema = z.object({
120
132
  amount: z.coerce.bigint(),
121
133
  usd: z.number()
122
134
  });
123
- var tokensPnl = z.object({
135
+ var AmountWithoutUsdSchema = z.object({
136
+ amount: z.coerce.bigint()
137
+ });
138
+ var TokensPnlSchema = z.object({
124
139
  amount: z.coerce.bigint(),
125
- bps: z.number()
140
+ rate: z.number()
126
141
  });
127
- var usdPnl = z.object({
142
+ var UsdPnlSchema = z.object({
128
143
  amount: z.number(),
129
- bps: z.number()
144
+ rate: z.number()
130
145
  });
131
- var NotificationEntity = {
132
- POOL_SWAP: "pool_swap",
133
- POOL_PRICE: "pool_price",
134
- ORDER_BOOK: "order_book",
135
- TUNA_POSITION: "tuna_position",
136
- TUNA_SPOT_POSITION: "tuna_spot_position",
137
- LENDING_POSITION: "lending_position",
138
- STAKING_POSITION: "staking_position",
139
- FUSION_LIMIT_ORDER: "fusion_limit_order",
140
- TRADE_HISTORY_ENTRY: "trade_history_entry",
141
- ORDER_HISTORY_ENTRY: "order_history_entry",
142
- STATE_SNAPSHOT: "state_snapshot"
143
- };
144
- var NotificationAction = {
145
- CREATE: "create",
146
- UPDATE: "update"
147
- };
148
146
  var PoolProvider = {
149
147
  ORCA: "orca",
150
148
  FUSION: "fusion"
151
149
  };
152
- var TunaPositionState = {
153
- OPEN: "open",
154
- LIQUIDATED: "liquidated",
155
- CLOSED_BY_LIMIT_ORDER: "closed_by_limit_order",
156
- CLOSED: "closed"
157
- };
158
- var TunaSpotPositionState = {
159
- OPEN: "open",
160
- CLOSED: "closed"
161
- };
150
+ var PoolProviderSchema = z.enum([PoolProvider.ORCA, ...Object.values(PoolProvider)]);
151
+
152
+ // src/client/schemas/limit_orders.ts
153
+ import { z as z2 } from "zod";
162
154
  var LimitOrderState = {
163
155
  OPEN: "open",
164
156
  PARTIALLY_FILLED: "partially_filled",
@@ -166,65 +158,50 @@ var LimitOrderState = {
166
158
  COMPLETE: "complete",
167
159
  CANCELLED: "cancelled"
168
160
  };
169
- var TradeHistoryAction = {
170
- SWAP: "swap",
171
- LIMIT_ORDER_FILL: "limit_order_fill",
172
- POSITION_INCREASE: "position_increase",
173
- POSITION_DECREASE: "position_decrease",
174
- TAKE_PROFIT: "take_profit",
175
- STOP_LOSS: "stop_loss",
176
- LIQUIDATION: "liquidation"
177
- };
178
- var TradeHistoryUIDirection = {
179
- BUY: "buy",
180
- SELL: "sell",
181
- OPEN_LONG: "open_long",
182
- CLOSE_LONG: "close_long",
183
- OPEN_SHORT: "open_short",
184
- CLOSE_SHORT: "close_short"
185
- };
186
- var OrderHistoryOrderType = {
187
- MARKET: "market",
188
- LIMIT: "limit",
189
- TAKE_PROFIT_MARKET: "take_profit_market",
190
- STOP_LOSS_MARKET: "stop_loss_market",
191
- LIQUIDATION_MARKET: "liquidation_market"
192
- };
193
- var OrderHistoryStatus = {
194
- OPEN: "open",
195
- PARTIALLY_FILLED: "partially_filled",
196
- FILLED: "filled",
197
- CANCELLED: "cancelled",
198
- CLAIMED: "claimed",
199
- REJECTED: "rejected"
200
- };
201
- var OrderHistoryUIDirection = {
202
- BUY: "buy",
203
- SELL: "sell",
204
- LONG: "long",
205
- SHORT: "short"
206
- };
207
- var StakingPositionHistoryActionType = {
208
- STAKE: "stake",
209
- UNSTAKE: "unstake",
210
- WITHDRAW: "withdraw",
211
- CLAIM_REWARDS: "claim_rewards",
212
- COMPOUND_REWARDS: "compound_rewards"
213
- };
214
- var PoolSubscriptionTopic = {
215
- ORDER_BOOK: "order_book",
216
- POOL_PRICES: "pool_prices",
217
- POOL_SWAPS: "pool_swaps"
218
- };
219
- var WalletSubscriptionTopic = {
220
- TUNA_POSITIONS: "tuna_positions",
221
- TUNA_SPOT_POSITIONS: "tuna_spot_positions",
222
- LENDING_POSITIONS: "lending_positions",
223
- FUSION_LIMIT_ORDERS: "fusion_limit_orders",
224
- STAKING_POSITION: "staking_position",
225
- TRADE_HISTORY: "trade_history",
226
- ORDER_HISTORY: "order_history"
161
+ var LimitOrderStateSchema = z2.enum([LimitOrderState.OPEN, ...Object.values(LimitOrderState)]);
162
+ var LimitOrder = z2.object({
163
+ address: z2.string(),
164
+ mint: z2.string(),
165
+ pool: z2.string(),
166
+ state: LimitOrderStateSchema,
167
+ aToB: z2.boolean(),
168
+ tickIndex: z2.number(),
169
+ fillRatio: z2.number(),
170
+ openTxSignature: z2.string(),
171
+ closeTxSignature: z2.nullable(z2.string()),
172
+ amountIn: AmountWithUsdSchema,
173
+ amountOut: AmountWithUsdSchema,
174
+ openedAt: z2.coerce.date(),
175
+ closedAt: z2.nullable(z2.coerce.date())
176
+ });
177
+
178
+ // src/client/schemas/lp_positions.ts
179
+ import z5 from "zod";
180
+
181
+ // src/client/schemas/mint.ts
182
+ import { z as z3 } from "zod";
183
+ var Mint = z3.object({
184
+ mint: z3.string(),
185
+ symbol: z3.string(),
186
+ name: z3.string(),
187
+ logo: z3.string(),
188
+ decimals: z3.number()
189
+ });
190
+
191
+ // src/client/schemas/positions_shared.ts
192
+ import z4 from "zod";
193
+ var TunaPositionPoolSchema = z4.object({
194
+ addr: z4.string(),
195
+ price: z4.number(),
196
+ tickSpacing: z4.number()
197
+ });
198
+ var TunaPositionPoolToken = {
199
+ A: "a",
200
+ B: "b"
227
201
  };
202
+ var TunaPositionPoolTokenSchema = z4.enum(Object.values(TunaPositionPoolToken));
203
+
204
+ // src/client/schemas/lp_positions.ts
228
205
  var LpPositionLimitOrderSwap = {
229
206
  NO_SWAP: "no_swap",
230
207
  SWAP_TO_TOKEN_A: "swap_to_token_a",
@@ -255,270 +232,173 @@ var LpPositionsActionType = {
255
232
  SET_FLAGS: "set_flags",
256
233
  SET_REBALANCE_THRESHOLD: "set_rebalance_threshold"
257
234
  };
258
- var NotificationEntitySchema = z.enum([NotificationEntity.POOL_SWAP, ...Object.values(NotificationEntity)]);
259
- var NotificationActionSchema = z.enum([NotificationAction.CREATE, ...Object.values(NotificationAction)]);
260
- var PoolProviderSchema = z.enum([PoolProvider.ORCA, ...Object.values(PoolProvider)]);
261
- var TunaPositionStateSchema = z.enum([TunaPositionState.OPEN, ...Object.values(TunaPositionState)]);
262
- var TunaSpotPositionStateSchema = z.enum([
263
- TunaSpotPositionState.OPEN,
264
- ...Object.values(TunaSpotPositionState)
265
- ]);
266
- var LimitOrderStateSchema = z.enum([LimitOrderState.OPEN, ...Object.values(LimitOrderState)]);
267
- var TradeHistoryActionSchema = z.enum([TradeHistoryAction.SWAP, ...Object.values(TradeHistoryAction)]);
268
- var TradeHistoryUIDirectionSchema = z.enum([
269
- TradeHistoryUIDirection.BUY,
270
- ...Object.values(TradeHistoryUIDirection)
271
- ]);
272
- var OrderHistoryOrderTypeSchema = z.enum([
273
- OrderHistoryOrderType.MARKET,
274
- ...Object.values(OrderHistoryOrderType)
275
- ]);
276
- var OrderHistoryStatusSchema = z.enum([OrderHistoryStatus.OPEN, ...Object.values(OrderHistoryStatus)]);
277
- var OrderHistoryUIDirectionSchema = z.enum([
278
- OrderHistoryUIDirection.BUY,
279
- ...Object.values(OrderHistoryUIDirection)
280
- ]);
281
- var StakingPositionHistoryActionTypeSchema = z.enum([
282
- StakingPositionHistoryActionType.STAKE,
283
- ...Object.values(StakingPositionHistoryActionType)
284
- ]);
285
- var PoolSubscriptionTopicSchema = z.enum([
286
- PoolSubscriptionTopic.ORDER_BOOK,
287
- ...Object.values(PoolSubscriptionTopic)
288
- ]);
289
- var WalletSubscriptionTopicSchema = z.enum([
290
- WalletSubscriptionTopic.TUNA_POSITIONS,
291
- ...Object.values(WalletSubscriptionTopic)
292
- ]);
293
- var LpPositionLimitOrderSwapSchema = z.enum(Object.values(LpPositionLimitOrderSwap));
294
- var LpPositionAutoCompoundSchema = z.enum(Object.values(LpPositionAutoCompound));
295
- var LpPositionRebalanceSchema = z.enum(Object.values(LpPositionRebalance));
296
- var LpPositionsActionTypeSchema = z.enum(Object.values(LpPositionsActionType));
297
- var PaginationMeta = z.object({
298
- total: z.number()
299
- });
300
- var Mint = z.object({
301
- symbol: z.string(),
302
- mint: z.string(),
303
- logo: z.string(),
304
- decimals: z.number()
305
- });
306
- var Market = z.object({
307
- address: z.string(),
308
- addressLookupTable: z.string(),
309
- poolAddress: z.string(),
310
- poolFeeRate: z.number(),
311
- provider: PoolProviderSchema,
312
- maxLeverage: z.number(),
313
- maxSwapSlippage: z.number(),
314
- protocolFee: z.number(),
315
- rebalanceProtocolFee: z.number(),
316
- protocolFeeOnCollateral: z.number(),
317
- liquidationFee: z.number(),
318
- liquidationThreshold: z.number(),
319
- oraclePriceDeviationThreshold: z.number(),
320
- limitOrderExecutionFee: z.number(),
321
- maxSpotPositionSizeA: amountWithUsd,
322
- maxSpotPositionSizeB: amountWithUsd,
323
- borrowedFundsA: amountWithUsd,
324
- borrowedFundsB: amountWithUsd,
325
- availableBorrowA: amountWithUsd,
326
- availableBorrowB: amountWithUsd,
327
- borrowLimitA: amountWithUsd,
328
- borrowLimitB: amountWithUsd,
329
- disabled: z.boolean(),
330
- createdAt: z.coerce.date()
331
- });
332
- var TokenOraclePrice = z.object({
333
- mint: z.string(),
334
- price: z.coerce.bigint(),
335
- decimals: z.number(),
336
- time: z.coerce.date()
337
- });
338
- var Vault = z.object({
339
- address: z.string(),
340
- mint: z.string(),
341
- depositedFunds: amountWithUsd,
342
- borrowedFunds: amountWithUsd,
343
- supplyLimit: amountWithUsd,
344
- borrowedShares: z.coerce.bigint(),
345
- depositedShares: z.coerce.bigint(),
346
- supplyApy: z.number(),
347
- borrowApy: z.number(),
348
- interestRate: z.coerce.bigint(),
349
- utilization: z.number(),
350
- pythOracleFeedId: z.string(),
351
- pythOraclePriceUpdate: z.string()
352
- });
353
- var VaultHistoricalStats = z.object({
354
- date: z.preprocess((val, ctx) => {
355
- if (typeof val === "string") {
356
- const [year, month, day] = val.split("-").map(Number);
357
- return new Date(year, month - 1, day);
358
- }
359
- ctx.addIssue({
360
- code: "custom",
361
- message: "Not a valid date string"
362
- });
363
- return z.NEVER;
364
- }, z.date()),
365
- supply: amountWithUsd,
366
- borrow: amountWithUsd,
367
- supplyApy: z.number(),
368
- borrowApr: z.number()
369
- });
370
- var Pool = z.object({
371
- address: z.string(),
372
- provider: PoolProviderSchema,
373
- tokenAMint: z.string(),
374
- tokenBMint: z.string(),
375
- tokenAVault: z.string(),
376
- tokenBVault: z.string(),
377
- tvlUsdc: z.coerce.number(),
378
- priceChange24H: z.number(),
379
- tickSpacing: z.number(),
380
- feeRate: z.number(),
381
- olpFeeRate: z.nullable(z.number()),
382
- protocolFeeRate: z.number(),
383
- liquidity: z.coerce.bigint(),
384
- sqrtPrice: z.coerce.bigint(),
385
- tickCurrentIndex: z.number(),
386
- stats: z.object({
387
- "24h": z.object({
388
- volume: z.coerce.number(),
389
- fees: z.coerce.number(),
390
- rewards: z.coerce.number(),
391
- yieldOverTvl: z.coerce.number()
392
- }),
393
- "7d": z.object({
394
- volume: z.coerce.number(),
395
- fees: z.coerce.number(),
396
- rewards: z.coerce.number(),
397
- yieldOverTvl: z.coerce.number()
398
- }),
399
- "30d": z.object({
400
- volume: z.coerce.number(),
401
- fees: z.coerce.number(),
402
- rewards: z.coerce.number(),
403
- yieldOverTvl: z.coerce.number()
404
- })
405
- })
406
- });
407
- var Tick = z.object({
408
- index: z.number(),
409
- liquidity: z.coerce.bigint()
410
- });
411
- var PoolTicks = z.object({
412
- tickSpacing: z.number(),
413
- ticks: Tick.array()
235
+ var LpPositionLimitOrderSwapSchema = z5.enum(Object.values(LpPositionLimitOrderSwap));
236
+ var LpPositionAutoCompoundSchema = z5.enum(Object.values(LpPositionAutoCompound));
237
+ var LpPositionRebalanceSchema = z5.enum(Object.values(LpPositionRebalance));
238
+ var LpPositionsActionTypeSchema = z5.enum(Object.values(LpPositionsActionType));
239
+ var TunaPositionState = {
240
+ OPEN: "open",
241
+ LIQUIDATED: "liquidated",
242
+ CLOSED_BY_LIMIT_ORDER: "closed_by_limit_order",
243
+ CLOSED: "closed"
244
+ };
245
+ var TunaPositionStateSchema = z5.enum([TunaPositionState.OPEN, ...Object.values(TunaPositionState)]);
246
+ var TunaLpPositionAutoCompounding = {
247
+ WITH_LEVERAGE: "with_leverage",
248
+ WITHOUT_LEVERAGE: "without_leverage"
249
+ };
250
+ var TunaLpPositionAutoCompoundingSchema = z5.enum(
251
+ Object.values(TunaLpPositionAutoCompounding)
252
+ );
253
+ var TunaPositionTokenPnlSchema = z5.object({
254
+ amount: z5.coerce.bigint(),
255
+ bps: z5.number()
414
256
  });
415
- var LendingPosition = z.object({
416
- address: z.string(),
417
- authority: z.string(),
418
- mint: z.string(),
419
- vault: z.string(),
420
- shares: z.coerce.bigint(),
421
- funds: amountWithUsd,
422
- earned: amountWithUsd
257
+ var TunaLpPositionFlagsSchema = z5.object({
258
+ lowerLimitOrderSwapToToken: z5.nullable(TunaPositionPoolTokenSchema),
259
+ upperLimitOrderSwapToToken: z5.nullable(TunaPositionPoolTokenSchema),
260
+ autoCompounding: z5.nullable(TunaLpPositionAutoCompoundingSchema),
261
+ autoRebalancing: z5.boolean()
423
262
  });
424
- var TunaPosition = z.object({
425
- address: z.string(),
426
- authority: z.string(),
427
- version: z.number(),
263
+ var TunaLpPositionDtoSchema = z5.object({
264
+ address: z5.string(),
265
+ authority: z5.string(),
266
+ version: z5.number(),
428
267
  state: TunaPositionStateSchema,
429
- positionMint: z.string(),
430
- liquidity: z.coerce.bigint(),
431
- tickLowerIndex: z.number(),
432
- tickUpperIndex: z.number(),
433
- entrySqrtPrice: z.coerce.bigint(),
434
- lowerLimitOrderSqrtPrice: z.coerce.bigint(),
435
- upperLimitOrderSqrtPrice: z.coerce.bigint(),
436
- flags: z.number(),
437
- pool: z.string(),
438
- poolSqrtPrice: z.coerce.bigint(),
439
- depositedCollateralA: amountWithoutUsd,
440
- depositedCollateralB: amountWithoutUsd,
441
- depositedCollateralUsd: z.object({
442
- amount: z.number()
443
- }),
444
- loanFundsA: amountWithUsd,
445
- loanFundsB: amountWithUsd,
446
- currentLoanA: amountWithUsd,
447
- currentLoanB: amountWithUsd,
448
- leftoversA: amountWithUsd,
449
- leftoversB: amountWithUsd,
450
- yieldA: amountWithUsd,
451
- yieldB: amountWithUsd,
452
- compoundedYieldA: amountWithUsd,
453
- compoundedYieldB: amountWithUsd,
454
- totalA: amountWithUsd,
455
- totalB: amountWithUsd,
456
- pnlA: tokensPnl,
457
- pnlB: tokensPnl,
458
- pnlUsd: usdPnl,
459
- openedAt: z.coerce.date(),
460
- updatedAtSlot: z.coerce.bigint(),
461
- closedAt: z.nullable(z.coerce.date())
268
+ positionMint: z5.string(),
269
+ liquidity: z5.coerce.bigint(),
270
+ lowerPrice: z5.number(),
271
+ upperPrice: z5.number(),
272
+ lowerLimitOrderPrice: z5.number(),
273
+ upperLimitOrderPrice: z5.number(),
274
+ entryPrice: z5.number(),
275
+ flags: TunaLpPositionFlagsSchema,
276
+ mintA: Mint,
277
+ mintB: Mint,
278
+ pool: TunaPositionPoolSchema,
279
+ marketMaker: PoolProviderSchema,
280
+ depositedCollateralA: AmountWithUsdSchema,
281
+ depositedCollateralB: AmountWithUsdSchema,
282
+ leverage: z5.number(),
283
+ maxLeverage: z5.number(),
284
+ liquidationPriceLower: z5.number(),
285
+ liquidationPriceUpper: z5.number(),
286
+ initialDebtA: AmountWithUsdSchema,
287
+ initialDebtB: AmountWithUsdSchema,
288
+ currentDebtA: AmountWithUsdSchema,
289
+ currentDebtB: AmountWithUsdSchema,
290
+ leftoversA: AmountWithUsdSchema,
291
+ leftoversB: AmountWithUsdSchema,
292
+ yieldA: AmountWithUsdSchema,
293
+ yieldB: AmountWithUsdSchema,
294
+ compoundedYieldA: AmountWithUsdSchema,
295
+ compoundedYieldB: AmountWithUsdSchema,
296
+ totalA: AmountWithUsdSchema,
297
+ totalB: AmountWithUsdSchema,
298
+ pnlA: TokensPnlSchema,
299
+ pnlB: TokensPnlSchema,
300
+ pnlUsd: UsdPnlSchema,
301
+ openedAt: z5.coerce.date(),
302
+ closedAt: z5.nullable(z5.coerce.date())
462
303
  });
463
- var TunaLpPosition = z.object({
464
- positionAddress: z.string(),
465
- authority: z.string(),
466
- pool: z.string(),
304
+ var TunaLpPositionHistorical = z5.object({
305
+ positionAddress: z5.string(),
306
+ authority: z5.string(),
307
+ pool: z5.string(),
467
308
  state: TunaPositionStateSchema,
468
- lowerPrice: z.number(),
469
- upperPrice: z.number(),
470
- lowerLimitOrder: z.number().nullable(),
471
- upperLimitOrder: z.number().nullable(),
309
+ lowerPrice: z5.number(),
310
+ upperPrice: z5.number(),
311
+ lowerLimitOrder: z5.number().nullable(),
312
+ upperLimitOrder: z5.number().nullable(),
472
313
  marketMaker: PoolProviderSchema,
473
- openedAt: z.coerce.date(),
474
- closedAt: z.coerce.date().nullable(),
475
- totalValueUsd: z.number(),
476
- leverage: z.number(),
477
- initialLeverage: z.number(),
478
- totalDepositUsd: z.number(),
479
- totalWithdrawnUsd: z.number(),
480
- feesSumUsd: z.number(),
481
- closedPnlSumUsd: z.number(),
482
- entryPrice: z.number(),
483
- exitPrice: z.number().nullable()
314
+ openedAt: z5.coerce.date(),
315
+ closedAt: z5.coerce.date().nullable(),
316
+ totalValueUsd: z5.number(),
317
+ leverage: z5.number(),
318
+ initialLeverage: z5.number(),
319
+ totalDepositUsd: z5.number(),
320
+ totalWithdrawnUsd: z5.number(),
321
+ feesSumUsd: z5.number(),
322
+ closedPnlSumUsd: z5.number(),
323
+ entryPrice: z5.number(),
324
+ exitPrice: z5.number().nullable()
325
+ });
326
+ var TunaPositionLegacy = z5.object({
327
+ address: z5.string(),
328
+ authority: z5.string(),
329
+ version: z5.number(),
330
+ state: TunaPositionStateSchema,
331
+ positionMint: z5.string(),
332
+ liquidity: z5.coerce.bigint(),
333
+ tickLowerIndex: z5.number(),
334
+ tickUpperIndex: z5.number(),
335
+ entrySqrtPrice: z5.coerce.bigint(),
336
+ lowerLimitOrderSqrtPrice: z5.coerce.bigint(),
337
+ upperLimitOrderSqrtPrice: z5.coerce.bigint(),
338
+ flags: z5.number(),
339
+ pool: z5.string(),
340
+ poolSqrtPrice: z5.coerce.bigint(),
341
+ depositedCollateralA: AmountWithoutUsdSchema,
342
+ depositedCollateralB: AmountWithoutUsdSchema,
343
+ depositedCollateralUsd: z5.object({
344
+ amount: z5.number()
345
+ }),
346
+ loanFundsA: AmountWithUsdSchema,
347
+ loanFundsB: AmountWithUsdSchema,
348
+ currentLoanA: AmountWithUsdSchema,
349
+ currentLoanB: AmountWithUsdSchema,
350
+ leftoversA: AmountWithUsdSchema,
351
+ leftoversB: AmountWithUsdSchema,
352
+ yieldA: AmountWithUsdSchema,
353
+ yieldB: AmountWithUsdSchema,
354
+ compoundedYieldA: AmountWithUsdSchema,
355
+ compoundedYieldB: AmountWithUsdSchema,
356
+ totalA: AmountWithUsdSchema,
357
+ totalB: AmountWithUsdSchema,
358
+ pnlA: TokensPnlSchema,
359
+ pnlB: TokensPnlSchema,
360
+ pnlUsd: UsdPnlSchema,
361
+ openedAt: z5.coerce.date(),
362
+ updatedAtSlot: z5.coerce.bigint(),
363
+ closedAt: z5.nullable(z5.coerce.date())
484
364
  });
485
- var TunaLpPositionParameters = z.object({
486
- lowerPrice: z.number(),
487
- upperPrice: z.number(),
488
- lowerLimitOrder: z.number().nullable(),
489
- upperLimitOrder: z.number().nullable(),
365
+ var TunaLpPositionParameters = z5.object({
366
+ lowerPrice: z5.number(),
367
+ upperPrice: z5.number(),
368
+ lowerLimitOrder: z5.number().nullable(),
369
+ upperLimitOrder: z5.number().nullable(),
490
370
  lowerLimitOrderSwap: LpPositionLimitOrderSwapSchema,
491
371
  upperLimitOrderSwap: LpPositionLimitOrderSwapSchema,
492
372
  autoCompound: LpPositionAutoCompoundSchema,
493
373
  rebalance: LpPositionRebalanceSchema,
494
- rebalanceThresholdTicks: z.number()
374
+ rebalanceThresholdTicks: z5.number()
495
375
  });
496
- var TunaLpPositionValue = z.object({
497
- totalValueA: z.number(),
498
- totalValueB: z.number(),
499
- totalValueUsd: z.number(),
500
- loanFundsA: z.number(),
501
- loanFundsB: z.number(),
502
- loanFundsUsd: z.number(),
503
- leverage: z.number()
376
+ var TunaLpPositionValue = z5.object({
377
+ totalValueA: z5.number(),
378
+ totalValueB: z5.number(),
379
+ totalValueUsd: z5.number(),
380
+ loanFundsA: z5.number(),
381
+ loanFundsB: z5.number(),
382
+ loanFundsUsd: z5.number(),
383
+ leverage: z5.number()
504
384
  });
505
- var TunaLpPositionTransfer = z.object({
506
- amountA: z.number(),
507
- amountB: z.number(),
508
- amountUsd: z.number()
385
+ var TunaLpPositionTransfer = z5.object({
386
+ amountA: z5.number(),
387
+ amountB: z5.number(),
388
+ amountUsd: z5.number()
509
389
  });
510
- var TunaLpPositionTokenPrices = z.object({
511
- tokenPriceA: z.number(),
512
- tokenPriceB: z.number()
390
+ var TunaLpPositionTokenPrices = z5.object({
391
+ tokenPriceA: z5.number(),
392
+ tokenPriceB: z5.number()
513
393
  });
514
- var TunaLpPositionActionOpen = z.object({
394
+ var TunaLpPositionActionOpen = z5.object({
515
395
  parameters: TunaLpPositionParameters
516
396
  });
517
- var TunaLpPositionActionClose = z.object({
397
+ var TunaLpPositionActionClose = z5.object({
518
398
  toOwner: TunaLpPositionTransfer.nullable(),
519
399
  prices: TunaLpPositionTokenPrices.nullable()
520
400
  });
521
- var TunaLpPositionActionIncreaseLiquidity = z.object({
401
+ var TunaLpPositionActionIncreaseLiquidity = z5.object({
522
402
  fromPosition: TunaLpPositionValue.nullable(),
523
403
  toPosition: TunaLpPositionValue,
524
404
  fromOwner: TunaLpPositionTransfer,
@@ -526,9 +406,9 @@ var TunaLpPositionActionIncreaseLiquidity = z.object({
526
406
  protocolFees: TunaLpPositionTransfer,
527
407
  prices: TunaLpPositionTokenPrices
528
408
  });
529
- var TunaLpPositionActionDecreaseLiquidity = z.object({
530
- withdrawPercent: z.number(),
531
- closedPnlUsd: z.number(),
409
+ var TunaLpPositionActionDecreaseLiquidity = z5.object({
410
+ withdrawPercent: z5.number(),
411
+ closedPnlUsd: z5.number(),
532
412
  fromPosition: TunaLpPositionValue,
533
413
  toPosition: TunaLpPositionValue.nullable(),
534
414
  toOwner: TunaLpPositionTransfer,
@@ -536,28 +416,28 @@ var TunaLpPositionActionDecreaseLiquidity = z.object({
536
416
  collectedFees: TunaLpPositionTransfer,
537
417
  prices: TunaLpPositionTokenPrices
538
418
  });
539
- var TunaLpPositionActionLiquidate = z.object({
540
- withdrawPercent: z.number(),
419
+ var TunaLpPositionActionLiquidate = z5.object({
420
+ withdrawPercent: z5.number(),
541
421
  fromPosition: TunaLpPositionValue,
542
422
  toLending: TunaLpPositionTransfer,
543
423
  protocolFees: TunaLpPositionTransfer,
544
424
  prices: TunaLpPositionTokenPrices
545
425
  });
546
- var TunaLpPositionActionRepayDebt = z.object({
426
+ var TunaLpPositionActionRepayDebt = z5.object({
547
427
  fromPosition: TunaLpPositionValue,
548
428
  toPosition: TunaLpPositionValue,
549
429
  fromOwner: TunaLpPositionTransfer,
550
430
  toLending: TunaLpPositionTransfer,
551
431
  prices: TunaLpPositionTokenPrices
552
432
  });
553
- var TunaLpPositionActionCollectFees = z.object({
554
- closedPnlUsd: z.number(),
433
+ var TunaLpPositionActionCollectFees = z5.object({
434
+ closedPnlUsd: z5.number(),
555
435
  position: TunaLpPositionValue,
556
436
  collectedFees: TunaLpPositionTransfer,
557
437
  toOwner: TunaLpPositionTransfer,
558
438
  prices: TunaLpPositionTokenPrices
559
439
  });
560
- var TunaLpPositionActionCollectAndCompoundFees = z.object({
440
+ var TunaLpPositionActionCollectAndCompoundFees = z5.object({
561
441
  fromPosition: TunaLpPositionValue,
562
442
  toPosition: TunaLpPositionValue,
563
443
  collectedFees: TunaLpPositionTransfer,
@@ -565,15 +445,15 @@ var TunaLpPositionActionCollectAndCompoundFees = z.object({
565
445
  protocolFees: TunaLpPositionTransfer,
566
446
  prices: TunaLpPositionTokenPrices
567
447
  });
568
- var TunaLpPositionActionParametersUpdate = z.object({
448
+ var TunaLpPositionActionParametersUpdate = z5.object({
569
449
  fromParameters: TunaLpPositionParameters,
570
450
  toParameters: TunaLpPositionParameters
571
451
  });
572
- var TunaLpPositionAction = z.object({
452
+ var TunaLpPositionAction = z5.object({
573
453
  action: LpPositionsActionTypeSchema,
574
- txSignature: z.string(),
575
- txTimestamp: z.coerce.date(),
576
- data: z.object({
454
+ txSignature: z5.string(),
455
+ txTimestamp: z5.coerce.date(),
456
+ data: z5.object({
577
457
  /** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
578
458
  fromPosition: TunaLpPositionValue.optional().nullable(),
579
459
  /** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
@@ -601,324 +481,548 @@ var TunaLpPositionAction = z.object({
601
481
  /** defined for: ParametersUpdate */
602
482
  toParameters: TunaLpPositionParameters.optional(),
603
483
  /** defined for: DecreaseLiquidity */
604
- withdrawPercent: z.number().optional(),
484
+ withdrawPercent: z5.number().optional(),
605
485
  /** defined for: DecreaseLiquidity, CollectFees */
606
- closedPnlUsd: z.number().optional()
486
+ closedPnlUsd: z5.number().optional()
607
487
  })
608
488
  });
609
- var TunaSpotPosition = z.object({
610
- address: z.string(),
611
- authority: z.string(),
612
- version: z.number(),
489
+
490
+ // src/client/schemas/spot_positions.ts
491
+ import { z as z6 } from "zod";
492
+ var TunaSpotPositionState = {
493
+ OPEN: "open",
494
+ CLOSED: "closed"
495
+ };
496
+ var TunaSpotPositionStateSchema = z6.enum([
497
+ TunaSpotPositionState.OPEN,
498
+ ...Object.values(TunaSpotPositionState)
499
+ ]);
500
+ var TunaSpotPosition = z6.object({
501
+ address: z6.string(),
502
+ authority: z6.string(),
503
+ version: z6.number(),
613
504
  state: TunaSpotPositionStateSchema,
614
- entrySqrtPrice: z.coerce.bigint(),
615
- lowerLimitOrderSqrtPrice: z.coerce.bigint(),
616
- upperLimitOrderSqrtPrice: z.coerce.bigint(),
617
- flags: z.number(),
618
- pool: z.string(),
619
- poolSqrtPrice: z.coerce.bigint(),
620
- collateralToken: z.string(),
621
- borrowToken: z.string(),
622
- positionToken: z.string(),
623
- collateral: amountWithUsd,
624
- loanFunds: amountWithUsd,
625
- currentLoan: amountWithUsd,
626
- total: amountWithUsd,
627
- uiLiquidationPrice: z.nullable(z.number()),
628
- pnlUsd: usdPnl,
629
- leverage: z.number(),
630
- openedAt: z.coerce.date(),
631
- openedAtSlot: z.coerce.bigint(),
632
- updatedAtSlot: z.coerce.bigint(),
633
- closedAt: z.nullable(z.coerce.date())
505
+ lowerLimitOrderPrice: z6.number(),
506
+ upperLimitOrderPrice: z6.number(),
507
+ entryPrice: z6.number(),
508
+ mintA: Mint,
509
+ mintB: Mint,
510
+ pool: TunaPositionPoolSchema,
511
+ positionToken: TunaPositionPoolToken,
512
+ collateralToken: TunaPositionPoolToken,
513
+ marketMaker: PoolProviderSchema,
514
+ depositedCollateral: AmountWithUsdSchema,
515
+ initialDebt: AmountWithUsdSchema,
516
+ currentDebt: AmountWithUsdSchema,
517
+ total: AmountWithUsdSchema,
518
+ leverage: z6.number(),
519
+ maxLeverage: z6.number(),
520
+ liquidationPrice: z6.number(),
521
+ pnlUsd: UsdPnlSchema,
522
+ openedAt: z6.coerce.date(),
523
+ closedAt: z6.nullable(z6.coerce.date())
524
+ });
525
+ var IncreaseSpotPositionQuote = z6.object({
526
+ /** Required collateral amount */
527
+ collateralAmount: z6.coerce.bigint(),
528
+ /** Required amount to borrow */
529
+ borrowAmount: z6.coerce.bigint(),
530
+ /** Estimated position size in the position token. */
531
+ estimatedAmount: z6.coerce.bigint(),
532
+ /** Swap input amount. */
533
+ swapInputAmount: z6.coerce.bigint(),
534
+ /** Minimum swap output amount according to the provided slippage. */
535
+ minSwapOutputAmount: z6.coerce.bigint(),
536
+ /** Protocol fee in token A */
537
+ protocolFeeA: z6.coerce.bigint(),
538
+ /** Protocol fee in token B */
539
+ protocolFeeB: z6.coerce.bigint(),
540
+ /** Price impact in percents */
541
+ priceImpact: z6.number(),
542
+ /** Liquidation price */
543
+ liquidationPrice: z6.number()
634
544
  });
635
- var PoolSwap = z.object({
636
- id: z.string(),
637
- amountIn: z.coerce.bigint(),
638
- amountOut: z.coerce.bigint(),
639
- amountUsd: z.number(),
640
- aToB: z.boolean(),
641
- pool: z.string(),
642
- time: z.coerce.date()
545
+ var DecreaseSpotPositionQuote = z6.object({
546
+ /** Confirmed position decrease percentage (100% = 1.0) */
547
+ decreasePercent: z6.number(),
548
+ /** The maximum acceptable swap input amount for position decrease according to the provided slippage
549
+ * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
550
+ */
551
+ requiredSwapAmount: z6.coerce.bigint(),
552
+ /** Estimated total amount of the adjusted position */
553
+ estimatedAmount: z6.coerce.bigint(),
554
+ /** Estimated amount of the withdrawn collateral */
555
+ estimatedWithdrawnCollateral: z6.coerce.bigint(),
556
+ /** Price impact in percents */
557
+ priceImpact: z6.number(),
558
+ /** Liquidation price */
559
+ liquidationPrice: z6.number()
643
560
  });
644
- var OrderBookEntry = z.object({
645
- concentratedAmount: z.coerce.bigint(),
646
- concentratedAmountQuote: z.coerce.bigint(),
647
- concentratedTotal: z.coerce.bigint(),
648
- concentratedTotalQuote: z.coerce.bigint(),
649
- limitAmount: z.coerce.bigint(),
650
- limitAmountQuote: z.coerce.bigint(),
651
- limitTotal: z.coerce.bigint(),
652
- limitTotalQuote: z.coerce.bigint(),
653
- price: z.number(),
654
- askSide: z.boolean()
561
+ var CloseSpotPositionQuote = z6.object({
562
+ /** Position decrease percentage */
563
+ decreasePercent: z6.number(),
564
+ /** The maximum acceptable swap input amount for position decrease according to the provided slippage
565
+ * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
566
+ */
567
+ requiredSwapAmount: z6.coerce.bigint(),
568
+ /** Estimated amount of the withdrawn collateral */
569
+ estimatedWithdrawnCollateral: z6.coerce.bigint(),
570
+ /** Price impact in percents */
571
+ priceImpact: z6.number()
655
572
  });
656
- var PoolPriceUpdate = z.object({
657
- pool: z.string(),
658
- price: z.number(),
659
- sqrtPrice: z.coerce.bigint(),
660
- time: z.coerce.date()
573
+
574
+ // src/client/schemas/state_snapshot.ts
575
+ import z7 from "zod";
576
+ var PoolPriceUpdate = z7.object({
577
+ pool: z7.string(),
578
+ price: z7.number(),
579
+ sqrtPrice: z7.coerce.bigint(),
580
+ time: z7.coerce.date()
661
581
  });
662
- var OrderBook = z.object({
663
- entries: OrderBookEntry.array(),
664
- poolPrice: z.number()
582
+ var StateSnapshot = z7.object({
583
+ slot: z7.coerce.bigint(),
584
+ blockTime: z7.coerce.date(),
585
+ poolPrices: z7.optional(z7.record(z7.string(), PoolPriceUpdate)),
586
+ tunaSpotPositions: z7.optional(z7.array(TunaSpotPosition)),
587
+ tunaLpPositions: z7.optional(z7.array(TunaLpPositionDtoSchema)),
588
+ fusionLimitOrders: z7.optional(z7.array(LimitOrder))
665
589
  });
666
- var LimitOrder = z.object({
667
- address: z.string(),
668
- mint: z.string(),
669
- pool: z.string(),
670
- state: LimitOrderStateSchema,
671
- aToB: z.boolean(),
672
- tickIndex: z.number(),
673
- fillRatio: z.number(),
674
- openTxSignature: z.string(),
675
- closeTxSignature: z.nullable(z.string()),
676
- amountIn: amountWithUsd,
677
- amountOut: amountWithUsd,
678
- openedAt: z.coerce.date(),
679
- closedAt: z.nullable(z.coerce.date())
590
+
591
+ // src/client/schemas.ts
592
+ var NotificationEntity = {
593
+ POOL_SWAP: "pool_swap",
594
+ POOL_PRICE: "pool_price",
595
+ ORDER_BOOK: "order_book",
596
+ TUNA_POSITION: "tuna_position",
597
+ TUNA_SPOT_POSITION: "tuna_spot_position",
598
+ LENDING_POSITION: "lending_position",
599
+ STAKING_POSITION: "staking_position",
600
+ FUSION_LIMIT_ORDER: "fusion_limit_order",
601
+ TRADE_HISTORY_ENTRY: "trade_history_entry",
602
+ ORDER_HISTORY_ENTRY: "order_history_entry",
603
+ STATE_SNAPSHOT: "state_snapshot"
604
+ };
605
+ var NotificationAction = {
606
+ CREATE: "create",
607
+ UPDATE: "update"
608
+ };
609
+ var TradeHistoryAction = {
610
+ SWAP: "swap",
611
+ LIMIT_ORDER_FILL: "limit_order_fill",
612
+ POSITION_INCREASE: "position_increase",
613
+ POSITION_DECREASE: "position_decrease",
614
+ TAKE_PROFIT: "take_profit",
615
+ STOP_LOSS: "stop_loss",
616
+ LIQUIDATION: "liquidation"
617
+ };
618
+ var TradeHistoryUIDirection = {
619
+ BUY: "buy",
620
+ SELL: "sell",
621
+ OPEN_LONG: "open_long",
622
+ CLOSE_LONG: "close_long",
623
+ OPEN_SHORT: "open_short",
624
+ CLOSE_SHORT: "close_short"
625
+ };
626
+ var OrderHistoryOrderType = {
627
+ MARKET: "market",
628
+ LIMIT: "limit",
629
+ TAKE_PROFIT_MARKET: "take_profit_market",
630
+ STOP_LOSS_MARKET: "stop_loss_market",
631
+ LIQUIDATION_MARKET: "liquidation_market"
632
+ };
633
+ var OrderHistoryStatus = {
634
+ OPEN: "open",
635
+ PARTIALLY_FILLED: "partially_filled",
636
+ FILLED: "filled",
637
+ CANCELLED: "cancelled",
638
+ CLAIMED: "claimed",
639
+ REJECTED: "rejected"
640
+ };
641
+ var OrderHistoryUIDirection = {
642
+ BUY: "buy",
643
+ SELL: "sell",
644
+ LONG: "long",
645
+ SHORT: "short"
646
+ };
647
+ var StakingPositionHistoryActionType = {
648
+ STAKE: "stake",
649
+ UNSTAKE: "unstake",
650
+ WITHDRAW: "withdraw",
651
+ CLAIM_REWARDS: "claim_rewards",
652
+ COMPOUND_REWARDS: "compound_rewards"
653
+ };
654
+ var PoolSubscriptionTopic = {
655
+ ORDER_BOOK: "order_book",
656
+ POOL_PRICES: "pool_prices",
657
+ POOL_SWAPS: "pool_swaps"
658
+ };
659
+ var WalletSubscriptionTopic = {
660
+ TUNA_POSITIONS: "tuna_positions",
661
+ TUNA_SPOT_POSITIONS: "tuna_spot_positions",
662
+ LENDING_POSITIONS: "lending_positions",
663
+ FUSION_LIMIT_ORDERS: "fusion_limit_orders",
664
+ STAKING_POSITION: "staking_position",
665
+ TRADE_HISTORY: "trade_history",
666
+ ORDER_HISTORY: "order_history"
667
+ };
668
+ var NotificationEntitySchema = z8.enum([NotificationEntity.POOL_SWAP, ...Object.values(NotificationEntity)]);
669
+ var NotificationActionSchema = z8.enum([NotificationAction.CREATE, ...Object.values(NotificationAction)]);
670
+ var TradeHistoryActionSchema = z8.enum([TradeHistoryAction.SWAP, ...Object.values(TradeHistoryAction)]);
671
+ var TradeHistoryUIDirectionSchema = z8.enum([
672
+ TradeHistoryUIDirection.BUY,
673
+ ...Object.values(TradeHistoryUIDirection)
674
+ ]);
675
+ var OrderHistoryOrderTypeSchema = z8.enum([
676
+ OrderHistoryOrderType.MARKET,
677
+ ...Object.values(OrderHistoryOrderType)
678
+ ]);
679
+ var OrderHistoryStatusSchema = z8.enum([OrderHistoryStatus.OPEN, ...Object.values(OrderHistoryStatus)]);
680
+ var OrderHistoryUIDirectionSchema = z8.enum([
681
+ OrderHistoryUIDirection.BUY,
682
+ ...Object.values(OrderHistoryUIDirection)
683
+ ]);
684
+ var StakingPositionHistoryActionTypeSchema = z8.enum([
685
+ StakingPositionHistoryActionType.STAKE,
686
+ ...Object.values(StakingPositionHistoryActionType)
687
+ ]);
688
+ var PoolSubscriptionTopicSchema = z8.enum([
689
+ PoolSubscriptionTopic.ORDER_BOOK,
690
+ ...Object.values(PoolSubscriptionTopic)
691
+ ]);
692
+ var WalletSubscriptionTopicSchema = z8.enum([
693
+ WalletSubscriptionTopic.TUNA_POSITIONS,
694
+ ...Object.values(WalletSubscriptionTopic)
695
+ ]);
696
+ var PaginationMeta = z8.object({
697
+ total: z8.number()
698
+ });
699
+ var Market = z8.object({
700
+ address: z8.string(),
701
+ addressLookupTable: z8.string(),
702
+ poolAddress: z8.string(),
703
+ poolFeeRate: z8.number(),
704
+ provider: PoolProviderSchema,
705
+ maxLeverage: z8.number(),
706
+ maxSwapSlippage: z8.number(),
707
+ protocolFee: z8.number(),
708
+ rebalanceProtocolFee: z8.number(),
709
+ protocolFeeOnCollateral: z8.number(),
710
+ liquidationFee: z8.number(),
711
+ liquidationThreshold: z8.number(),
712
+ oraclePriceDeviationThreshold: z8.number(),
713
+ maxSpotPositionSizeA: AmountWithUsdSchema,
714
+ maxSpotPositionSizeB: AmountWithUsdSchema,
715
+ borrowedFundsA: AmountWithUsdSchema,
716
+ borrowedFundsB: AmountWithUsdSchema,
717
+ availableBorrowA: AmountWithUsdSchema,
718
+ availableBorrowB: AmountWithUsdSchema,
719
+ borrowLimitA: AmountWithUsdSchema,
720
+ borrowLimitB: AmountWithUsdSchema,
721
+ disabled: z8.boolean(),
722
+ createdAt: z8.coerce.date()
723
+ });
724
+ var TokenOraclePrice = z8.object({
725
+ mint: z8.string(),
726
+ price: z8.coerce.bigint(),
727
+ decimals: z8.number(),
728
+ time: z8.coerce.date()
729
+ });
730
+ var Vault = z8.object({
731
+ address: z8.string(),
732
+ mint: z8.string(),
733
+ depositedFunds: AmountWithUsdSchema,
734
+ borrowedFunds: AmountWithUsdSchema,
735
+ supplyLimit: AmountWithUsdSchema,
736
+ borrowedShares: z8.coerce.bigint(),
737
+ depositedShares: z8.coerce.bigint(),
738
+ supplyApy: z8.number(),
739
+ borrowApy: z8.number(),
740
+ interestRate: z8.coerce.bigint(),
741
+ utilization: z8.number(),
742
+ pythOracleFeedId: z8.string(),
743
+ pythOraclePriceUpdate: z8.string()
744
+ });
745
+ var VaultHistoricalStats = z8.object({
746
+ date: z8.preprocess((val, ctx) => {
747
+ if (typeof val === "string") {
748
+ const [year, month, day] = val.split("-").map(Number);
749
+ return new Date(year, month - 1, day);
750
+ }
751
+ ctx.addIssue({
752
+ code: "custom",
753
+ message: "Not a valid date string"
754
+ });
755
+ return z8.NEVER;
756
+ }, z8.date()),
757
+ supply: AmountWithUsdSchema,
758
+ borrow: AmountWithUsdSchema,
759
+ supplyApy: z8.number(),
760
+ borrowApr: z8.number()
761
+ });
762
+ var Pool = z8.object({
763
+ address: z8.string(),
764
+ provider: PoolProviderSchema,
765
+ tokenAMint: z8.string(),
766
+ tokenBMint: z8.string(),
767
+ tokenAVault: z8.string(),
768
+ tokenBVault: z8.string(),
769
+ tvlUsdc: z8.coerce.number(),
770
+ priceChange24H: z8.number(),
771
+ tickSpacing: z8.number(),
772
+ feeRate: z8.number(),
773
+ olpFeeRate: z8.nullable(z8.number()),
774
+ protocolFeeRate: z8.number(),
775
+ liquidity: z8.coerce.bigint(),
776
+ sqrtPrice: z8.coerce.bigint(),
777
+ tickCurrentIndex: z8.number(),
778
+ stats: z8.object({
779
+ "24h": z8.object({
780
+ volume: z8.coerce.number(),
781
+ fees: z8.coerce.number(),
782
+ rewards: z8.coerce.number(),
783
+ yieldOverTvl: z8.coerce.number()
784
+ }),
785
+ "7d": z8.object({
786
+ volume: z8.coerce.number(),
787
+ fees: z8.coerce.number(),
788
+ rewards: z8.coerce.number(),
789
+ yieldOverTvl: z8.coerce.number()
790
+ }),
791
+ "30d": z8.object({
792
+ volume: z8.coerce.number(),
793
+ fees: z8.coerce.number(),
794
+ rewards: z8.coerce.number(),
795
+ yieldOverTvl: z8.coerce.number()
796
+ })
797
+ })
798
+ });
799
+ var Tick = z8.object({
800
+ index: z8.number(),
801
+ liquidity: z8.coerce.bigint()
802
+ });
803
+ var PoolTicks = z8.object({
804
+ tickSpacing: z8.number(),
805
+ ticks: Tick.array()
806
+ });
807
+ var LendingPosition = z8.object({
808
+ address: z8.string(),
809
+ authority: z8.string(),
810
+ mint: z8.string(),
811
+ vault: z8.string(),
812
+ shares: z8.coerce.bigint(),
813
+ funds: AmountWithUsdSchema,
814
+ earned: AmountWithUsdSchema
680
815
  });
681
- var TradeHistoryEntry = z.object({
816
+ var PoolSwap = z8.object({
817
+ id: z8.string(),
818
+ amountIn: z8.coerce.bigint(),
819
+ amountOut: z8.coerce.bigint(),
820
+ amountUsd: z8.number(),
821
+ aToB: z8.boolean(),
822
+ pool: z8.string(),
823
+ time: z8.coerce.date()
824
+ });
825
+ var OrderBookEntry = z8.object({
826
+ concentratedAmount: z8.coerce.bigint(),
827
+ concentratedAmountQuote: z8.coerce.bigint(),
828
+ concentratedTotal: z8.coerce.bigint(),
829
+ concentratedTotalQuote: z8.coerce.bigint(),
830
+ limitAmount: z8.coerce.bigint(),
831
+ limitAmountQuote: z8.coerce.bigint(),
832
+ limitTotal: z8.coerce.bigint(),
833
+ limitTotalQuote: z8.coerce.bigint(),
834
+ price: z8.number(),
835
+ askSide: z8.boolean()
836
+ });
837
+ var OrderBook = z8.object({
838
+ entries: OrderBookEntry.array(),
839
+ poolPrice: z8.number()
840
+ });
841
+ var TradeHistoryEntry = z8.object({
682
842
  // Internal entry ID
683
- id: z.string(),
684
- pool: z.string(),
685
- authority: z.string(),
686
- aToB: z.boolean(),
843
+ id: z8.string(),
844
+ pool: z8.string(),
845
+ authority: z8.string(),
846
+ aToB: z8.boolean(),
687
847
  // Trade action which created entry
688
848
  action: TradeHistoryActionSchema,
689
849
  // Trade direction formatted for ui display
690
850
  uiDirection: TradeHistoryUIDirectionSchema,
691
851
  // Trade price formatted for ui display
692
- uiPrice: z.number(),
693
- baseToken: amountWithUsd,
694
- quoteToken: amountWithUsd,
695
- fee: amountWithUsd,
696
- pnl: z.nullable(
697
- z.object({
698
- usd: z.number(),
699
- bps: z.number()
852
+ uiPrice: z8.number(),
853
+ baseToken: AmountWithUsdSchema,
854
+ quoteToken: AmountWithUsdSchema,
855
+ fee: AmountWithUsdSchema,
856
+ pnl: z8.nullable(
857
+ z8.object({
858
+ usd: z8.number(),
859
+ bps: z8.number()
700
860
  })
701
861
  ),
702
- txSignature: z.nullable(z.string()),
703
- positionAddress: z.nullable(z.string()),
704
- slot: z.coerce.bigint(),
705
- ts: z.coerce.date()
862
+ txSignature: z8.nullable(z8.string()),
863
+ positionAddress: z8.nullable(z8.string()),
864
+ slot: z8.coerce.bigint(),
865
+ ts: z8.coerce.date()
706
866
  });
707
- var OrderHistoryEntry = z.object({
867
+ var OrderHistoryEntry = z8.object({
708
868
  // Internal entry ID
709
- id: z.string(),
710
- pool: z.string(),
711
- authority: z.string(),
869
+ id: z8.string(),
870
+ pool: z8.string(),
871
+ authority: z8.string(),
712
872
  orderType: OrderHistoryOrderTypeSchema,
713
- isReduceOnly: z.nullable(z.boolean()),
714
- aToB: z.boolean(),
873
+ isReduceOnly: z8.nullable(z8.boolean()),
874
+ aToB: z8.boolean(),
715
875
  uiDirection: OrderHistoryUIDirectionSchema,
716
- uiPrice: z.nullable(z.number()),
717
- uiExecutionPrice: z.nullable(z.number()),
876
+ uiPrice: z8.nullable(z8.number()),
877
+ uiExecutionPrice: z8.nullable(z8.number()),
718
878
  status: OrderHistoryStatusSchema,
719
- baseToken: amountWithUsd,
720
- quoteToken: amountWithUsd,
721
- baseTokenConsumedAmount: z.nullable(amountWithUsd),
722
- quoteTokenFilledAmount: z.nullable(amountWithUsd),
723
- txSignature: z.nullable(z.string()),
724
- positionAddress: z.nullable(z.string()),
725
- slot: z.coerce.bigint(),
726
- ts: z.coerce.date()
879
+ baseToken: AmountWithUsdSchema,
880
+ quoteToken: AmountWithUsdSchema,
881
+ baseTokenConsumedAmount: z8.nullable(AmountWithUsdSchema),
882
+ quoteTokenFilledAmount: z8.nullable(AmountWithUsdSchema),
883
+ txSignature: z8.nullable(z8.string()),
884
+ positionAddress: z8.nullable(z8.string()),
885
+ slot: z8.coerce.bigint(),
886
+ ts: z8.coerce.date()
727
887
  });
728
- var StakingTreasury = z.object({
729
- address: z.string(),
730
- stakedTokenMint: z.string(),
731
- rewardTokenMint: z.string(),
732
- apy: z.number(),
733
- uniqueStakers: z.number(),
734
- totalStaked: amountWithUsd,
735
- totalReward: amountWithUsd,
736
- unstakeCooldownSeconds: z.number(),
737
- isStakingEnabled: z.boolean(),
738
- isUnstakingEnabled: z.boolean(),
739
- isWithdrawEnabled: z.boolean()
888
+ var StakingTreasury = z8.object({
889
+ address: z8.string(),
890
+ stakedTokenMint: z8.string(),
891
+ rewardTokenMint: z8.string(),
892
+ apy: z8.number(),
893
+ uniqueStakers: z8.number(),
894
+ totalStaked: AmountWithUsdSchema,
895
+ totalReward: AmountWithUsdSchema,
896
+ unstakeCooldownSeconds: z8.number(),
897
+ isStakingEnabled: z8.boolean(),
898
+ isUnstakingEnabled: z8.boolean(),
899
+ isWithdrawEnabled: z8.boolean()
740
900
  });
741
- var StakingPosition = z.object({
742
- address: z.string(),
743
- owner: z.string(),
744
- staked: amountWithUsd,
745
- unstaked: amountWithUsd,
746
- claimedReward: amountWithUsd,
747
- unclaimedReward: amountWithUsd,
748
- rank: z.nullable(z.number()),
749
- vesting: z.object({
750
- locked: amountWithUsd,
751
- unlocked: amountWithUsd,
752
- unlockRate: z.coerce.bigint(),
753
- unlockEverySeconds: z.number(),
754
- unlockCliffSeconds: z.number(),
755
- lockedAt: z.nullable(z.coerce.date())
901
+ var StakingPosition = z8.object({
902
+ address: z8.string(),
903
+ owner: z8.string(),
904
+ staked: AmountWithUsdSchema,
905
+ unstaked: AmountWithUsdSchema,
906
+ claimedReward: AmountWithUsdSchema,
907
+ unclaimedReward: AmountWithUsdSchema,
908
+ rank: z8.nullable(z8.number()),
909
+ vesting: z8.object({
910
+ locked: AmountWithUsdSchema,
911
+ unlocked: AmountWithUsdSchema,
912
+ unlockRate: z8.coerce.bigint(),
913
+ unlockEverySeconds: z8.number(),
914
+ unlockCliffSeconds: z8.number(),
915
+ lockedAt: z8.nullable(z8.coerce.date())
756
916
  }),
757
- lastUnstakedAt: z.nullable(z.coerce.date()),
758
- withdrawAvailableAt: z.nullable(z.coerce.date())
917
+ lastUnstakedAt: z8.nullable(z8.coerce.date()),
918
+ withdrawAvailableAt: z8.nullable(z8.coerce.date())
759
919
  });
760
- var StakingLeaderboardPosition = z.object({
761
- rank: z.number(),
762
- address: z.string(),
763
- owner: z.string(),
764
- staked: amountWithUsd
920
+ var StakingLeaderboardPosition = z8.object({
921
+ rank: z8.number(),
922
+ address: z8.string(),
923
+ owner: z8.string(),
924
+ staked: AmountWithUsdSchema
765
925
  });
766
- var StakingLeaderboardPage = z.object({
926
+ var StakingLeaderboardPage = z8.object({
767
927
  data: StakingLeaderboardPosition.array(),
768
928
  meta: PaginationMeta
769
929
  });
770
- var StakingPositionHistoryAction = z.object({
771
- position: z.string(),
930
+ var StakingPositionHistoryAction = z8.object({
931
+ position: z8.string(),
772
932
  action: StakingPositionHistoryActionTypeSchema,
773
- txSignature: z.string(),
774
- amount: z.coerce.bigint(),
775
- time: z.coerce.date()
933
+ txSignature: z8.string(),
934
+ amount: z8.coerce.bigint(),
935
+ time: z8.coerce.date()
776
936
  });
777
- var PoolPriceCandle = z.object({
778
- time: z.number(),
779
- open: z.number(),
780
- close: z.number(),
781
- high: z.number(),
782
- low: z.number(),
783
- volume: z.number()
937
+ var PoolPriceCandle = z8.object({
938
+ time: z8.number(),
939
+ open: z8.number(),
940
+ close: z8.number(),
941
+ high: z8.number(),
942
+ low: z8.number(),
943
+ volume: z8.number()
784
944
  });
785
- var FeesStatsGroup = z.object({
786
- time: z.coerce.date(),
787
- addLiquidityFees: z.number(),
788
- limitOrderFees: z.number(),
789
- yieldCompoundingFees: z.number(),
790
- liquidationFees: z.number(),
791
- totalLiquidationsNetworkFees: z.number(),
792
- totalLimitOrdersNetworkFees: z.number(),
793
- totalYieldCompoundingNetworkFees: z.number(),
794
- failedNetworkFees: z.number(),
795
- processedNetworkFees: z.number(),
796
- totalCollectedFees: z.number(),
797
- totalNetworkFees: z.number(),
798
- jitoLiquidationFees: z.number(),
799
- jitoLimitOrderFees: z.number(),
800
- jitoYieldCompoundingFees: z.number(),
801
- runningAddLiquidityFees: z.number(),
802
- runningLimitOrderFees: z.number(),
803
- runningYieldCompoundingFees: z.number(),
804
- runningLiquidationFees: z.number(),
805
- runningTotalLiquidationsNetworkFees: z.number(),
806
- runningTotalLimitOrdersNetworkFees: z.number(),
807
- runningTotalYieldCompoundingNetworkFees: z.number(),
808
- runningFailedNetworkFees: z.number(),
809
- runningProcessedNetworkFees: z.number(),
810
- runningJitoLiquidationFees: z.number(),
811
- runningJitoLimitOrderFees: z.number(),
812
- runningJitoYieldCompoundingFees: z.number(),
813
- runningTotalCollectedFees: z.number(),
814
- runningTotalNetworkFees: z.number()
945
+ var FeesStatsGroup = z8.object({
946
+ time: z8.coerce.date(),
947
+ addLiquidityFees: z8.number(),
948
+ limitOrderFees: z8.number(),
949
+ yieldCompoundingFees: z8.number(),
950
+ liquidationFees: z8.number(),
951
+ totalLiquidationsNetworkFees: z8.number(),
952
+ totalLimitOrdersNetworkFees: z8.number(),
953
+ totalYieldCompoundingNetworkFees: z8.number(),
954
+ failedNetworkFees: z8.number(),
955
+ processedNetworkFees: z8.number(),
956
+ totalCollectedFees: z8.number(),
957
+ totalNetworkFees: z8.number(),
958
+ jitoLiquidationFees: z8.number(),
959
+ jitoLimitOrderFees: z8.number(),
960
+ jitoYieldCompoundingFees: z8.number(),
961
+ runningAddLiquidityFees: z8.number(),
962
+ runningLimitOrderFees: z8.number(),
963
+ runningYieldCompoundingFees: z8.number(),
964
+ runningLiquidationFees: z8.number(),
965
+ runningTotalLiquidationsNetworkFees: z8.number(),
966
+ runningTotalLimitOrdersNetworkFees: z8.number(),
967
+ runningTotalYieldCompoundingNetworkFees: z8.number(),
968
+ runningFailedNetworkFees: z8.number(),
969
+ runningProcessedNetworkFees: z8.number(),
970
+ runningJitoLiquidationFees: z8.number(),
971
+ runningJitoLimitOrderFees: z8.number(),
972
+ runningJitoYieldCompoundingFees: z8.number(),
973
+ runningTotalCollectedFees: z8.number(),
974
+ runningTotalNetworkFees: z8.number()
815
975
  });
816
- var StakingRevenueStatsGroup = z.object({
817
- time: z.coerce.date(),
818
- totalDepositsUsd: z.number(),
819
- totalDepositsSol: z.coerce.bigint(),
820
- runningTotalDepositsUsd: z.number(),
821
- runningTotalDepositsSol: z.coerce.bigint()
976
+ var StakingRevenueStatsGroup = z8.object({
977
+ time: z8.coerce.date(),
978
+ totalDepositsUsd: z8.number(),
979
+ totalDepositsSol: z8.coerce.bigint(),
980
+ runningTotalDepositsUsd: z8.number(),
981
+ runningTotalDepositsSol: z8.coerce.bigint()
822
982
  });
823
- var IncreaseSpotPositionQuote = z.object({
824
- /** Required collateral amount */
825
- collateralAmount: z.coerce.bigint(),
826
- /** Required amount to borrow */
827
- borrowAmount: z.coerce.bigint(),
828
- /** Estimated position size in the position token. */
829
- estimatedAmount: z.coerce.bigint(),
830
- /** Swap input amount. */
831
- swapInputAmount: z.coerce.bigint(),
832
- /** Minimum swap output amount according to the provided slippage. */
833
- minSwapOutputAmount: z.coerce.bigint(),
834
- /** Protocol fee in token A */
835
- protocolFeeA: z.coerce.bigint(),
836
- /** Protocol fee in token B */
837
- protocolFeeB: z.coerce.bigint(),
983
+ var SwapQuoteByInput = z8.object({
984
+ estimatedAmountOut: z8.coerce.bigint(),
985
+ minAmountOut: z8.coerce.bigint(),
986
+ feeAmount: z8.coerce.bigint(),
987
+ feeUsd: z8.number(),
838
988
  /** Price impact in percents */
839
- priceImpact: z.number(),
840
- /** Liquidation price */
841
- uiLiquidationPrice: z.nullable(z.number())
989
+ priceImpact: z8.number()
842
990
  });
843
- var DecreaseSpotPositionQuote = z.object({
844
- /** Confirmed position decrease percentage (100% = 1.0) */
845
- decreasePercent: z.number(),
846
- /** The maximum acceptable swap input amount for position decrease according to the provided slippage
847
- * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
848
- */
849
- requiredSwapAmount: z.coerce.bigint(),
850
- /** Estimated total amount of the adjusted position */
851
- estimatedAmount: z.coerce.bigint(),
852
- /** Estimated amount of the withdrawn collateral */
853
- estimatedWithdrawnCollateral: z.coerce.bigint(),
991
+ var SwapQuoteByOutput = z8.object({
992
+ estimatedAmountIn: z8.coerce.bigint(),
993
+ maxAmountIn: z8.coerce.bigint(),
994
+ feeAmount: z8.coerce.bigint(),
995
+ feeUsd: z8.number(),
854
996
  /** Price impact in percents */
855
- priceImpact: z.number(),
856
- /** Liquidation price */
857
- uiLiquidationPrice: z.nullable(z.number())
858
- });
859
- var CloseSpotPositionQuote = z.object({
860
- /** Position decrease percentage */
861
- decreasePercent: z.number(),
862
- /** The maximum acceptable swap input amount for position decrease according to the provided slippage
863
- * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
864
- */
865
- requiredSwapAmount: z.coerce.bigint(),
866
- /** Estimated amount of the withdrawn collateral */
867
- estimatedWithdrawnCollateral: z.coerce.bigint(),
868
- /** Price impact in percents */
869
- priceImpact: z.number()
870
- });
871
- var SwapQuoteByInput = z.object({
872
- estimatedAmountOut: z.coerce.bigint(),
873
- minAmountOut: z.coerce.bigint(),
874
- feeAmount: z.coerce.bigint(),
875
- feeUsd: z.number(),
876
- /** Price impact in percents */
877
- priceImpact: z.number()
878
- });
879
- var SwapQuoteByOutput = z.object({
880
- estimatedAmountIn: z.coerce.bigint(),
881
- maxAmountIn: z.coerce.bigint(),
882
- feeAmount: z.coerce.bigint(),
883
- feeUsd: z.number(),
884
- /** Price impact in percents */
885
- priceImpact: z.number()
886
- });
887
- var StateSnapshot = z.object({
888
- slot: z.coerce.bigint(),
889
- blockTime: z.coerce.date(),
890
- poolPrices: z.optional(z.record(z.string(), PoolPriceUpdate)),
891
- tunaSpotPositions: z.optional(z.array(TunaSpotPosition)),
892
- tunaLpPositions: z.optional(z.array(TunaPosition)),
893
- fusionLimitOrders: z.optional(z.array(LimitOrder))
997
+ priceImpact: z8.number()
894
998
  });
895
- var LimitOrderQuoteByInput = z.object({
896
- amountOut: z.coerce.bigint()
999
+ var LimitOrderQuoteByInput = z8.object({
1000
+ amountOut: z8.coerce.bigint()
897
1001
  });
898
- var LimitOrderQuoteByOutput = z.object({
899
- amountIn: z.coerce.bigint()
1002
+ var LimitOrderQuoteByOutput = z8.object({
1003
+ amountIn: z8.coerce.bigint()
900
1004
  });
901
- var TradableAmount = amountWithUsd;
902
- var UpdateStreamSubscriptionResult = z.object({
903
- status: z.string()
1005
+ var TradableAmount = AmountWithUsdSchema;
1006
+ var UpdateStreamSubscriptionResult = z8.object({
1007
+ status: z8.string()
904
1008
  });
905
- var createNotificationSchema = (dataSchema, metaSchema) => z.object({
1009
+ var createNotificationSchema = (dataSchema, metaSchema) => z8.object({
906
1010
  entity: NotificationEntitySchema,
907
1011
  action: NotificationActionSchema,
908
1012
  data: dataSchema,
909
- id: z.string(),
910
- authority: z.nullish(z.string()),
911
- ...metaSchema ? { meta: metaSchema } : { meta: z.undefined().nullable() }
1013
+ id: z8.string(),
1014
+ authority: z8.nullish(z8.string()),
1015
+ ...metaSchema ? { meta: metaSchema } : { meta: z8.undefined().nullable() }
912
1016
  });
913
- var OrderBookNotificationMeta = z.object({
914
- pool: z.string(),
915
- priceStep: z.number(),
916
- inverted: z.boolean()
1017
+ var OrderBookNotificationMeta = z8.object({
1018
+ pool: z8.string(),
1019
+ priceStep: z8.number(),
1020
+ inverted: z8.boolean()
917
1021
  });
918
1022
  var PoolSwapNotification = createNotificationSchema(PoolSwap);
919
1023
  var PoolPriceUpdateNotification = createNotificationSchema(PoolPriceUpdate);
920
1024
  var OrderBookNotification = createNotificationSchema(OrderBook, OrderBookNotificationMeta);
921
- var TunaPositionNotification = createNotificationSchema(TunaPosition);
1025
+ var TunaPositionNotification = createNotificationSchema(TunaPositionLegacy);
922
1026
  var TunaSpotPositionNotification = createNotificationSchema(TunaSpotPosition);
923
1027
  var LendingPositionNotification = createNotificationSchema(LendingPosition);
924
1028
  var LimitOrderNotification = createNotificationSchema(LimitOrder);
@@ -1096,11 +1200,11 @@ var TunaApiClient = class {
1096
1200
  }
1097
1201
  async getUserTunaPositions(userAddress) {
1098
1202
  const url = this.buildURL(`users/${userAddress}/tuna-positions`);
1099
- return await this.httpRequest(url, TunaPosition.array());
1203
+ return await this.httpRequest(url, TunaLpPositionDtoSchema.array());
1100
1204
  }
1101
1205
  async getUserTunaPositionByAddress(userAddress, tunaPositionAddress) {
1102
1206
  const url = this.buildURL(`users/${userAddress}/tuna-positions/${tunaPositionAddress}`);
1103
- return await this.httpRequest(url, TunaPosition);
1207
+ return await this.httpRequest(url, TunaLpPositionDtoSchema);
1104
1208
  }
1105
1209
  async getUserLpPositions(userAddress, options) {
1106
1210
  const query = {};
@@ -1129,7 +1233,7 @@ var TunaApiClient = class {
1129
1233
  }
1130
1234
  }
1131
1235
  const url = this.appendUrlSearchParams(this.buildURL(`users/${userAddress}/lp-positions`), query);
1132
- return await this.httpRequest(url, TunaLpPosition.array());
1236
+ return await this.httpRequest(url, TunaLpPositionHistorical.array());
1133
1237
  }
1134
1238
  async getUserLpPositionActions(userAddress, positionAddress) {
1135
1239
  const url = this.buildURL(`users/${userAddress}/lp-positions/${positionAddress}/actions`);