@crypticdot/defituna-api 4.2.0 → 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,
@@ -1026,6 +1048,7 @@ var PoolSubscriptionTopic = {
1026
1048
  ORDER_BOOK: "order_book",
1027
1049
  POOL_PRICES: "pool_prices"
1028
1050
  };
1051
+ var RateLimitSource = { INTERNAL: "internal", UPSTREAM: "upstream" };
1029
1052
  var StakingPositionActionType = {
1030
1053
  STAKE: "stake",
1031
1054
  UNSTAKE: "unstake",
@@ -9236,6 +9259,11 @@ var zMintDto = object({
9236
9259
  name: string2(),
9237
9260
  symbol: string2()
9238
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
+ });
9239
9267
  var zSpotPositionError404Error = object({
9240
9268
  code: _enum(["not_found"])
9241
9269
  });
@@ -9300,6 +9328,217 @@ var zPoolTicksDto = object({
9300
9328
  tickSpacing: int().gte(0).max(2147483647, { error: "Invalid value: Expected int32 to be <= 2147483647" }),
9301
9329
  ticks: array(zTickDto)
9302
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
+ });
9303
9542
  var zTradeHistoryAction = _enum([
9304
9543
  "swap",
9305
9544
  "limit_order_fill",
@@ -10651,6 +10890,27 @@ var zUpdateStreamSubscriptionData = object({
10651
10890
  var zUpdateStreamSubscriptionResponse = object({
10652
10891
  data: zHttpStatusData
10653
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
+ });
10654
10914
  var zGetLendingPositionsData = object({
10655
10915
  body: optional(never()),
10656
10916
  path: object({
@@ -11380,6 +11640,32 @@ var _TunaBackendSdk = class _TunaBackendSdk extends HeyApiClient {
11380
11640
  }
11381
11641
  });
11382
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
+ }
11383
11669
  /**
11384
11670
  * Request all user lending positions
11385
11671
  */
@@ -11719,6 +12005,7 @@ async function unwrap(promise2) {
11719
12005
  OrderHistoryUiDirection,
11720
12006
  PoolProvider,
11721
12007
  PoolSubscriptionTopic,
12008
+ RateLimitSource,
11722
12009
  StakingPositionActionType,
11723
12010
  TradeHistoryAction,
11724
12011
  TradeHistoryUiDirection,
@@ -11791,6 +12078,8 @@ async function unwrap(promise2) {
11791
12078
  zGetOraclePricesResponse,
11792
12079
  zGetOrderHistoryData,
11793
12080
  zGetOrderHistoryResponse,
12081
+ zGetPairPriceData,
12082
+ zGetPairPriceResponse,
11794
12083
  zGetPoolCandlesData,
11795
12084
  zGetPoolCandlesResponse,
11796
12085
  zGetPoolData,
@@ -11905,6 +12194,10 @@ async function unwrap(promise2) {
11905
12194
  zPoolsError404Error,
11906
12195
  zPoolsError500Error,
11907
12196
  zPubkeyDto,
12197
+ zRateLimitSource,
12198
+ zRetryAfterHint,
12199
+ zSearchTokensData,
12200
+ zSearchTokensResponse,
11908
12201
  zSnapshot,
11909
12202
  zSnapshotContainer,
11910
12203
  zSpotPositionError404Error,
@@ -11943,6 +12236,21 @@ async function unwrap(promise2) {
11943
12236
  zSwapQuoteByOutputDto,
11944
12237
  zTickDto,
11945
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,
11946
12254
  zTradableAmountDto,
11947
12255
  zTradeHistoryAction,
11948
12256
  zTradeHistoryEntryDto,