@crypticdot/defituna-api 1.5.1 → 1.5.3

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
@@ -1167,6 +1167,7 @@ declare const TunaSpotPosition$1: z.ZodObject<{
1167
1167
  amount: bigint;
1168
1168
  usd: number;
1169
1169
  }>;
1170
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
1170
1171
  pnlUsd: z.ZodObject<{
1171
1172
  amount: z.ZodNumber;
1172
1173
  bps: z.ZodNumber;
@@ -1219,6 +1220,7 @@ declare const TunaSpotPosition$1: z.ZodObject<{
1219
1220
  amount: bigint;
1220
1221
  usd: number;
1221
1222
  };
1223
+ uiLiquidationPrice: number | null;
1222
1224
  leverage: number;
1223
1225
  openedAtSlot: bigint;
1224
1226
  }, {
@@ -1258,6 +1260,7 @@ declare const TunaSpotPosition$1: z.ZodObject<{
1258
1260
  amount: bigint;
1259
1261
  usd: number;
1260
1262
  };
1263
+ uiLiquidationPrice: number | null;
1261
1264
  leverage: number;
1262
1265
  openedAtSlot: bigint;
1263
1266
  }>;
@@ -2207,6 +2210,7 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
2207
2210
  /** Liquidation price */
2208
2211
  uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
2209
2212
  }, "strip", z.ZodTypeAny, {
2213
+ uiLiquidationPrice: number | null;
2210
2214
  collateralAmount: bigint;
2211
2215
  borrowAmount: bigint;
2212
2216
  estimatedAmount: bigint;
@@ -2215,8 +2219,8 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
2215
2219
  protocolFeeA: bigint;
2216
2220
  protocolFeeB: bigint;
2217
2221
  priceImpact: number;
2218
- uiLiquidationPrice: number | null;
2219
2222
  }, {
2223
+ uiLiquidationPrice: number | null;
2220
2224
  collateralAmount: bigint;
2221
2225
  borrowAmount: bigint;
2222
2226
  estimatedAmount: bigint;
@@ -2225,61 +2229,28 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
2225
2229
  protocolFeeA: bigint;
2226
2230
  protocolFeeB: bigint;
2227
2231
  priceImpact: number;
2228
- uiLiquidationPrice: number | null;
2229
2232
  }>;
2230
2233
  declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
2231
2234
  /** Position decrease percentage */
2232
2235
  decreasePercent: z.ZodNumber;
2233
- /** Collateral token of the new position */
2234
- collateralToken: z.ZodNumber;
2235
- /** Token of the new position */
2236
- positionToken: z.ZodNumber;
2237
- /** Required additional collateral amount */
2238
- collateralAmount: z.ZodBigInt;
2239
- /** Required amount to borrow */
2240
- borrowAmount: z.ZodBigInt;
2241
2236
  /** The maximum acceptable swap input amount for position decrease according to the provided slippage
2242
2237
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
2243
2238
  */
2244
- decreaseAcceptableSwapAmount: z.ZodBigInt;
2245
- /** The minimum swap output amount for position increase according to the provided slippage. */
2246
- increaseMinSwapOutputAmount: z.ZodBigInt;
2247
- /** Estimated total amount of the new position */
2248
- estimatedAmount: z.ZodBigInt;
2249
- /** Protocol fee in token A */
2250
- protocolFeeA: z.ZodBigInt;
2251
- /** Protocol fee in token B */
2252
- protocolFeeB: z.ZodBigInt;
2239
+ requiredSwapAmount: z.ZodBigInt;
2253
2240
  /** Price impact in percents */
2254
2241
  priceImpact: z.ZodNumber;
2255
2242
  /** Liquidation price */
2256
2243
  uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
