@crypticdot/defituna-api 1.10.0 → 1.10.1

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