@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.js CHANGED
@@ -132,8 +132,21 @@ var marketDtoSchemaResponseTransformer = (data) => {
132
132
  data.pool = poolDtoSchemaResponseTransformer(data.pool);
133
133
  return data;
134
134
  };
135
+ var vaultDtoSchemaResponseTransformer = (data) => {
136
+ data.borrowedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.borrowedFunds);
137
+ data.borrowedShares = u64DtoSchemaResponseTransformer(data.borrowedShares);
138
+ data.depositedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.depositedFunds);
139
+ data.depositedShares = u64DtoSchemaResponseTransformer(data.depositedShares);
140
+ data.interestRate = u64DtoSchemaResponseTransformer(data.interestRate);
141
+ data.supplyLimit = tokenAmountWithUsdSchemaResponseTransformer(data.supplyLimit);
142
+ return data;
143
+ };
135
144
  var marketsListResponseSchemaResponseTransformer = (data) => {
136
145
  data.items = data.items.map((item) => marketDtoSchemaResponseTransformer(item));
146
+ const _additionalPropertiesTarget3 = data.vaults;
147
+ Object.keys(_additionalPropertiesTarget3).forEach((key) => {
148
+ _additionalPropertiesTarget3[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget3[key]);
149
+ });
137
150
  return data;
138
151
  };