2257
2244
  }, "strip", z.ZodTypeAny, {
2258
- collateralToken: number;
2259
- positionToken: number;
2260
- collateralAmount: bigint;
2261
- borrowAmount: bigint;
2262
- estimatedAmount: bigint;
2263
- protocolFeeA: bigint;
2264
- protocolFeeB: bigint;
2265
- priceImpact: number;
2266
2245
  uiLiquidationPrice: number | null;
2246
+ priceImpact: number;
2267
2247
  decreasePercent: number;
2268
- decreaseAcceptableSwapAmount: bigint;
2269
- increaseMinSwapOutputAmount: bigint;
2248
+ requiredSwapAmount: bigint;
2270
2249
  }, {
2271
- collateralToken: number;
2272
- positionToken: number;
2273
- collateralAmount: bigint;
2274
- borrowAmount: bigint;
2275
- estimatedAmount: bigint;
2276
- protocolFeeA: bigint;
2277
- protocolFeeB: bigint;
2278
- priceImpact: number;
2279
2250
  uiLiquidationPrice: number | null;
2251
+ priceImpact: number;
2280
2252
  decreasePercent: number;
2281
- decreaseAcceptableSwapAmount: bigint;
2282
- increaseMinSwapOutputAmount: bigint;
2253
+ requiredSwapAmount: bigint;
2283
2254
  }>;
2284
2255
  declare const SwapByInputQuote$1: z.ZodObject<{
2285
2256
  estimatedAmountOut: z.ZodBigInt;
@@ -3997,6 +3968,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
3997
3968
  amount: bigint;
3998
3969
  usd: number;
3999
3970
  }>;
3971
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4000
3972
  pnlUsd: z.ZodObject<{
4001
3973
  amount: z.ZodNumber;
4002
3974
  bps: z.ZodNumber;
@@ -4049,6 +4021,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4049
4021
  amount: bigint;
4050
4022
  usd: number;
4051
4023
  };
4024
+ uiLiquidationPrice: number | null;
4052
4025
  leverage: number;
4053
4026
  openedAtSlot: bigint;
4054
4027
  }, {
@@ -4088,6 +4061,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4088
4061
  amount: bigint;
4089
4062
  usd: number;
4090
4063
  };
4064
+ uiLiquidationPrice: number | null;
4091
4065
  leverage: number;
4092
4066
  openedAtSlot: bigint;
4093
4067
  }>;
@@ -4151,6 +4125,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4151
4125
  amount: bigint;
4152
4126
  usd: number;
4153
4127
  }>;
4128
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4154
4129
  pnlUsd: z.ZodObject<{
4155
4130
  amount: z.ZodNumber;
4156
4131
  bps: z.ZodNumber;
@@ -4203,6 +4178,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4203
4178
  amount: bigint;
4204
4179
  usd: number;
4205
4180
  };
4181
+ uiLiquidationPrice: number | null;
4206
4182
  leverage: number;
4207
4183
  openedAtSlot: bigint;
4208
4184
  }, {
@@ -4242,6 +4218,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4242
4218
  amount: bigint;
4243
4219
  usd: number;
4244
4220
  };
4221
+ uiLiquidationPrice: number | null;
4245
4222
  leverage: number;
4246
4223
  openedAtSlot: bigint;
4247
4224
  }>;
@@ -4288,6 +4265,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4288
4265
  amount: bigint;
4289
4266
  usd: number;
4290
4267
  };
4268
+ uiLiquidationPrice: number | null;
4291
4269
  leverage: number;
4292
4270
  openedAtSlot: bigint;
4293
4271
  };
@@ -4334,6 +4312,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4334
4312
  amount: bigint;
4335
4313
  usd: number;
4336
4314
  };
4315
+ uiLiquidationPrice: number | null;
4337
4316
  leverage: number;
4338
4317
  openedAtSlot: bigint;
4339
4318
  };
@@ -4380,6 +4359,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4380
4359
  amount: bigint;
4381
4360
  usd: number;
4382
4361
  };
4362
+ uiLiquidationPrice: number | null;
4383
4363
  leverage: number;
4384
4364
  openedAtSlot: bigint;
4385
4365
  };
@@ -4426,6 +4406,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4426
4406
  amount: bigint;
4427
4407
  usd: number;
4428
4408
  };
4409
+ uiLiquidationPrice: number | null;
4429
4410
  leverage: number;
4430
4411
  openedAtSlot: bigint;
