@crypticdot/defituna-api 4.1.3 → 4.3.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.cjs CHANGED
@@ -29,6 +29,7 @@ __export(index_exports, {
29
29
  OrderHistoryUiDirection: () => OrderHistoryUiDirection,
30
30
  PoolProvider: () => PoolProvider,
31
31
  PoolSubscriptionTopic: () => PoolSubscriptionTopic,
32
+ RateLimitSource: () => RateLimitSource,
32
33
  StakingPositionActionType: () => StakingPositionActionType,
33
34
  TradeHistoryAction: () => TradeHistoryAction,
34
35
  TradeHistoryUiDirection: () => TradeHistoryUiDirection,
@@ -101,6 +102,8 @@ __export(index_exports, {
101
102
  zGetOraclePricesResponse: () => zGetOraclePricesResponse,
102
103
  zGetOrderHistoryData: () => zGetOrderHistoryData,
103
104
  zGetOrderHistoryResponse: () => zGetOrderHistoryResponse,
105
+ zGetPairPriceData: () => zGetPairPriceData,
106
+ zGetPairPriceResponse: () => zGetPairPriceResponse,
104
107
  zGetPoolCandlesData: () => zGetPoolCandlesData,
105
108
  zGetPoolCandlesResponse: () => zGetPoolCandlesResponse,
106
109
  zGetPoolData: () => zGetPoolData,
@@ -215,6 +218,10 @@ __export(index_exports, {
215
218
  zPoolsError404Error: () => zPoolsError404Error,
216
219
  zPoolsError500Error: () => zPoolsError500Error,
217
220
  zPubkeyDto: () => zPubkeyDto,
221
+ zRateLimitSource: () => zRateLimitSource,
222
+ zRetryAfterHint: () => zRetryAfterHint,
223
+ zSearchTokensData: () => zSearchTokensData,
224
+ zSearchTokensResponse: () => zSearchTokensResponse,
218
225
  zSnapshot: () => zSnapshot,
219
226
  zSnapshotContainer: () => zSnapshotContainer,
220
227
  zSpotPositionError404Error: () => zSpotPositionError404Error,
@@ -253,6 +260,21 @@ __export(index_exports, {
253
260
  zSwapQuoteByOutputDto: () => zSwapQuoteByOutputDto,
254
261
  zTickDto: () => zTickDto,
255
262
  zTokenAmountWithUsd: () => zTokenAmountWithUsd,
263
+ zTokenAuditDto: () => zTokenAuditDto,
264
+ zTokenFirstPoolDto: () => zTokenFirstPoolDto,
265
+ zTokenPairPriceResponseDto: () => zTokenPairPriceResponseDto,
266
+ zTokenPriceDto: () => zTokenPriceDto,
267
+ zTokenSearchItemDto: () => zTokenSearchItemDto,
268
+ zTokenSearchResponseDto: () => zTokenSearchResponseDto,
269
+ zTokenStatsWindowDto: () => zTokenStatsWindowDto,
270
+ zTokensError400BadRequest: () => zTokensError400BadRequest,
271
+ zTokensError400Error: () => zTokensError400Error,
272
+ zTokensError404Error: () => zTokensError404Error,
273
+ zTokensError429Error: () => zTokensError429Error,
274
+ zTokensError429TooManyRequests: () => zTokensError429TooManyRequests,
275
+ zTokensError429UpstreamRateLimited: () => zTokensError429UpstreamRateLimited,
276
+ zTokensError500Error: () => zTokensError500Error,
277
+ zTokensError502Error: () => zTokensError502Error,
256
278
  zTradableAmountDto: () => zTradableAmountDto,
257
279
  zTradeHistoryAction: () => zTradeHistoryAction,
258
280
  zTradeHistoryEntryDto: () => zTradeHistoryEntryDto,
@@ -437,8 +459,21 @@ var marketDtoSchemaResponseTransformer = (data) => {
437
459
  data.pool = poolDtoSchemaResponseTransformer(data.pool);
438
460
  return data;
439
461
  };
462
+ var vaultDtoSchemaResponseTransformer = (data) => {
463
+ data.borrowedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.borrowedFunds);
464
+ data.borrowedShares = u64DtoSchemaResponseTransformer(data.borrowedShares);
465
+ data.depositedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.depositedFunds);
466
+ data.depositedShares = u64DtoSchemaResponseTransformer(data.depositedShares);
467
+ data.interestRate = u64DtoSchemaResponseTransformer(data.interestRate);
468
+ data.supplyLimit = tokenAmountWithUsdSchemaResponseTransformer(data.supplyLimit);
469
+ return data;
470
+ };
440
471
  var marketsListResponseSchemaResponseTransformer = (data) => {
441
472
  data.items = data.items.map((item) => marketDtoSchemaResponseTransformer(item));
473
+ const _additionalPropertiesTarget3 = data.vaults;
474
+ Object.keys(_additionalPropertiesTarget3).forEach((key) => {
475
+ _additionalPropertiesTarget3[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget3[key]);
476
+ });
442
477
  return data;
443
478
  };
444
479
  var getMarketsResponseTransformer = async (data) => {
@@ -447,6 +482,10 @@ var getMarketsResponseTransformer = async (data) => {
447
482
  };
448
483
  var marketResponseSchemaResponseTransformer = (data) => {
449
484
  data.item = marketDtoSchemaResponseTransformer(data.item);
485
+ const _additionalPropertiesTarget5 = data.vaults;
486
+ Object.keys(_additionalPropertiesTarget5).forEach((key) => {
487
+ _additionalPropertiesTarget5[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget5[key]);
488
+ });
450
489
  return data;
451
490
  };
452
491
  var getMarketResponseTransformer = async (data) => {
@@ -656,6 +695,14 @@ var lendingPositionDtoSchemaResponseTransformer = (data) => {
656
695
  };
657
696
  var lendingPositionsListResponseSchemaResponseTransformer = (data) => {
658
697
  data.items = data.items.map((item) => lendingPositionDtoSchemaResponseTransformer(item));
698
+ const _additionalPropertiesTarget6 = data.markets;
699
+ Object.keys(_additionalPropertiesTarget6).forEach((key) => {
700
+ _additionalPropertiesTarget6[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget6[key]);
701
+ });
702
+ const _additionalPropertiesTarget8 = data.vaults;
703
+ Object.keys(_additionalPropertiesTarget8).forEach((key) => {
704
+ _additionalPropertiesTarget8[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget8[key]);
705
+ });
659
706
  return data;
660
707
  };
661
708
  var getLendingPositionsResponseTransformer = async (data) => {
@@ -664,6 +711,14 @@ var getLendingPositionsResponseTransformer = async (data) => {
664
711
  };
665
712
  var lendingPositionResponseSchemaResponseTransformer = (data) => {
666
713
  data.item = lendingPositionDtoSchemaResponseTransformer(data.item);
714
+ const _additionalPropertiesTarget9 = data.markets;
715
+ Object.keys(_additionalPropertiesTarget9).forEach((key) => {
716
+ _additionalPropertiesTarget9[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget9[key]);
717
+ });
718
+ const _additionalPropertiesTarget11 = data.vaults;
719
+ Object.keys(_additionalPropertiesTarget11).forEach((key) => {
720
+ _additionalPropertiesTarget11[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget11[key]);
721
+ });
667
722
  return data;
668
723
  };
669
724
  var getLendingPositionResponseTransformer = async (data) => {
@@ -681,9 +736,9 @@ var limitOrderDtoSchemaResponseTransformer = (data) => {
681
736
  };
682
737
  var limitOrdersListResponseSchemaResponseTransformer = (data) => {
683
738
  data.items = data.items.map((item) => limitOrderDtoSchemaResponseTransformer(item));
684
- const _additionalPropertiesTarget6 = data.markets;
685
- Object.keys(_additionalPropertiesTarget6).forEach((key) => {
686
- _additionalPropertiesTarget6[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget6[key]);
739
+ const _additionalPropertiesTarget12 = data.markets;
740
+ Object.keys(_additionalPropertiesTarget12).forEach((key) => {
741
+ _additionalPropertiesTarget12[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget12[key]);
687
742
  });
688
743
  return data;
689
744
  };
@@ -693,9 +748,9 @@ var getLimitOrdersResponseTransformer = async (data) => {
693
748
  };
694
749
  var limitOrderResponseSchemaResponseTransformer = (data) => {
695
750
  data.item = limitOrderDtoSchemaResponseTransformer(data.item);
696
- const _additionalPropertiesTarget8 = data.markets;
697
- Object.keys(_additionalPropertiesTarget8).forEach((key) => {
698
- _additionalPropertiesTarget8[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget8[key]);
751
+ const _additionalPropertiesTarget14 = data.markets;
752
+ Object.keys(_additionalPropertiesTarget14).forEach((key) => {
753
+ _additionalPropertiesTarget14[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget14[key]);
699
754
  });
700
755
  return data;
701
756
  };
@@ -713,9 +768,9 @@ var tunaLpPositionDtoSchemaResponseTransformer = (data) => {
713
768
  };
714
769
  var lpPositionsHistoryListResponseSchemaResponseTransformer = (data) => {
715
770
  data.items = data.items.map((item) => tunaLpPositionDtoSchemaResponseTransformer(item));
716
- const _additionalPropertiesTarget10 = data.markets;
717
- Object.keys(_additionalPropertiesTarget10).forEach((key) => {
718
- _additionalPropertiesTarget10[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget10[key]);
771
+ const _additionalPropertiesTarget16 = data.markets;
772
+ Object.keys(_additionalPropertiesTarget16).forEach((key) => {
773
+ _additionalPropertiesTarget16[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget16[key]);
719
774
  });
720
775
  return data;
721
776
  };
@@ -746,9 +801,9 @@ var orderHistoryEntryDtoSchemaResponseTransformer = (data) => {
746
801
  };
747
802
  var orderHistoryListResponseSchemaResponseTransformer = (data) => {
748
803
  data.items = data.items.map((item) => orderHistoryEntryDtoSchemaResponseTransformer(item));
749
- const _additionalPropertiesTarget12 = data.markets;
750
- Object.keys(_additionalPropertiesTarget12).forEach((key) => {
751
- _additionalPropertiesTarget12[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget12[key]);
804
+ const _additionalPropertiesTarget18 = data.markets;
805
+ Object.keys(_additionalPropertiesTarget18).forEach((key) => {
806
+ _additionalPropertiesTarget18[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget18[key]);
752
807
  });
753
808
  return data;
754
809
  };
@@ -769,9 +824,9 @@ var tunaSpotPositionDtoSchemaResponseTransformer = (data) => {
769
824
  };
770
825
  var spotPositionsListResponseSchemaResponseTransformer = (data) => {
771
826
  data.items = data.items.map((item) => tunaSpotPositionDtoSchemaResponseTransformer(item));
772
- const _additionalPropertiesTarget14 = data.markets;
773
- Object.keys(_additionalPropertiesTarget14).forEach((key) => {
774
- _additionalPropertiesTarget14[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget14[key]);
827
+ const _additionalPropertiesTarget20 = data.markets;
828
+ Object.keys(_additionalPropertiesTarget20).forEach((key) => {
829
+ _additionalPropertiesTarget20[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget20[key]);
775
830
  });
776
831
  return data;
777
832
  };
@@ -781,9 +836,9 @@ var getSpotPositionsResponseTransformer = async (data) => {
781
836
  };
782
837
  var spotPositionResponseSchemaResponseTransformer = (data) => {
783
838
  data.item = tunaSpotPositionDtoSchemaResponseTransformer(data.item);
784
- const _additionalPropertiesTarget16 = data.markets;
785
- Object.keys(_additionalPropertiesTarget16).forEach((key) => {
786
- _additionalPropertiesTarget16[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget16[key]);
839
+ const _additionalPropertiesTarget22 = data.markets;
840
+ Object.keys(_additionalPropertiesTarget22).forEach((key) => {
841
+ _additionalPropertiesTarget22[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget22[key]);
787
842
  });
788
843
  return data;
789
844
  };
@@ -845,9 +900,9 @@ var tradeHistoryEntryDtoSchemaResponseTransformer = (data) => {
845
900
  };
846
901
  var tradeHistoryListResponseSchemaResponseTransformer = (data) => {
847
902
  data.items = data.items.map((item) => tradeHistoryEntryDtoSchemaResponseTransformer(item));
848
- const _additionalPropertiesTarget18 = data.markets;
849
- Object.keys(_additionalPropertiesTarget18).forEach((key) => {
850
- _additionalPropertiesTarget18[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget18[key]);
903
+ const _additionalPropertiesTarget24 = data.markets;
904
+ Object.keys(_additionalPropertiesTarget24).forEach((key) => {
905
+ _additionalPropertiesTarget24[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget24[key]);
851
906
  });
852
907
  return data;
853
908
  };
@@ -889,9 +944,9 @@ var tunaPositionDtoSchemaResponseTransformer = (data) => {
889
944
  };
890
945
  var lpPositionsListResponseSchemaResponseTransformer = (data) => {
891
946
  data.items = data.items.map((item) => tunaPositionDtoSchemaResponseTransformer(item));
892
- const _additionalPropertiesTarget20 = data.markets;
893
- Object.keys(_additionalPropertiesTarget20).forEach((key) => {
894
- _additionalPropertiesTarget20[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget20[key]);
947
+ const _additionalPropertiesTarget26 = data.markets;
948
+ Object.keys(_additionalPropertiesTarget26).forEach((key) => {
949
+ _additionalPropertiesTarget26[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget26[key]);
895
950
  });
896
951
  return data;
897
952
  };
@@ -901,9 +956,9 @@ var getTunaPositionsResponseTransformer = async (data) => {
901
956
  };
902
957
  var lpPositionResponseSchemaResponseTransformer = (data) => {
903
958
  data.item = tunaPositionDtoSchemaResponseTransformer(data.item);
904
- const _additionalPropertiesTarget22 = data.markets;
905
- Object.keys(_additionalPropertiesTarget22).forEach((key) => {
906
- _additionalPropertiesTarget22[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget22[key]);
959
+ const _additionalPropertiesTarget28 = data.markets;
960
+ Object.keys(_additionalPropertiesTarget28).forEach((key) => {
961
+ _additionalPropertiesTarget28[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget28[key]);
907
962
  });
908
963
  return data;
909
964
  };
@@ -913,15 +968,6 @@ var getTunaPositionResponseTransformer = async (data) => {
913
968
  }
914
969
  return data;
915
970
  };
916
- var vaultDtoSchemaResponseTransformer = (data) => {
917
- data.borrowedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.borrowedFunds);
918
- data.borrowedShares = u64DtoSchemaResponseTransformer(data.borrowedShares);
919
- data.depositedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.depositedFunds);
920
- data.depositedShares = u64DtoSchemaResponseTransformer(data.depositedShares);
921
- data.interestRate = u64DtoSchemaResponseTransformer(data.interestRate);
922
- data.supplyLimit = tokenAmountWithUsdSchemaResponseTransformer(data.supplyLimit);
923
- return data;
924
- };
925
971
  var vaultsListResponseSchemaResponseTransformer = (data) => {
926
972
  data.items = data.items.map((item) => vaultDtoSchemaResponseTransformer(item));
927
973
  return data;
@@ -1002,6 +1048,7 @@ var PoolSubscriptionTopic = {
1002
1048
  ORDER_BOOK: "order_book",
1003
1049
  POOL_PRICES: "pool_prices"
1004
1050
  };
1051
+ var RateLimitSource = { INTERNAL: "internal", UPSTREAM: "upstream" };
1005
1052
  var StakingPositionActionType = {
1006
1053
  STAKE: "stake",
1007
1054
  UNSTAKE: "unstake",
@@ -1091,26 +1138,26 @@ var toBigInt = (value) => {
1091
1138
  };
1092
1139
  var transformMarketsMap = async (markets) => {
1093
1140
  const entries = Object.entries(markets);
1094
- const marketEntries = [];
1141
+ const transformedByAddress = /* @__PURE__ */ new Map();
1095
1142
  for (const [address, market] of entries) {
1096
- if (isRecord(market)) {
1097
- marketEntries.push([address, market]);
1143
+ if (!isRecord(market)) {
1144
+ transformedByAddress.set(address, market);
1145
+ continue;
1146
+ }
1147
+ try {
1148
+ const response = await getMarketsResponseTransformer({
1149
+ data: {
1150
+ items: [market],
1151
+ mints: {},
1152
+ vaults: {}
1153
+ }
1154
+ });
1155
+ transformedByAddress.set(address, response.data.items[0] ?? market);
1156
+ } catch (_) {
1157
+ transformedByAddress.set(address, market);
1098
1158
  }
1099
1159
  }
1100
- const transformedByAddress = /* @__PURE__ */ new Map();
1101
- if (marketEntries.length > 0) {
1102
- const response = await getMarketsResponseTransformer({
1103
- data: {
1104
- items: marketEntries.map(([, market]) => market),
1105
- mints: {}
1106
- }
1107
- });
1108
- const transformedItems = response.data.items;
1109
- marketEntries.forEach(([address], index) => {
1110
- transformedByAddress.set(address, transformedItems[index]);
1111
- });
1112
- }
1113
- return Object.fromEntries(entries.map(([address, market]) => [address, transformedByAddress.get(address) ?? market]));
1160
+ return Object.fromEntries(entries.map(([address]) => [address, transformedByAddress.get(address)]));
1114
1161
  };
1115
1162
  var normalizeMintsMap = (mints) => Object.fromEntries(Object.entries(mints).map(([address, mint]) => [address, mint]));
1116
1163
  var applySseResponseTransforms = async (payload) => {
@@ -9212,6 +9259,11 @@ var zMintDto = object({
9212
9259
  name: string2(),
9213
9260
  symbol: string2()
9214
9261
  });
9262
+ var zRateLimitSource = _enum(["internal", "upstream"]);
9263
+ var zRetryAfterHint = object({
9264
+ retryAfterSeconds: coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9265
+ source: zRateLimitSource
9266
+ });
9215
9267
  var zSpotPositionError404Error = object({
9216
9268
  code: _enum(["not_found"])
9217
9269
  });
@@ -9276,6 +9328,217 @@ var zPoolTicksDto = object({
9276
9328
  tickSpacing: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9277
9329
  ticks: array(zTickDto)
9278
9330
  });
9331
+ var zTokenAuditDto = object({
9332
+ freezeAuthorityDisabled: optional(union([
9333
+ boolean2(),
9334
+ _null3()
9335
+ ])),
9336
+ mintAuthorityDisabled: optional(union([
9337
+ boolean2(),
9338
+ _null3()
9339
+ ])),
9340
+ topHoldersPercentage: optional(union([
9341
+ number2(),
9342
+ _null3()
9343
+ ]))
9344
+ });
9345
+ var zTokenFirstPoolDto = object({
9346
+ createdAt: string2(),
9347
+ id: string2()
9348
+ });
9349
+ var zTokenPriceDto = object({
9350
+ mint: string2(),
9351
+ priceBlockId: optional(union([
9352
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9353
+ _null3()
9354
+ ])),
9355
+ priceChange24h: optional(union([
9356
+ number2(),
9357
+ _null3()
9358
+ ])),
9359
+ usdPrice: number2()
9360
+ });
9361
+ var zTokenPairPriceResponseDto = object({
9362
+ tokenA: zTokenPriceDto,
9363
+ tokenB: zTokenPriceDto
9364
+ });
9365
+ var zTokenStatsWindowDto = object({
9366
+ buyOrganicVolume: optional(union([
9367
+ number2(),
9368
+ _null3()
9369
+ ])),
9370
+ buyVolume: optional(union([
9371
+ number2(),
9372
+ _null3()
9373
+ ])),
9374
+ liquidityChange: optional(union([
9375
+ number2(),
9376
+ _null3()
9377
+ ])),
9378
+ numBuys: optional(union([
9379
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9380
+ _null3()
9381
+ ])),
9382
+ numNetBuyers: optional(union([
9383
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9384
+ _null3()
9385
+ ])),
9386
+ numOrganicBuyers: optional(union([
9387
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9388
+ _null3()
9389
+ ])),
9390
+ numSells: optional(union([
9391
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9392
+ _null3()
9393
+ ])),
9394
+ numTraders: optional(union([
9395
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9396
+ _null3()
9397
+ ])),
9398
+ priceChange: optional(union([
9399
+ number2(),
9400
+ _null3()
9401
+ ])),
9402
+ sellOrganicVolume: optional(union([
9403
+ number2(),
9404
+ _null3()
9405
+ ])),
9406
+ sellVolume: optional(union([
9407
+ number2(),
9408
+ _null3()
9409
+ ])),
9410
+ volumeChange: optional(union([
9411
+ number2(),
9412
+ _null3()
9413
+ ]))
9414
+ });
9415
+ var zTokenSearchItemDto = object({
9416
+ audit: optional(union([
9417
+ _null3(),
9418
+ zTokenAuditDto
9419
+ ])),
9420
+ circSupply: optional(union([
9421
+ number2(),
9422
+ _null3()
9423
+ ])),
9424
+ decimals: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9425
+ fdv: optional(union([
9426
+ number2(),
9427
+ _null3()
9428
+ ])),
9429
+ firstPool: optional(union([
9430
+ _null3(),
9431
+ zTokenFirstPoolDto
9432
+ ])),
9433
+ holderCount: optional(union([
9434
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9435
+ _null3()
9436
+ ])),
9437
+ iconUrl: optional(union([
9438
+ string2(),
9439
+ _null3()
9440
+ ])),
9441
+ isVerified: boolean2(),
9442
+ liquidity: optional(union([
9443
+ number2(),
9444
+ _null3()
9445
+ ])),
9446
+ mcap: optional(union([
9447
+ number2(),
9448
+ _null3()
9449
+ ])),
9450
+ mint: string2(),
9451
+ name: string2(),
9452
+ organicScore: optional(union([
9453
+ number2(),
9454
+ _null3()
9455
+ ])),
9456
+ organicScoreLabel: optional(union([
9457
+ string2(),
9458
+ _null3()
9459
+ ])),
9460
+ priceBlockId: optional(union([
9461
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9462
+ _null3()
9463
+ ])),
9464
+ stats1h: optional(union([
9465
+ _null3(),
9466
+ zTokenStatsWindowDto
9467
+ ])),
9468
+ stats24h: optional(union([
9469
+ _null3(),
9470
+ zTokenStatsWindowDto
9471
+ ])),
9472
+ stats5m: optional(union([
9473
+ _null3(),
9474
+ zTokenStatsWindowDto
9475
+ ])),
9476
+ stats6h: optional(union([
9477
+ _null3(),
9478
+ zTokenStatsWindowDto
9479
+ ])),
9480
+ symbol: string2(),
9481
+ tags: array(string2()),
9482
+ tokenProgram: optional(union([
9483
+ string2(),
9484
+ _null3()
9485
+ ])),
9486
+ totalSupply: optional(union([
9487
+ number2(),
9488
+ _null3()
9489
+ ])),
9490
+ updatedAt: optional(union([
9491
+ string2(),
9492
+ _null3()
9493
+ ])),
9494
+ usdPrice: optional(union([
9495
+ number2(),
9496
+ _null3()
9497
+ ]))
9498
+ });
9499
+ var zTokenSearchResponseDto = object({
9500
+ items: array(zTokenSearchItemDto)
9501
+ });
9502
+ var zTokensError400BadRequest = object({
9503
+ code: _enum(["bad_request"])
9504
+ });
9505
+ var zTokensError400Error = union([
9506
+ object({
9507
+ code: literal("bad_request")
9508
+ }).and(zTokensError400BadRequest),
9509
+ object({
9510
+ code: union([
9511
+ literal("invalid_body"),
9512
+ literal("invalid_path"),
9513
+ literal("invalid_query")
9514
+ ])
9515
+ }).and(zBadRequestErrorCodeErrorBody)
9516
+ ]);
9517
+ var zTokensError404Error = object({
9518
+ code: _enum(["not_found"])
9519
+ });
9520
+ var zTokensError429TooManyRequests = object({
9521
+ code: _enum(["too_many_requests"]),
9522
+ data: zRetryAfterHint
9523
+ });
9524
+ var zTokensError429UpstreamRateLimited = object({
9525
+ code: _enum(["upstream_rate_limited"]),
9526
+ data: zRetryAfterHint
9527
+ });
9528
+ var zTokensError429Error = union([
9529
+ object({
9530
+ code: literal("too_many_requests")
9531
+ }).and(zTokensError429TooManyRequests),
9532
+ object({
9533
+ code: literal("upstream_rate_limited")
9534
+ }).and(zTokensError429UpstreamRateLimited)
9535
+ ]);
9536
+ var zTokensError500Error = object({
9537
+ code: _enum(["internal_error"])
9538
+ });
9539
+ var zTokensError502Error = object({
9540
+ code: _enum(["upstream_unavailable"])
9541
+ });
9279
9542
  var zTradeHistoryAction = _enum([
9280
9543
  "swap",
9281
9544
  "limit_order_fill",
@@ -9714,20 +9977,16 @@ var zLendingPositionDto = object({
9714
9977
  authority: zPubkeyDto,
9715
9978
  earned: zTokenAmountWithUsd,
9716
9979
  funds: zTokenAmountWithUsd,
9980
+ market: optional(union([
9981
+ _null3(),
9982
+ zPubkeyDto
9983
+ ])),
9717
9984
  mint: zPubkeyDto,
9718
9985
  shares: zU64Dto,
9719
9986
  supplyApy: number2(),
9720
9987
  updatedAtSlot: zU64Dto,
9721
9988
  vault: zPubkeyDto
9722
9989
  });
9723
- var zLendingPositionResponse = object({
9724
- item: zLendingPositionDto,
9725
- mints: record(string2(), zMintDto)
9726
- });
9727
- var zLendingPositionsListResponse = object({
9728
- items: array(zLendingPositionDto),
9729
- mints: record(string2(), zMintDto)
9730
- });
9731
9990
  var zLimitOrderDto = object({
9732
9991
  aToB: boolean2(),
9733
9992
  address: zPubkeyDto,
@@ -9754,12 +10013,18 @@ var zLimitOrderDto = object({
9754
10013
  var zMarketDto = object({
9755
10014
  address: zPubkeyDto,
9756
10015
  addressLookupTable: zPubkeyDto,
10016
+ authority: optional(union([
10017
+ _null3(),
10018
+ zPubkeyDto
10019
+ ])),
9757
10020
  borrowLimitA: zTokenAmountWithUsd,
9758
10021
  borrowLimitB: zTokenAmountWithUsd,
9759
10022
  borrowedFundsA: zTokenAmountWithUsd,
9760
10023
  borrowedFundsB: zTokenAmountWithUsd,
9761
10024
  createdAt: preprocess((value) => value instanceof Date ? value.toISOString() : value, iso_exports.datetime()),
9762
10025
  disabled: boolean2(),
10026
+ isPermissionless: boolean2(),
10027
+ isVerified: boolean2(),
9763
10028
  liquidationFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9764
10029
  liquidationThreshold: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9765
10030
  maxLeverage: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
@@ -9770,7 +10035,9 @@ var zMarketDto = object({
9770
10035
  pool: zPoolDto,
9771
10036
  protocolFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9772
10037
  protocolFeeOnCollateral: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9773
- rebalanceProtocolFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" })
10038
+ rebalanceProtocolFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
10039
+ vaultA: zPubkeyDto,
10040
+ vaultB: zPubkeyDto
9774
10041
  });
9775
10042
  var zLimitOrderResponse = object({
9776
10043
  item: zLimitOrderDto,
@@ -9787,14 +10054,6 @@ var zLpPositionsHistoryListResponse = object({
9787
10054
  markets: record(string2(), zMarketDto),
9788
10055
  mints: record(string2(), zMintDto)
9789
10056
  });
9790
- var zMarketResponse = object({
9791
- item: zMarketDto,
9792
- mints: record(string2(), zMintDto)
9793
- });
9794
- var zMarketsListResponse = object({
9795
- items: array(zMarketDto),
9796
- mints: record(string2(), zMintDto)
9797
- });
9798
10057
  var zOrderHistoryEntryDto = object({
9799
10058
  aToB: boolean2(),
9800
10059
  authority: zPubkeyDto,
@@ -9847,19 +10106,6 @@ var zOrderHistoryNotificationResponse = object({
9847
10106
  markets: record(string2(), zMarketDto),
9848
10107
  mints: record(string2(), zMintDto)
9849
10108
  });
9850
- var zSseResponseLendingPositionPayload = object({
9851
- action: zNotificationAction,
9852
- authority: optional(union([
9853
- _null3(),
9854
- zPubkeyDto
9855
- ])),
9856
- data: zLendingPositionResponse,
9857
- entity: zNotificationEntity,
9858
- id: string2()
9859
- });
9860
- var zSseResponseLendingPosition = zSseResponseLendingPositionPayload.and(object({
9861
- entity: _enum(["lending_position"])
9862
- }));
9863
10109
  var zSseResponseOrderHistoryEntryPayload = object({
9864
10110
  action: zNotificationAction,
9865
10111
  authority: optional(union([
@@ -10027,44 +10273,6 @@ var zTunaSpotPositionDto = object({
10027
10273
  upperLimitOrderPrice: number2(),
10028
10274
  version: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" })
10029
10275
  });
10030
- var zSnapshot = object({
10031
- blockTime: preprocess((value) => value instanceof Date ? value.toISOString() : value, iso_exports.datetime()),
10032
- fusionLimitOrders: optional(union([
10033
- array(zLimitOrderDto),
10034
- _null3()
10035
- ])),
10036
- markets: optional(union([
10037
- record(string2(), zMarketDto),
10038
- _null3()
10039
- ])),
10040
- mints: optional(union([
10041
- record(string2(), zMintDto),
10042
- _null3()
10043
- ])),
10044
- oraclePrices: optional(union([
10045
- record(string2(), string2()),
10046
- _null3()
10047
- ])),
10048
- orderBooks: optional(union([
10049
- array(zOrderBookWrapper),
10050
- _null3()
10051
- ])),
10052
- slot: coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
10053
- tunaLpPositions: optional(union([
10054
- array(zTunaPositionDto),
10055
- _null3()
10056
- ])),
10057
- tunaSpotPositions: optional(union([
10058
- array(zTunaSpotPositionDto),
10059
- _null3()
10060
- ]))
10061
- });
10062
- var zSnapshotContainer = object({
10063
- action: string2(),
10064
- data: zSnapshot,
10065
- entity: string2(),
10066
- id: string2()
10067
- });
10068
10276
  var zSpotPositionResponse = object({
10069
10277
  item: zTunaSpotPositionDto,
10070
10278
  markets: record(string2(), zMarketDto),
@@ -10075,9 +10283,6 @@ var zSpotPositionsListResponse = object({
10075
10283
  markets: record(string2(), zMarketDto),
10076
10284
  mints: record(string2(), zMintDto)
10077
10285
  });
10078
- var zSseResponseSnapshot = zSnapshotContainer.and(object({
10079
- entity: _enum(["state_snapshot"])
10080
- }));
10081
10286
  var zUpdateStreamSubscriptionError404Error = object({
10082
10287
  code: _enum(["not_found"])
10083
10288
  });
@@ -10098,12 +10303,20 @@ var zValidationErrorCodeValidationDetailsErrorBody = object({
10098
10303
  });
10099
10304
  var zVaultDto = object({
10100
10305
  address: zPubkeyDto,
10306
+ authority: optional(union([
10307
+ _null3(),
10308
+ zPubkeyDto
10309
+ ])),
10101
10310
  borrowApy: number2(),
10102
10311
  borrowedFunds: zTokenAmountWithUsd,
10103
10312
  borrowedShares: zU64Dto,
10104
10313
  depositedFunds: zTokenAmountWithUsd,
10105
10314
  depositedShares: zU64Dto,
10106
10315
  interestRate: zU64Dto,
10316
+ market: optional(union([
10317
+ _null3(),
10318
+ zPubkeyDto
10319
+ ])),
10107
10320
  mint: zPubkeyDto,
10108
10321
  pythOracleFeedId: zPubkeyDto,
10109
10322
  pythOraclePriceUpdate: zPubkeyDto,
@@ -10111,6 +10324,86 @@ var zVaultDto = object({
10111
10324
  supplyLimit: zTokenAmountWithUsd,
10112
10325
  utilization: number2()
10113
10326
  });
10327
+ var zLendingPositionResponse = object({
10328
+ item: zLendingPositionDto,
10329
+ markets: record(string2(), zMarketDto),
10330
+ mints: record(string2(), zMintDto),
10331
+ vaults: record(string2(), zVaultDto)
10332
+ });
10333
+ var zLendingPositionsListResponse = object({
10334
+ items: array(zLendingPositionDto),
10335
+ markets: record(string2(), zMarketDto),
10336
+ mints: record(string2(), zMintDto),
10337
+ vaults: record(string2(), zVaultDto)
10338
+ });
10339
+ var zMarketResponse = object({
10340
+ item: zMarketDto,
10341
+ mints: record(string2(), zMintDto),
10342
+ vaults: record(string2(), zVaultDto)
10343
+ });
10344
+ var zMarketsListResponse = object({
10345
+ items: array(zMarketDto),
10346
+ mints: record(string2(), zMintDto),
10347
+ vaults: record(string2(), zVaultDto)
10348
+ });
10349
+ var zSnapshot = object({
10350
+ blockTime: preprocess((value) => value instanceof Date ? value.toISOString() : value, iso_exports.datetime()),
10351
+ fusionLimitOrders: optional(union([
10352
+ array(zLimitOrderDto),
10353
+ _null3()
10354
+ ])),
10355
+ markets: optional(union([
10356
+ record(string2(), zMarketDto),
10357
+ _null3()
10358
+ ])),
10359
+ mints: optional(union([
10360
+ record(string2(), zMintDto),
10361
+ _null3()
10362
+ ])),
10363
+ oraclePrices: optional(union([
10364
+ record(string2(), string2()),
10365
+ _null3()
10366
+ ])),
10367
+ orderBooks: optional(union([
10368
+ array(zOrderBookWrapper),
10369
+ _null3()
10370
+ ])),
10371
+ slot: coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
10372
+ tunaLpPositions: optional(union([
10373
+ array(zTunaPositionDto),
10374
+ _null3()
10375
+ ])),
10376
+ tunaSpotPositions: optional(union([
10377
+ array(zTunaSpotPositionDto),
10378
+ _null3()
10379
+ ])),
10380
+ vaults: optional(union([
10381
+ record(string2(), zVaultDto),
10382
+ _null3()
10383
+ ]))
10384
+ });
10385
+ var zSnapshotContainer = object({
10386
+ action: string2(),
10387
+ data: zSnapshot,
10388
+ entity: string2(),
10389
+ id: string2()
10390
+ });
10391
+ var zSseResponseLendingPositionPayload = object({
10392
+ action: zNotificationAction,
10393
+ authority: optional(union([
10394
+ _null3(),
10395
+ zPubkeyDto
10396
+ ])),
10397
+ data: zLendingPositionResponse,
10398
+ entity: zNotificationEntity,
10399
+ id: string2()
10400
+ });
10401
+ var zSseResponseLendingPosition = zSseResponseLendingPositionPayload.and(object({
10402
+ entity: _enum(["lending_position"])
10403
+ }));
10404
+ var zSseResponseSnapshot = zSnapshotContainer.and(object({
10405
+ entity: _enum(["state_snapshot"])
10406
+ }));
10114
10407
  var zVaultError400BadRequest = object({
10115
10408
  code: _enum(["bad_request"])
10116
10409
  });
@@ -10597,6 +10890,27 @@ var zUpdateStreamSubscriptionData = object({
10597
10890
  var zUpdateStreamSubscriptionResponse = object({
10598
10891
  data: zHttpStatusData
10599
10892
  });
10893
+ var zGetPairPriceData = object({
10894
+ body: optional(never()),
10895
+ path: optional(never()),
10896
+ query: object({
10897
+ tokenA: zPubkeyDto,
10898
+ tokenB: zPubkeyDto
10899
+ })
10900
+ });
10901
+ var zGetPairPriceResponse = object({
10902
+ data: zTokenPairPriceResponseDto
10903
+ });
10904
+ var zSearchTokensData = object({
10905
+ body: optional(never()),
10906
+ path: optional(never()),
10907
+ query: object({
10908
+ q: string2()
10909
+ })
10910
+ });
10911
+ var zSearchTokensResponse = object({
10912
+ data: zTokenSearchResponseDto
10913
+ });
10600
10914
  var zGetLendingPositionsData = object({
10601
10915
  body: optional(never()),
10602
10916
  path: object({
@@ -11326,6 +11640,32 @@ var _TunaBackendSdk = class _TunaBackendSdk extends HeyApiClient {
11326
11640
  }
11327
11641
  });
11328
11642
  }
11643
+ /**
11644
+ * Get USD prices for token_a and token_b
11645
+ */
11646
+ getPairPrice(parameters, options) {
11647
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "tokenA" }, { in: "query", key: "tokenB" }] }]);
11648
+ return (options?.client ?? this.client).get({
11649
+ requestValidator: async (data) => await zGetPairPriceData.parseAsync(data),
11650
+ responseValidator: async (data) => await zGetPairPriceResponse.parseAsync(data),
11651
+ url: "/v1/tokens/price",
11652
+ ...options,
11653
+ ...params
11654
+ });
11655
+ }
11656
+ /**
11657
+ * Search tokens by mint or name/symbol
11658
+ */
11659
+ searchTokens(parameters, options) {
11660
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "q" }] }]);
11661
+ return (options?.client ?? this.client).get({
11662
+ requestValidator: async (data) => await zSearchTokensData.parseAsync(data),
11663
+ responseValidator: async (data) => await zSearchTokensResponse.parseAsync(data),
11664
+ url: "/v1/tokens/search",
11665
+ ...options,
11666
+ ...params
11667
+ });
11668
+ }
11329
11669
  /**
11330
11670
  * Request all user lending positions
11331
11671
  */
@@ -11665,6 +12005,7 @@ async function unwrap(promise2) {
11665
12005
  OrderHistoryUiDirection,
11666
12006
  PoolProvider,
11667
12007
  PoolSubscriptionTopic,
12008
+ RateLimitSource,
11668
12009
  StakingPositionActionType,
11669
12010
  TradeHistoryAction,
11670
12011
  TradeHistoryUiDirection,
@@ -11737,6 +12078,8 @@ async function unwrap(promise2) {
11737
12078
  zGetOraclePricesResponse,
11738
12079
  zGetOrderHistoryData,
11739
12080
  zGetOrderHistoryResponse,
12081
+ zGetPairPriceData,
12082
+ zGetPairPriceResponse,
11740
12083
  zGetPoolCandlesData,
11741
12084
  zGetPoolCandlesResponse,
11742
12085
  zGetPoolData,
@@ -11851,6 +12194,10 @@ async function unwrap(promise2) {
11851
12194
  zPoolsError404Error,
11852
12195
  zPoolsError500Error,
11853
12196
  zPubkeyDto,
12197
+ zRateLimitSource,
12198
+ zRetryAfterHint,
12199
+ zSearchTokensData,
12200
+ zSearchTokensResponse,
11854
12201
  zSnapshot,
11855
12202
  zSnapshotContainer,
11856
12203
  zSpotPositionError404Error,
@@ -11889,6 +12236,21 @@ async function unwrap(promise2) {
11889
12236
  zSwapQuoteByOutputDto,
11890
12237
  zTickDto,
11891
12238
  zTokenAmountWithUsd,
12239
+ zTokenAuditDto,
12240
+ zTokenFirstPoolDto,
12241
+ zTokenPairPriceResponseDto,
12242
+ zTokenPriceDto,
12243
+ zTokenSearchItemDto,
12244
+ zTokenSearchResponseDto,
12245
+ zTokenStatsWindowDto,
12246
+ zTokensError400BadRequest,
12247
+ zTokensError400Error,
12248
+ zTokensError404Error,
12249
+ zTokensError429Error,
12250
+ zTokensError429TooManyRequests,
12251
+ zTokensError429UpstreamRateLimited,
12252
+ zTokensError500Error,
12253
+ zTokensError502Error,
11892
12254
  zTradableAmountDto,
11893
12255
  zTradeHistoryAction,
11894
12256
  zTradeHistoryEntryDto,