@crypticdot/defituna-api 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.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,11 +2229,10 @@ 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
- decreasePercent: z.ZodBigInt;
2235
+ decreasePercent: z.ZodNumber;
2233
2236
  /** Collateral token of the new position */
2234
2237
  collateralToken: z.ZodNumber;
2235
2238
  /** Token of the new position */
@@ -2257,27 +2260,27 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
2257
2260
  }, "strip", z.ZodTypeAny, {
2258
2261
  collateralToken: number;
2259
2262
  positionToken: number;
2263
+ uiLiquidationPrice: number | null;
2260
2264
  collateralAmount: bigint;
2261
2265
  borrowAmount: bigint;
2262
2266
  estimatedAmount: bigint;
2263
2267
  protocolFeeA: bigint;
2264
2268
  protocolFeeB: bigint;
2265
2269
  priceImpact: number;
2266
- uiLiquidationPrice: number | null;
2267
- decreasePercent: bigint;
2270
+ decreasePercent: number;
2268
2271
  decreaseAcceptableSwapAmount: bigint;
2269
2272
  increaseMinSwapOutputAmount: bigint;
2270
2273
  }, {
2271
2274
  collateralToken: number;
2272
2275
  positionToken: number;
2276
+ uiLiquidationPrice: number | null;
2273
2277
  collateralAmount: bigint;
2274
2278
  borrowAmount: bigint;
2275
2279
  estimatedAmount: bigint;
2276
2280
  protocolFeeA: bigint;
2277
2281
  protocolFeeB: bigint;
2278
2282
  priceImpact: number;
2279
- uiLiquidationPrice: number | null;
2280
- decreasePercent: bigint;
2283
+ decreasePercent: number;
2281
2284
  decreaseAcceptableSwapAmount: bigint;
2282
2285
  increaseMinSwapOutputAmount: bigint;
2283
2286
  }>;
@@ -3997,6 +4000,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
3997
4000
  amount: bigint;
3998
4001
  usd: number;
3999
4002
  }>;
4003
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4000
4004
  pnlUsd: z.ZodObject<{
4001
4005
  amount: z.ZodNumber;
4002
4006
  bps: z.ZodNumber;
@@ -4049,6 +4053,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4049
4053
  amount: bigint;
4050
4054
  usd: number;
4051
4055
  };
4056
+ uiLiquidationPrice: number | null;
4052
4057
  leverage: number;
4053
4058
  openedAtSlot: bigint;
4054
4059
  }, {
@@ -4088,6 +4093,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4088
4093
  amount: bigint;
4089
4094
  usd: number;
4090
4095
  };
4096
+ uiLiquidationPrice: number | null;
4091
4097
  leverage: number;
4092
4098
  openedAtSlot: bigint;
4093
4099
  }>;
@@ -4151,6 +4157,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4151
4157
  amount: bigint;
4152
4158
  usd: number;
4153
4159
  }>;
4160
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4154
4161
  pnlUsd: z.ZodObject<{
4155
4162
  amount: z.ZodNumber;
4156
4163
  bps: z.ZodNumber;
@@ -4203,6 +4210,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4203
4210
  amount: bigint;
4204
4211
  usd: number;
4205
4212
  };
4213
+ uiLiquidationPrice: number | null;
4206
4214
  leverage: number;
4207
4215
  openedAtSlot: bigint;
4208
4216
  }, {
@@ -4242,6 +4250,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4242
4250
  amount: bigint;
4243
4251
  usd: number;
4244
4252
  };
4253
+ uiLiquidationPrice: number | null;
4245
4254
  leverage: number;
4246
4255
  openedAtSlot: bigint;
4247
4256
  }>;
@@ -4288,6 +4297,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4288
4297
  amount: bigint;
4289
4298
  usd: number;
4290
4299
  };
4300
+ uiLiquidationPrice: number | null;
4291
4301
  leverage: number;
4292
4302
  openedAtSlot: bigint;
4293
4303
  };
@@ -4334,6 +4344,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4334
4344
  amount: bigint;
4335
4345
  usd: number;
4336
4346
  };
4347
+ uiLiquidationPrice: number | null;
4337
4348
  leverage: number;
4338
4349
  openedAtSlot: bigint;
4339
4350
  };
@@ -4380,6 +4391,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4380
4391
  amount: bigint;
4381
4392
  usd: number;
4382
4393
  };
4394
+ uiLiquidationPrice: number | null;
4383
4395
  leverage: number;
4384
4396
  openedAtSlot: bigint;
4385
4397
  };
@@ -4426,6 +4438,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4426
4438
  amount: bigint;
4427
4439
  usd: number;
4428
4440
  };
4441
+ uiLiquidationPrice: number | null;
4429
4442
  leverage: number;
4430
4443
  openedAtSlot: bigint;
4431
4444
  };