4431
4412
  };
@@ -6413,7 +6394,7 @@ declare class TunaApiClient {
6413
6394
  getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByOutputQuote>;
6414
6395
  getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: bigint, positionDebt?: bigint, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6415
6396
  getDecreaseSpotPositionQuote(market: string, decreaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint, slippageTolerance?: number): Promise<DecreaseSpotPositionQuote>;
6416
- getTradableAmount(market: string, collateralToken: number, positionToken: number, newPositionToken: number, availableBalance: bigint, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint): Promise<TradableAmount>;
6397
+ getTradableAmount(market: string, collateralToken: number, positionToken: number, availableBalance: bigint, leverage: number, positionAmount: bigint, increase: boolean): Promise<TradableAmount>;
6417
6398
  getUpdatesStream(): Promise<EventSource>;
6418
6399
  updateStreamSubscription(streamId: string, subscription: SubscriptionPayload): Promise<unknown>;
6419
6400
  private buildURL;
package/dist/index.d.ts CHANGED
@@ -1167,6 +1167,7 @@ declare const TunaSpotPosition$1: z.ZodObject<{
1167
1167
  amount: bigint;
1168
1168
  usd: number;
1169
1169
  }>;
1170
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
1170
1171
  pnlUsd: z.ZodObject<{
1171
1172
  amount: z.ZodNumber;
1172
1173
  bps: z.ZodNumber;
@@ -1219,6 +1220,7 @@ declare const TunaSpotPosition$1: z.ZodObject<{
1219
1220
  amount: bigint;
1220
1221
  usd: number;
1221
1222
  };
1223
+ uiLiquidationPrice: number | null;
1222
1224
  leverage: number;
1223
1225
  openedAtSlot: bigint;
1224
1226
  }, {
@@ -1258,6 +1260,7 @@ declare const TunaSpotPosition$1: z.ZodObject<{
1258
1260
  amount: bigint;
1259
1261
  usd: number;
1260
1262
  };
1263
+ uiLiquidationPrice: number | null;
1261
1264
  leverage: number;
1262
1265
  openedAtSlot: bigint;
1263
1266
  }>;
@@ -2207,6 +2210,7 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
2207
2210
  /** Liquidation price */
2208
2211
  uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
2209
2212
  }, "strip", z.ZodTypeAny, {
2213
+ uiLiquidationPrice: number | null;
2210
2214
  collateralAmount: bigint;
2211
2215
  borrowAmount: bigint;
2212
2216
  estimatedAmount: bigint;
@@ -2215,8 +2219,8 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
2215
2219
  protocolFeeA: bigint;
2216
2220
  protocolFeeB: bigint;
2217
2221
  priceImpact: number;
2218
- uiLiquidationPrice: number | null;
2219
2222
  }, {
2223
+ uiLiquidationPrice: number | null;
2220
2224
  collateralAmount: bigint;
2221
2225
  borrowAmount: bigint;
2222
2226
  estimatedAmount: bigint;
@@ -2225,61 +2229,28 @@ declare const IncreaseSpotPositionQuote$1: z.ZodObject<{
2225
2229
  protocolFeeA: bigint;
2226
2230
  protocolFeeB: bigint;
2227
2231
  priceImpact: number;
2228
- uiLiquidationPrice: number | null;
2229
2232
  }>;
2230
2233
  declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
2231
2234
  /** Position decrease percentage */
2232
2235
  decreasePercent: z.ZodNumber;
2233
- /** Collateral token of the new position */
2234
- collateralToken: z.ZodNumber;
2235
- /** Token of the new position */
2236
- positionToken: z.ZodNumber;
2237
- /** Required additional collateral amount */
2238
- collateralAmount: z.ZodBigInt;
2239
- /** Required amount to borrow */
2240
- borrowAmount: z.ZodBigInt;
2241
2236
  /** The maximum acceptable swap input amount for position decrease according to the provided slippage
2242
2237
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
2243
2238
  */
2244
- decreaseAcceptableSwapAmount: z.ZodBigInt;
2245
- /** The minimum swap output amount for position increase according to the provided slippage. */
2246
- increaseMinSwapOutputAmount: z.ZodBigInt;
2247
- /** Estimated total amount of the new position */
2248
- estimatedAmount: z.ZodBigInt;
2249
- /** Protocol fee in token A */
2250
- protocolFeeA: z.ZodBigInt;
2251
- /** Protocol fee in token B */
2252
- protocolFeeB: z.ZodBigInt;
2239
+ requiredSwapAmount: z.ZodBigInt;
2253
2240
  /** Price impact in percents */
2254
2241
  priceImpact: z.ZodNumber;
2255
2242
  /** Liquidation price */
2256
2243
  uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
2257
2244
  }, "strip", z.ZodTypeAny, {
2258
- collateralToken: number;
2259
- positionToken: number;
2260
- collateralAmount: bigint;
2261
- borrowAmount: bigint;
2262
- estimatedAmount: bigint;
2263
- protocolFeeA: bigint;
2264
- protocolFeeB: bigint;
2265
- priceImpact: number;
2266
2245
  uiLiquidationPrice: number | null;
2246
+ priceImpact: number;
2267
2247
  decreasePercent: number;
2268
- decreaseAcceptableSwapAmount: bigint;
2269
- increaseMinSwapOutputAmount: bigint;
2248
+ requiredSwapAmount: bigint;
2270
2249
  }, {
2271
- collateralToken: number;
2272
- positionToken: number;
2273
- collateralAmount: bigint;
2274
- borrowAmount: bigint;
2275
- estimatedAmount: bigint;
2276
- protocolFeeA: bigint;
2277
- protocolFeeB: bigint;
2278
- priceImpact: number;
2279
2250
  uiLiquidationPrice: number | null;
2251
+ priceImpact: number;
2280
2252
  decreasePercent: number;
2281
- decreaseAcceptableSwapAmount: bigint;
2282
- increaseMinSwapOutputAmount: bigint;
2253
+ requiredSwapAmount: bigint;
2283
2254
  }>;
