@crypticdot/defituna-api 1.6.0 → 1.7.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 +42 -3
- package/dist/index.d.ts +42 -3
- package/dist/index.js +34 -1
- package/dist/index.mjs +34 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2231,7 +2231,7 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
|
|
|
2231
2231
|
priceImpact: number;
|
|
2232
2232
|
}>;
|
|
2233
2233
|
declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
|
|
2234
|
-
/**
|
|
2234
|
+
/** Confirmed position decrease percentage (100% = 1.0) */
|
|
2235
2235
|
decreasePercent: z.ZodNumber;
|
|
2236
2236
|
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
2237
2237
|
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
@@ -2239,6 +2239,8 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
|
|
|
2239
2239
|
requiredSwapAmount: z.ZodBigInt;
|
|
2240
2240
|
/** Estimated total amount of the adjusted position */
|
|
2241
2241
|
estimatedAmount: z.ZodBigInt;
|
|
2242
|
+
/** Estimated amount of the withdrawn collateral */
|
|
2243
|
+
estimatedWithdrawnCollateral: z.ZodBigInt;
|
|
2242
2244
|
/** Price impact in percents */
|
|
2243
2245
|
priceImpact: z.ZodNumber;
|
|
2244
2246
|
/** Liquidation price */
|
|
@@ -2249,12 +2251,36 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
|
|
|
2249
2251
|
priceImpact: number;
|
|
2250
2252
|
decreasePercent: number;
|
|
2251
2253
|
requiredSwapAmount: bigint;
|
|
2254
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2252
2255
|
}, {
|
|
2253
2256
|
uiLiquidationPrice: number | null;
|
|
2254
2257
|
estimatedAmount: bigint;
|
|
2255
2258
|
priceImpact: number;
|
|
2256
2259
|
decreasePercent: number;
|
|
2257
2260
|
requiredSwapAmount: bigint;
|
|
2261
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2262
|
+
}>;
|
|
2263
|
+
declare const CloseSpotPositionQuote$1: z.ZodObject<{
|
|
2264
|
+
/** Position decrease percentage */
|
|
2265
|
+
decreasePercent: z.ZodNumber;
|
|
2266
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
2267
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
2268
|
+
*/
|
|
2269
|
+
requiredSwapAmount: z.ZodBigInt;
|
|
2270
|
+
/** Estimated amount of the withdrawn collateral */
|
|
2271
|
+
estimatedWithdrawnCollateral: z.ZodBigInt;
|
|
2272
|
+
/** Price impact in percents */
|
|
2273
|
+
priceImpact: z.ZodNumber;
|
|
2274
|
+
}, "strip", z.ZodTypeAny, {
|
|
2275
|
+
priceImpact: number;
|
|
2276
|
+
decreasePercent: number;
|
|
2277
|
+
requiredSwapAmount: bigint;
|
|
2278
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2279
|
+
}, {
|
|
2280
|
+
priceImpact: number;
|
|
2281
|
+
decreasePercent: number;
|
|
2282
|
+
requiredSwapAmount: bigint;
|
|
2283
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2258
2284
|
}>;
|
|
2259
2285
|
declare const SwapQuoteByInput$1: z.ZodObject<{
|
|
2260
2286
|
estimatedAmountOut: z.ZodBigInt;
|
|
@@ -6245,7 +6271,7 @@ declare const schemas_UpdateStreamSubscriptionResult: typeof UpdateStreamSubscri
|
|
|
6245
6271
|
declare const schemas_WalletSubscriptionTopic: typeof WalletSubscriptionTopic;
|
|
6246
6272
|
declare const schemas_WalletSubscriptionTopicSchema: typeof WalletSubscriptionTopicSchema;
|
|
6247
6273
|
declare namespace schemas {
|
|
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 };
|
|
6274
|
+
export { CloseSpotPositionQuote$1 as CloseSpotPositionQuote, 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 };
|
|
6249
6275
|
}
|
|
6250
6276
|
|
|
6251
6277
|
type PoolProviderType = z.infer<typeof PoolProviderSchema>;
|
|
@@ -6292,6 +6318,7 @@ type SwapQuoteByInput = z.infer<typeof SwapQuoteByInput$1>;
|
|
|
6292
6318
|
type SwapQuoteByOutput = z.infer<typeof SwapQuoteByOutput$1>;
|
|
6293
6319
|
type IncreaseSpotPositionQuote = z.infer<typeof IncreaseSpotPositionQuote$1>;
|
|
6294
6320
|
type DecreaseSpotPositionQuote = z.infer<typeof DecreaseSpotPositionQuote$1>;
|
|
6321
|
+
type CloseSpotPositionQuote = z.infer<typeof CloseSpotPositionQuote$1>;
|
|
6295
6322
|
type TradableAmount = z.infer<typeof TradableAmount$1>;
|
|
6296
6323
|
type PoolPriceUpdate = z.infer<typeof PoolPriceUpdate$1>;
|
|
6297
6324
|
type SubscriptionPayload = {
|
|
@@ -6350,6 +6377,15 @@ type GetDecreaseSpotPositionQuoteArgs = {
|
|
|
6350
6377
|
positionDebt: bigint;
|
|
6351
6378
|
slippageTolerance?: number;
|
|
6352
6379
|
};
|
|
6380
|
+
type GetCloseSpotPositionQuoteArgs = {
|
|
6381
|
+
market: string;
|
|
6382
|
+
decreasePercent: number;
|
|
6383
|
+
collateralToken: number;
|
|
6384
|
+
positionToken: number;
|
|
6385
|
+
positionAmount: bigint;
|
|
6386
|
+
positionDebt: bigint;
|
|
6387
|
+
slippageTolerance?: number;
|
|
6388
|
+
};
|
|
6353
6389
|
type GetTradableAmountArgs = {
|
|
6354
6390
|
market: string;
|
|
6355
6391
|
collateralToken: number;
|
|
@@ -6481,6 +6517,9 @@ declare class TunaApiClient {
|
|
|
6481
6517
|
getDecreaseSpotPositionQuote(args: GetDecreaseSpotPositionQuoteArgs, config?: {
|
|
6482
6518
|
abortSignal?: AbortSignal;
|
|
6483
6519
|
}): Promise<DecreaseSpotPositionQuote>;
|
|
6520
|
+
getCloseSpotPositionQuote(args: GetCloseSpotPositionQuoteArgs, config?: {
|
|
6521
|
+
abortSignal?: AbortSignal;
|
|
6522
|
+
}): Promise<CloseSpotPositionQuote>;
|
|
6484
6523
|
getTradableAmount(args: GetTradableAmountArgs, config?: {
|
|
6485
6524
|
abortSignal?: AbortSignal;
|
|
6486
6525
|
}): Promise<TradableAmount>;
|
|
@@ -6490,4 +6529,4 @@ declare class TunaApiClient {
|
|
|
6490
6529
|
private appendUrlSearchParams;
|
|
6491
6530
|
}
|
|
6492
6531
|
|
|
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 };
|
|
6532
|
+
export { type CloseSpotPositionQuote, type DecreaseSpotPositionQuote, type DurationInMs, type FeesStatsGroup, type GetCloseSpotPositionQuoteArgs, 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
|
@@ -2231,7 +2231,7 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
|
|
|
2231
2231
|
priceImpact: number;
|
|
2232
2232
|
}>;
|
|
2233
2233
|
declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
|
|
2234
|
-
/**
|
|
2234
|
+
/** Confirmed position decrease percentage (100% = 1.0) */
|
|
2235
2235
|
decreasePercent: z.ZodNumber;
|
|
2236
2236
|
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
2237
2237
|
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
@@ -2239,6 +2239,8 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
|
|
|
2239
2239
|
requiredSwapAmount: z.ZodBigInt;
|
|
2240
2240
|
/** Estimated total amount of the adjusted position */
|
|
2241
2241
|
estimatedAmount: z.ZodBigInt;
|
|
2242
|
+
/** Estimated amount of the withdrawn collateral */
|
|
2243
|
+
estimatedWithdrawnCollateral: z.ZodBigInt;
|
|
2242
2244
|
/** Price impact in percents */
|
|
2243
2245
|
priceImpact: z.ZodNumber;
|
|
2244
2246
|
/** Liquidation price */
|
|
@@ -2249,12 +2251,36 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
|
|
|
2249
2251
|
priceImpact: number;
|
|
2250
2252
|
decreasePercent: number;
|
|
2251
2253
|
requiredSwapAmount: bigint;
|
|
2254
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2252
2255
|
}, {
|
|
2253
2256
|
uiLiquidationPrice: number | null;
|
|
2254
2257
|
estimatedAmount: bigint;
|
|
2255
2258
|
priceImpact: number;
|
|
2256
2259
|
decreasePercent: number;
|
|
2257
2260
|
requiredSwapAmount: bigint;
|
|
2261
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2262
|
+
}>;
|
|
2263
|
+
declare const CloseSpotPositionQuote$1: z.ZodObject<{
|
|
2264
|
+
/** Position decrease percentage */
|
|
2265
|
+
decreasePercent: z.ZodNumber;
|
|
2266
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
2267
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
2268
|
+
*/
|
|
2269
|
+
requiredSwapAmount: z.ZodBigInt;
|
|
2270
|
+
/** Estimated amount of the withdrawn collateral */
|
|
2271
|
+
estimatedWithdrawnCollateral: z.ZodBigInt;
|
|
2272
|
+
/** Price impact in percents */
|
|
2273
|
+
priceImpact: z.ZodNumber;
|
|
2274
|
+
}, "strip", z.ZodTypeAny, {
|
|
2275
|
+
priceImpact: number;
|
|
2276
|
+
decreasePercent: number;
|
|
2277
|
+
requiredSwapAmount: bigint;
|
|
2278
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2279
|
+
}, {
|
|
2280
|
+
priceImpact: number;
|
|
2281
|
+
decreasePercent: number;
|
|
2282
|
+
requiredSwapAmount: bigint;
|
|
2283
|
+
estimatedWithdrawnCollateral: bigint;
|
|
2258
2284
|
}>;
|
|
2259
2285
|
declare const SwapQuoteByInput$1: z.ZodObject<{
|
|
2260
2286
|
estimatedAmountOut: z.ZodBigInt;
|
|
@@ -6245,7 +6271,7 @@ declare const schemas_UpdateStreamSubscriptionResult: typeof UpdateStreamSubscri
|
|
|
6245
6271
|
declare const schemas_WalletSubscriptionTopic: typeof WalletSubscriptionTopic;
|
|
6246
6272
|
declare const schemas_WalletSubscriptionTopicSchema: typeof WalletSubscriptionTopicSchema;
|
|
6247
6273
|
declare namespace schemas {
|
|
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 };
|
|
6274
|
+
export { CloseSpotPositionQuote$1 as CloseSpotPositionQuote, 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 };
|
|
6249
6275
|
}
|
|
6250
6276
|
|
|
6251
6277
|
type PoolProviderType = z.infer<typeof PoolProviderSchema>;
|
|
@@ -6292,6 +6318,7 @@ type SwapQuoteByInput = z.infer<typeof SwapQuoteByInput$1>;
|
|
|
6292
6318
|
type SwapQuoteByOutput = z.infer<typeof SwapQuoteByOutput$1>;
|
|
6293
6319
|
type IncreaseSpotPositionQuote = z.infer<typeof IncreaseSpotPositionQuote$1>;
|
|
6294
6320
|
type DecreaseSpotPositionQuote = z.infer<typeof DecreaseSpotPositionQuote$1>;
|
|
6321
|
+
type CloseSpotPositionQuote = z.infer<typeof CloseSpotPositionQuote$1>;
|
|
6295
6322
|
type TradableAmount = z.infer<typeof TradableAmount$1>;
|
|
6296
6323
|
type PoolPriceUpdate = z.infer<typeof PoolPriceUpdate$1>;
|
|
6297
6324
|
type SubscriptionPayload = {
|
|
@@ -6350,6 +6377,15 @@ type GetDecreaseSpotPositionQuoteArgs = {
|
|
|
6350
6377
|
positionDebt: bigint;
|
|
6351
6378
|
slippageTolerance?: number;
|
|
6352
6379
|
};
|
|
6380
|
+
type GetCloseSpotPositionQuoteArgs = {
|
|
6381
|
+
market: string;
|
|
6382
|
+
decreasePercent: number;
|
|
6383
|
+
collateralToken: number;
|
|
6384
|
+
positionToken: number;
|
|
6385
|
+
positionAmount: bigint;
|
|
6386
|
+
positionDebt: bigint;
|
|
6387
|
+
slippageTolerance?: number;
|
|
6388
|
+
};
|
|
6353
6389
|
type GetTradableAmountArgs = {
|
|
6354
6390
|
market: string;
|
|
6355
6391
|
collateralToken: number;
|
|
@@ -6481,6 +6517,9 @@ declare class TunaApiClient {
|
|
|
6481
6517
|
getDecreaseSpotPositionQuote(args: GetDecreaseSpotPositionQuoteArgs, config?: {
|
|
6482
6518
|
abortSignal?: AbortSignal;
|
|
6483
6519
|
}): Promise<DecreaseSpotPositionQuote>;
|
|
6520
|
+
getCloseSpotPositionQuote(args: GetCloseSpotPositionQuoteArgs, config?: {
|
|
6521
|
+
abortSignal?: AbortSignal;
|
|
6522
|
+
}): Promise<CloseSpotPositionQuote>;
|
|
6484
6523
|
getTradableAmount(args: GetTradableAmountArgs, config?: {
|
|
6485
6524
|
abortSignal?: AbortSignal;
|
|
6486
6525
|
}): Promise<TradableAmount>;
|
|
@@ -6490,4 +6529,4 @@ declare class TunaApiClient {
|
|
|
6490
6529
|
private appendUrlSearchParams;
|
|
6491
6530
|
}
|
|
6492
6531
|
|
|
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 };
|
|
6532
|
+
export { type CloseSpotPositionQuote, type DecreaseSpotPositionQuote, type DurationInMs, type FeesStatsGroup, type GetCloseSpotPositionQuoteArgs, 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
|
@@ -46,6 +46,7 @@ var import_snakecase_keys = __toESM(require("snakecase-keys"));
|
|
|
46
46
|
// src/client/schemas.ts
|
|
47
47
|
var schemas_exports = {};
|
|
48
48
|
__export(schemas_exports, {
|
|
49
|
+
CloseSpotPositionQuote: () => CloseSpotPositionQuote,
|
|
49
50
|
DecreaseSpotPositionQuote: () => DecreaseSpotPositionQuote,
|
|
50
51
|
FeesStatsGroup: () => FeesStatsGroup,
|
|
51
52
|
IncreaseSpotPositionQuote: () => IncreaseSpotPositionQuote,
|
|
@@ -669,7 +670,7 @@ var IncreaseSpotPositionQuote = import_zod.z.object({
|
|
|
669
670
|
uiLiquidationPrice: import_zod.z.nullable(import_zod.z.number())
|
|
670
671
|
});
|
|
671
672
|
var DecreaseSpotPositionQuote = import_zod.z.object({
|
|
672
|
-
/**
|
|
673
|
+
/** Confirmed position decrease percentage (100% = 1.0) */
|
|
673
674
|
decreasePercent: import_zod.z.number(),
|
|
674
675
|
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
675
676
|
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
@@ -677,11 +678,25 @@ var DecreaseSpotPositionQuote = import_zod.z.object({
|
|
|
677
678
|
requiredSwapAmount: import_zod.z.coerce.bigint(),
|
|
678
679
|
/** Estimated total amount of the adjusted position */
|
|
679
680
|
estimatedAmount: import_zod.z.coerce.bigint(),
|
|
681
|
+
/** Estimated amount of the withdrawn collateral */
|
|
682
|
+
estimatedWithdrawnCollateral: import_zod.z.coerce.bigint(),
|
|
680
683
|
/** Price impact in percents */
|
|
681
684
|
priceImpact: import_zod.z.number(),
|
|
682
685
|
/** Liquidation price */
|
|
683
686
|
uiLiquidationPrice: import_zod.z.nullable(import_zod.z.number())
|
|
684
687
|
});
|
|
688
|
+
var CloseSpotPositionQuote = import_zod.z.object({
|
|
689
|
+
/** Position decrease percentage */
|
|
690
|
+
decreasePercent: import_zod.z.number(),
|
|
691
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
692
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
693
|
+
*/
|
|
694
|
+
requiredSwapAmount: import_zod.z.coerce.bigint(),
|
|
695
|
+
/** Estimated amount of the withdrawn collateral */
|
|
696
|
+
estimatedWithdrawnCollateral: import_zod.z.coerce.bigint(),
|
|
697
|
+
/** Price impact in percents */
|
|
698
|
+
priceImpact: import_zod.z.number()
|
|
699
|
+
});
|
|
685
700
|
var SwapQuoteByInput = import_zod.z.object({
|
|
686
701
|
estimatedAmountOut: import_zod.z.coerce.bigint(),
|
|
687
702
|
minAmountOut: import_zod.z.coerce.bigint(),
|
|
@@ -1136,6 +1151,24 @@ var TunaApiClient = class {
|
|
|
1136
1151
|
signal: config?.abortSignal
|
|
1137
1152
|
});
|
|
1138
1153
|
}
|
|
1154
|
+
async getCloseSpotPositionQuote(args, config) {
|
|
1155
|
+
const { market, decreasePercent, collateralToken, positionToken, positionAmount, positionDebt, slippageTolerance } = args;
|
|
1156
|
+
let query = {
|
|
1157
|
+
market,
|
|
1158
|
+
decrease_percent: decreasePercent,
|
|
1159
|
+
collateral_token: collateralToken,
|
|
1160
|
+
position_token: positionToken,
|
|
1161
|
+
position_amount: positionAmount.toString(),
|
|
1162
|
+
position_debt: positionDebt.toString()
|
|
1163
|
+
};
|
|
1164
|
+
if (slippageTolerance) {
|
|
1165
|
+
query.slippage_tolerance = slippageTolerance;
|
|
1166
|
+
}
|
|
1167
|
+
const url = this.appendUrlSearchParams(this.buildURL(`quotes/close-spot-position`), query);
|
|
1168
|
+
return await this.httpRequest(url, CloseSpotPositionQuote, {
|
|
1169
|
+
signal: config?.abortSignal
|
|
1170
|
+
});
|
|
1171
|
+
}
|
|
1139
1172
|
async getTradableAmount(args, config) {
|
|
1140
1173
|
const { market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase } = args;
|
|
1141
1174
|
const url = this.appendUrlSearchParams(this.buildURL(`quotes/tradable-amount`), {
|
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import snakecaseKeys from "snakecase-keys";
|
|
|
11
11
|
// src/client/schemas.ts
|
|
12
12
|
var schemas_exports = {};
|
|
13
13
|
__export(schemas_exports, {
|
|
14
|
+
CloseSpotPositionQuote: () => CloseSpotPositionQuote,
|
|
14
15
|
DecreaseSpotPositionQuote: () => DecreaseSpotPositionQuote,
|
|
15
16
|
FeesStatsGroup: () => FeesStatsGroup,
|
|
16
17
|
IncreaseSpotPositionQuote: () => IncreaseSpotPositionQuote,
|
|
@@ -634,7 +635,7 @@ var IncreaseSpotPositionQuote = z.object({
|
|
|
634
635
|
uiLiquidationPrice: z.nullable(z.number())
|
|
635
636
|
});
|
|
636
637
|
var DecreaseSpotPositionQuote = z.object({
|
|
637
|
-
/**
|
|
638
|
+
/** Confirmed position decrease percentage (100% = 1.0) */
|
|
638
639
|
decreasePercent: z.number(),
|
|
639
640
|
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
640
641
|
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
@@ -642,11 +643,25 @@ var DecreaseSpotPositionQuote = z.object({
|
|
|
642
643
|
requiredSwapAmount: z.coerce.bigint(),
|
|
643
644
|
/** Estimated total amount of the adjusted position */
|
|
644
645
|
estimatedAmount: z.coerce.bigint(),
|
|
646
|
+
/** Estimated amount of the withdrawn collateral */
|
|
647
|
+
estimatedWithdrawnCollateral: z.coerce.bigint(),
|
|
645
648
|
/** Price impact in percents */
|
|
646
649
|
priceImpact: z.number(),
|
|
647
650
|
/** Liquidation price */
|
|
648
651
|
uiLiquidationPrice: z.nullable(z.number())
|
|
649
652
|
});
|
|
653
|
+
var CloseSpotPositionQuote = z.object({
|
|
654
|
+
/** Position decrease percentage */
|
|
655
|
+
decreasePercent: z.number(),
|
|
656
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
657
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
658
|
+
*/
|
|
659
|
+
requiredSwapAmount: z.coerce.bigint(),
|
|
660
|
+
/** Estimated amount of the withdrawn collateral */
|
|
661
|
+
estimatedWithdrawnCollateral: z.coerce.bigint(),
|
|
662
|
+
/** Price impact in percents */
|
|
663
|
+
priceImpact: z.number()
|
|
664
|
+
});
|
|
650
665
|
var SwapQuoteByInput = z.object({
|
|
651
666
|
estimatedAmountOut: z.coerce.bigint(),
|
|
652
667
|
minAmountOut: z.coerce.bigint(),
|
|
@@ -1101,6 +1116,24 @@ var TunaApiClient = class {
|
|
|
1101
1116
|
signal: config?.abortSignal
|
|
1102
1117
|
});
|
|
1103
1118
|
}
|
|
1119
|
+
async getCloseSpotPositionQuote(args, config) {
|
|
1120
|
+
const { market, decreasePercent, collateralToken, positionToken, positionAmount, positionDebt, slippageTolerance } = args;
|
|
1121
|
+
let query = {
|
|
1122
|
+
market,
|
|
1123
|
+
decrease_percent: decreasePercent,
|
|
1124
|
+
collateral_token: collateralToken,
|
|
1125
|
+
position_token: positionToken,
|
|
1126
|
+
position_amount: positionAmount.toString(),
|
|
1127
|
+
position_debt: positionDebt.toString()
|
|
1128
|
+
};
|
|
1129
|
+
if (slippageTolerance) {
|
|
1130
|
+
query.slippage_tolerance = slippageTolerance;
|
|
1131
|
+
}
|
|
1132
|
+
const url = this.appendUrlSearchParams(this.buildURL(`quotes/close-spot-position`), query);
|
|
1133
|
+
return await this.httpRequest(url, CloseSpotPositionQuote, {
|
|
1134
|
+
signal: config?.abortSignal
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1104
1137
|
async getTradableAmount(args, config) {
|
|
1105
1138
|
const { market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase } = args;
|
|
1106
1139
|
const url = this.appendUrlSearchParams(this.buildURL(`quotes/tradable-amount`), {
|