@@ -6410,8 +6423,8 @@ declare class TunaApiClient {
6410
6423
  getFeesStats(from: Date, to: Date, interval: string): Promise<FeesStatsGroup[]>;
6411
6424
  getStakingRevenueStats(from: Date, to: Date): Promise<StakingRevenueStatsGroup[]>;
6412
6425
  getSwapQuoteByInput(pool: string, amountIn: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByInputQuote>;
6413
- getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByInputQuote>;
6414
- getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: number, positionDebt?: number, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6426
+ getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByOutputQuote>;
6427
+ getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: bigint, positionDebt?: bigint, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6415
6428
  getDecreaseSpotPositionQuote(market: string, decreaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint, slippageTolerance?: number): Promise<DecreaseSpotPositionQuote>;
6416
6429
  getTradableAmount(market: string, collateralToken: number, positionToken: number, newPositionToken: number, availableBalance: bigint, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint): Promise<TradableAmount>;
6417
6430
  getUpdatesStream(): Promise<EventSource>;
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,11 +2229,10 @@ 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
- decreasePercent: z.ZodBigInt;
2235
+ decreasePercent: z.ZodNumber;
2233
2236
  /** Collateral token of the new position */
2234
2237
  collateralToken: z.ZodNumber;
2235
2238
  /** Token of the new position */
@@ -2257,27 +2260,27 @@ declare const DecreaseSpotPositionQuote$1: z.ZodObject<{
2257
2260
  }, "strip", z.ZodTypeAny, {
2258
2261
  collateralToken: number;
2259
2262
  positionToken: number;
2263
+ uiLiquidationPrice: number | null;
2260
2264
  collateralAmount: bigint;
2261
2265
  borrowAmount: bigint;
2262
2266
  estimatedAmount: bigint;
2263
2267
  protocolFeeA: bigint;
2264
2268
  protocolFeeB: bigint;
2265
2269
  priceImpact: number;
2266
- uiLiquidationPrice: number | null;
2267
- decreasePercent: bigint;
2270
+ decreasePercent: number;
2268
2271
  decreaseAcceptableSwapAmount: bigint;
2269
2272
  increaseMinSwapOutputAmount: bigint;
2270
2273
  }, {
2271
2274
  collateralToken: number;
2272
2275
  positionToken: number;
2276
+ uiLiquidationPrice: number | null;
2273
2277
  collateralAmount: bigint;
2274
2278
  borrowAmount: bigint;
2275
2279
  estimatedAmount: bigint;
2276
2280
  protocolFeeA: bigint;
2277
2281
  protocolFeeB: bigint;
2278
2282
  priceImpact: number;
2279
- uiLiquidationPrice: number | null;
2280
- decreasePercent: bigint;
2283
+ decreasePercent: number;
2281
2284
  decreaseAcceptableSwapAmount: bigint;
2282
2285
  increaseMinSwapOutputAmount: bigint;
2283
2286
  }>;
@@ -3997,6 +4000,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
3997
4000
  amount: bigint;
3998
4001
  usd: number;
3999
4002
  }>;
4003
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4000
4004
  pnlUsd: z.ZodObject<{
4001
4005
  amount: z.ZodNumber;
4002
4006
  bps: z.ZodNumber;
@@ -4049,6 +4053,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4049
4053
  amount: bigint;
4050
4054
  usd: number;
4051
4055
  };
4056
+ uiLiquidationPrice: number | null;
4052
4057
  leverage: number;
4053
4058
  openedAtSlot: bigint;
4054
4059
  }, {
@@ -4088,6 +4093,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4088
4093
  amount: bigint;
4089
4094
  usd: number;
4090
4095
  };
4096
+ uiLiquidationPrice: number | null;
4091
4097
  leverage: number;
4092
4098
  openedAtSlot: bigint;
4093
4099
  }>;
@@ -4151,6 +4157,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4151
4157
  amount: bigint;
4152
4158
  usd: number;
4153
4159
  }>;
4160
+ uiLiquidationPrice: z.ZodNullable<z.ZodNumber>;
4154
4161
  pnlUsd: z.ZodObject<{
4155
4162
  amount: z.ZodNumber;
4156
4163
  bps: z.ZodNumber;
@@ -4203,6 +4210,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4203
4210
  amount: bigint;
4204
4211
  usd: number;
4205
4212
  };
4213
+ uiLiquidationPrice: number | null;
4206
4214
  leverage: number;
4207
4215
  openedAtSlot: bigint;
4208
4216
  }, {
@@ -4242,6 +4250,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4242
4250
  amount: bigint;
4243
4251
  usd: number;
4244
4252
  };
4253
+ uiLiquidationPrice: number | null;
4245
4254
  leverage: number;
4246
4255
  openedAtSlot: bigint;
4247
4256
  }>;
@@ -4288,6 +4297,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4288
4297
  amount: bigint;