2284
2255
  declare const SwapByInputQuote$1: z.ZodObject<{
2285
2256
  estimatedAmountOut: z.ZodBigInt;
@@ -3997,6 +3968,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
3997
3968
  amount: bigint;
3998
3969
  usd: number;
3999
3970
  }>;
3971
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4000
3972
  pnlUsd: z.ZodObject<{
4001
3973
  amount: z.ZodNumber;
4002
3974
  bps: z.ZodNumber;
@@ -4049,6 +4021,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4049
4021
  amount: bigint;
4050
4022
  usd: number;
4051
4023
  };
4024
+ uiLiquidationPrice: number | null;
4052
4025
  leverage: number;
4053
4026
  openedAtSlot: bigint;
4054
4027
  }, {
@@ -4088,6 +4061,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4088
4061
  amount: bigint;
4089
4062
  usd: number;
4090
4063
  };
4064
+ uiLiquidationPrice: number | null;
4091
4065
  leverage: number;
4092
4066
  openedAtSlot: bigint;
4093
4067
  }>;
@@ -4151,6 +4125,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4151
4125
  amount: bigint;
4152
4126
  usd: number;
4153
4127
  }>;
4128
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4154
4129
  pnlUsd: z.ZodObject<{
4155
4130
  amount: z.ZodNumber;
4156
4131
  bps: z.ZodNumber;
@@ -4203,6 +4178,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4203
4178
  amount: bigint;
4204
4179
  usd: number;
4205
4180
  };
4181
+ uiLiquidationPrice: number | null;
4206
4182
  leverage: number;
4207
4183
  openedAtSlot: bigint;
4208
4184
  }, {
@@ -4242,6 +4218,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4242
4218
  amount: bigint;
4243
4219
  usd: number;
4244
4220
  };
4221
+ uiLiquidationPrice: number | null;
4245
4222
  leverage: number;
4246
4223
  openedAtSlot: bigint;
4247
4224
  }>;
@@ -4288,6 +4265,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4288
4265
  amount: bigint;
4289
4266
  usd: number;
4290
4267
  };
