@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 +164 -12
- package/dist/index.d.cts +928 -1360
- package/dist/index.d.ts +928 -1360
- package/dist/index.js +134 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -101,6 +101,26 @@ async function customFetch(url, init) {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// src/gen/defiTunaAPI.ts
|
|
104
|
+
var BadRequestErrorCodeErrorBodyCode = {
|
|
105
|
+
invalidBody: "invalid_body",
|
|
106
|
+
invalidPath: "invalid_path",
|
|
107
|
+
invalidQuery: "invalid_query"
|
|
108
|
+
};
|
|
109
|
+
var GetLimitOrderError404ErrorCode = {
|
|
110
|
+
notFound: "not_found"
|
|
111
|
+
};
|
|
112
|
+
var GetLimitOrderError500ErrorCode = {
|
|
113
|
+
internalError: "internal_error"
|
|
114
|
+
};
|
|
115
|
+
var InternalErrorCodeErrorBodyCode = {
|
|
116
|
+
internalError: "internal_error"
|
|
117
|
+
};
|
|
118
|
+
var LeaderboardError400BadRequestCode = {
|
|
119
|
+
badRequest: "bad_request"
|
|
120
|
+
};
|
|
121
|
+
var LeaderboardError500ErrorCode = {
|
|
122
|
+
internalError: "internal_error"
|
|
123
|
+
};
|
|
104
124
|
var LeaderboardPeriod = {
|
|
105
125
|
week: "week"
|
|
106
126
|
};
|
|
@@ -115,10 +135,23 @@ var LimitOrderStatus = {
|
|
|
115
135
|
complete: "complete",
|
|
116
136
|
cancelled: "cancelled"
|
|
117
137
|
};
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
138
|
+
var LpPositionsError400BadRequestCode = {
|
|
139
|
+
badRequest: "bad_request"
|
|
140
|
+
};
|
|
141
|
+
var LpPositionsError500ErrorCode = {
|
|
142
|
+
internalError: "internal_error"
|
|
143
|
+
};
|
|
144
|
+
var MarketError404ErrorCode = {
|
|
145
|
+
notFound: "not_found"
|
|
146
|
+
};
|
|
147
|
+
var MarketError500ErrorCode = {
|
|
148
|
+
internalError: "internal_error"
|
|
149
|
+
};
|
|
150
|
+
var MintError404ErrorCode = {
|
|
151
|
+
notFound: "not_found"
|
|
152
|
+
};
|
|
153
|
+
var MintError500ErrorCode = {
|
|
154
|
+
internalError: "internal_error"
|
|
122
155
|
};
|
|
123
156
|
var NotificationAction = {
|
|
124
157
|
create: "create",
|
|
@@ -139,6 +172,12 @@ var NotificationEntity = {
|
|
|
139
172
|
orderHistoryEntry: "order_history_entry",
|
|
140
173
|
stateSnapshot: "state_snapshot"
|
|
141
174
|
};
|
|
175
|
+
var OraclePriceError404ErrorCode = {
|
|
176
|
+
notFound: "not_found"
|
|
177
|
+
};
|
|
178
|
+
var OraclePriceError500ErrorCode = {
|
|
179
|
+
internalError: "internal_error"
|
|
180
|
+
};
|
|
142
181
|
var OrderHistoryStatus = {
|
|
143
182
|
open: "open",
|
|
144
183
|
partiallyFilled: "partially_filled",
|
|
@@ -169,6 +208,27 @@ var PoolSubscriptionTopic = {
|
|
|
169
208
|
orderBook: "order_book",
|
|
170
209
|
poolPrices: "pool_prices"
|
|
171
210
|
};
|
|
211
|
+
var PoolsError400BadRequestCode = {
|
|
212
|
+
badRequest: "bad_request"
|
|
213
|
+
};
|
|
214
|
+
var PoolsError404ErrorCode = {
|
|
215
|
+
notFound: "not_found"
|
|
216
|
+
};
|
|
217
|
+
var PoolsError500ErrorCode = {
|
|
218
|
+
internalError: "internal_error"
|
|
219
|
+
};
|
|
220
|
+
var SpotPositionError404ErrorCode = {
|
|
221
|
+
notFound: "not_found"
|
|
222
|
+
};
|
|
223
|
+
var SpotPositionError500ErrorCode = {
|
|
224
|
+
internalError: "internal_error"
|
|
225
|
+
};
|
|
226
|
+
var StakingError400BadRequestCode = {
|
|
227
|
+
badRequest: "bad_request"
|
|
228
|
+
};
|
|
229
|
+
var StakingError500ErrorCode = {
|
|
230
|
+
internalError: "internal_error"
|
|
231
|
+
};
|
|
172
232
|
var StakingPositionActionType = {
|
|
173
233
|
stake: "stake",
|
|
174
234
|
unstake: "unstake",
|
|
@@ -176,6 +236,12 @@ var StakingPositionActionType = {
|
|
|
176
236
|
claimRewards: "claim_rewards",
|
|
177
237
|
compoundRewards: "compound_rewards"
|
|
178
238
|
};
|
|
239
|
+
var StatsError400BadRequestCode = {
|
|
240
|
+
badRequest: "bad_request"
|
|
241
|
+
};
|
|
242
|
+
var StatsError500ErrorCode = {
|
|
243
|
+
internalError: "internal_error"
|
|
244
|
+
};
|
|
179
245
|
var TradeHistoryAction = {
|
|
180
246
|
swap: "swap",
|
|
181
247
|
limitOrderFill: "limit_order_fill",
|
|
@@ -245,6 +311,27 @@ var TunaSpotPositionDtoState = {
|
|
|
245
311
|
open: "open",
|
|
246
312
|
closed: "closed"
|
|
247
313
|
};
|
|
314
|
+
var UpdateStreamSubscriptionError404ErrorCode = {
|
|
315
|
+
notFound: "not_found"
|
|
316
|
+
};
|
|
317
|
+
var UpdateStreamSubscriptionError500ErrorCode = {
|
|
318
|
+
internalError: "internal_error"
|
|
319
|
+
};
|
|
320
|
+
var ValidationErrorCodeErrorBodyCode = {
|
|
321
|
+
validationFailed: "validation_failed"
|
|
322
|
+
};
|
|
323
|
+
var ValidationErrorCodeValidationDetailsErrorBodyCode = {
|
|
324
|
+
validationFailed: "validation_failed"
|
|
325
|
+
};
|
|
326
|
+
var VaultError400BadRequestCode = {
|
|
327
|
+
badRequest: "bad_request"
|
|
328
|
+
};
|
|
329
|
+
var VaultError404ErrorCode = {
|
|
330
|
+
notFound: "not_found"
|
|
331
|
+
};
|
|
332
|
+
var VaultError500ErrorCode = {
|
|
333
|
+
internalError: "internal_error"
|
|
334
|
+
};
|
|
248
335
|
var WalletSubscriptionTopic = {
|
|
249
336
|
tunaPositions: "tuna_positions",
|
|
250
337
|
tunaSpotPositions: "tuna_spot_positions",
|
|
@@ -802,8 +889,15 @@ var getLimitOrder = async (userAddress, limitOrderAddress, options) => {
|
|
|
802
889
|
var getGetLpPositionsUrl = (userAddress, params) => {
|
|
803
890
|
const normalizedParams = new URLSearchParams();
|
|
804
891
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
892
|
+
const explodeParameters = ["liquidityPool", "state"];
|
|
893
|
+
if (Array.isArray(value) && explodeParameters.includes(key)) {
|
|
894
|
+
value.forEach((v) => {
|
|
895
|
+
normalizedParams.append(key, v === null ? "null" : v.toString());
|
|
896
|
+
});
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
805
899
|
if (value !== void 0) {
|
|
806
|
-
normalizedParams.append(key, value === null ? "null" : value
|
|
900
|
+
normalizedParams.append(key, value === null ? "null" : value.toString());
|
|
807
901
|
}
|
|
808
902
|
});
|
|
809
903
|
const stringifiedParams = normalizedParams.toString();
|
|
@@ -868,12 +962,12 @@ var getSpotPositions = async (userAddress, options) => {
|
|
|
868
962
|
}
|
|
869
963
|
);
|
|
870
964
|
};
|
|
871
|
-
var getGetSpotPositionUrl = (userAddress,
|
|
872
|
-
return `/v1/users/${userAddress}/spot-positions/${
|
|
965
|
+
var getGetSpotPositionUrl = (userAddress, positionAddress) => {
|
|
966
|
+
return `/v1/users/${userAddress}/spot-positions/${positionAddress}`;
|
|
873
967
|
};
|
|
874
|
-
var getSpotPosition = async (userAddress,
|
|
968
|
+
var getSpotPosition = async (userAddress, positionAddress, options) => {
|
|
875
969
|
return customFetch(
|
|
876
|
-
getGetSpotPositionUrl(userAddress,
|
|
970
|
+
getGetSpotPositionUrl(userAddress, positionAddress),
|
|
877
971
|
{
|
|
878
972
|
...options,
|
|
879
973
|
method: "GET"
|
|
@@ -1007,7 +1101,7 @@ function unwrapData(data) {
|
|
|
1007
1101
|
}
|
|
1008
1102
|
async function unwrap(promise) {
|
|
1009
1103
|
const res = await promise;
|
|
1010
|
-
if (res.status
|
|
1104
|
+
if (res.status !== 200) {
|
|
1011
1105
|
throw {
|
|
1012
1106
|
message: String(res.data),
|
|
1013
1107
|
status: res.status
|
|
@@ -1443,18 +1537,40 @@ function eventIsStateSnapshot(event) {
|
|
|
1443
1537
|
return "entity" in event && event.entity === NotificationEntity.stateSnapshot;
|
|
1444
1538
|
}
|
|
1445
1539
|
export {
|
|
1540
|
+
BadRequestErrorCodeErrorBodyCode,
|
|
1541
|
+
GetLimitOrderError404ErrorCode,
|
|
1542
|
+
GetLimitOrderError500ErrorCode,
|
|
1543
|
+
InternalErrorCodeErrorBodyCode,
|
|
1544
|
+
LeaderboardError400BadRequestCode,
|
|
1545
|
+
LeaderboardError500ErrorCode,
|
|
1446
1546
|
LeaderboardPeriod,
|
|
1447
1547
|
LeaderboardSortBy,
|
|
1448
1548
|
LimitOrderStatus,
|
|
1449
|
-
|
|
1549
|
+
LpPositionsError400BadRequestCode,
|
|
1550
|
+
LpPositionsError500ErrorCode,
|
|
1551
|
+
MarketError404ErrorCode,
|
|
1552
|
+
MarketError500ErrorCode,
|
|
1553
|
+
MintError404ErrorCode,
|
|
1554
|
+
MintError500ErrorCode,
|
|
1450
1555
|
NotificationAction,
|
|
1451
1556
|
NotificationEntity,
|
|
1557
|
+
OraclePriceError404ErrorCode,
|
|
1558
|
+
OraclePriceError500ErrorCode,
|
|
1452
1559
|
OrderHistoryStatus,
|
|
1453
1560
|
OrderHistoryType,
|
|
1454
1561
|
OrderHistoryUIDirection,
|
|
1455
1562
|
PoolProvider,
|
|
1456
1563
|
PoolSubscriptionTopic,
|
|
1564
|
+
PoolsError400BadRequestCode,
|
|
1565
|
+
PoolsError404ErrorCode,
|
|
1566
|
+
PoolsError500ErrorCode,
|
|
1567
|
+
SpotPositionError404ErrorCode,
|
|
1568
|
+
SpotPositionError500ErrorCode,
|
|
1569
|
+
StakingError400BadRequestCode,
|
|
1570
|
+
StakingError500ErrorCode,
|
|
1457
1571
|
StakingPositionActionType,
|
|
1572
|
+
StatsError400BadRequestCode,
|
|
1573
|
+
StatsError500ErrorCode,
|
|
1458
1574
|
TradeHistoryAction,
|
|
1459
1575
|
TradeHistoryUIDirection,
|
|
1460
1576
|
TunaLpPositionAutoCompound,
|
|
@@ -1466,6 +1582,13 @@ export {
|
|
|
1466
1582
|
TunaPositionMarketMaker,
|
|
1467
1583
|
TunaPositionPoolToken,
|
|
1468
1584
|
TunaSpotPositionDtoState,
|
|
1585
|
+
UpdateStreamSubscriptionError404ErrorCode,
|
|
1586
|
+
UpdateStreamSubscriptionError500ErrorCode,
|
|
1587
|
+
ValidationErrorCodeErrorBodyCode,
|
|
1588
|
+
ValidationErrorCodeValidationDetailsErrorBodyCode,
|
|
1589
|
+
VaultError400BadRequestCode,
|
|
1590
|
+
VaultError404ErrorCode,
|
|
1591
|
+
VaultError500ErrorCode,
|
|
1469
1592
|
WalletSubscriptionTopic,
|
|
1470
1593
|
eventIsInitialMessage,
|
|
1471
1594
|
eventIsLendingPosition,
|