4289
4298
  usd: number;
4290
4299
  };
4300
+ uiLiquidationPrice: number | null;
4291
4301
  leverage: number;
4292
4302
  openedAtSlot: bigint;
4293
4303
  };
@@ -4334,6 +4344,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4334
4344
  amount: bigint;
4335
4345
  usd: number;
4336
4346
  };
4347
+ uiLiquidationPrice: number | null;
4337
4348
  leverage: number;
4338
4349
  openedAtSlot: bigint;
4339
4350
  };
@@ -4380,6 +4391,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4380
4391
  amount: bigint;
4381
4392
  usd: number;
4382
4393
  };
4394
+ uiLiquidationPrice: number | null;
4383
4395
  leverage: number;
4384
4396
  openedAtSlot: bigint;
4385
4397
  };
@@ -4426,6 +4438,7 @@ declare const TunaSpotPositionNotification: z.ZodObject<{
4426
4438
  amount: bigint;
4427
4439
  usd: number;
4428
4440
  };
4441
+ uiLiquidationPrice: number | null;
4429
4442
  leverage: number;
4430
4443
  openedAtSlot: bigint;
4431
4444
  };
@@ -6410,8 +6423,8 @@ declare class TunaApiClient {
6410
6423
  getFeesStats(from: Date, to: Date, interval: string): Promise<FeesStatsGroup[]>;
6411
6424
  getStakingRevenueStats(from: Date, to: Date): Promise<StakingRevenueStatsGroup[]>;
6412
6425
  getSwapQuoteByInput(pool: string, amountIn: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByInputQuote>;
6413
- getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByInputQuote>;
6414
- getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: number, positionDebt?: number, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6426
+ getSwapQuoteByOutput(pool: string, amountOut: bigint, aToB: boolean, slippageToleranceBps?: number): Promise<SwapByOutputQuote>;
6427
+ getIncreaseSpotPositionQuote(market: string, increaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, positionAmount?: bigint, positionDebt?: bigint, slippageTolerance?: number): Promise<IncreaseSpotPositionQuote>;
6415
6428
  getDecreaseSpotPositionQuote(market: string, decreaseAmount: bigint, collateralToken: number, positionToken: number, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint, slippageTolerance?: number): Promise<DecreaseSpotPositionQuote>;
6416
6429
  getTradableAmount(market: string, collateralToken: number, positionToken: number, newPositionToken: number, availableBalance: bigint, leverage: number, reduceOnly: boolean, positionAmount: bigint, positionDebt: bigint): Promise<TradableAmount>;
6417
6430
  getUpdatesStream(): Promise<EventSource>;
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(),
@@ -667,7 +668,7 @@ var IncreaseSpotPositionQuote = import_zod.z.object({
667
668
  });
668
669
  var DecreaseSpotPositionQuote = import_zod.z.object({
669
670
  /** Position decrease percentage */
670
- decreasePercent: import_zod.z.coerce.bigint(),
671
+ decreasePercent: import_zod.z.number(),
671
672
  /** Collateral token of the new position */
672
673
  collateralToken: import_zod.z.number(),
673
674
  /** Token of the new position */
@@ -1047,7 +1048,7 @@ var TunaApiClient = class {
1047
1048
  query.slippage_tolerance = slippageToleranceBps;
1048
1049
  }
1049
1050
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/swap-by-output`), query);
1050
- return await this.httpRequest(url, SwapByInputQuote);
1051
+ return await this.httpRequest(url, SwapByOutputQuote);
1051
1052
  }
1052
1053
  async getIncreaseSpotPositionQuote(market, increaseAmount, collateralToken, positionToken, leverage, positionAmount, positionDebt, slippageTolerance) {
1053
1054
  let query = {
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(),
@@ -632,7 +633,7 @@ var IncreaseSpotPositionQuote = z.object({
632
633
  });
633
634
  var DecreaseSpotPositionQuote = z.object({
634
635
  /** Position decrease percentage */
635
- decreasePercent: z.coerce.bigint(),
636
+ decreasePercent: z.number(),
636
637
  /** Collateral token of the new position */
637
638
  collateralToken: z.number(),
638
639
  /** Token of the new position */
@@ -1012,7 +1013,7 @@ var TunaApiClient = class {
1012
1013
  query.slippage_tolerance = slippageToleranceBps;
1013
1014
  }
1014
1015
  const url = this.appendUrlSearchParams(this.buildURL(`quotes/swap-by-output`), query);
1015
- return await this.httpRequest(url, SwapByInputQuote);
1016
+ return await this.httpRequest(url, SwapByOutputQuote);
1016
1017
  }
1017
1018
  async getIncreaseSpotPositionQuote(market, increaseAmount, collateralToken, positionToken, leverage, positionAmount, positionDebt, slippageTolerance) {
1018
1019
  let query = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-api",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",