4268
+ uiLiquidationPrice: number | null;
4291
4269
  leverage: number;
4292
4270
  openedAtSlot: bigint;
4293
4271
  };
@@ -4334,6 +4312,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4334
4312
  amount: bigint;
4335
4313
  usd: number;
4336
4314
  };
4315
+ uiLiquidationPrice: number | null;
4337
4316
  leverage: number;
4338
4317
  openedAtSlot: bigint;
4339
4318
  };
@@ -4380,6 +4359,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4380
4359
  amount: bigint;
4381
4360
  usd: number;
4382
4361
  };
4362
+ uiLiquidationPrice: number | null;
4383
4363
  leverage: number;
4384
4364
  openedAtSlot: bigint;
4385
4365
  };
@@ -4426,6 +4406,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4426
4406
  amount: bigint;
4427
4407
  usd: number;
4428
4408
  };
4409
+ uiLiquidationPrice: number | null;
4429
4410
  leverage: number;
4430
4411
  openedAtSlot: bigint;
4431
4412
  };
@@ -6413,7 +6394,7 @@ declare class TunaApiClient {
6413
6394
  getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByOutputQuote>;
6414
6395
  getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: bigint, positionDebt?: bigint, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6415
6396
  getDecreaseSpotPositionQuote(market: string, decreaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint, slippageTolerance?: number): Promise<DecreaseSpotPositionQuote>;
6416
- getTradableAmount(market: string, collateralToken: number, positionToken: number, newPositionToken: number, availableBalance: bigint, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint): Promise<TradableAmount>;
6397
+ getTradableAmount(market: string, collateralToken: number, positionToken: number, availableBalance: bigint, leverage: number, positionAmount: bigint, increase: boolean): Promise<TradableAmount>;
6417
6398
  getUpdatesStream(): Promise<EventSource>;
6418
6399
  updateStreamSubscription(streamId: string, subscription: SubscriptionPayload): Promise<unknown>;
6419
6400
  private buildURL;
package/dist/index.js CHANGED
@@ -450,6 +450,7 @@ var TunaSpotPosition = import_zod.z.object({
450
450
  loanFunds: amountWithUsd,
451
451
  currentLoan: amountWithUsd,
452
452
  total: amountWithUsd,
453
+ uiLiquidationPrice: import_zod.z.nullable(import_zod.z.number()),
453
454
  pnlUsd: usdPnl,
454
455
  leverage: import_zod.z.number(),
455
456
  openedAt: import_zod.z.coerce.date(),
@@ -668,26 +669,10 @@ var IncreaseSpotPositionQuote = import_zod.z.object({
668
669
  var DecreaseSpotPositionQuote = import_zod.z.object({
669
670
  /** Position decrease percentage */
670
671
  decreasePercent: import_zod.z.number(),
671
- /** Collateral token of the new position */
672
- collateralToken: import_zod.z.number(),
673
- /** Token of the new position */
674
- positionToken: import_zod.z.number(),
675
- /** Required additional collateral amount */
676
- collateralAmount: import_zod.z.coerce.bigint(),
677
- /** Required amount to borrow */
678
- borrowAmount: import_zod.z.coerce.bigint(),
679
672
  /** The maximum acceptable swap input amount for position decrease according to the provided slippage
680
673
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
681
674
  */
682
- decreaseAcceptableSwapAmount: import_zod.z.coerce.bigint(),
683
- /** The minimum swap output amount for position increase according to the provided slippage. */
684
- increaseMinSwapOutputAmount: import_zod.z.coerce.bigint(),
685
- /** Estimated total amount of the new position */
686
- estimatedAmount: import_zod.z.coerce.bigint(),
687
- /** Protocol fee in token A */
688
- protocolFeeA: import_zod.z.coerce.bigint(),
689
- /** Protocol fee in token B */
690
- protocolFeeB: import_zod.z.coerce.bigint(),
675
+ requiredSwapAmount: import_zod.z.coerce.bigint(),
691
676
  /** Price impact in percents */
692
677
  priceImpact: import_zod.z.number(),
693
678
  /** Liquidation price */
@@ -1086,17 +1071,15 @@ var TunaApiClient = class {
1086
1071
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/decrease-spot-position`), query);
1087
1072
  return await this.httpRequest(url, DecreaseSpotPositionQuote);
1088
1073
  }
1089
- async getTradableAmount(market, collateralToken, positionToken, newPositionToken, availableBalance, leverage, reduceOnly, positionAmount, positionDebt) {
1074
+ async getTradableAmount(market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase) {
1090
1075
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/tradable-amount`), {
1091
1076
  market,
1092
1077
  collateral_token: collateralToken,
1093
1078
  position_token: positionToken,
1094
- new_position_token: newPositionToken,
1095
1079
  available_balance: availableBalance.toString(),
1096
1080
  leverage,
1097
- reduce_only: reduceOnly,
1098
1081
  position_amount: positionAmount.toString(),
1099
- position_debt: positionDebt.toString()
1082
+ increase
1100
1083
  });
1101
1084
  return await this.httpRequest(url, TradableAmount);
1102
1085
  }
package/dist/index.mjs CHANGED
@@ -415,6 +415,7 @@ var TunaSpotPosition = z.object({
415
415
  loanFunds: amountWithUsd,
416
416
  currentLoan: amountWithUsd,
417
417
  total: amountWithUsd,
418
+ uiLiquidationPrice: z.nullable(z.number()),
418
419
  pnlUsd: usdPnl,
419
420
  leverage: z.number(),
420
421
  openedAt: z.coerce.date(),
@@ -633,26 +634,10 @@ var IncreaseSpotPositionQuote = z.object({
633
634
  var DecreaseSpotPositionQuote = z.object({
634
635
  /** Position decrease percentage */
635
636
  decreasePercent: z.number(),
636
- /** Collateral token of the new position */
637
- collateralToken: z.number(),
638
- /** Token of the new position */
639
- positionToken: z.number(),
640
- /** Required additional collateral amount */
641
- collateralAmount: z.coerce.bigint(),
642
- /** Required amount to borrow */
643
- borrowAmount: z.coerce.bigint(),
644
637
  /** The maximum acceptable swap input amount for position decrease according to the provided slippage
645
638
  * (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
646
639
  */
647
- decreaseAcceptableSwapAmount: z.coerce.bigint(),
648
- /** The minimum swap output amount for position increase according to the provided slippage. */
649
- increaseMinSwapOutputAmount: z.coerce.bigint(),
650
- /** Estimated total amount of the new position */
651
- estimatedAmount: z.coerce.bigint(),
652
- /** Protocol fee in token A */
653
- protocolFeeA: z.coerce.bigint(),
654
- /** Protocol fee in token B */
655
- protocolFeeB: z.coerce.bigint(),
640
+ requiredSwapAmount: z.coerce.bigint(),
656
641
  /** Price impact in percents */
657
642
  priceImpact: z.number(),
658
643
  /** Liquidation price */
@@ -1051,17 +1036,15 @@ var TunaApiClient = class {
1051
1036
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/decrease-spot-position`), query);
1052
1037
  return await this.httpRequest(url, DecreaseSpotPositionQuote);
1053
1038
  }
1054
- async getTradableAmount(market, collateralToken, positionToken, newPositionToken, availableBalance, leverage, reduceOnly, positionAmount, positionDebt) {
1039
+ async getTradableAmount(market, collateralToken, positionToken, availableBalance, leverage, positionAmount, increase) {
1055
1040
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/tradable-amount`), {
1056
1041
  market,
1057
1042
  collateral_token: collateralToken,
1058
1043
  position_token: positionToken,
1059
- new_position_token: newPositionToken,
1060
1044
  available_balance: availableBalance.toString(),
1061
1045
  leverage,
1062
- reduce_only: reduceOnly,
1063
1046
  position_amount: positionAmount.toString(),
1064
- position_debt: positionDebt.toString()
1047
+ increase
1065
1048
  });
1066
1049
  return await this.httpRequest(url, TradableAmount);
1067
1050
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-api",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",