@crypticdot/defituna-api 1.5.3 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2237,22 +2237,26 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
2237
2237
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
2238
2238
  */
2239
2239
  requiredSwapAmount: z.ZodBigInt;
2240
+ /** Estimated total amount of the adjusted position */
2241
+ estimatedAmount: z.ZodBigInt;
2240
2242
  /** Price impact in percents */
2241
2243
  priceImpact: z.ZodNumber;
2242
2244
  /** Liquidation price */
2243
2245
  uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
2244
2246
  }, "strip", z.ZodTypeAny, {
2245
2247
  uiLiquidationPrice: number | null;
2248
+ estimatedAmount: bigint;
2246
2249
  priceImpact: number;
2247
2250
  decreasePercent: number;
2248
2251
  requiredSwapAmount: bigint;
2249
2252
  }, {
2250
2253
  uiLiquidationPrice: number | null;
2254
+ estimatedAmount: bigint;
2251
2255
  priceImpact: number;
2252
2256
  decreasePercent: number;
2253
2257
  requiredSwapAmount: bigint;
2254
2258
  }>;
2255
- declare const SwapByInputQuote$1: z.ZodObject<{
2259
+ declare const SwapQuoteByInput$1: z.ZodObject<{
2256
2260
  estimatedAmountOut: z.ZodBigInt;
2257
2261
  minAmountOut: z.ZodBigInt;
2258
2262
  feeAmount: z.ZodBigInt;
@@ -2272,7 +2276,7 @@ declare const SwapByInputQuote$1: z.ZodObject<{
2272
2276
  feeAmount: bigint;
2273
2277
  feeUsd: number;
2274
2278
  }>;
2275
- declare const SwapByOutputQuote$1: z.ZodObject<{
2279
+ declare const SwapQuoteByOutput$1: z.ZodObject<{
2276
2280
  estimatedAmountIn: z.ZodBigInt;
2277
2281
  maxAmountIn: z.ZodBigInt;
2278
2282
  feeAmount: z.ZodBigInt;
@@ -2292,6 +2296,20 @@ declare const SwapByOutputQuote$1: z.ZodObject<{
2292
2296
  estimatedAmountIn: bigint;
2293
2297
  maxAmountIn: bigint;
2294
2298
  }>;
2299
+ declare const LimitOrderQuoteByInput$1: z.ZodObject<{
2300
+ amountOut: z.ZodBigInt;
2301
+ }, "strip", z.ZodTypeAny, {
2302
+ amountOut: bigint;
2303
+ }, {
2304
+ amountOut: bigint;
2305
+ }>;
2306
+ declare const LimitOrderQuoteByOutput$1: z.ZodObject<{
2307
+ amountIn: z.ZodBigInt;
2308
+ }, "strip", z.ZodTypeAny, {
2309
+ amountIn: bigint;
2310
+ }, {
2311
+ amountIn: bigint;
2312
+ }>;
2295
2313
  declare const TradableAmount$1: z.ZodObject<{
2296
2314
  amount: z.ZodBigInt;
2297
2315
  usd: z.ZodNumber;
@@ -6227,7 +6245,7 @@ declare const schemas_UpdateStreamSubscriptionResult: typeof UpdateStreamSubscri
6227
6245
  declare const schemas_WalletSubscriptionTopic: typeof WalletSubscriptionTopic;
6228
6246
  declare const schemas_WalletSubscriptionTopicSchema: typeof WalletSubscriptionTopicSchema;
6229
6247
  declare namespace schemas {
6230
- export { DecreaseSpotPositionQuote$1 as DecreaseSpotPositionQuote, FeesStatsGroup$1 as FeesStatsGroup, IncreaseSpotPositionQuote$1 as IncreaseSpotPositionQuote, LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, OrderHistoryEntry$1 as OrderHistoryEntry, schemas_OrderHistoryEntryNotification as OrderHistoryEntryNotification, schemas_OrderHistoryOrderType as OrderHistoryOrderType, schemas_OrderHistoryOrderTypeSchema as OrderHistoryOrderTypeSchema, schemas_OrderHistoryStatus as OrderHistoryStatus, schemas_OrderHistoryStatusSchema as OrderHistoryStatusSchema, schemas_OrderHistoryUIDirection as OrderHistoryUIDirection, schemas_OrderHistoryUIDirectionSchema as OrderHistoryUIDirectionSchema, PaginationMeta$1 as PaginationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, StakingLeaderboardPage$1 as StakingLeaderboardPage, StakingLeaderboardPosition$1 as StakingLeaderboardPosition, StakingPosition$1 as StakingPosition, StakingPositionHistoryAction$1 as StakingPositionHistoryAction, StakingPositionHistoryActionType$1 as StakingPositionHistoryActionType, schemas_StakingPositionHistoryActionTypeSchema as StakingPositionHistoryActionTypeSchema, schemas_StakingPositionNotification as StakingPositionNotification, StakingRevenueStatsGroup$1 as StakingRevenueStatsGroup, StakingTreasury$1 as StakingTreasury, SwapByInputQuote$1 as SwapByInputQuote, SwapByOutputQuote$1 as SwapByOutputQuote, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TradableAmount$1 as TradableAmount, schemas_TradeHistoryAction as TradeHistoryAction, schemas_TradeHistoryActionSchema as TradeHistoryActionSchema, TradeHistoryEntry$1 as TradeHistoryEntry, schemas_TradeHistoryEntryNotification as TradeHistoryEntryNotification, schemas_TradeHistoryUIDirection as TradeHistoryUIDirection, schemas_TradeHistoryUIDirectionSchema as TradeHistoryUIDirectionSchema, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, TunaSpotPosition$1 as TunaSpotPosition, schemas_TunaSpotPositionNotification as TunaSpotPositionNotification, schemas_TunaSpotPositionState as TunaSpotPositionState, schemas_TunaSpotPositionStateSchema as TunaSpotPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, VaultHistoricalStats$1 as VaultHistoricalStats, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
6248
+ export { DecreaseSpotPositionQuote$1 as DecreaseSpotPositionQuote, FeesStatsGroup$1 as FeesStatsGroup, IncreaseSpotPositionQuote$1 as IncreaseSpotPositionQuote, LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, LimitOrderQuoteByInput$1 as LimitOrderQuoteByInput, LimitOrderQuoteByOutput$1 as LimitOrderQuoteByOutput, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, OrderHistoryEntry$1 as OrderHistoryEntry, schemas_OrderHistoryEntryNotification as OrderHistoryEntryNotification, schemas_OrderHistoryOrderType as OrderHistoryOrderType, schemas_OrderHistoryOrderTypeSchema as OrderHistoryOrderTypeSchema, schemas_OrderHistoryStatus as OrderHistoryStatus, schemas_OrderHistoryStatusSchema as OrderHistoryStatusSchema, schemas_OrderHistoryUIDirection as OrderHistoryUIDirection, schemas_OrderHistoryUIDirectionSchema as OrderHistoryUIDirectionSchema, PaginationMeta$1 as PaginationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, StakingLeaderboardPage$1 as StakingLeaderboardPage, StakingLeaderboardPosition$1 as StakingLeaderboardPosition, StakingPosition$1 as StakingPosition, StakingPositionHistoryAction$1 as StakingPositionHistoryAction, StakingPositionHistoryActionType$1 as StakingPositionHistoryActionType, schemas_StakingPositionHistoryActionTypeSchema as StakingPositionHistoryActionTypeSchema, schemas_StakingPositionNotification as StakingPositionNotification, StakingRevenueStatsGroup$1 as StakingRevenueStatsGroup, StakingTreasury$1 as StakingTreasury, SwapQuoteByInput$1 as SwapQuoteByInput, SwapQuoteByOutput$1 as SwapQuoteByOutput, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TradableAmount$1 as TradableAmount, schemas_TradeHistoryAction as TradeHistoryAction, schemas_TradeHistoryActionSchema as TradeHistoryActionSchema, TradeHistoryEntry$1 as TradeHistoryEntry, schemas_TradeHistoryEntryNotification as TradeHistoryEntryNotification, schemas_TradeHistoryUIDirection as TradeHistoryUIDirection, schemas_TradeHistoryUIDirectionSchema as TradeHistoryUIDirectionSchema, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, TunaSpotPosition$1 as TunaSpotPosition, schemas_TunaSpotPositionNotification as TunaSpotPositionNotification, schemas_TunaSpotPositionState as TunaSpotPositionState, schemas_TunaSpotPositionStateSchema as TunaSpotPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, VaultHistoricalStats$1 as VaultHistoricalStats, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
6231
6249
  }
6232
6250
 
6233
6251
  type PoolProviderType = z.infer<typeof PoolProviderSchema>;
@@ -6268,10 +6286,12 @@ type StakingPositionHistoryAction = z.infer<typeof StakingPositionHistoryAction$
6268
6286
  type PoolPriceCandle = z.infer<typeof PoolPriceCandle$1>;
6269
6287
  type FeesStatsGroup = z.infer<typeof FeesStatsGroup$1>;
6270
6288
  type StakingRevenueStatsGroup = z.infer<typeof StakingRevenueStatsGroup$1>;
6289
+ type LimitOrderQuoteByInput = z.infer<typeof LimitOrderQuoteByInput$1>;
6290
+ type LimitOrderQuoteByOutput = z.infer<typeof LimitOrderQuoteByOutput$1>;
6291
+ type SwapQuoteByInput = z.infer<typeof SwapQuoteByInput$1>;
6292
+ type SwapQuoteByOutput = z.infer<typeof SwapQuoteByOutput$1>;
6271
6293
  type IncreaseSpotPositionQuote = z.infer<typeof IncreaseSpotPositionQuote$1>;
6272
6294
  type DecreaseSpotPositionQuote = z.infer<typeof DecreaseSpotPositionQuote$1>;
6273
- type SwapByInputQuote = z.infer<typeof SwapByInputQuote$1>;
6274
- type SwapByOutputQuote = z.infer<typeof SwapByOutputQuote$1>;
6275
6295
  type TradableAmount = z.infer<typeof TradableAmount$1>;
6276
6296
  type PoolPriceUpdate = z.infer<typeof PoolPriceUpdate$1>;
6277
6297
  type SubscriptionPayload = {
@@ -6286,6 +6306,59 @@ type SubscriptionPayload = {
6286
6306
  topics: WalletSubscriptionTopicType[];
6287
6307
  };
6288
6308
  };
6309
+ type GetLimitOrderQuoteByInputArgs = {
6310
+ pool: string;
6311
+ amountIn: bigint;
6312
+ aToB: boolean;
6313
+ tickIndex: number;
6314
+ };
6315
+ type GetLimitOrderQuoteByOutputArgs = {
6316
+ pool: string;
6317
+ amountOut: bigint;
6318
+ aToB: boolean;
6319
+ tickIndex: number;
6320
+ };
6321
+ type GetSwapQuoteByInputArgs = {
6322
+ pool: string;
6323
+ amountIn: bigint;
6324
+ aToB: boolean;
6325
+ slippageToleranceBps?: number;
6326
+ };
6327
+ type GetSwapQuoteByOutputArgs = {
6328
+ pool: string;
6329
+ amountOut: bigint;
6330
+ aToB: boolean;
6331
+ slippageToleranceBps?: number;
6332
+ };
6333
+ type GetIncreaseSpotPositionQuoteArgs = {
6334
+ market: string;
6335
+ increaseAmount: bigint;
6336
+ collateralToken: number;
6337
+ positionToken: number;
6338
+ leverage: number;
6339
+ positionAmount?: bigint;
6340
+ positionDebt?: bigint;
6341
+ slippageTolerance?: number;
6342
+ };
6343
+ type GetDecreaseSpotPositionQuoteArgs = {
6344
+ market: string;
6345
+ decreaseAmount: bigint;
6346
+ collateralToken: number;
6347
+ positionToken: number;
6348
+ leverage: number;
6349
+ positionAmount: bigint;
6350
+ positionDebt: bigint;
6351
+ slippageTolerance?: number;
6352
+ };
6353
+ type GetTradableAmountArgs = {
6354
+ market: string;
6355
+ collateralToken: number;
6356
+ positionToken: number;
6357
+ availableBalance: bigint;
6358
+ leverage: number;
6359
+ positionAmount: bigint;
6360
+ increase: boolean;
6361
+ };
6289
6362
  type GetUserLimitOrdersOptions = {
6290
6363
  pool?: string[];
6291
6364
  status?: LimitOrderStateType[];
@@ -6390,15 +6463,31 @@ declare class TunaApiClient {
6390
6463
  getUserStakingPositionHistory(userAddress: string): Promise<StakingPositionHistoryAction[]>;
6391
6464
  getFeesStats(from: Date, to: Date, interval: string): Promise<FeesStatsGroup[]>;
6392
6465
  getStakingRevenueStats(from: Date, to: Date): Promise<StakingRevenueStatsGroup[]>;
6393
- getSwapQuoteByInput(pool: string, amountIn: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByInputQuote>;
6394
- getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByOutputQuote>;
6395
- getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: bigint, positionDebt?: bigint, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6396
- getDecreaseSpotPositionQuote(market: string, decreaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint, slippageTolerance?: number): Promise<DecreaseSpotPositionQuote>;
6397
- getTradableAmount(market: string, collateralToken: number, positionToken: number, availableBalance: bigint, leverage: number, positionAmount: bigint, increase: boolean): Promise<TradableAmount>;
6466
+ getLimitOrderQuoteByInput(args: GetLimitOrderQuoteByInputArgs, config?: {
6467
+ abortSignal?: AbortSignal;
6468
+ }): Promise<LimitOrderQuoteByInput>;
6469
+ getLimitOrderQuoteByOutput(args: GetLimitOrderQuoteByOutputArgs, config?: {
6470
+ abortSignal?: AbortSignal;
6471
+ }): Promise<LimitOrderQuoteByOutput>;
6472
+ getSwapQuoteByInput(args: GetSwapQuoteByInputArgs, config?: {
6473
+ abortSignal?: AbortSignal;
6474
+ }): Promise<SwapQuoteByInput>;
6475
+ getSwapQuoteByOutput(args: GetSwapQuoteByOutputArgs, config?: {
6476
+ abortSignal?: AbortSignal;
6477
+ }): Promise<SwapQuoteByOutput>;
6478
+ getIncreaseSpotPositionQuote(args: GetIncreaseSpotPositionQuoteArgs, config?: {
6479
+ abortSignal?: AbortSignal;
6480
+ }): Promise<IncreaseSpotPositionQuote>;
6481
+ getDecreaseSpotPositionQuote(args: GetDecreaseSpotPositionQuoteArgs, config?: {
6482
+ abortSignal?: AbortSignal;
6483
+ }): Promise<DecreaseSpotPositionQuote>;
6484
+ getTradableAmount(args: GetTradableAmountArgs, config?: {
6485
+ abortSignal?: AbortSignal;
6486
+ }): Promise<TradableAmount>;
6398
6487
  getUpdatesStream(): Promise<EventSource>;
6399
6488
  updateStreamSubscription(streamId: string, subscription: SubscriptionPayload): Promise<unknown>;
6400
6489
  private buildURL;
6401
6490
  private appendUrlSearchParams;
6402
6491
  }
6403
6492
 
6404
- export { type DecreaseSpotPositionQuote, type DurationInMs, type FeesStatsGroup, type GetPoolPriceCandlesOptions, type GetUserLimitOrdersOptions, type GetUserOrderHistoryOptions, type GetUserTradeHistoryOptions, type IncreaseSpotPositionQuote, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type OrderHistoryEntry, type OrderHistoryOrderTypeType, type OrderHistoryStatusType, type OrderHistoryUIDirectionType, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type SwapByInputQuote, type SwapByOutputQuote, type Tick, type TokenOraclePrice, type TradableAmount, type TradeHistoryActionType, type TradeHistoryEntry, type TradeHistoryUIDirectionType, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
6493
+ export { type DecreaseSpotPositionQuote, type DurationInMs, type FeesStatsGroup, type GetDecreaseSpotPositionQuoteArgs, type GetIncreaseSpotPositionQuoteArgs, type GetLimitOrderQuoteByInputArgs, type GetLimitOrderQuoteByOutputArgs, type GetPoolPriceCandlesOptions, type GetSwapQuoteByInputArgs, type GetSwapQuoteByOutputArgs, type GetTradableAmountArgs, type GetUserLimitOrdersOptions, type GetUserOrderHistoryOptions, type GetUserTradeHistoryOptions, type IncreaseSpotPositionQuote, type LendingPosition, type LimitOrder, type LimitOrderQuoteByInput, type LimitOrderQuoteByOutput, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type OrderHistoryEntry, type OrderHistoryOrderTypeType, type OrderHistoryStatusType, type OrderHistoryUIDirectionType, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type SwapQuoteByInput, type SwapQuoteByOutput, type Tick, type TokenOraclePrice, type TradableAmount, type TradeHistoryActionType, type TradeHistoryEntry, type TradeHistoryUIDirectionType, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
package/dist/index.d.ts CHANGED
@@ -2237,22 +2237,26 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
2237
2237
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
2238
2238
  */
2239
2239
  requiredSwapAmount: z.ZodBigInt;
2240
+ /** Estimated total amount of the adjusted position */
2241
+ estimatedAmount: z.ZodBigInt;
2240
2242
  /** Price impact in percents */
2241
2243
  priceImpact: z.ZodNumber;
2242
2244
  /** Liquidation price */
2243
2245
  uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
2244
2246
  }, "strip", z.ZodTypeAny, {
2245
2247
  uiLiquidationPrice: number | null;
2248
+ estimatedAmount: bigint;
2246
2249
  priceImpact: number;
2247
2250
  decreasePercent: number;
2248
2251
  requiredSwapAmount: bigint;
2249
2252
  }, {
2250
2253
  uiLiquidationPrice: number | null;
2254
+ estimatedAmount: bigint;
2251
2255
  priceImpact: number;
2252
2256
  decreasePercent: number;
2253
2257
  requiredSwapAmount: bigint;
2254
2258
  }>;
2255
- declare const SwapByInputQuote$1: z.ZodObject<{
2259
+ declare const SwapQuoteByInput$1: z.ZodObject<{
2256
2260
  estimatedAmountOut: z.ZodBigInt;
2257
2261
  minAmountOut: z.ZodBigInt;
2258
2262
  feeAmount: z.ZodBigInt;
@@ -2272,7 +2276,7 @@ declare const SwapByInputQuote$1: z.ZodObject<{
2272
2276
  feeAmount: bigint;
2273
2277
  feeUsd: number;
2274
2278
  }>;
2275
- declare const SwapByOutputQuote$1: z.ZodObject<{
2279
+ declare const SwapQuoteByOutput$1: z.ZodObject<{
2276
2280
  estimatedAmountIn: z.ZodBigInt;
2277
2281
  maxAmountIn: z.ZodBigInt;
2278
2282
  feeAmount: z.ZodBigInt;
@@ -2292,6 +2296,20 @@ declare const SwapByOutputQuote$1: z.ZodObject<{
2292
2296
  estimatedAmountIn: bigint;
2293
2297
  maxAmountIn: bigint;
2294
2298
  }>;
2299
+ declare const LimitOrderQuoteByInput$1: z.ZodObject<{
2300
+ amountOut: z.ZodBigInt;
2301
+ }, "strip", z.ZodTypeAny, {
2302
+ amountOut: bigint;
2303
+ }, {
2304
+ amountOut: bigint;
2305
+ }>;
2306
+ declare const LimitOrderQuoteByOutput$1: z.ZodObject<{
2307
+ amountIn: z.ZodBigInt;
2308
+ }, "strip", z.ZodTypeAny, {
2309
+ amountIn: bigint;
2310
+ }, {
2311
+ amountIn: bigint;
2312
+ }>;
2295
2313
  declare const TradableAmount$1: z.ZodObject<{
2296
2314
  amount: z.ZodBigInt;
2297
2315
  usd: z.ZodNumber;
@@ -6227,7 +6245,7 @@ declare const schemas_UpdateStreamSubscriptionResult: typeof UpdateStreamSubscri
6227
6245
  declare const schemas_WalletSubscriptionTopic: typeof WalletSubscriptionTopic;
6228
6246
  declare const schemas_WalletSubscriptionTopicSchema: typeof WalletSubscriptionTopicSchema;
6229
6247
  declare namespace schemas {
6230
- export { DecreaseSpotPositionQuote$1 as DecreaseSpotPositionQuote, FeesStatsGroup$1 as FeesStatsGroup, IncreaseSpotPositionQuote$1 as IncreaseSpotPositionQuote, LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, OrderHistoryEntry$1 as OrderHistoryEntry, schemas_OrderHistoryEntryNotification as OrderHistoryEntryNotification, schemas_OrderHistoryOrderType as OrderHistoryOrderType, schemas_OrderHistoryOrderTypeSchema as OrderHistoryOrderTypeSchema, schemas_OrderHistoryStatus as OrderHistoryStatus, schemas_OrderHistoryStatusSchema as OrderHistoryStatusSchema, schemas_OrderHistoryUIDirection as OrderHistoryUIDirection, schemas_OrderHistoryUIDirectionSchema as OrderHistoryUIDirectionSchema, PaginationMeta$1 as PaginationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, StakingLeaderboardPage$1 as StakingLeaderboardPage, StakingLeaderboardPosition$1 as StakingLeaderboardPosition, StakingPosition$1 as StakingPosition, StakingPositionHistoryAction$1 as StakingPositionHistoryAction, StakingPositionHistoryActionType$1 as StakingPositionHistoryActionType, schemas_StakingPositionHistoryActionTypeSchema as StakingPositionHistoryActionTypeSchema, schemas_StakingPositionNotification as StakingPositionNotification, StakingRevenueStatsGroup$1 as StakingRevenueStatsGroup, StakingTreasury$1 as StakingTreasury, SwapByInputQuote$1 as SwapByInputQuote, SwapByOutputQuote$1 as SwapByOutputQuote, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TradableAmount$1 as TradableAmount, schemas_TradeHistoryAction as TradeHistoryAction, schemas_TradeHistoryActionSchema as TradeHistoryActionSchema, TradeHistoryEntry$1 as TradeHistoryEntry, schemas_TradeHistoryEntryNotification as TradeHistoryEntryNotification, schemas_TradeHistoryUIDirection as TradeHistoryUIDirection, schemas_TradeHistoryUIDirectionSchema as TradeHistoryUIDirectionSchema, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, TunaSpotPosition$1 as TunaSpotPosition, schemas_TunaSpotPositionNotification as TunaSpotPositionNotification, schemas_TunaSpotPositionState as TunaSpotPositionState, schemas_TunaSpotPositionStateSchema as TunaSpotPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, VaultHistoricalStats$1 as VaultHistoricalStats, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
6248
+ export { DecreaseSpotPositionQuote$1 as DecreaseSpotPositionQuote, FeesStatsGroup$1 as FeesStatsGroup, IncreaseSpotPositionQuote$1 as IncreaseSpotPositionQuote, LendingPosition$1 as LendingPosition, schemas_LendingPositionNotification as LendingPositionNotification, LimitOrder$1 as LimitOrder, schemas_LimitOrderNotification as LimitOrderNotification, LimitOrderQuoteByInput$1 as LimitOrderQuoteByInput, LimitOrderQuoteByOutput$1 as LimitOrderQuoteByOutput, schemas_LimitOrderState as LimitOrderState, schemas_LimitOrderStateSchema as LimitOrderStateSchema, Market$1 as Market, Mint$1 as Mint, schemas_NotificationAction as NotificationAction, schemas_NotificationActionSchema as NotificationActionSchema, schemas_NotificationEntity as NotificationEntity, schemas_NotificationEntitySchema as NotificationEntitySchema, OrderBook$1 as OrderBook, OrderBookEntry$1 as OrderBookEntry, schemas_OrderBookNotification as OrderBookNotification, schemas_OrderBookNotificationMeta as OrderBookNotificationMeta, OrderHistoryEntry$1 as OrderHistoryEntry, schemas_OrderHistoryEntryNotification as OrderHistoryEntryNotification, schemas_OrderHistoryOrderType as OrderHistoryOrderType, schemas_OrderHistoryOrderTypeSchema as OrderHistoryOrderTypeSchema, schemas_OrderHistoryStatus as OrderHistoryStatus, schemas_OrderHistoryStatusSchema as OrderHistoryStatusSchema, schemas_OrderHistoryUIDirection as OrderHistoryUIDirection, schemas_OrderHistoryUIDirectionSchema as OrderHistoryUIDirectionSchema, PaginationMeta$1 as PaginationMeta, Pool$1 as Pool, PoolPriceCandle$1 as PoolPriceCandle, PoolPriceUpdate$1 as PoolPriceUpdate, schemas_PoolPriceUpdateNotification as PoolPriceUpdateNotification, schemas_PoolProvider as PoolProvider, schemas_PoolProviderSchema as PoolProviderSchema, schemas_PoolSubscriptionTopic as PoolSubscriptionTopic, schemas_PoolSubscriptionTopicSchema as PoolSubscriptionTopicSchema, PoolSwap$1 as PoolSwap, schemas_PoolSwapNotification as PoolSwapNotification, PoolTicks$1 as PoolTicks, StakingLeaderboardPage$1 as StakingLeaderboardPage, StakingLeaderboardPosition$1 as StakingLeaderboardPosition, StakingPosition$1 as StakingPosition, StakingPositionHistoryAction$1 as StakingPositionHistoryAction, StakingPositionHistoryActionType$1 as StakingPositionHistoryActionType, schemas_StakingPositionHistoryActionTypeSchema as StakingPositionHistoryActionTypeSchema, schemas_StakingPositionNotification as StakingPositionNotification, StakingRevenueStatsGroup$1 as StakingRevenueStatsGroup, StakingTreasury$1 as StakingTreasury, SwapQuoteByInput$1 as SwapQuoteByInput, SwapQuoteByOutput$1 as SwapQuoteByOutput, Tick$1 as Tick, TokenOraclePrice$1 as TokenOraclePrice, TradableAmount$1 as TradableAmount, schemas_TradeHistoryAction as TradeHistoryAction, schemas_TradeHistoryActionSchema as TradeHistoryActionSchema, TradeHistoryEntry$1 as TradeHistoryEntry, schemas_TradeHistoryEntryNotification as TradeHistoryEntryNotification, schemas_TradeHistoryUIDirection as TradeHistoryUIDirection, schemas_TradeHistoryUIDirectionSchema as TradeHistoryUIDirectionSchema, TunaPosition$1 as TunaPosition, schemas_TunaPositionNotification as TunaPositionNotification, schemas_TunaPositionState as TunaPositionState, schemas_TunaPositionStateSchema as TunaPositionStateSchema, TunaSpotPosition$1 as TunaSpotPosition, schemas_TunaSpotPositionNotification as TunaSpotPositionNotification, schemas_TunaSpotPositionState as TunaSpotPositionState, schemas_TunaSpotPositionStateSchema as TunaSpotPositionStateSchema, schemas_UpdateStreamSubscriptionResult as UpdateStreamSubscriptionResult, Vault$1 as Vault, VaultHistoricalStats$1 as VaultHistoricalStats, schemas_WalletSubscriptionTopic as WalletSubscriptionTopic, schemas_WalletSubscriptionTopicSchema as WalletSubscriptionTopicSchema };
6231
6249
  }
6232
6250
 
6233
6251
  type PoolProviderType = z.infer<typeof PoolProviderSchema>;
@@ -6268,10 +6286,12 @@ type StakingPositionHistoryAction = z.infer<typeof StakingPositionHistoryAction$
6268
6286
  type PoolPriceCandle = z.infer<typeof PoolPriceCandle$1>;
6269
6287
  type FeesStatsGroup = z.infer<typeof FeesStatsGroup$1>;
6270
6288
  type StakingRevenueStatsGroup = z.infer<typeof StakingRevenueStatsGroup$1>;
6289
+ type LimitOrderQuoteByInput = z.infer<typeof LimitOrderQuoteByInput$1>;
6290
+ type LimitOrderQuoteByOutput = z.infer<typeof LimitOrderQuoteByOutput$1>;
6291
+ type SwapQuoteByInput = z.infer<typeof SwapQuoteByInput$1>;
6292
+ type SwapQuoteByOutput = z.infer<typeof SwapQuoteByOutput$1>;
6271
6293
  type IncreaseSpotPositionQuote = z.infer<typeof IncreaseSpotPositionQuote$1>;
6272
6294
  type DecreaseSpotPositionQuote = z.infer<typeof DecreaseSpotPositionQuote$1>;
6273
- type SwapByInputQuote = z.infer<typeof SwapByInputQuote$1>;
6274
- type SwapByOutputQuote = z.infer<typeof SwapByOutputQuote$1>;
6275
6295
  type TradableAmount = z.infer<typeof TradableAmount$1>;
6276
6296
  type PoolPriceUpdate = z.infer<typeof PoolPriceUpdate$1>;
6277
6297
  type SubscriptionPayload = {
@@ -6286,6 +6306,59 @@ type SubscriptionPayload = {
6286
6306
  topics: WalletSubscriptionTopicType[];
6287
6307
  };
6288
6308
  };
6309
+ type GetLimitOrderQuoteByInputArgs = {
6310
+ pool: string;
6311
+ amountIn: bigint;
6312
+ aToB: boolean;
6313
+ tickIndex: number;
6314
+ };
6315
+ type GetLimitOrderQuoteByOutputArgs = {
6316
+ pool: string;
6317
+ amountOut: bigint;
6318
+ aToB: boolean;
6319
+ tickIndex: number;
6320
+ };
6321
+ type GetSwapQuoteByInputArgs = {
6322
+ pool: string;
6323
+ amountIn: bigint;
6324
+ aToB: boolean;
6325
+ slippageToleranceBps?: number;
6326
+ };
6327
+ type GetSwapQuoteByOutputArgs = {
6328
+ pool: string;
6329
+ amountOut: bigint;
6330
+ aToB: boolean;
6331
+ slippageToleranceBps?: number;
6332
+ };
6333
+ type GetIncreaseSpotPositionQuoteArgs = {
6334
+ market: string;
6335
+ increaseAmount: bigint;
6336
+ collateralToken: number;
6337
+ positionToken: number;
6338
+ leverage: number;
6339
+ positionAmount?: bigint;
6340
+ positionDebt?: bigint;
6341
+ slippageTolerance?: number;
6342
+ };
6343
+ type GetDecreaseSpotPositionQuoteArgs = {
6344
+ market: string;
6345
+ decreaseAmount: bigint;
6346
+ collateralToken: number;
6347
+ positionToken: number;
6348
+ leverage: number;
6349
+ positionAmount: bigint;
6350
+ positionDebt: bigint;
6351
+ slippageTolerance?: number;
6352
+ };
6353
+ type GetTradableAmountArgs = {
6354
+ market: string;
6355
+ collateralToken: number;
6356
+ positionToken: number;
6357
+ availableBalance: bigint;
6358
+ leverage: number;
6359
+ positionAmount: bigint;
6360
+ increase: boolean;
6361
+ };
6289
6362
  type GetUserLimitOrdersOptions = {
6290
6363
  pool?: string[];
6291
6364
  status?: LimitOrderStateType[];
@@ -6390,15 +6463,31 @@ declare class TunaApiClient {
6390
6463
  getUserStakingPositionHistory(userAddress: string): Promise<StakingPositionHistoryAction[]>;
6391
6464
  getFeesStats(from: Date, to: Date, interval: string): Promise<FeesStatsGroup[]>;
6392
6465
  getStakingRevenueStats(from: Date, to: Date): Promise<StakingRevenueStatsGroup[]>;
6393
- getSwapQuoteByInput(pool: string, amountIn: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByInputQuote>;
6394
- getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByOutputQuote>;
6395
- getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: bigint, positionDebt?: bigint, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6396
- getDecreaseSpotPositionQuote(market: string, decreaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint, slippageTolerance?: number): Promise<DecreaseSpotPositionQuote>;
6397
- getTradableAmount(market: string, collateralToken: number, positionToken: number, availableBalance: bigint, leverage: number, positionAmount: bigint, increase: boolean): Promise<TradableAmount>;
6466
+ getLimitOrderQuoteByInput(args: GetLimitOrderQuoteByInputArgs, config?: {
6467
+ abortSignal?: AbortSignal;
6468
+ }): Promise<LimitOrderQuoteByInput>;
6469
+ getLimitOrderQuoteByOutput(args: GetLimitOrderQuoteByOutputArgs, config?: {
6470
+ abortSignal?: AbortSignal;
6471
+ }): Promise<LimitOrderQuoteByOutput>;
6472
+ getSwapQuoteByInput(args: GetSwapQuoteByInputArgs, config?: {
6473
+ abortSignal?: AbortSignal;
6474
+ }): Promise<SwapQuoteByInput>;
6475
+ getSwapQuoteByOutput(args: GetSwapQuoteByOutputArgs, config?: {
6476
+ abortSignal?: AbortSignal;
6477
+ }): Promise<SwapQuoteByOutput>;
6478
+ getIncreaseSpotPositionQuote(args: GetIncreaseSpotPositionQuoteArgs, config?: {
6479
+ abortSignal?: AbortSignal;
6480
+ }): Promise<IncreaseSpotPositionQuote>;
6481
+ getDecreaseSpotPositionQuote(args: GetDecreaseSpotPositionQuoteArgs, config?: {
6482
+ abortSignal?: AbortSignal;
6483
+ }): Promise<DecreaseSpotPositionQuote>;
6484
+ getTradableAmount(args: GetTradableAmountArgs, config?: {
6485
+ abortSignal?: AbortSignal;
6486
+ }): Promise<TradableAmount>;
6398
6487
  getUpdatesStream(): Promise<EventSource>;
6399
6488
  updateStreamSubscription(streamId: string, subscription: SubscriptionPayload): Promise<unknown>;
6400
6489
  private buildURL;
6401
6490
  private appendUrlSearchParams;
6402
6491
  }
6403
6492
 
6404
- export { type DecreaseSpotPositionQuote, type DurationInMs, type FeesStatsGroup, type GetPoolPriceCandlesOptions, type GetUserLimitOrdersOptions, type GetUserOrderHistoryOptions, type GetUserTradeHistoryOptions, type IncreaseSpotPositionQuote, type LendingPosition, type LimitOrder, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type OrderHistoryEntry, type OrderHistoryOrderTypeType, type OrderHistoryStatusType, type OrderHistoryUIDirectionType, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type SwapByInputQuote, type SwapByOutputQuote, type Tick, type TokenOraclePrice, type TradableAmount, type TradeHistoryActionType, type TradeHistoryEntry, type TradeHistoryUIDirectionType, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
6493
+ export { type DecreaseSpotPositionQuote, type DurationInMs, type FeesStatsGroup, type GetDecreaseSpotPositionQuoteArgs, type GetIncreaseSpotPositionQuoteArgs, type GetLimitOrderQuoteByInputArgs, type GetLimitOrderQuoteByOutputArgs, type GetPoolPriceCandlesOptions, type GetSwapQuoteByInputArgs, type GetSwapQuoteByOutputArgs, type GetTradableAmountArgs, type GetUserLimitOrdersOptions, type GetUserOrderHistoryOptions, type GetUserTradeHistoryOptions, type IncreaseSpotPositionQuote, type LendingPosition, type LimitOrder, type LimitOrderQuoteByInput, type LimitOrderQuoteByOutput, type LimitOrderStateType, type Market, type Mint, NotificationAction, NotificationEntity, type OrderBook, type OrderBookEntry, type OrderHistoryEntry, type OrderHistoryOrderTypeType, type OrderHistoryStatusType, type OrderHistoryUIDirectionType, type PaginationMeta, type Pool, type PoolPriceCandle, type PoolPriceUpdate, PoolProvider, type PoolProviderType, type PoolSubscriptionTopicType, type PoolSwap, type PoolTicks, ProviderFilter, type StakingLeaderboardPage, type StakingLeaderboardPosition, type StakingPosition, type StakingPositionHistoryAction, type StakingPositionHistoryActionType, type StakingRevenueStatsGroup, type StakingTreasury, type SubscriptionPayload, type SwapQuoteByInput, type SwapQuoteByOutput, type Tick, type TokenOraclePrice, type TradableAmount, type TradeHistoryActionType, type TradeHistoryEntry, type TradeHistoryUIDirectionType, TunaApiClient, type TunaApiClientConfig, type TunaPosition, TunaPositionState, type TunaPositionStateType, type TunaSpotPosition, type TunaSpotPositionStateType, type Vault, type VaultHistoricalStats, type WalletSubscriptionTopicType, schemas };
package/dist/index.js CHANGED
@@ -53,6 +53,8 @@ __export(schemas_exports, {
53
53
  LendingPositionNotification: () => LendingPositionNotification,
54
54
  LimitOrder: () => LimitOrder,
55
55
  LimitOrderNotification: () => LimitOrderNotification,
56
+ LimitOrderQuoteByInput: () => LimitOrderQuoteByInput,
57
+ LimitOrderQuoteByOutput: () => LimitOrderQuoteByOutput,
56
58
  LimitOrderState: () => LimitOrderState,
57
59
  LimitOrderStateSchema: () => LimitOrderStateSchema,
58
60
  Market: () => Market,
@@ -94,8 +96,8 @@ __export(schemas_exports, {
94
96
  StakingPositionNotification: () => StakingPositionNotification,
95
97
  StakingRevenueStatsGroup: () => StakingRevenueStatsGroup,
96
98
  StakingTreasury: () => StakingTreasury,
97
- SwapByInputQuote: () => SwapByInputQuote,
98
- SwapByOutputQuote: () => SwapByOutputQuote,
99
+ SwapQuoteByInput: () => SwapQuoteByInput,
100
+ SwapQuoteByOutput: () => SwapQuoteByOutput,
99
101
  Tick: () => Tick,
100
102
  TokenOraclePrice: () => TokenOraclePrice,
101
103
  TradableAmount: () => TradableAmount,
@@ -673,12 +675,14 @@ var DecreaseSpotPositionQuote = import_zod.z.object({
673
675
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
674
676
  */
675
677
  requiredSwapAmount: import_zod.z.coerce.bigint(),
678
+ /** Estimated total amount of the adjusted position */
679
+ estimatedAmount: import_zod.z.coerce.bigint(),
676
680
  /** Price impact in percents */
677
681
  priceImpact: import_zod.z.number(),
678
682
  /** Liquidation price */
679
683
  uiLiquidationPrice: import_zod.z.nullable(import_zod.z.number())
680
684
  });
681
- var SwapByInputQuote = import_zod.z.object({
685
+ var SwapQuoteByInput = import_zod.z.object({
682
686
  estimatedAmountOut: import_zod.z.coerce.bigint(),
683
687
  minAmountOut: import_zod.z.coerce.bigint(),
684
688
  feeAmount: import_zod.z.coerce.bigint(),
@@ -686,7 +690,7 @@ var SwapByInputQuote = import_zod.z.object({
686
690
  /** Price impact in percents */
687
691
  priceImpact: import_zod.z.number()
688
692
  });
689
- var SwapByOutputQuote = import_zod.z.object({
693
+ var SwapQuoteByOutput = import_zod.z.object({
690
694
  estimatedAmountIn: import_zod.z.coerce.bigint(),
691
695
  maxAmountIn: import_zod.z.coerce.bigint(),
692
696
  feeAmount: import_zod.z.coerce.bigint(),
@@ -694,6 +698,12 @@ var SwapByOutputQuote = import_zod.z.object({
694
698
  /** Price impact in percents */
695
699
  priceImpact: import_zod.z.number()
696
700
  });
701
+ var LimitOrderQuoteByInput = import_zod.z.object({
702
+ amountOut: import_zod.z.coerce.bigint()
703
+ });
704
+ var LimitOrderQuoteByOutput = import_zod.z.object({
705
+ amountIn: import_zod.z.coerce.bigint()
706
+ });
697
707
  var TradableAmount = amountWithUsd;
698
708
  var UpdateStreamSubscriptionResult = import_zod.z.object({
699
709
  status: import_zod.z.string()
@@ -1010,7 +1020,34 @@ var TunaApiClient = class {
1010
1020
  });
1011
1021
  return await this.httpRequest(url, StakingRevenueStatsGroup.array());
1012
1022
  }
1013
- async getSwapQuoteByInput(pool, amountIn, aToB, slippageToleranceBps) {
1023
+ async getLimitOrderQuoteByInput(args, config) {
1024
+ const { pool, amountIn, aToB, tickIndex } = args;
1025
+ let query = {
1026
+ pool,
1027
+ amount_in: amountIn.toString(),
1028
+ a_to_b: aToB,
1029
+ tick_index: tickIndex
1030
+ };
1031
+ const url = this.appendUrlSearchParams(this.buildURL(`quotes/limit-order-by-input`), query);
1032
+ return await this.httpRequest(url, LimitOrderQuoteByInput, {
1033
+ signal: config?.abortSignal
1034
+ });
1035
+ }
1036
+ async getLimitOrderQuoteByOutput(args, config) {
1037
+ const { pool, amountOut, aToB, tickIndex } = args;
1038
+ let query = {
1039
+ pool,
1040
+ amount_out: amountOut.toString(),
1041
+ a_to_b: aToB,
1042
+ tick_index: tickIndex
1043
+ };
1044
+ const url = this.appendUrlSearchParams(this.buildURL(`quotes/limit-order-by-output`), query);
1045
+ return await this.httpRequest(url, LimitOrderQuoteByOutput, {
1046
+ signal: config?.abortSignal
1047
+ });
1048
+ }
1049
+ async getSwapQuoteByInput(args, config) {
1050
+ const { pool, amountIn, aToB, slippageToleranceBps } = args;
1014
1051
  let query = {
1015
1052
  pool,
1016
1053
  amount_in: amountIn.toString(),
@@ -1020,9 +1057,12 @@ var TunaApiClient = class {
1020
1057
  query.slippage_tolerance = slippageToleranceBps;
1021
1058
  }
1022
1059
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/swap-by-input`), query);
1023
- return await this.httpRequest(url, SwapByInputQuote);
1060
+ return await this.httpRequest(url, SwapQuoteByInput, {
1061
+ signal: config?.abortSignal
1062
+ });
1024
1063
  }
1025
- async getSwapQuoteByOutput(pool, amountOut, aToB, slippageToleranceBps) {
1064
+ async getSwapQuoteByOutput(args, config) {
1065
+ const { pool, amountOut, aToB, slippageToleranceBps } = args;
1026
1066
  let query = {
1027
1067
  pool,
1028
1068
  amount_out: amountOut.toString(),
@@ -1032,9 +1072,21 @@ var TunaApiClient = class {
1032
1072
  query.slippage_tolerance = slippageToleranceBps;
1033
1073
  }
1034
1074
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/swap-by-output`), query);
1035
- return await this.httpRequest(url, SwapByOutputQuote);
1075
+ return await this.httpRequest(url, SwapQuoteByOutput, {
1076
+ signal: config?.abortSignal
1077
+ });
1036
1078
  }
1037
- async getIncreaseSpotPositionQuote(market, increaseAmount, collateralToken, positionToken, leverage, positionAmount, positionDebt, slippageTolerance) {
1079
+ async getIncreaseSpotPositionQuote(args, config) {
1080
+ const {
1081
+ market,
1082
+ increaseAmount,
1083
+ collateralToken,
1084
+ positionToken,
1085
+ leverage,
1086
+ positionAmount,
1087
+ positionDebt,
1088
+ slippageTolerance
1089
+ } = args;
1038
1090
  let query = {
1039
1091
  market,
1040
1092
  increase_amount: increaseAmount.toString(),
@@ -1052,16 +1104,27 @@ var TunaApiClient = class {
1052
1104
  query.position_debt = positionDebt.toString();
1053
1105
  }
1054
1106
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/increase-spot-position`), query);
1055
- return await this.httpRequest(url, IncreaseSpotPositionQuote);
1107
+ return await this.httpRequest(url, IncreaseSpotPositionQuote, {
1108
+ signal: config?.abortSignal
1109
+ });
1056
1110
  }
1057
- async getDecreaseSpotPositionQuote(market, decreaseAmount, collateralToken, positionToken, leverage, reduceOnly, positionAmount, positionDebt, slippageTolerance) {
1111
+ async getDecreaseSpotPositionQuote(args, config) {
1112
+ const {
1113
+ market,
1114
+ decreaseAmount,
1115
+ collateralToken,
1116
+ positionToken,
1117
+ leverage,
1118
+ positionAmount,
1119
+ positionDebt,
1120
+ slippageTolerance
1121
+ } = args;
1058
1122
  let query = {
1059
1123
  market,
1060
1124
  decrease_amount: decreaseAmount.toString(),
1061
1125
  collateral_token: collateralToken,
1062
1126
  position_token: positionToken,
1063
1127
  leverage,
1064
- reduce_only: reduceOnly,
1065
1128
  position_amount: positionAmount.toString(),
1066
1129
  position_debt: positionDebt.toString()
1067
1130
  };
@@ -1069,9 +1132,12 @@ var TunaApiClient = class {
1069
1132
  query.slippage_tolerance = slippageTolerance;
1070
1133
  }
1071
1134
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/decrease-spot-position`), query);
1072
- return await this.httpRequest(url, DecreaseSpotPositionQuote);
1135
+ return await this.httpRequest(url, DecreaseSpotPositionQuote, {
1136
+ signal: config?.abortSignal
1137
+ });
1073
1138
  }
1074
- async getTradableAmount(market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase) {
1139
+ async getTradableAmount(args, config) {
1140
+ const { market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase } = args;
1075
1141
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/tradable-amount`), {
1076
1142
  market,
1077
1143
  collateral_token: collateralToken,
@@ -1081,7 +1147,9 @@ var TunaApiClient = class {
1081
1147
  position_amount: positionAmount.toString(),
1082
1148
  increase
1083
1149
  });
1084
- return await this.httpRequest(url, TradableAmount);
1150
+ return await this.httpRequest(url, TradableAmount, {
1151
+ signal: config?.abortSignal
1152
+ });
1085
1153
  }
1086
1154
  async getUpdatesStream() {
1087
1155
  const url = this.buildURL(`streams/sse`);
package/dist/index.mjs CHANGED
@@ -18,6 +18,8 @@ __export(schemas_exports, {
18
18
  LendingPositionNotification: () => LendingPositionNotification,
19
19
  LimitOrder: () => LimitOrder,
20
20
  LimitOrderNotification: () => LimitOrderNotification,
21
+ LimitOrderQuoteByInput: () => LimitOrderQuoteByInput,
22
+ LimitOrderQuoteByOutput: () => LimitOrderQuoteByOutput,
21
23
  LimitOrderState: () => LimitOrderState,
22
24
  LimitOrderStateSchema: () => LimitOrderStateSchema,
23
25
  Market: () => Market,
@@ -59,8 +61,8 @@ __export(schemas_exports, {
59
61
  StakingPositionNotification: () => StakingPositionNotification,
60
62
  StakingRevenueStatsGroup: () => StakingRevenueStatsGroup,
61
63
  StakingTreasury: () => StakingTreasury,
62
- SwapByInputQuote: () => SwapByInputQuote,
63
- SwapByOutputQuote: () => SwapByOutputQuote,
64
+ SwapQuoteByInput: () => SwapQuoteByInput,
65
+ SwapQuoteByOutput: () => SwapQuoteByOutput,
64
66
  Tick: () => Tick,
65
67
  TokenOraclePrice: () => TokenOraclePrice,
66
68
  TradableAmount: () => TradableAmount,
@@ -638,12 +640,14 @@ var DecreaseSpotPositionQuote = z.object({
638
640
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
639
641
  */
640
642
  requiredSwapAmount: z.coerce.bigint(),
643
+ /** Estimated total amount of the adjusted position */
644
+ estimatedAmount: z.coerce.bigint(),
641
645
  /** Price impact in percents */
642
646
  priceImpact: z.number(),
643
647
  /** Liquidation price */
644
648
  uiLiquidationPrice: z.nullable(z.number())
645
649
  });
646
- var SwapByInputQuote = z.object({
650
+ var SwapQuoteByInput = z.object({
647
651
  estimatedAmountOut: z.coerce.bigint(),
648
652
  minAmountOut: z.coerce.bigint(),
649
653
  feeAmount: z.coerce.bigint(),
@@ -651,7 +655,7 @@ var SwapByInputQuote = z.object({
651
655
  /** Price impact in percents */
652
656
  priceImpact: z.number()
653
657
  });
654
- var SwapByOutputQuote = z.object({
658
+ var SwapQuoteByOutput = z.object({
655
659
  estimatedAmountIn: z.coerce.bigint(),
656
660
  maxAmountIn: z.coerce.bigint(),
657
661
  feeAmount: z.coerce.bigint(),
@@ -659,6 +663,12 @@ var SwapByOutputQuote = z.object({
659
663
  /** Price impact in percents */
660
664
  priceImpact: z.number()
661
665
  });
666
+ var LimitOrderQuoteByInput = z.object({
667
+ amountOut: z.coerce.bigint()
668
+ });
669
+ var LimitOrderQuoteByOutput = z.object({
670
+ amountIn: z.coerce.bigint()
671
+ });
662
672
  var TradableAmount = amountWithUsd;
663
673
  var UpdateStreamSubscriptionResult = z.object({
664
674
  status: z.string()
@@ -975,7 +985,34 @@ var TunaApiClient = class {
975
985
  });
976
986
  return await this.httpRequest(url, StakingRevenueStatsGroup.array());
977
987
  }
978
- async getSwapQuoteByInput(pool, amountIn, aToB, slippageToleranceBps) {
988
+ async getLimitOrderQuoteByInput(args, config) {
989
+ const { pool, amountIn, aToB, tickIndex } = args;
990
+ let query = {
991
+ pool,
992
+ amount_in: amountIn.toString(),
993
+ a_to_b: aToB,
994
+ tick_index: tickIndex
995
+ };
996
+ const url = this.appendUrlSearchParams(this.buildURL(`quotes/limit-order-by-input`), query);
997
+ return await this.httpRequest(url, LimitOrderQuoteByInput, {
998
+ signal: config?.abortSignal
999
+ });
1000
+ }
1001
+ async getLimitOrderQuoteByOutput(args, config) {
1002
+ const { pool, amountOut, aToB, tickIndex } = args;
1003
+ let query = {
1004
+ pool,
1005
+ amount_out: amountOut.toString(),
1006
+ a_to_b: aToB,
1007
+ tick_index: tickIndex
1008
+ };
1009
+ const url = this.appendUrlSearchParams(this.buildURL(`quotes/limit-order-by-output`), query);
1010
+ return await this.httpRequest(url, LimitOrderQuoteByOutput, {
1011
+ signal: config?.abortSignal
1012
+ });
1013
+ }
1014
+ async getSwapQuoteByInput(args, config) {
1015
+ const { pool, amountIn, aToB, slippageToleranceBps } = args;
979
1016
  let query = {
980
1017
  pool,
981
1018
  amount_in: amountIn.toString(),
@@ -985,9 +1022,12 @@ var TunaApiClient = class {
985
1022
  query.slippage_tolerance = slippageToleranceBps;
986
1023
  }
987
1024
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/swap-by-input`), query);
988
- return await this.httpRequest(url, SwapByInputQuote);
1025
+ return await this.httpRequest(url, SwapQuoteByInput, {
1026
+ signal: config?.abortSignal
1027
+ });
989
1028
  }
990
- async getSwapQuoteByOutput(pool, amountOut, aToB, slippageToleranceBps) {
1029
+ async getSwapQuoteByOutput(args, config) {
1030
+ const { pool, amountOut, aToB, slippageToleranceBps } = args;
991
1031
  let query = {
992
1032
  pool,
993
1033
  amount_out: amountOut.toString(),
@@ -997,9 +1037,21 @@ var TunaApiClient = class {
997
1037
  query.slippage_tolerance = slippageToleranceBps;
998
1038
  }
999
1039
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/swap-by-output`), query);
1000
- return await this.httpRequest(url, SwapByOutputQuote);
1040
+ return await this.httpRequest(url, SwapQuoteByOutput, {
1041
+ signal: config?.abortSignal
1042
+ });
1001
1043
  }
1002
- async getIncreaseSpotPositionQuote(market, increaseAmount, collateralToken, positionToken, leverage, positionAmount, positionDebt, slippageTolerance) {
1044
+ async getIncreaseSpotPositionQuote(args, config) {
1045
+ const {
1046
+ market,
1047
+ increaseAmount,
1048
+ collateralToken,
1049
+ positionToken,
1050
+ leverage,
1051
+ positionAmount,
1052
+ positionDebt,
1053
+ slippageTolerance
1054
+ } = args;
1003
1055
  let query = {
1004
1056
  market,
1005
1057
  increase_amount: increaseAmount.toString(),
@@ -1017,16 +1069,27 @@ var TunaApiClient = class {
1017
1069
  query.position_debt = positionDebt.toString();
1018
1070
  }
1019
1071
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/increase-spot-position`), query);
1020
- return await this.httpRequest(url, IncreaseSpotPositionQuote);
1072
+ return await this.httpRequest(url, IncreaseSpotPositionQuote, {
1073
+ signal: config?.abortSignal
1074
+ });
1021
1075
  }
1022
- async getDecreaseSpotPositionQuote(market, decreaseAmount, collateralToken, positionToken, leverage, reduceOnly, positionAmount, positionDebt, slippageTolerance) {
1076
+ async getDecreaseSpotPositionQuote(args, config) {
1077
+ const {
1078
+ market,
1079
+ decreaseAmount,
1080
+ collateralToken,
1081
+ positionToken,
1082
+ leverage,
1083
+ positionAmount,
1084
+ positionDebt,
1085
+ slippageTolerance
1086
+ } = args;
1023
1087
  let query = {
1024
1088
  market,
1025
1089
  decrease_amount: decreaseAmount.toString(),
1026
1090
  collateral_token: collateralToken,
1027
1091
  position_token: positionToken,
1028
1092
  leverage,
1029
- reduce_only: reduceOnly,
1030
1093
  position_amount: positionAmount.toString(),
1031
1094
  position_debt: positionDebt.toString()
1032
1095
  };
@@ -1034,9 +1097,12 @@ var TunaApiClient = class {
1034
1097
  query.slippage_tolerance = slippageTolerance;
1035
1098
  }
1036
1099
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/decrease-spot-position`), query);
1037
- return await this.httpRequest(url, DecreaseSpotPositionQuote);
1100
+ return await this.httpRequest(url, DecreaseSpotPositionQuote, {
1101
+ signal: config?.abortSignal
1102
+ });
1038
1103
  }
1039
- async getTradableAmount(market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase) {
1104
+ async getTradableAmount(args, config) {
1105
+ const { market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase } = args;
1040
1106
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/tradable-amount`), {
1041
1107
  market,
1042
1108
  collateral_token: collateralToken,
@@ -1046,7 +1112,9 @@ var TunaApiClient = class {
1046
1112
  position_amount: positionAmount.toString(),
1047
1113
  increase
1048
1114
  });
1049
- return await this.httpRequest(url, TradableAmount);
1115
+ return await this.httpRequest(url, TradableAmount, {
1116
+ signal: config?.abortSignal
1117
+ });
1050
1118
  }
1051
1119
  async getUpdatesStream() {
1052
1120
  const url = this.buildURL(`streams/sse`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-api",
3
- "version": "1.5.3",
3
+ "version": "1.6.0",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -19,6 +19,7 @@
19
19
  "@crypticdot/prettier-config": "^1.0.0",
20
20
  "@crypticdot/typescript-config": "^1.0.0",
21
21
  "@crypticdot/fusionamm-client": "^1.0.62",
22
+ "@crypticdot/fusionamm-core": "^1.0.62",
22
23
  "@solana/kit": "^2.1.0",
23
24
  "@types/node": "^22.13.14",
24
25
  "decimal.js": "^10.5.0",