139
152
  var getMarketsResponseTransformer = async (data) => {
@@ -142,6 +155,10 @@ var getMarketsResponseTransformer = async (data) => {
142
155
  };
143
156
  var marketResponseSchemaResponseTransformer = (data) => {
144
157
  data.item = marketDtoSchemaResponseTransformer(data.item);
158
+ const _additionalPropertiesTarget5 = data.vaults;
159
+ Object.keys(_additionalPropertiesTarget5).forEach((key) => {
160
+ _additionalPropertiesTarget5[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget5[key]);
161
+ });
145
162
  return data;
146
163
  };
147
164
  var getMarketResponseTransformer = async (data) => {
@@ -351,6 +368,14 @@ var lendingPositionDtoSchemaResponseTransformer = (data) => {
351
368
  };
352
369
  var lendingPositionsListResponseSchemaResponseTransformer = (data) => {
353
370
  data.items = data.items.map((item) => lendingPositionDtoSchemaResponseTransformer(item));
371
+ const _additionalPropertiesTarget6 = data.markets;
372
+ Object.keys(_additionalPropertiesTarget6).forEach((key) => {
373
+ _additionalPropertiesTarget6[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget6[key]);
374
+ });
375
+ const _additionalPropertiesTarget8 = data.vaults;
376
+ Object.keys(_additionalPropertiesTarget8).forEach((key) => {
377
+ _additionalPropertiesTarget8[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget8[key]);
378
+ });
354
379
  return data;
355
380
  };
356
381
  var getLendingPositionsResponseTransformer = async (data) => {
@@ -359,6 +384,14 @@ var getLendingPositionsResponseTransformer = async (data) => {
359
384
  };
360
385
  var lendingPositionResponseSchemaResponseTransformer = (data) => {
361
386
  data.item = lendingPositionDtoSchemaResponseTransformer(data.item);
387
+ const _additionalPropertiesTarget9 = data.markets;
388
+ Object.keys(_additionalPropertiesTarget9).forEach((key) => {
389
+ _additionalPropertiesTarget9[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget9[key]);
390
+ });
391
+ const _additionalPropertiesTarget11 = data.vaults;
392
+ Object.keys(_additionalPropertiesTarget11).forEach((key) => {
393
+ _additionalPropertiesTarget11[key] = vaultDtoSchemaResponseTransformer(_additionalPropertiesTarget11[key]);
394
+ });
362
395
  return data;
363
396
  };
364
397
  var getLendingPositionResponseTransformer = async (data) => {
@@ -376,9 +409,9 @@ var limitOrderDtoSchemaResponseTransformer = (data) => {
376
409
  };
377
410
  var limitOrdersListResponseSchemaResponseTransformer = (data) => {
378
411
  data.items = data.items.map((item) => limitOrderDtoSchemaResponseTransformer(item));
379
- const _additionalPropertiesTarget6 = data.markets;
380
- Object.keys(_additionalPropertiesTarget6).forEach((key) => {
381
- _additionalPropertiesTarget6[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget6[key]);
412
+ const _additionalPropertiesTarget12 = data.markets;
413
+ Object.keys(_additionalPropertiesTarget12).forEach((key) => {
414
+ _additionalPropertiesTarget12[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget12[key]);
382
415
  });
383
416
  return data;
384
417
  };
@@ -388,9 +421,9 @@ var getLimitOrdersResponseTransformer = async (data) => {
388
421
  };
389
422
  var limitOrderResponseSchemaResponseTransformer = (data) => {
390
423
  data.item = limitOrderDtoSchemaResponseTransformer(data.item);
391
- const _additionalPropertiesTarget8 = data.markets;
392
- Object.keys(_additionalPropertiesTarget8).forEach((key) => {
393
- _additionalPropertiesTarget8[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget8[key]);
424
+ const _additionalPropertiesTarget14 = data.markets;
425
+ Object.keys(_additionalPropertiesTarget14).forEach((key) => {
426
+ _additionalPropertiesTarget14[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget14[key]);
394
427
  });
395
428
  return data;
396
429
  };
@@ -408,9 +441,9 @@ var tunaLpPositionDtoSchemaResponseTransformer = (data) => {
408
441
  };
409
442
  var lpPositionsHistoryListResponseSchemaResponseTransformer = (data) => {
410
443
  data.items = data.items.map((item) => tunaLpPositionDtoSchemaResponseTransformer(item));
411
- const _additionalPropertiesTarget10 = data.markets;
412
- Object.keys(_additionalPropertiesTarget10).forEach((key) => {
413
- _additionalPropertiesTarget10[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget10[key]);
444
+ const _additionalPropertiesTarget16 = data.markets;
445
+ Object.keys(_additionalPropertiesTarget16).forEach((key) => {
446
+ _additionalPropertiesTarget16[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget16[key]);
414
447
  });
415
448
  return data;
416
449
  };
@@ -441,9 +474,9 @@ var orderHistoryEntryDtoSchemaResponseTransformer = (data) => {
441
474
  };
442
475
  var orderHistoryListResponseSchemaResponseTransformer = (data) => {
443
476
  data.items = data.items.map((item) => orderHistoryEntryDtoSchemaResponseTransformer(item));
444
- const _additionalPropertiesTarget12 = data.markets;
445
- Object.keys(_additionalPropertiesTarget12).forEach((key) => {
446
- _additionalPropertiesTarget12[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget12[key]);
477
+ const _additionalPropertiesTarget18 = data.markets;
478
+ Object.keys(_additionalPropertiesTarget18).forEach((key) => {
479
+ _additionalPropertiesTarget18[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget18[key]);
447
480
  });
448
481
  return data;
449
482
  };
@@ -464,9 +497,9 @@ var tunaSpotPositionDtoSchemaResponseTransformer = (data) => {
464
497
  };
465
498
  var spotPositionsListResponseSchemaResponseTransformer = (data) => {
466
499
  data.items = data.items.map((item) => tunaSpotPositionDtoSchemaResponseTransformer(item));
467
- const _additionalPropertiesTarget14 = data.markets;
468
- Object.keys(_additionalPropertiesTarget14).forEach((key) => {
469
- _additionalPropertiesTarget14[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget14[key]);
500
+ const _additionalPropertiesTarget20 = data.markets;
501
+ Object.keys(_additionalPropertiesTarget20).forEach((key) => {
502
+ _additionalPropertiesTarget20[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget20[key]);
470
503
  });
471
504
  return data;
472
505
  };
@@ -476,9 +509,9 @@ var getSpotPositionsResponseTransformer = async (data) => {
476
509
  };
477
510
  var spotPositionResponseSchemaResponseTransformer = (data) => {
478
511
  data.item = tunaSpotPositionDtoSchemaResponseTransformer(data.item);
479
- const _additionalPropertiesTarget16 = data.markets;
480
- Object.keys(_additionalPropertiesTarget16).forEach((key) => {
481
- _additionalPropertiesTarget16[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget16[key]);
512
+ const _additionalPropertiesTarget22 = data.markets;
513
+ Object.keys(_additionalPropertiesTarget22).forEach((key) => {
514
+ _additionalPropertiesTarget22[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget22[key]);
482
515
  });
483
516
  return data;
484
517
  };
@@ -540,9 +573,9 @@ var tradeHistoryEntryDtoSchemaResponseTransformer = (data) => {
540
573
  };
541
574
  var tradeHistoryListResponseSchemaResponseTransformer = (data) => {
542
575
  data.items = data.items.map((item) => tradeHistoryEntryDtoSchemaResponseTransformer(item));
543
- const _additionalPropertiesTarget18 = data.markets;
544
- Object.keys(_additionalPropertiesTarget18).forEach((key) => {
545
- _additionalPropertiesTarget18[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget18[key]);
576
+ const _additionalPropertiesTarget24 = data.markets;
577
+ Object.keys(_additionalPropertiesTarget24).forEach((key) => {
578
+ _additionalPropertiesTarget24[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget24[key]);
546
579
  });
547
580
  return data;
548
581
  };
@@ -584,9 +617,9 @@ var tunaPositionDtoSchemaResponseTransformer = (data) => {
584
617
  };
585
618
  var lpPositionsListResponseSchemaResponseTransformer = (data) => {
586
619
  data.items = data.items.map((item) => tunaPositionDtoSchemaResponseTransformer(item));
587
- const _additionalPropertiesTarget20 = data.markets;
588
- Object.keys(_additionalPropertiesTarget20).forEach((key) => {
589
- _additionalPropertiesTarget20[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget20[key]);
620
+ const _additionalPropertiesTarget26 = data.markets;
621
+ Object.keys(_additionalPropertiesTarget26).forEach((key) => {
622
+ _additionalPropertiesTarget26[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget26[key]);
590
623
  });
591
624
  return data;
592
625
  };
@@ -596,9 +629,9 @@ var getTunaPositionsResponseTransformer = async (data) => {
596
629
  };
597
630
  var lpPositionResponseSchemaResponseTransformer = (data) => {
598
631
  data.item = tunaPositionDtoSchemaResponseTransformer(data.item);
599
- const _additionalPropertiesTarget22 = data.markets;
600
- Object.keys(_additionalPropertiesTarget22).forEach((key) => {
601
- _additionalPropertiesTarget22[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget22[key]);
632
+ const _additionalPropertiesTarget28 = data.markets;
633
+ Object.keys(_additionalPropertiesTarget28).forEach((key) => {
634
+ _additionalPropertiesTarget28[key] = marketDtoSchemaResponseTransformer(_additionalPropertiesTarget28[key]);
602
635
  });
603
636
  return data;
604
637
  };
@@ -608,15 +641,6 @@ var getTunaPositionResponseTransformer = async (data) => {
608
641
  }
609
642
  return data;
610
643
  };
611
- var vaultDtoSchemaResponseTransformer = (data) => {
612
- data.borrowedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.borrowedFunds);
613
- data.borrowedShares = u64DtoSchemaResponseTransformer(data.borrowedShares);
614
- data.depositedFunds = tokenAmountWithUsdSchemaResponseTransformer(data.depositedFunds);
615
- data.depositedShares = u64DtoSchemaResponseTransformer(data.depositedShares);
616
- data.interestRate = u64DtoSchemaResponseTransformer(data.interestRate);
617
- data.supplyLimit = tokenAmountWithUsdSchemaResponseTransformer(data.supplyLimit);
618
- return data;
619
- };
620
644
  var vaultsListResponseSchemaResponseTransformer = (data) => {
621
645
  data.items = data.items.map((item) => vaultDtoSchemaResponseTransformer(item));
622
646
  return data;
@@ -697,6 +721,7 @@ var PoolSubscriptionTopic = {
697
721
  ORDER_BOOK: "order_book",
698
722
  POOL_PRICES: "pool_prices"
699
723
  };
724
+ var RateLimitSource = { INTERNAL: "internal", UPSTREAM: "upstream" };
700
725
  var StakingPositionActionType = {
701
726
  STAKE: "stake",
702
727
  UNSTAKE: "unstake",
@@ -786,26 +811,26 @@ var toBigInt = (value) => {
786
811
  };
787
812
  var transformMarketsMap = async (markets) => {
788
813
  const entries = Object.entries(markets);
789
- const marketEntries = [];
814
+ const transformedByAddress = /* @__PURE__ */ new Map();
790
815
  for (const [address, market] of entries) {
791
- if (isRecord(market)) {
792
- marketEntries.push([address, market]);
816
+ if (!isRecord(market)) {
817
+ transformedByAddress.set(address, market);
818
+ continue;
819
+ }
820
+ try {
821
+ const response = await getMarketsResponseTransformer({
822
+ data: {
823
+ items: [market],
824
+ mints: {},
825
+ vaults: {}
826
+ }
827
+ });
828
+ transformedByAddress.set(address, response.data.items[0] ?? market);
829
+ } catch (_) {
830
+ transformedByAddress.set(address, market);
793
831
  }
794
832
  }
795
- const transformedByAddress = /* @__PURE__ */ new Map();
796
- if (marketEntries.length > 0) {
797
- const response = await getMarketsResponseTransformer({
798
- data: {
799
- items: marketEntries.map(([, market]) => market),
800
- mints: {}
801
- }
802
- });
803
- const transformedItems = response.data.items;
804
- marketEntries.forEach(([address], index) => {
805
- transformedByAddress.set(address, transformedItems[index]);
806
- });
807
- }
808
- return Object.fromEntries(entries.map(([address, market]) => [address, transformedByAddress.get(address) ?? market]));
833
+ return Object.fromEntries(entries.map(([address]) => [address, transformedByAddress.get(address)]));
809
834
  };
810
835
  var normalizeMintsMap = (mints) => Object.fromEntries(Object.entries(mints).map(([address, mint]) => [address, mint]));
811
836
  var applySseResponseTransforms = async (payload) => {
@@ -8907,6 +8932,11 @@ var zMintDto = object({
8907
8932
  name: string2(),
8908
8933
  symbol: string2()
8909
8934
  });
8935
+ var zRateLimitSource = _enum(["internal", "upstream"]);
8936
+ var zRetryAfterHint = object({
8937
+ retryAfterSeconds: coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
8938
+ source: zRateLimitSource
8939
+ });
8910
8940
  var zSpotPositionError404Error = object({
8911
8941
  code: _enum(["not_found"])
8912
8942
  });
@@ -8971,6 +9001,217 @@ var zPoolTicksDto = object({
8971
9001
  tickSpacing: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
8972
9002
  ticks: array(zTickDto)
8973
9003
  });
9004
+ var zTokenAuditDto = object({
9005
+ freezeAuthorityDisabled: optional(union([
9006
+ boolean2(),
9007
+ _null3()
9008
+ ])),
9009
+ mintAuthorityDisabled: optional(union([
9010
+ boolean2(),
9011
+ _null3()
9012
+ ])),
9013
+ topHoldersPercentage: optional(union([
9014
+ number2(),
9015
+ _null3()
9016
+ ]))
9017
+ });
9018
+ var zTokenFirstPoolDto = object({
9019
+ createdAt: string2(),
9020
+ id: string2()
9021
+ });
9022
+ var zTokenPriceDto = object({
9023
+ mint: string2(),
9024
+ priceBlockId: optional(union([
9025
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9026
+ _null3()
9027
+ ])),
9028
+ priceChange24h: optional(union([
9029
+ number2(),
9030
+ _null3()
9031
+ ])),
9032
+ usdPrice: number2()
9033
+ });
9034
+ var zTokenPairPriceResponseDto = object({
9035
+ tokenA: zTokenPriceDto,
9036
+ tokenB: zTokenPriceDto
9037
+ });
9038
+ var zTokenStatsWindowDto = object({
9039
+ buyOrganicVolume: optional(union([
9040
+ number2(),
9041
+ _null3()
9042
+ ])),
9043
+ buyVolume: optional(union([
9044
+ number2(),
9045
+ _null3()
9046
+ ])),
9047
+ liquidityChange: optional(union([
9048
+ number2(),
9049
+ _null3()
9050
+ ])),
9051
+ numBuys: optional(union([
9052
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9053
+ _null3()
9054
+ ])),
9055
+ numNetBuyers: optional(union([
9056
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9057
+ _null3()
9058
+ ])),
9059
+ numOrganicBuyers: optional(union([
9060
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9061
+ _null3()
9062
+ ])),
9063
+ numSells: optional(union([
9064
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9065
+ _null3()
9066
+ ])),
9067
+ numTraders: optional(union([
9068
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9069
+ _null3()
9070
+ ])),
9071
+ priceChange: optional(union([
9072
+ number2(),
9073
+ _null3()
9074
+ ])),
9075
+ sellOrganicVolume: optional(union([
9076
+ number2(),
9077
+ _null3()
9078
+ ])),
9079
+ sellVolume: optional(union([
9080
+ number2(),
9081
+ _null3()
9082
+ ])),
9083
+ volumeChange: optional(union([
9084
+ number2(),
9085
+ _null3()
9086
+ ]))
9087
+ });
9088
+ var zTokenSearchItemDto = object({
9089
+ audit: optional(union([
9090
+ _null3(),
9091
+ zTokenAuditDto
9092
+ ])),
9093
+ circSupply: optional(union([
9094
+ number2(),
9095
+ _null3()
9096
+ ])),
9097
+ decimals: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9098
+ fdv: optional(union([
9099
+ number2(),
9100
+ _null3()
9101
+ ])),
9102
+ firstPool: optional(union([
9103
+ _null3(),
9104
+ zTokenFirstPoolDto
9105
+ ])),
9106
+ holderCount: optional(union([
9107
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9108
+ _null3()
9109
+ ])),
9110
+ iconUrl: optional(union([
9111
+ string2(),
9112
+ _null3()
9113
+ ])),
9114
+ isVerified: boolean2(),
9115
+ liquidity: optional(union([
9116
+ number2(),
9117
+ _null3()
9118
+ ])),
9119
+ mcap: optional(union([
9120
+ number2(),
9121
+ _null3()
9122
+ ])),
9123
+ mint: string2(),
9124
+ name: string2(),
9125
+ organicScore: optional(union([
9126
+ number2(),
9127
+ _null3()
9128
+ ])),
9129
+ organicScoreLabel: optional(union([
9130
+ string2(),
9131
+ _null3()
9132
+ ])),
9133
+ priceBlockId: optional(union([
9134
+ coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9135
+ _null3()
9136
+ ])),
9137
+ stats1h: optional(union([
9138
+ _null3(),
9139
+ zTokenStatsWindowDto
9140
+ ])),
9141
+ stats24h: optional(union([
9142
+ _null3(),
9143
+ zTokenStatsWindowDto
9144
+ ])),
9145
+ stats5m: optional(union([
9146
+ _null3(),
9147
+ zTokenStatsWindowDto
9148
+ ])),
9149
+ stats6h: optional(union([
9150
+ _null3(),
9151
+ zTokenStatsWindowDto
9152
+ ])),
9153
+ symbol: string2(),
9154
+ tags: array(string2()),
9155
+ tokenProgram: optional(union([
9156
+ string2(),
9157
+ _null3()
9158
+ ])),
9159
+ totalSupply: optional(union([
9160
+ number2(),
9161
+ _null3()
9162
+ ])),
9163
+ updatedAt: optional(union([
9164
+ string2(),
9165
+ _null3()
9166
+ ])),
9167
+ usdPrice: optional(union([
9168
+ number2(),
9169
+ _null3()
9170
+ ]))
9171
+ });
9172
+ var zTokenSearchResponseDto = object({
9173
+ items: array(zTokenSearchItemDto)
9174
+ });
9175
+ var zTokensError400BadRequest = object({
9176
+ code: _enum(["bad_request"])
9177
+ });
9178
+ var zTokensError400Error = union([
9179
+ object({
9180
+ code: literal("bad_request")
9181
+ }).and(zTokensError400BadRequest),
9182
+ object({
9183
+ code: union([
9184
+ literal("invalid_body"),
9185
+ literal("invalid_path"),
9186
+ literal("invalid_query")
9187
+ ])
9188
+ }).and(zBadRequestErrorCodeErrorBody)
9189
+ ]);
9190
+ var zTokensError404Error = object({
9191
+ code: _enum(["not_found"])
9192
+ });
9193
+ var zTokensError429TooManyRequests = object({
9194
+ code: _enum(["too_many_requests"]),
9195
+ data: zRetryAfterHint
9196
+ });
9197
+ var zTokensError429UpstreamRateLimited = object({
9198
+ code: _enum(["upstream_rate_limited"]),
9199
+ data: zRetryAfterHint
9200
+ });
9201
+ var zTokensError429Error = union([
9202
+ object({
9203
+ code: literal("too_many_requests")
9204
+ }).and(zTokensError429TooManyRequests),
9205
+ object({
9206
+ code: literal("upstream_rate_limited")
9207
+ }).and(zTokensError429UpstreamRateLimited)
9208
+ ]);
9209
+ var zTokensError500Error = object({
9210
+ code: _enum(["internal_error"])
9211
+ });
9212
+ var zTokensError502Error = object({
9213
+ code: _enum(["upstream_unavailable"])
9214
+ });
8974
9215
  var zTradeHistoryAction = _enum([
8975
9216
  "swap",
8976
9217
  "limit_order_fill",
@@ -9409,20 +9650,16 @@ var zLendingPositionDto = object({
9409
9650
  authority: zPubkeyDto,
9410
9651
  earned: zTokenAmountWithUsd,
9411
9652
  funds: zTokenAmountWithUsd,
9653
+ market: optional(union([
9654
+ _null3(),
9655
+ zPubkeyDto
9656
+ ])),
9412
9657
  mint: zPubkeyDto,
9413
9658
  shares: zU64Dto,
9414
9659
  supplyApy: number2(),
9415
9660
  updatedAtSlot: zU64Dto,
9416
9661
  vault: zPubkeyDto
9417
9662
  });
9418
- var zLendingPositionResponse = object({
9419
- item: zLendingPositionDto,
9420
- mints: record(string2(), zMintDto)
9421
- });
9422
- var zLendingPositionsListResponse = object({
9423
- items: array(zLendingPositionDto),
9424
- mints: record(string2(), zMintDto)
9425
- });
9426
9663
  var zLimitOrderDto = object({
9427
9664
  aToB: boolean2(),
9428
9665
  address: zPubkeyDto,
@@ -9449,12 +9686,18 @@ var zLimitOrderDto = object({
9449
9686
  var zMarketDto = object({
9450
9687
  address: zPubkeyDto,
9451
9688
  addressLookupTable: zPubkeyDto,
9689
+ authority: optional(union([
9690
+ _null3(),
9691
+ zPubkeyDto
9692
+ ])),
9452
9693
  borrowLimitA: zTokenAmountWithUsd,
9453
9694
  borrowLimitB: zTokenAmountWithUsd,
9454
9695
  borrowedFundsA: zTokenAmountWithUsd,
9455
9696
  borrowedFundsB: zTokenAmountWithUsd,
9456
9697
  createdAt: preprocess((value) => value instanceof Date ? value.toISOString() : value, iso_exports.datetime()),
9457
9698
  disabled: boolean2(),
9699
+ isPermissionless: boolean2(),
9700
+ isVerified: boolean2(),
9458
9701
  liquidationFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9459
9702
  liquidationThreshold: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9460
9703
  maxLeverage: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
@@ -9465,7 +9708,9 @@ var zMarketDto = object({
9465
9708
  pool: zPoolDto,
9466
9709
  protocolFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9467
9710
  protocolFeeOnCollateral: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9468
- rebalanceProtocolFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" })
9711
+ rebalanceProtocolFee: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9712
+ vaultA: zPubkeyDto,
9713
+ vaultB: zPubkeyDto
9469
9714
  });
9470
9715
  var zLimitOrderResponse = object({
9471
9716
  item: zLimitOrderDto,
@@ -9482,14 +9727,6 @@ var zLpPositionsHistoryListResponse = object({
9482
9727
  markets: record(string2(), zMarketDto),
9483
9728
  mints: record(string2(), zMintDto)
9484
9729
  });
9485
- var zMarketResponse = object({
9486
- item: zMarketDto,
9487
- mints: record(string2(), zMintDto)
9488
- });
9489
- var zMarketsListResponse = object({
9490
- items: array(zMarketDto),
9491
- mints: record(string2(), zMintDto)
9492
- });
9493
9730
  var zOrderHistoryEntryDto = object({
9494
9731
  aToB: boolean2(),
9495
9732
  authority: zPubkeyDto,
@@ -9542,19 +9779,6 @@ var zOrderHistoryNotificationResponse = object({
9542
9779
  markets: record(string2(), zMarketDto),
9543
9780
  mints: record(string2(), zMintDto)
9544
9781
  });
9545
- var zSseResponseLendingPositionPayload = object({
9546
- action: zNotificationAction,
9547
- authority: optional(union([
9548
- _null3(),
9549
- zPubkeyDto
9550
- ])),
9551
- data: zLendingPositionResponse,
9552
- entity: zNotificationEntity,
9553
- id: string2()
9554
- });
9555
- var zSseResponseLendingPosition = zSseResponseLendingPositionPayload.and(object({
9556
- entity: _enum(["lending_position"])
9557
- }));
9558
9782
  var zSseResponseOrderHistoryEntryPayload = object({
9559
9783
  action: zNotificationAction,
9560
9784
  authority: optional(union([
@@ -9722,44 +9946,6 @@ var zTunaSpotPositionDto = object({
9722
9946
  upperLimitOrderPrice: number2(),
9723
9947
  version: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" })
9724
9948
  });
9725
- var zSnapshot = object({
9726
- blockTime: preprocess((value) => value instanceof Date ? value.toISOString() : value, iso_exports.datetime()),
9727
- fusionLimitOrders: optional(union([
9728
- array(zLimitOrderDto),
9729
- _null3()
9730
- ])),
9731
- markets: optional(union([
9732
- record(string2(), zMarketDto),
9733
- _null3()
9734
- ])),
9735
- mints: optional(union([
9736
- record(string2(), zMintDto),
9737
- _null3()
9738
- ])),
9739
- oraclePrices: optional(union([
9740
- record(string2(), string2()),
9741
- _null3()
9742
- ])),
9743
- orderBooks: optional(union([
9744
- array(zOrderBookWrapper),
9745
- _null3()
9746
- ])),
9747
- slot: coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
9748
- tunaLpPositions: optional(union([
9749
- array(zTunaPositionDto),
9750
- _null3()
9751
- ])),
9752
- tunaSpotPositions: optional(union([
9753
- array(zTunaSpotPositionDto),
9754
- _null3()
9755
- ]))
9756
- });
9757
- var zSnapshotContainer = object({
9758
- action: string2(),
9759
- data: zSnapshot,
9760
- entity: string2(),
9761
- id: string2()
9762
- });
9763
9949
  var zSpotPositionResponse = object({
9764
9950
  item: zTunaSpotPositionDto,
9765
9951
  markets: record(string2(), zMarketDto),
@@ -9770,9 +9956,6 @@ var zSpotPositionsListResponse = object({
9770
9956
  markets: record(string2(), zMarketDto),
9771
9957
  mints: record(string2(), zMintDto)
9772
9958
  });
9773
- var zSseResponseSnapshot = zSnapshotContainer.and(object({
9774
- entity: _enum(["state_snapshot"])
9775
- }));
9776
9959
  var zUpdateStreamSubscriptionError404Error = object({
9777
9960
  code: _enum(["not_found"])
9778
9961
  });
@@ -9793,12 +9976,20 @@ var zValidationErrorCodeValidationDetailsErrorBody = object({
9793
9976
  });
9794
9977
  var zVaultDto = object({
9795
9978
  address: zPubkeyDto,
9979
+ authority: optional(union([
9980
+ _null3(),
9981
+ zPubkeyDto
9982
+ ])),
9796
9983
  borrowApy: number2(),
9797
9984
  borrowedFunds: zTokenAmountWithUsd,
9798
9985
  borrowedShares: zU64Dto,
9799
9986
  depositedFunds: zTokenAmountWithUsd,
9800
9987
  depositedShares: zU64Dto,
9801
9988
  interestRate: zU64Dto,
9989
+ market: optional(union([
9990
+ _null3(),
9991
+ zPubkeyDto
9992
+ ])),
9802
9993
  mint: zPubkeyDto,
9803
9994
  pythOracleFeedId: zPubkeyDto,
9804
9995
  pythOraclePriceUpdate: zPubkeyDto,
@@ -9806,6 +9997,86 @@ var zVaultDto = object({
9806
9997
  supplyLimit: zTokenAmountWithUsd,
9807
9998
  utilization: number2()
9808
9999
  });
10000
+ var zLendingPositionResponse = object({
10001
+ item: zLendingPositionDto,
10002
+ markets: record(string2(), zMarketDto),
10003
+ mints: record(string2(), zMintDto),
10004
+ vaults: record(string2(), zVaultDto)
10005
+ });
10006
+ var zLendingPositionsListResponse = object({
10007
+ items: array(zLendingPositionDto),
10008
+ markets: record(string2(), zMarketDto),
10009
+ mints: record(string2(), zMintDto),
10010
+ vaults: record(string2(), zVaultDto)
10011
+ });
10012
+ var zMarketResponse = object({
10013
+ item: zMarketDto,
10014
+ mints: record(string2(), zMintDto),
10015
+ vaults: record(string2(), zVaultDto)
10016
+ });
10017
+ var zMarketsListResponse = object({
10018
+ items: array(zMarketDto),
10019
+ mints: record(string2(), zMintDto),
10020
+ vaults: record(string2(), zVaultDto)
10021
+ });
10022
+ var zSnapshot = object({
10023
+ blockTime: preprocess((value) => value instanceof Date ? value.toISOString() : value, iso_exports.datetime()),
10024
+ fusionLimitOrders: optional(union([
10025
+ array(zLimitOrderDto),
10026
+ _null3()
10027
+ ])),
10028
+ markets: optional(union([
10029
+ record(string2(), zMarketDto),
10030
+ _null3()
10031
+ ])),
10032
+ mints: optional(union([
10033
+ record(string2(), zMintDto),
10034
+ _null3()
10035
+ ])),
10036
+ oraclePrices: optional(union([
10037
+ record(string2(), string2()),
10038
+ _null3()
10039
+ ])),
10040
+ orderBooks: optional(union([
10041
+ array(zOrderBookWrapper),
10042
+ _null3()
10043
+ ])),
10044
+ slot: coerce_exports.bigint().gte(BigInt(0)).max(BigInt("9223372036854775807"), { error: "Invalid value: Expected int64 to be <= 9223372036854775807" }),
10045
+ tunaLpPositions: optional(union([
10046
+ array(zTunaPositionDto),
10047
+ _null3()
10048
+ ])),
10049
+ tunaSpotPositions: optional(union([
10050
+ array(zTunaSpotPositionDto),
10051
+ _null3()
10052
+ ])),
10053
+ vaults: optional(union([
10054
+ record(string2(), zVaultDto),
10055
+ _null3()
10056
+ ]))
10057
+ });
10058
+ var zSnapshotContainer = object({
10059
+ action: string2(),
10060
+ data: zSnapshot,
10061
+ entity: string2(),
10062
+ id: string2()
10063
+ });
10064
+ var zSseResponseLendingPositionPayload = object({
10065
+ action: zNotificationAction,
10066
+ authority: optional(union([
10067
+ _null3(),
10068
+ zPubkeyDto
10069
+ ])),
10070
+ data: zLendingPositionResponse,
10071
+ entity: zNotificationEntity,
10072
+ id: string2()
10073
+ });
10074
+ var zSseResponseLendingPosition = zSseResponseLendingPositionPayload.and(object({
10075
+ entity: _enum(["lending_position"])
10076
+ }));
10077
+ var zSseResponseSnapshot = zSnapshotContainer.and(object({
10078
+ entity: _enum(["state_snapshot"])
10079
+ }));
9809
10080
  var zVaultError400BadRequest = object({
9810
10081
  code: _enum(["bad_request"])
9811
10082
  });
@@ -10292,6 +10563,27 @@ var zUpdateStreamSubscriptionData = object({
10292
10563
  var zUpdateStreamSubscriptionResponse = object({
10293
10564
  data: zHttpStatusData
10294
10565
  });
10566
+ var zGetPairPriceData = object({
10567
+ body: optional(never()),
10568
+ path: optional(never()),
10569
+ query: object({
10570
+ tokenA: zPubkeyDto,
10571
+ tokenB: zPubkeyDto
10572
+ })
10573
+ });
10574
+ var zGetPairPriceResponse = object({
10575
+ data: zTokenPairPriceResponseDto
10576
+ });
10577
+ var zSearchTokensData = object({
10578
+ body: optional(never()),
10579
+ path: optional(never()),
10580
+ query: object({
10581
+ q: string2()
10582
+ })
10583
+ });
10584
+ var zSearchTokensResponse = object({
10585
+ data: zTokenSearchResponseDto
10586
+ });
10295
10587
  var zGetLendingPositionsData = object({
10296
10588
  body: optional(never()),
10297
10589
  path: object({
@@ -11021,6 +11313,32 @@ var _TunaBackendSdk = class _TunaBackendSdk extends HeyApiClient {
11021
11313
  }
11022
11314
  });
11023
11315
  }
11316
+ /**
11317
+ * Get USD prices for token_a and token_b
11318
+ */
11319
+ getPairPrice(parameters, options) {
11320
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "tokenA" }, { in: "query", key: "tokenB" }] }]);
11321
+ return (options?.client ?? this.client).get({
11322
+ requestValidator: async (data) => await zGetPairPriceData.parseAsync(data),
11323
+ responseValidator: async (data) => await zGetPairPriceResponse.parseAsync(data),
11324
+ url: "/v1/tokens/price",
11325
+ ...options,
11326
+ ...params
11327
+ });
11328
+ }
11329
+ /**
11330
+ * Search tokens by mint or name/symbol
11331
+ */
11332
+ searchTokens(parameters, options) {
11333
+ const params = buildClientParams([parameters], [{ args: [{ in: "query", key: "q" }] }]);
11334
+ return (options?.client ?? this.client).get({
11335
+ requestValidator: async (data) => await zSearchTokensData.parseAsync(data),
11336
+ responseValidator: async (data) => await zSearchTokensResponse.parseAsync(data),
11337
+ url: "/v1/tokens/search",
11338
+ ...options,
11339
+ ...params
11340
+ });
11341
+ }
11024
11342
  /**
11025
11343
  * Request all user lending positions
11026
11344
  */
@@ -11359,6 +11677,7 @@ export {
11359
11677
  OrderHistoryUiDirection,
11360
11678
  PoolProvider,
11361
11679
  PoolSubscriptionTopic,
11680
+ RateLimitSource,
11362
11681
  StakingPositionActionType,
11363
11682
  TradeHistoryAction,
11364
11683
  TradeHistoryUiDirection,
@@ -11431,6 +11750,8 @@ export {
11431
11750
  zGetOraclePricesResponse,
11432
11751
  zGetOrderHistoryData,
11433
11752
  zGetOrderHistoryResponse,
11753
+ zGetPairPriceData,
11754
+ zGetPairPriceResponse,
11434
11755
  zGetPoolCandlesData,
11435
11756
  zGetPoolCandlesResponse,
11436
11757
  zGetPoolData,
@@ -11545,6 +11866,10 @@ export {
11545
11866
  zPoolsError404Error,
11546
11867
  zPoolsError500Error,
11547
11868
  zPubkeyDto,
11869
+ zRateLimitSource,
11870
+ zRetryAfterHint,
11871
+ zSearchTokensData,
11872
+ zSearchTokensResponse,
11548
11873
  zSnapshot,
11549
11874
  zSnapshotContainer,
11550
11875
  zSpotPositionError404Error,
@@ -11583,6 +11908,21 @@ export {
11583
11908
  zSwapQuoteByOutputDto,
11584
11909
  zTickDto,
11585
11910
  zTokenAmountWithUsd,
11911
+ zTokenAuditDto,
11912
+ zTokenFirstPoolDto,
11913
+ zTokenPairPriceResponseDto,
11914
+ zTokenPriceDto,
11915
+ zTokenSearchItemDto,
11916
+ zTokenSearchResponseDto,
11917
+ zTokenStatsWindowDto,
11918
+ zTokensError400BadRequest,
11919
+ zTokensError400Error,
11920
+ zTokensError404Error,
11921
+ zTokensError429Error,
11922
+ zTokensError429TooManyRequests,
11923
+ zTokensError429UpstreamRateLimited,
11924
+ zTokensError500Error,
11925
+ zTokensError502Error,
11586
11926
  zTradableAmountDto,
11587
11927
  zTradeHistoryAction,
11588
11928
  zTradeHistoryEntryDto,