@crypticdot/defituna-api 3.0.3 → 3.1.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
@@ -19,18 +19,40 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  // src/index.ts
20
20
  var index_exports = {};
21
21
  __export(index_exports, {
22
+ BadRequestErrorCodeErrorBodyCode: () => BadRequestErrorCodeErrorBodyCode,
23
+ GetLimitOrderError404ErrorCode: () => GetLimitOrderError404ErrorCode,
24
+ GetLimitOrderError500ErrorCode: () => GetLimitOrderError500ErrorCode,
25
+ InternalErrorCodeErrorBodyCode: () => InternalErrorCodeErrorBodyCode,
26
+ LeaderboardError400BadRequestCode: () => LeaderboardError400BadRequestCode,
27
+ LeaderboardError500ErrorCode: () => LeaderboardError500ErrorCode,
22
28
  LeaderboardPeriod: () => LeaderboardPeriod,
23
29
  LeaderboardSortBy: () => LeaderboardSortBy,
24
30
  LimitOrderStatus: () => LimitOrderStatus,
25
- LpPositionsHistoryQueryFilter: () => LpPositionsHistoryQueryFilter,
31
+ LpPositionsError400BadRequestCode: () => LpPositionsError400BadRequestCode,
32
+ LpPositionsError500ErrorCode: () => LpPositionsError500ErrorCode,
33
+ MarketError404ErrorCode: () => MarketError404ErrorCode,
34
+ MarketError500ErrorCode: () => MarketError500ErrorCode,
35
+ MintError404ErrorCode: () => MintError404ErrorCode,
36
+ MintError500ErrorCode: () => MintError500ErrorCode,
26
37
  NotificationAction: () => NotificationAction,
27
38
  NotificationEntity: () => NotificationEntity,
39
+ OraclePriceError404ErrorCode: () => OraclePriceError404ErrorCode,
40
+ OraclePriceError500ErrorCode: () => OraclePriceError500ErrorCode,
28
41
  OrderHistoryStatus: () => OrderHistoryStatus,
29
42
  OrderHistoryType: () => OrderHistoryType,
30
43
  OrderHistoryUIDirection: () => OrderHistoryUIDirection,
31
44
  PoolProvider: () => PoolProvider,
32
45
  PoolSubscriptionTopic: () => PoolSubscriptionTopic,
46
+ PoolsError400BadRequestCode: () => PoolsError400BadRequestCode,
47
+ PoolsError404ErrorCode: () => PoolsError404ErrorCode,
48
+ PoolsError500ErrorCode: () => PoolsError500ErrorCode,
49
+ SpotPositionError404ErrorCode: () => SpotPositionError404ErrorCode,
50
+ SpotPositionError500ErrorCode: () => SpotPositionError500ErrorCode,
51
+ StakingError400BadRequestCode: () => StakingError400BadRequestCode,
52
+ StakingError500ErrorCode: () => StakingError500ErrorCode,
33
53
  StakingPositionActionType: () => StakingPositionActionType,
54
+ StatsError400BadRequestCode: () => StatsError400BadRequestCode,
55
+ StatsError500ErrorCode: () => StatsError500ErrorCode,
34
56
  TradeHistoryAction: () => TradeHistoryAction,
35
57
  TradeHistoryUIDirection: () => TradeHistoryUIDirection,
36
58
  TunaLpPositionAutoCompound: () => TunaLpPositionAutoCompound,
@@ -42,6 +64,13 @@ __export(index_exports, {
42
64
  TunaPositionMarketMaker: () => TunaPositionMarketMaker,
43
65
  TunaPositionPoolToken: () => TunaPositionPoolToken,
44
66
  TunaSpotPositionDtoState: () => TunaSpotPositionDtoState,
67
+ UpdateStreamSubscriptionError404ErrorCode: () => UpdateStreamSubscriptionError404ErrorCode,
68
+ UpdateStreamSubscriptionError500ErrorCode: () => UpdateStreamSubscriptionError500ErrorCode,
69
+ ValidationErrorCodeErrorBodyCode: () => ValidationErrorCodeErrorBodyCode,
70
+ ValidationErrorCodeValidationDetailsErrorBodyCode: () => ValidationErrorCodeValidationDetailsErrorBodyCode,
71
+ VaultError400BadRequestCode: () => VaultError400BadRequestCode,
72
+ VaultError404ErrorCode: () => VaultError404ErrorCode,
73
+ VaultError500ErrorCode: () => VaultError500ErrorCode,
45
74
  WalletSubscriptionTopic: () => WalletSubscriptionTopic,
46
75
  eventIsInitialMessage: () => eventIsInitialMessage,
47
76
  eventIsLendingPosition: () => eventIsLendingPosition,
@@ -254,6 +283,26 @@ async function customFetch(url, init) {
254
283
  }
255
284
 
256
285
  // src/gen/defiTunaAPI.ts
286
+ var BadRequestErrorCodeErrorBodyCode = {
287
+ invalidBody: "invalid_body",
288
+ invalidPath: "invalid_path",
289
+ invalidQuery: "invalid_query"
290
+ };
291
+ var GetLimitOrderError404ErrorCode = {
292
+ notFound: "not_found"
293
+ };
294
+ var GetLimitOrderError500ErrorCode = {
295
+ internalError: "internal_error"
296
+ };
297
+ var InternalErrorCodeErrorBodyCode = {
298
+ internalError: "internal_error"
299
+ };
300
+ var LeaderboardError400BadRequestCode = {
301
+ badRequest: "bad_request"
302
+ };
303
+ var LeaderboardError500ErrorCode = {
304
+ internalError: "internal_error"
305
+ };
257
306
  var LeaderboardPeriod = {
258
307
  week: "week"
259
308
  };
@@ -268,10 +317,23 @@ var LimitOrderStatus = {
268
317
  complete: "complete",
269
318
  cancelled: "cancelled"
270
319
  };
271
- var LpPositionsHistoryQueryFilter = {
272
- opened: "opened",
273
- closed: "closed",
274
- all: "all"
320
+ var LpPositionsError400BadRequestCode = {
321
+ badRequest: "bad_request"
322
+ };
323
+ var LpPositionsError500ErrorCode = {
324
+ internalError: "internal_error"
325
+ };
326
+ var MarketError404ErrorCode = {
327
+ notFound: "not_found"
328
+ };
329
+ var MarketError500ErrorCode = {
330
+ internalError: "internal_error"
331
+ };
332
+ var MintError404ErrorCode = {
333
+ notFound: "not_found"
334
+ };
335
+ var MintError500ErrorCode = {
336
+ internalError: "internal_error"
275
337
  };
276
338
  var NotificationAction = {
277
339
  create: "create",
@@ -292,6 +354,12 @@ var NotificationEntity = {
292
354
  orderHistoryEntry: "order_history_entry",
293
355
  stateSnapshot: "state_snapshot"
294
356
  };
357
+ var OraclePriceError404ErrorCode = {
358
+ notFound: "not_found"
359
+ };
360
+ var OraclePriceError500ErrorCode = {
361
+ internalError: "internal_error"
362
+ };
295
363
  var OrderHistoryStatus = {
296
364
  open: "open",
297
365
  partiallyFilled: "partially_filled",
@@ -322,6 +390,27 @@ var PoolSubscriptionTopic = {
322
390
  orderBook: "order_book",
323
391
  poolPrices: "pool_prices"
324
392
  };
393
+ var PoolsError400BadRequestCode = {
394
+ badRequest: "bad_request"
395
+ };
396
+ var PoolsError404ErrorCode = {
397
+ notFound: "not_found"
398
+ };
399
+ var PoolsError500ErrorCode = {
400
+ internalError: "internal_error"
401
+ };
402
+ var SpotPositionError404ErrorCode = {
403
+ notFound: "not_found"
404
+ };
405
+ var SpotPositionError500ErrorCode = {
406
+ internalError: "internal_error"
407
+ };
408
+ var StakingError400BadRequestCode = {
409
+ badRequest: "bad_request"
410
+ };
411
+ var StakingError500ErrorCode = {
412
+ internalError: "internal_error"
413
+ };
325
414
  var StakingPositionActionType = {
326
415
  stake: "stake",
327
416
  unstake: "unstake",
@@ -329,6 +418,12 @@ var StakingPositionActionType = {
329
418
  claimRewards: "claim_rewards",
330
419
  compoundRewards: "compound_rewards"
331
420
  };
421
+ var StatsError400BadRequestCode = {
422
+ badRequest: "bad_request"
423
+ };
424
+ var StatsError500ErrorCode = {
425
+ internalError: "internal_error"
426
+ };
332
427
  var TradeHistoryAction = {
333
428
  swap: "swap",
334
429
  limitOrderFill: "limit_order_fill",
@@ -398,6 +493,27 @@ var TunaSpotPositionDtoState = {
398
493
  open: "open",
399
494
  closed: "closed"
400
495
  };
496
+ var UpdateStreamSubscriptionError404ErrorCode = {
497
+ notFound: "not_found"
498
+ };
499
+ var UpdateStreamSubscriptionError500ErrorCode = {
500
+ internalError: "internal_error"
501
+ };
502
+ var ValidationErrorCodeErrorBodyCode = {
503
+ validationFailed: "validation_failed"
504
+ };
505
+ var ValidationErrorCodeValidationDetailsErrorBodyCode = {
506
+ validationFailed: "validation_failed"
507
+ };
508
+ var VaultError400BadRequestCode = {
509
+ badRequest: "bad_request"
510
+ };
511
+ var VaultError404ErrorCode = {
512
+ notFound: "not_found"
513
+ };
514
+ var VaultError500ErrorCode = {
515
+ internalError: "internal_error"
516
+ };
401
517
  var WalletSubscriptionTopic = {
402
518
  tunaPositions: "tuna_positions",
403
519
  tunaSpotPositions: "tuna_spot_positions",
@@ -955,8 +1071,15 @@ var getLimitOrder = async (userAddress, limitOrderAddress, options) => {
955
1071
  var getGetLpPositionsUrl = (userAddress, params) => {
956
1072
  const normalizedParams = new URLSearchParams();
957
1073
  Object.entries(params || {}).forEach(([key, value]) => {
1074
+ const explodeParameters = ["liquidityPool", "state"];
1075
+ if (Array.isArray(value) && explodeParameters.includes(key)) {
1076
+ value.forEach((v) => {
1077
+ normalizedParams.append(key, v === null ? "null" : v.toString());
1078
+ });
1079
+ return;
1080
+ }
958
1081
  if (value !== void 0) {
959
- normalizedParams.append(key, value === null ? "null" : value instanceof Date ? value.toISOString() : value.toString());
1082
+ normalizedParams.append(key, value === null ? "null" : value.toString());
960
1083
  }
961
1084
  });
962
1085
  const stringifiedParams = normalizedParams.toString();
@@ -1021,12 +1144,12 @@ var getSpotPositions = async (userAddress, options) => {
1021
1144
  }
1022
1145
  );
1023
1146
  };
1024
- var getGetSpotPositionUrl = (userAddress, spotPositionAddress) => {
1025
- return `/v1/users/${userAddress}/spot-positions/${spotPositionAddress}`;
1147
+ var getGetSpotPositionUrl = (userAddress, positionAddress) => {
1148
+ return `/v1/users/${userAddress}/spot-positions/${positionAddress}`;
1026
1149
  };
1027
- var getSpotPosition = async (userAddress, spotPositionAddress, options) => {
1150
+ var getSpotPosition = async (userAddress, positionAddress, options) => {
1028
1151
  return customFetch(
1029
- getGetSpotPositionUrl(userAddress, spotPositionAddress),
1152
+ getGetSpotPositionUrl(userAddress, positionAddress),
1030
1153
  {
1031
1154
  ...options,
1032
1155
  method: "GET"
@@ -1160,7 +1283,7 @@ function unwrapData(data) {
1160
1283
  }
1161
1284
  async function unwrap(promise) {
1162
1285
  const res = await promise;
1163
- if (res.status != 200) {
1286
+ if (res.status !== 200) {
1164
1287
  throw {
1165
1288
  message: String(res.data),
1166
1289
  status: res.status
@@ -1597,18 +1720,40 @@ function eventIsStateSnapshot(event) {
1597
1720
  }
1598
1721
  // Annotate the CommonJS export names for ESM import in node:
1599
1722
  0 && (module.exports = {
1723
+ BadRequestErrorCodeErrorBodyCode,
1724
+ GetLimitOrderError404ErrorCode,
1725
+ GetLimitOrderError500ErrorCode,
1726
+ InternalErrorCodeErrorBodyCode,
1727
+ LeaderboardError400BadRequestCode,
1728
+ LeaderboardError500ErrorCode,
1600
1729
  LeaderboardPeriod,
1601
1730
  LeaderboardSortBy,
1602
1731
  LimitOrderStatus,
1603
- LpPositionsHistoryQueryFilter,
1732
+ LpPositionsError400BadRequestCode,
1733
+ LpPositionsError500ErrorCode,
1734
+ MarketError404ErrorCode,
1735
+ MarketError500ErrorCode,
1736
+ MintError404ErrorCode,
1737
+ MintError500ErrorCode,
1604
1738
  NotificationAction,
1605
1739
  NotificationEntity,
1740
+ OraclePriceError404ErrorCode,
1741
+ OraclePriceError500ErrorCode,
1606
1742
  OrderHistoryStatus,
1607
1743
  OrderHistoryType,
1608
1744
  OrderHistoryUIDirection,
1609
1745
  PoolProvider,
1610
1746
  PoolSubscriptionTopic,
1747
+ PoolsError400BadRequestCode,
1748
+ PoolsError404ErrorCode,
1749
+ PoolsError500ErrorCode,
1750
+ SpotPositionError404ErrorCode,
1751
+ SpotPositionError500ErrorCode,
1752
+ StakingError400BadRequestCode,
1753
+ StakingError500ErrorCode,
1611
1754
  StakingPositionActionType,
1755
+ StatsError400BadRequestCode,
1756
+ StatsError500ErrorCode,
1612
1757
  TradeHistoryAction,
1613
1758
  TradeHistoryUIDirection,
1614
1759
  TunaLpPositionAutoCompound,
@@ -1620,6 +1765,13 @@ function eventIsStateSnapshot(event) {
1620
1765
  TunaPositionMarketMaker,
1621
1766
  TunaPositionPoolToken,
1622
1767
  TunaSpotPositionDtoState,
1768
+ UpdateStreamSubscriptionError404ErrorCode,
1769
+ UpdateStreamSubscriptionError500ErrorCode,
1770
+ ValidationErrorCodeErrorBodyCode,
1771
+ ValidationErrorCodeValidationDetailsErrorBodyCode,
1772
+ VaultError400BadRequestCode,
1773
+ VaultError404ErrorCode,
1774
+ VaultError500ErrorCode,
1623
1775
  WalletSubscriptionTopic,
1624
1776
  eventIsInitialMessage,
1625
1777
  eventIsLendingPosition,