@crypticdot/defituna-api 1.1.50 → 1.1.52

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.js CHANGED
@@ -63,6 +63,7 @@ __export(schemas_exports, {
63
63
  OrderBookEntry: () => OrderBookEntry,
64
64
  OrderBookNotification: () => OrderBookNotification,
65
65
  OrderBookNotificationMeta: () => OrderBookNotificationMeta,
66
+ PaginationMeta: () => PaginationMeta,
66
67
  Pool: () => Pool,
67
68
  PoolPriceCandle: () => PoolPriceCandle,
68
69
  PoolPriceUpdate: () => PoolPriceUpdate,
@@ -74,6 +75,8 @@ __export(schemas_exports, {
74
75
  PoolSwap: () => PoolSwap,
75
76
  PoolSwapNotification: () => PoolSwapNotification,
76
77
  PoolTicks: () => PoolTicks,
78
+ StakingLeaderboardPage: () => StakingLeaderboardPage,
79
+ StakingLeaderboardPosition: () => StakingLeaderboardPosition,
77
80
  StakingPosition: () => StakingPosition,
78
81
  StakingPositionHistoryAction: () => StakingPositionHistoryAction,
79
82
  StakingPositionHistoryActionType: () => StakingPositionHistoryActionType,
@@ -174,6 +177,9 @@ var WalletSubscriptionTopicSchema = import_zod.z.enum([
174
177
  WalletSubscriptionTopic.TUNA_POSITIONS,
175
178
  ...Object.values(WalletSubscriptionTopic)
176
179
  ]);
180
+ var PaginationMeta = import_zod.z.object({
181
+ total: import_zod.z.number()
182
+ });
177
183
  var Mint = import_zod.z.object({
178
184
  symbol: import_zod.z.string(),
179
185
  mint: import_zod.z.string(),
@@ -187,10 +193,13 @@ var Market = import_zod.z.object({
187
193
  poolFeeRate: import_zod.z.number(),
188
194
  provider: PoolProviderSchema,
189
195
  maxLeverage: import_zod.z.number(),
196
+ maxSwapSlippage: import_zod.z.number(),
190
197
  protocolFee: import_zod.z.number(),
198
+ rebalanceProtocolFee: import_zod.z.number(),
191
199
  protocolFeeOnCollateral: import_zod.z.number(),
192
200
  liquidationFee: import_zod.z.number(),
193
201
  liquidationThreshold: import_zod.z.number(),
202
+ oraclePriceDeviationThreshold: import_zod.z.number(),
194
203
  limitOrderExecutionFee: import_zod.z.number(),
195
204
  borrowedFundsA: amountWithUsd,
196
205
  borrowedFundsB: amountWithUsd,
@@ -216,6 +225,7 @@ var Vault = import_zod.z.object({
216
225
  depositedShares: import_zod.z.coerce.bigint(),
217
226
  supplyApy: import_zod.z.number(),
218
227
  borrowApy: import_zod.z.number(),
228
+ interestRate: import_zod.z.coerce.bigint(),
219
229
  utilization: import_zod.z.number(),
220
230
  pythOracleFeedId: import_zod.z.string(),
221
231
  pythOraclePriceUpdate: import_zod.z.string()
@@ -407,6 +417,16 @@ var StakingPosition = import_zod.z.object({
407
417
  lastUnstakedAt: import_zod.z.nullable(import_zod.z.coerce.date()),
408
418
  withdrawAvailableAt: import_zod.z.nullable(import_zod.z.coerce.date())
409
419
  });
420
+ var StakingLeaderboardPosition = import_zod.z.object({
421
+ rank: import_zod.z.number(),
422
+ address: import_zod.z.string(),
423
+ owner: import_zod.z.string(),
424
+ staked: amountWithUsd
425
+ });
426
+ var StakingLeaderboardPage = import_zod.z.object({
427
+ data: StakingLeaderboardPosition.array(),
428
+ meta: PaginationMeta
429
+ });
410
430
  var StakingPositionHistoryAction = import_zod.z.object({
411
431
  position: import_zod.z.string(),
412
432
  action: StakingPositionHistoryActionTypeSchema,
@@ -539,6 +559,9 @@ var TunaApiClient = class {
539
559
  }
540
560
  const data = await response.json();
541
561
  const transformed = (0, import_camelcase_keys.default)(data, { deep: true, exclude: ["24h", "7d", "30d"] });
562
+ if (options?.parseRoot) {
563
+ return schema.parse(transformed);
564
+ }
542
565
  return schema.parse(transformed.data);
543
566
  } catch (error) {
544
567
  if (retries > 0 && !(error instanceof Error && error.name === "AbortError")) {
@@ -633,6 +656,14 @@ var TunaApiClient = class {
633
656
  const url = this.buildURL(`staking/treasury`);
634
657
  return await this.httpRequest(url.toString(), StakingTreasury);
635
658
  }
659
+ async getStakingLeaderboard(page, pageSize) {
660
+ const url = this.buildURL(`staking/leaderboard`);
661
+ this.appendUrlSearchParams(url, {
662
+ page: page.toString(),
663
+ page_size: pageSize.toString()
664
+ });
665
+ return await this.httpRequest(url.toString(), StakingLeaderboardPage, { parseRoot: true });
666
+ }
636
667
  async getUserLendingPositions(userAddress) {
637
668
  const url = this.buildURL(`users/${userAddress}/lending-positions`);
638
669
  return await this.httpRequest(url.toString(), LendingPosition.array());
package/dist/index.mjs CHANGED
@@ -28,6 +28,7 @@ __export(schemas_exports, {
28
28
  OrderBookEntry: () => OrderBookEntry,
29
29
  OrderBookNotification: () => OrderBookNotification,
30
30
  OrderBookNotificationMeta: () => OrderBookNotificationMeta,
31
+ PaginationMeta: () => PaginationMeta,
31
32
  Pool: () => Pool,
32
33
  PoolPriceCandle: () => PoolPriceCandle,
33
34
  PoolPriceUpdate: () => PoolPriceUpdate,
@@ -39,6 +40,8 @@ __export(schemas_exports, {
39
40
  PoolSwap: () => PoolSwap,
40
41
  PoolSwapNotification: () => PoolSwapNotification,
41
42
  PoolTicks: () => PoolTicks,
43
+ StakingLeaderboardPage: () => StakingLeaderboardPage,
44
+ StakingLeaderboardPosition: () => StakingLeaderboardPosition,
42
45
  StakingPosition: () => StakingPosition,
43
46
  StakingPositionHistoryAction: () => StakingPositionHistoryAction,
44
47
  StakingPositionHistoryActionType: () => StakingPositionHistoryActionType,
@@ -139,6 +142,9 @@ var WalletSubscriptionTopicSchema = z.enum([
139
142
  WalletSubscriptionTopic.TUNA_POSITIONS,
140
143
  ...Object.values(WalletSubscriptionTopic)
141
144
  ]);
145
+ var PaginationMeta = z.object({
146
+ total: z.number()
147
+ });
142
148
  var Mint = z.object({
143
149
  symbol: z.string(),
144
150
  mint: z.string(),
@@ -152,10 +158,13 @@ var Market = z.object({
152
158
  poolFeeRate: z.number(),
153
159
  provider: PoolProviderSchema,
154
160
  maxLeverage: z.number(),
161
+ maxSwapSlippage: z.number(),
155
162
  protocolFee: z.number(),
163
+ rebalanceProtocolFee: z.number(),
156
164
  protocolFeeOnCollateral: z.number(),
157
165
  liquidationFee: z.number(),
158
166
  liquidationThreshold: z.number(),
167
+ oraclePriceDeviationThreshold: z.number(),
159
168
  limitOrderExecutionFee: z.number(),
160
169
  borrowedFundsA: amountWithUsd,
161
170
  borrowedFundsB: amountWithUsd,
@@ -181,6 +190,7 @@ var Vault = z.object({
181
190
  depositedShares: z.coerce.bigint(),
182
191
  supplyApy: z.number(),
183
192
  borrowApy: z.number(),
193
+ interestRate: z.coerce.bigint(),
184
194
  utilization: z.number(),
185
195
  pythOracleFeedId: z.string(),
186
196
  pythOraclePriceUpdate: z.string()
@@ -372,6 +382,16 @@ var StakingPosition = z.object({
372
382
  lastUnstakedAt: z.nullable(z.coerce.date()),
373
383
  withdrawAvailableAt: z.nullable(z.coerce.date())
374
384
  });
385
+ var StakingLeaderboardPosition = z.object({
386
+ rank: z.number(),
387
+ address: z.string(),
388
+ owner: z.string(),
389
+ staked: amountWithUsd
390
+ });
391
+ var StakingLeaderboardPage = z.object({
392
+ data: StakingLeaderboardPosition.array(),
393
+ meta: PaginationMeta
394
+ });
375
395
  var StakingPositionHistoryAction = z.object({
376
396
  position: z.string(),
377
397
  action: StakingPositionHistoryActionTypeSchema,
@@ -504,6 +524,9 @@ var TunaApiClient = class {
504
524
  }
505
525
  const data = await response.json();
506
526
  const transformed = camelcaseKeys(data, { deep: true, exclude: ["24h", "7d", "30d"] });
527
+ if (options?.parseRoot) {
528
+ return schema.parse(transformed);
529
+ }
507
530
  return schema.parse(transformed.data);
508
531
  } catch (error) {
509
532
  if (retries > 0 && !(error instanceof Error && error.name === "AbortError")) {
@@ -598,6 +621,14 @@ var TunaApiClient = class {
598
621
  const url = this.buildURL(`staking/treasury`);
599
622
  return await this.httpRequest(url.toString(), StakingTreasury);
600
623
  }
624
+ async getStakingLeaderboard(page, pageSize) {
625
+ const url = this.buildURL(`staking/leaderboard`);
626
+ this.appendUrlSearchParams(url, {
627
+ page: page.toString(),
628
+ page_size: pageSize.toString()
629
+ });
630
+ return await this.httpRequest(url.toString(), StakingLeaderboardPage, { parseRoot: true });
631
+ }
601
632
  async getUserLendingPositions(userAddress) {
602
633
  const url = this.buildURL(`users/${userAddress}/lending-positions`);
603
634
  return await this.httpRequest(url.toString(), LendingPosition.array());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crypticdot/defituna-api",
3
- "version": "1.1.50",
3
+ "version": "1.1.52",
4
4
  "private": false,
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",