@crypticdot/defituna-api 1.9.0 → 1.10.1
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.d.mts +1494 -533
- package/dist/index.d.ts +1494 -533
- package/dist/index.js +822 -480
- package/dist/index.mjs +810 -468
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -48,6 +48,8 @@ var import_snakecase_keys = __toESM(require("snakecase-keys"));
|
|
|
48
48
|
// src/client/schemas.ts
|
|
49
49
|
var schemas_exports = {};
|
|
50
50
|
__export(schemas_exports, {
|
|
51
|
+
AmountWithUsdSchema: () => AmountWithUsdSchema,
|
|
52
|
+
AmountWithoutUsdSchema: () => AmountWithoutUsdSchema,
|
|
51
53
|
CloseSpotPositionQuote: () => CloseSpotPositionQuote,
|
|
52
54
|
DecreaseSpotPositionQuote: () => DecreaseSpotPositionQuote,
|
|
53
55
|
FeesStatsGroup: () => FeesStatsGroup,
|
|
@@ -60,6 +62,14 @@ __export(schemas_exports, {
|
|
|
60
62
|
LimitOrderQuoteByOutput: () => LimitOrderQuoteByOutput,
|
|
61
63
|
LimitOrderState: () => LimitOrderState,
|
|
62
64
|
LimitOrderStateSchema: () => LimitOrderStateSchema,
|
|
65
|
+
LpPositionAutoCompound: () => LpPositionAutoCompound,
|
|
66
|
+
LpPositionAutoCompoundSchema: () => LpPositionAutoCompoundSchema,
|
|
67
|
+
LpPositionLimitOrderSwap: () => LpPositionLimitOrderSwap,
|
|
68
|
+
LpPositionLimitOrderSwapSchema: () => LpPositionLimitOrderSwapSchema,
|
|
69
|
+
LpPositionRebalance: () => LpPositionRebalance,
|
|
70
|
+
LpPositionRebalanceSchema: () => LpPositionRebalanceSchema,
|
|
71
|
+
LpPositionsActionType: () => LpPositionsActionType,
|
|
72
|
+
LpPositionsActionTypeSchema: () => LpPositionsActionTypeSchema,
|
|
63
73
|
Market: () => Market,
|
|
64
74
|
Mint: () => Mint,
|
|
65
75
|
NotificationAction: () => NotificationAction,
|
|
@@ -105,6 +115,7 @@ __export(schemas_exports, {
|
|
|
105
115
|
SwapQuoteByOutput: () => SwapQuoteByOutput,
|
|
106
116
|
Tick: () => Tick,
|
|
107
117
|
TokenOraclePrice: () => TokenOraclePrice,
|
|
118
|
+
TokensPnlSchema: () => TokensPnlSchema,
|
|
108
119
|
TradableAmount: () => TradableAmount,
|
|
109
120
|
TradeHistoryAction: () => TradeHistoryAction,
|
|
110
121
|
TradeHistoryActionSchema: () => TradeHistoryActionSchema,
|
|
@@ -112,36 +123,505 @@ __export(schemas_exports, {
|
|
|
112
123
|
TradeHistoryEntryNotification: () => TradeHistoryEntryNotification,
|
|
113
124
|
TradeHistoryUIDirection: () => TradeHistoryUIDirection,
|
|
114
125
|
TradeHistoryUIDirectionSchema: () => TradeHistoryUIDirectionSchema,
|
|
115
|
-
|
|
126
|
+
TunaLpPositionAction: () => TunaLpPositionAction,
|
|
127
|
+
TunaLpPositionActionClose: () => TunaLpPositionActionClose,
|
|
128
|
+
TunaLpPositionActionCollectAndCompoundFees: () => TunaLpPositionActionCollectAndCompoundFees,
|
|
129
|
+
TunaLpPositionActionCollectFees: () => TunaLpPositionActionCollectFees,
|
|
130
|
+
TunaLpPositionActionDecreaseLiquidity: () => TunaLpPositionActionDecreaseLiquidity,
|
|
131
|
+
TunaLpPositionActionIncreaseLiquidity: () => TunaLpPositionActionIncreaseLiquidity,
|
|
132
|
+
TunaLpPositionActionLiquidate: () => TunaLpPositionActionLiquidate,
|
|
133
|
+
TunaLpPositionActionOpen: () => TunaLpPositionActionOpen,
|
|
134
|
+
TunaLpPositionActionParametersUpdate: () => TunaLpPositionActionParametersUpdate,
|
|
135
|
+
TunaLpPositionActionRepayDebt: () => TunaLpPositionActionRepayDebt,
|
|
136
|
+
TunaLpPositionAutoCompounding: () => TunaLpPositionAutoCompounding,
|
|
137
|
+
TunaLpPositionAutoCompoundingSchema: () => TunaLpPositionAutoCompoundingSchema,
|
|
138
|
+
TunaLpPositionDtoSchema: () => TunaLpPositionDtoSchema,
|
|
139
|
+
TunaLpPositionFlagsSchema: () => TunaLpPositionFlagsSchema,
|
|
140
|
+
TunaLpPositionHistorical: () => TunaLpPositionHistorical,
|
|
141
|
+
TunaLpPositionParameters: () => TunaLpPositionParameters,
|
|
142
|
+
TunaLpPositionTokenPrices: () => TunaLpPositionTokenPrices,
|
|
143
|
+
TunaLpPositionTransfer: () => TunaLpPositionTransfer,
|
|
144
|
+
TunaLpPositionValue: () => TunaLpPositionValue,
|
|
145
|
+
TunaPositionLegacy: () => TunaPositionLegacy,
|
|
146
|
+
TunaPositionMintSchema: () => TunaPositionMintSchema,
|
|
116
147
|
TunaPositionNotification: () => TunaPositionNotification,
|
|
148
|
+
TunaPositionPoolSchema: () => TunaPositionPoolSchema,
|
|
149
|
+
TunaPositionPoolToken: () => TunaPositionPoolToken,
|
|
150
|
+
TunaPositionPoolTokenSchema: () => TunaPositionPoolTokenSchema,
|
|
117
151
|
TunaPositionState: () => TunaPositionState,
|
|
118
152
|
TunaPositionStateSchema: () => TunaPositionStateSchema,
|
|
153
|
+
TunaPositionTokenPnlSchema: () => TunaPositionTokenPnlSchema,
|
|
119
154
|
TunaSpotPosition: () => TunaSpotPosition,
|
|
120
155
|
TunaSpotPositionNotification: () => TunaSpotPositionNotification,
|
|
121
156
|
TunaSpotPositionState: () => TunaSpotPositionState,
|
|
122
157
|
TunaSpotPositionStateSchema: () => TunaSpotPositionStateSchema,
|
|
123
158
|
UpdateStreamSubscriptionResult: () => UpdateStreamSubscriptionResult,
|
|
159
|
+
UsdPnlSchema: () => UsdPnlSchema,
|
|
124
160
|
Vault: () => Vault,
|
|
125
161
|
VaultHistoricalStats: () => VaultHistoricalStats,
|
|
126
162
|
WalletSubscriptionTopic: () => WalletSubscriptionTopic,
|
|
127
163
|
WalletSubscriptionTopicSchema: () => WalletSubscriptionTopicSchema
|
|
128
164
|
});
|
|
165
|
+
var import_zod7 = require("zod");
|
|
166
|
+
|
|
167
|
+
// src/client/schemas/basic.ts
|
|
129
168
|
var import_zod = require("zod");
|
|
130
|
-
var
|
|
131
|
-
amount: import_zod.z.coerce.bigint()
|
|
132
|
-
});
|
|
133
|
-
var amountWithUsd = import_zod.z.object({
|
|
169
|
+
var AmountWithUsdSchema = import_zod.z.object({
|
|
134
170
|
amount: import_zod.z.coerce.bigint(),
|
|
135
171
|
usd: import_zod.z.number()
|
|
136
172
|
});
|
|
137
|
-
var
|
|
173
|
+
var AmountWithoutUsdSchema = import_zod.z.object({
|
|
174
|
+
amount: import_zod.z.coerce.bigint()
|
|
175
|
+
});
|
|
176
|
+
var TokensPnlSchema = import_zod.z.object({
|
|
138
177
|
amount: import_zod.z.coerce.bigint(),
|
|
139
|
-
|
|
178
|
+
rate: import_zod.z.number()
|
|
140
179
|
});
|
|
141
|
-
var
|
|
180
|
+
var UsdPnlSchema = import_zod.z.object({
|
|
142
181
|
amount: import_zod.z.number(),
|
|
143
|
-
|
|
182
|
+
rate: import_zod.z.number()
|
|
183
|
+
});
|
|
184
|
+
var PoolProvider = {
|
|
185
|
+
ORCA: "orca",
|
|
186
|
+
FUSION: "fusion"
|
|
187
|
+
};
|
|
188
|
+
var PoolProviderSchema = import_zod.z.enum([PoolProvider.ORCA, ...Object.values(PoolProvider)]);
|
|
189
|
+
|
|
190
|
+
// src/client/schemas/limit_orders.ts
|
|
191
|
+
var import_zod2 = require("zod");
|
|
192
|
+
var LimitOrderState = {
|
|
193
|
+
OPEN: "open",
|
|
194
|
+
PARTIALLY_FILLED: "partially_filled",
|
|
195
|
+
FILLED: "filled",
|
|
196
|
+
COMPLETE: "complete",
|
|
197
|
+
CANCELLED: "cancelled"
|
|
198
|
+
};
|
|
199
|
+
var LimitOrderStateSchema = import_zod2.z.enum([LimitOrderState.OPEN, ...Object.values(LimitOrderState)]);
|
|
200
|
+
var LimitOrder = import_zod2.z.object({
|
|
201
|
+
address: import_zod2.z.string(),
|
|
202
|
+
mint: import_zod2.z.string(),
|
|
203
|
+
pool: import_zod2.z.string(),
|
|
204
|
+
state: LimitOrderStateSchema,
|
|
205
|
+
aToB: import_zod2.z.boolean(),
|
|
206
|
+
tickIndex: import_zod2.z.number(),
|
|
207
|
+
fillRatio: import_zod2.z.number(),
|
|
208
|
+
openTxSignature: import_zod2.z.string(),
|
|
209
|
+
closeTxSignature: import_zod2.z.nullable(import_zod2.z.string()),
|
|
210
|
+
amountIn: AmountWithUsdSchema,
|
|
211
|
+
amountOut: AmountWithUsdSchema,
|
|
212
|
+
openedAt: import_zod2.z.coerce.date(),
|
|
213
|
+
closedAt: import_zod2.z.nullable(import_zod2.z.coerce.date())
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// src/client/schemas/lp_positions.ts
|
|
217
|
+
var import_zod4 = __toESM(require("zod"));
|
|
218
|
+
|
|
219
|
+
// src/client/schemas/positions_shared.ts
|
|
220
|
+
var import_zod3 = __toESM(require("zod"));
|
|
221
|
+
var TunaPositionMintSchema = import_zod3.default.object({
|
|
222
|
+
addr: import_zod3.default.string(),
|
|
223
|
+
symbol: import_zod3.default.string(),
|
|
224
|
+
decimals: import_zod3.default.number()
|
|
225
|
+
});
|
|
226
|
+
var TunaPositionPoolSchema = import_zod3.default.object({
|
|
227
|
+
addr: import_zod3.default.string(),
|
|
228
|
+
price: import_zod3.default.number(),
|
|
229
|
+
tickSpacing: import_zod3.default.number()
|
|
230
|
+
});
|
|
231
|
+
var TunaPositionPoolToken = {
|
|
232
|
+
A: "a",
|
|
233
|
+
B: "b"
|
|
234
|
+
};
|
|
235
|
+
var TunaPositionPoolTokenSchema = import_zod3.default.enum(Object.values(TunaPositionPoolToken));
|
|
236
|
+
|
|
237
|
+
// src/client/schemas/lp_positions.ts
|
|
238
|
+
var LpPositionLimitOrderSwap = {
|
|
239
|
+
NO_SWAP: "no_swap",
|
|
240
|
+
SWAP_TO_TOKEN_A: "swap_to_token_a",
|
|
241
|
+
SWAP_TO_TOKEN_B: "swap_to_token_b"
|
|
242
|
+
};
|
|
243
|
+
var LpPositionAutoCompound = {
|
|
244
|
+
NO_AUTO_COMPOUND: "no_auto_compound",
|
|
245
|
+
AUTO_COMPOUND: "auto_compound",
|
|
246
|
+
AUTO_COMPOUND_WITH_LEVERAGE: "auto_compound_with_leverage"
|
|
247
|
+
};
|
|
248
|
+
var LpPositionRebalance = {
|
|
249
|
+
NO_REBALANCE: "no_rebalance",
|
|
250
|
+
AUTO_REBALANCE: "auto_rebalance"
|
|
251
|
+
};
|
|
252
|
+
var LpPositionsActionType = {
|
|
253
|
+
OPEN_POSITION: "open_position",
|
|
254
|
+
CLOSE_POSITION: "close_position",
|
|
255
|
+
INCREASE_LIQUIDITY: "increase_liquidity",
|
|
256
|
+
DECREASE_LIQUIDITY: "decrease_liquidity",
|
|
257
|
+
REPAY_DEBT: "repay_debt",
|
|
258
|
+
LIQUIDATE: "liquidate",
|
|
259
|
+
EXECUTE_LIMIT_ORDER: "execute_limit_order",
|
|
260
|
+
COLLECT_FEES: "collect_fees",
|
|
261
|
+
COLLECT_REWARDS: "collect_rewards",
|
|
262
|
+
COLLECT_AND_COMPOUND_FEES: "collect_and_compound_fees",
|
|
263
|
+
REBALANCE_POSITION: "rebalance_position",
|
|
264
|
+
SET_LIMIT_ORDERS: "set_limit_orders",
|
|
265
|
+
SET_FLAGS: "set_flags",
|
|
266
|
+
SET_REBALANCE_THRESHOLD: "set_rebalance_threshold"
|
|
267
|
+
};
|
|
268
|
+
var LpPositionLimitOrderSwapSchema = import_zod4.default.enum(Object.values(LpPositionLimitOrderSwap));
|
|
269
|
+
var LpPositionAutoCompoundSchema = import_zod4.default.enum(Object.values(LpPositionAutoCompound));
|
|
270
|
+
var LpPositionRebalanceSchema = import_zod4.default.enum(Object.values(LpPositionRebalance));
|
|
271
|
+
var LpPositionsActionTypeSchema = import_zod4.default.enum(Object.values(LpPositionsActionType));
|
|
272
|
+
var TunaPositionState = {
|
|
273
|
+
OPEN: "open",
|
|
274
|
+
LIQUIDATED: "liquidated",
|
|
275
|
+
CLOSED_BY_LIMIT_ORDER: "closed_by_limit_order",
|
|
276
|
+
CLOSED: "closed"
|
|
277
|
+
};
|
|
278
|
+
var TunaPositionStateSchema = import_zod4.default.enum([TunaPositionState.OPEN, ...Object.values(TunaPositionState)]);
|
|
279
|
+
var TunaLpPositionAutoCompounding = {
|
|
280
|
+
WITH_LEVERAGE: "with_leverage",
|
|
281
|
+
WITHOUT_LEVERAGE: "without_leverage"
|
|
282
|
+
};
|
|
283
|
+
var TunaLpPositionAutoCompoundingSchema = import_zod4.default.enum(
|
|
284
|
+
Object.values(TunaLpPositionAutoCompounding)
|
|
285
|
+
);
|
|
286
|
+
var TunaPositionTokenPnlSchema = import_zod4.default.object({
|
|
287
|
+
amount: import_zod4.default.coerce.bigint(),
|
|
288
|
+
bps: import_zod4.default.number()
|
|
289
|
+
});
|
|
290
|
+
var TunaLpPositionFlagsSchema = import_zod4.default.object({
|
|
291
|
+
lowerLimitOrderSwapToToken: import_zod4.default.nullable(TunaPositionPoolTokenSchema),
|
|
292
|
+
upperLimitOrderSwapToToken: import_zod4.default.nullable(TunaPositionPoolTokenSchema),
|
|
293
|
+
autoCompounding: import_zod4.default.nullable(TunaLpPositionAutoCompoundingSchema),
|
|
294
|
+
autoRebalancing: import_zod4.default.boolean()
|
|
295
|
+
});
|
|
296
|
+
var TunaLpPositionDtoSchema = import_zod4.default.object({
|
|
297
|
+
address: import_zod4.default.string(),
|
|
298
|
+
authority: import_zod4.default.string(),
|
|
299
|
+
version: import_zod4.default.number(),
|
|
300
|
+
state: TunaPositionStateSchema,
|
|
301
|
+
positionMint: import_zod4.default.string(),
|
|
302
|
+
liquidity: import_zod4.default.coerce.bigint(),
|
|
303
|
+
lowerPrice: import_zod4.default.number(),
|
|
304
|
+
upperPrice: import_zod4.default.number(),
|
|
305
|
+
lowerLimitOrderPrice: import_zod4.default.number(),
|
|
306
|
+
upperLimitOrderPrice: import_zod4.default.number(),
|
|
307
|
+
entryPrice: import_zod4.default.number(),
|
|
308
|
+
flags: TunaLpPositionFlagsSchema,
|
|
309
|
+
mintA: TunaPositionMintSchema,
|
|
310
|
+
mintB: TunaPositionMintSchema,
|
|
311
|
+
pool: TunaPositionPoolSchema,
|
|
312
|
+
marketMaker: PoolProviderSchema,
|
|
313
|
+
depositedCollateralA: AmountWithUsdSchema,
|
|
314
|
+
depositedCollateralB: AmountWithUsdSchema,
|
|
315
|
+
leverage: import_zod4.default.number(),
|
|
316
|
+
maxLeverage: import_zod4.default.number(),
|
|
317
|
+
liquidationPriceLower: import_zod4.default.number(),
|
|
318
|
+
liquidationPriceUpper: import_zod4.default.number(),
|
|
319
|
+
initialDebtA: AmountWithUsdSchema,
|
|
320
|
+
initialDebtB: AmountWithUsdSchema,
|
|
321
|
+
currentDebtA: AmountWithUsdSchema,
|
|
322
|
+
currentDebtB: AmountWithUsdSchema,
|
|
323
|
+
leftoversA: AmountWithUsdSchema,
|
|
324
|
+
leftoversB: AmountWithUsdSchema,
|
|
325
|
+
yieldA: AmountWithUsdSchema,
|
|
326
|
+
yieldB: AmountWithUsdSchema,
|
|
327
|
+
compoundedYieldA: AmountWithUsdSchema,
|
|
328
|
+
compoundedYieldB: AmountWithUsdSchema,
|
|
329
|
+
totalA: AmountWithUsdSchema,
|
|
330
|
+
totalB: AmountWithUsdSchema,
|
|
331
|
+
pnlA: TokensPnlSchema,
|
|
332
|
+
pnlB: TokensPnlSchema,
|
|
333
|
+
pnlUsd: UsdPnlSchema,
|
|
334
|
+
openedAt: import_zod4.default.coerce.date(),
|
|
335
|
+
closedAt: import_zod4.default.nullable(import_zod4.default.coerce.date())
|
|
336
|
+
});
|
|
337
|
+
var TunaLpPositionHistorical = import_zod4.default.object({
|
|
338
|
+
positionAddress: import_zod4.default.string(),
|
|
339
|
+
authority: import_zod4.default.string(),
|
|
340
|
+
pool: import_zod4.default.string(),
|
|
341
|
+
state: TunaPositionStateSchema,
|
|
342
|
+
lowerPrice: import_zod4.default.number(),
|
|
343
|
+
upperPrice: import_zod4.default.number(),
|
|
344
|
+
lowerLimitOrder: import_zod4.default.number().nullable(),
|
|
345
|
+
upperLimitOrder: import_zod4.default.number().nullable(),
|
|
346
|
+
marketMaker: PoolProviderSchema,
|
|
347
|
+
openedAt: import_zod4.default.coerce.date(),
|
|
348
|
+
closedAt: import_zod4.default.coerce.date().nullable(),
|
|
349
|
+
totalValueUsd: import_zod4.default.number(),
|
|
350
|
+
leverage: import_zod4.default.number(),
|
|
351
|
+
initialLeverage: import_zod4.default.number(),
|
|
352
|
+
totalDepositUsd: import_zod4.default.number(),
|
|
353
|
+
totalWithdrawnUsd: import_zod4.default.number(),
|
|
354
|
+
feesSumUsd: import_zod4.default.number(),
|
|
355
|
+
closedPnlSumUsd: import_zod4.default.number(),
|
|
356
|
+
entryPrice: import_zod4.default.number(),
|
|
357
|
+
exitPrice: import_zod4.default.number().nullable()
|
|
358
|
+
});
|
|
359
|
+
var TunaPositionLegacy = import_zod4.default.object({
|
|
360
|
+
address: import_zod4.default.string(),
|
|
361
|
+
authority: import_zod4.default.string(),
|
|
362
|
+
version: import_zod4.default.number(),
|
|
363
|
+
state: TunaPositionStateSchema,
|
|
364
|
+
positionMint: import_zod4.default.string(),
|
|
365
|
+
liquidity: import_zod4.default.coerce.bigint(),
|
|
366
|
+
tickLowerIndex: import_zod4.default.number(),
|
|
367
|
+
tickUpperIndex: import_zod4.default.number(),
|
|
368
|
+
entrySqrtPrice: import_zod4.default.coerce.bigint(),
|
|
369
|
+
lowerLimitOrderSqrtPrice: import_zod4.default.coerce.bigint(),
|
|
370
|
+
upperLimitOrderSqrtPrice: import_zod4.default.coerce.bigint(),
|
|
371
|
+
flags: import_zod4.default.number(),
|
|
372
|
+
pool: import_zod4.default.string(),
|
|
373
|
+
poolSqrtPrice: import_zod4.default.coerce.bigint(),
|
|
374
|
+
depositedCollateralA: AmountWithoutUsdSchema,
|
|
375
|
+
depositedCollateralB: AmountWithoutUsdSchema,
|
|
376
|
+
depositedCollateralUsd: import_zod4.default.object({
|
|
377
|
+
amount: import_zod4.default.number()
|
|
378
|
+
}),
|
|
379
|
+
loanFundsA: AmountWithUsdSchema,
|
|
380
|
+
loanFundsB: AmountWithUsdSchema,
|
|
381
|
+
currentLoanA: AmountWithUsdSchema,
|
|
382
|
+
currentLoanB: AmountWithUsdSchema,
|
|
383
|
+
leftoversA: AmountWithUsdSchema,
|
|
384
|
+
leftoversB: AmountWithUsdSchema,
|
|
385
|
+
yieldA: AmountWithUsdSchema,
|
|
386
|
+
yieldB: AmountWithUsdSchema,
|
|
387
|
+
compoundedYieldA: AmountWithUsdSchema,
|
|
388
|
+
compoundedYieldB: AmountWithUsdSchema,
|
|
389
|
+
totalA: AmountWithUsdSchema,
|
|
390
|
+
totalB: AmountWithUsdSchema,
|
|
391
|
+
pnlA: TokensPnlSchema,
|
|
392
|
+
pnlB: TokensPnlSchema,
|
|
393
|
+
pnlUsd: UsdPnlSchema,
|
|
394
|
+
openedAt: import_zod4.default.coerce.date(),
|
|
395
|
+
updatedAtSlot: import_zod4.default.coerce.bigint(),
|
|
396
|
+
closedAt: import_zod4.default.nullable(import_zod4.default.coerce.date())
|
|
397
|
+
});
|
|
398
|
+
var TunaLpPositionParameters = import_zod4.default.object({
|
|
399
|
+
lowerPrice: import_zod4.default.number(),
|
|
400
|
+
upperPrice: import_zod4.default.number(),
|
|
401
|
+
lowerLimitOrder: import_zod4.default.number().nullable(),
|
|
402
|
+
upperLimitOrder: import_zod4.default.number().nullable(),
|
|
403
|
+
lowerLimitOrderSwap: LpPositionLimitOrderSwapSchema,
|
|
404
|
+
upperLimitOrderSwap: LpPositionLimitOrderSwapSchema,
|
|
405
|
+
autoCompound: LpPositionAutoCompoundSchema,
|
|
406
|
+
rebalance: LpPositionRebalanceSchema,
|
|
407
|
+
rebalanceThresholdTicks: import_zod4.default.number()
|
|
408
|
+
});
|
|
409
|
+
var TunaLpPositionValue = import_zod4.default.object({
|
|
410
|
+
totalValueA: import_zod4.default.number(),
|
|
411
|
+
totalValueB: import_zod4.default.number(),
|
|
412
|
+
totalValueUsd: import_zod4.default.number(),
|
|
413
|
+
loanFundsA: import_zod4.default.number(),
|
|
414
|
+
loanFundsB: import_zod4.default.number(),
|
|
415
|
+
loanFundsUsd: import_zod4.default.number(),
|
|
416
|
+
leverage: import_zod4.default.number()
|
|
417
|
+
});
|
|
418
|
+
var TunaLpPositionTransfer = import_zod4.default.object({
|
|
419
|
+
amountA: import_zod4.default.number(),
|
|
420
|
+
amountB: import_zod4.default.number(),
|
|
421
|
+
amountUsd: import_zod4.default.number()
|
|
422
|
+
});
|
|
423
|
+
var TunaLpPositionTokenPrices = import_zod4.default.object({
|
|
424
|
+
tokenPriceA: import_zod4.default.number(),
|
|
425
|
+
tokenPriceB: import_zod4.default.number()
|
|
426
|
+
});
|
|
427
|
+
var TunaLpPositionActionOpen = import_zod4.default.object({
|
|
428
|
+
parameters: TunaLpPositionParameters
|
|
429
|
+
});
|
|
430
|
+
var TunaLpPositionActionClose = import_zod4.default.object({
|
|
431
|
+
toOwner: TunaLpPositionTransfer.nullable(),
|
|
432
|
+
prices: TunaLpPositionTokenPrices.nullable()
|
|
433
|
+
});
|
|
434
|
+
var TunaLpPositionActionIncreaseLiquidity = import_zod4.default.object({
|
|
435
|
+
fromPosition: TunaLpPositionValue.nullable(),
|
|
436
|
+
toPosition: TunaLpPositionValue,
|
|
437
|
+
fromOwner: TunaLpPositionTransfer,
|
|
438
|
+
fromLending: TunaLpPositionTransfer,
|
|
439
|
+
protocolFees: TunaLpPositionTransfer,
|
|
440
|
+
prices: TunaLpPositionTokenPrices
|
|
441
|
+
});
|
|
442
|
+
var TunaLpPositionActionDecreaseLiquidity = import_zod4.default.object({
|
|
443
|
+
withdrawPercent: import_zod4.default.number(),
|
|
444
|
+
closedPnlUsd: import_zod4.default.number(),
|
|
445
|
+
fromPosition: TunaLpPositionValue,
|
|
446
|
+
toPosition: TunaLpPositionValue.nullable(),
|
|
447
|
+
toOwner: TunaLpPositionTransfer,
|
|
448
|
+
toLending: TunaLpPositionTransfer,
|
|
449
|
+
collectedFees: TunaLpPositionTransfer,
|
|
450
|
+
prices: TunaLpPositionTokenPrices
|
|
451
|
+
});
|
|
452
|
+
var TunaLpPositionActionLiquidate = import_zod4.default.object({
|
|
453
|
+
withdrawPercent: import_zod4.default.number(),
|
|
454
|
+
fromPosition: TunaLpPositionValue,
|
|
455
|
+
toLending: TunaLpPositionTransfer,
|
|
456
|
+
protocolFees: TunaLpPositionTransfer,
|
|
457
|
+
prices: TunaLpPositionTokenPrices
|
|
458
|
+
});
|
|
459
|
+
var TunaLpPositionActionRepayDebt = import_zod4.default.object({
|
|
460
|
+
fromPosition: TunaLpPositionValue,
|
|
461
|
+
toPosition: TunaLpPositionValue,
|
|
462
|
+
fromOwner: TunaLpPositionTransfer,
|
|
463
|
+
toLending: TunaLpPositionTransfer,
|
|
464
|
+
prices: TunaLpPositionTokenPrices
|
|
465
|
+
});
|
|
466
|
+
var TunaLpPositionActionCollectFees = import_zod4.default.object({
|
|
467
|
+
closedPnlUsd: import_zod4.default.number(),
|
|
468
|
+
position: TunaLpPositionValue,
|
|
469
|
+
collectedFees: TunaLpPositionTransfer,
|
|
470
|
+
toOwner: TunaLpPositionTransfer,
|
|
471
|
+
prices: TunaLpPositionTokenPrices
|
|
472
|
+
});
|
|
473
|
+
var TunaLpPositionActionCollectAndCompoundFees = import_zod4.default.object({
|
|
474
|
+
fromPosition: TunaLpPositionValue,
|
|
475
|
+
toPosition: TunaLpPositionValue,
|
|
476
|
+
collectedFees: TunaLpPositionTransfer,
|
|
477
|
+
fromLending: TunaLpPositionTransfer,
|
|
478
|
+
protocolFees: TunaLpPositionTransfer,
|
|
479
|
+
prices: TunaLpPositionTokenPrices
|
|
480
|
+
});
|
|
481
|
+
var TunaLpPositionActionParametersUpdate = import_zod4.default.object({
|
|
482
|
+
fromParameters: TunaLpPositionParameters,
|
|
483
|
+
toParameters: TunaLpPositionParameters
|
|
484
|
+
});
|
|
485
|
+
var TunaLpPositionAction = import_zod4.default.object({
|
|
486
|
+
action: LpPositionsActionTypeSchema,
|
|
487
|
+
txSignature: import_zod4.default.string(),
|
|
488
|
+
txTimestamp: import_zod4.default.coerce.date(),
|
|
489
|
+
data: import_zod4.default.object({
|
|
490
|
+
/** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
|
|
491
|
+
fromPosition: TunaLpPositionValue.optional().nullable(),
|
|
492
|
+
/** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
|
|
493
|
+
toPosition: TunaLpPositionValue.optional().nullable(),
|
|
494
|
+
/** defined for: CollectFees */
|
|
495
|
+
position: TunaLpPositionValue.optional().nullable(),
|
|
496
|
+
/** defined for: IncreaseLiquidity, RepayDebt */
|
|
497
|
+
fromOwner: TunaLpPositionTransfer.optional(),
|
|
498
|
+
/** defined for: DecreaseLiquidity, CollectFees, ClosePosition; nullable for: ClosePosition */
|
|
499
|
+
toOwner: TunaLpPositionTransfer.optional().nullable(),
|
|
500
|
+
/** defined for: IncreaseLiquidity, CollectAndCompoundFees */
|
|
501
|
+
fromLending: TunaLpPositionTransfer.optional(),
|
|
502
|
+
/** defined for: DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt */
|
|
503
|
+
toLending: TunaLpPositionTransfer.optional(),
|
|
504
|
+
/** defined for: CollectFees, CollectAndCompoundFees */
|
|
505
|
+
collectedFees: TunaLpPositionTransfer.optional(),
|
|
506
|
+
/** defined for: IncreaseLiquidity, Liquidate, ExecuteLimitOrder, CollectAndCompoundFees */
|
|
507
|
+
protocolFees: TunaLpPositionTransfer.optional(),
|
|
508
|
+
/** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectFees, CollectAndCompoundFees, ClosePosition; nullable for: ClosePosition */
|
|
509
|
+
prices: TunaLpPositionTokenPrices.optional().nullable(),
|
|
510
|
+
/** defined for: OpenPosition */
|
|
511
|
+
parameters: TunaLpPositionParameters.optional(),
|
|
512
|
+
/** defined for: ParametersUpdate */
|
|
513
|
+
fromParameters: TunaLpPositionParameters.optional(),
|
|
514
|
+
/** defined for: ParametersUpdate */
|
|
515
|
+
toParameters: TunaLpPositionParameters.optional(),
|
|
516
|
+
/** defined for: DecreaseLiquidity */
|
|
517
|
+
withdrawPercent: import_zod4.default.number().optional(),
|
|
518
|
+
/** defined for: DecreaseLiquidity, CollectFees */
|
|
519
|
+
closedPnlUsd: import_zod4.default.number().optional()
|
|
520
|
+
})
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
// src/client/schemas/spot_positions.ts
|
|
524
|
+
var import_zod5 = require("zod");
|
|
525
|
+
var TunaSpotPositionState = {
|
|
526
|
+
OPEN: "open",
|
|
527
|
+
CLOSED: "closed"
|
|
528
|
+
};
|
|
529
|
+
var TunaSpotPositionStateSchema = import_zod5.z.enum([
|
|
530
|
+
TunaSpotPositionState.OPEN,
|
|
531
|
+
...Object.values(TunaSpotPositionState)
|
|
532
|
+
]);
|
|
533
|
+
var TunaSpotPosition = import_zod5.z.object({
|
|
534
|
+
address: import_zod5.z.string(),
|
|
535
|
+
authority: import_zod5.z.string(),
|
|
536
|
+
version: import_zod5.z.number(),
|
|
537
|
+
state: TunaSpotPositionStateSchema,
|
|
538
|
+
lowerLimitOrderPrice: import_zod5.z.number(),
|
|
539
|
+
upperLimitOrderPrice: import_zod5.z.number(),
|
|
540
|
+
entryPrice: import_zod5.z.number(),
|
|
541
|
+
mintA: TunaPositionMintSchema,
|
|
542
|
+
mintB: TunaPositionMintSchema,
|
|
543
|
+
pool: TunaPositionPoolSchema,
|
|
544
|
+
positionToken: TunaPositionPoolToken,
|
|
545
|
+
collateralToken: TunaPositionPoolToken,
|
|
546
|
+
marketMaker: PoolProviderSchema,
|
|
547
|
+
depositedCollateral: AmountWithUsdSchema,
|
|
548
|
+
initialDebt: AmountWithUsdSchema,
|
|
549
|
+
currentDebt: AmountWithUsdSchema,
|
|
550
|
+
total: AmountWithUsdSchema,
|
|
551
|
+
leverage: import_zod5.z.number(),
|
|
552
|
+
maxLeverage: import_zod5.z.number(),
|
|
553
|
+
liquidationPrice: import_zod5.z.number(),
|
|
554
|
+
pnlUsd: UsdPnlSchema,
|
|
555
|
+
openedAt: import_zod5.z.coerce.date(),
|
|
556
|
+
closedAt: import_zod5.z.nullable(import_zod5.z.coerce.date())
|
|
557
|
+
});
|
|
558
|
+
var IncreaseSpotPositionQuote = import_zod5.z.object({
|
|
559
|
+
/** Required collateral amount */
|
|
560
|
+
collateralAmount: import_zod5.z.coerce.bigint(),
|
|
561
|
+
/** Required amount to borrow */
|
|
562
|
+
borrowAmount: import_zod5.z.coerce.bigint(),
|
|
563
|
+
/** Estimated position size in the position token. */
|
|
564
|
+
estimatedAmount: import_zod5.z.coerce.bigint(),
|
|
565
|
+
/** Swap input amount. */
|
|
566
|
+
swapInputAmount: import_zod5.z.coerce.bigint(),
|
|
567
|
+
/** Minimum swap output amount according to the provided slippage. */
|
|
568
|
+
minSwapOutputAmount: import_zod5.z.coerce.bigint(),
|
|
569
|
+
/** Protocol fee in token A */
|
|
570
|
+
protocolFeeA: import_zod5.z.coerce.bigint(),
|
|
571
|
+
/** Protocol fee in token B */
|
|
572
|
+
protocolFeeB: import_zod5.z.coerce.bigint(),
|
|
573
|
+
/** Price impact in percents */
|
|
574
|
+
priceImpact: import_zod5.z.number(),
|
|
575
|
+
/** Liquidation price */
|
|
576
|
+
liquidationPrice: import_zod5.z.number()
|
|
577
|
+
});
|
|
578
|
+
var DecreaseSpotPositionQuote = import_zod5.z.object({
|
|
579
|
+
/** Confirmed position decrease percentage (100% = 1.0) */
|
|
580
|
+
decreasePercent: import_zod5.z.number(),
|
|
581
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
582
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
583
|
+
*/
|
|
584
|
+
requiredSwapAmount: import_zod5.z.coerce.bigint(),
|
|
585
|
+
/** Estimated total amount of the adjusted position */
|
|
586
|
+
estimatedAmount: import_zod5.z.coerce.bigint(),
|
|
587
|
+
/** Estimated amount of the withdrawn collateral */
|
|
588
|
+
estimatedWithdrawnCollateral: import_zod5.z.coerce.bigint(),
|
|
589
|
+
/** Price impact in percents */
|
|
590
|
+
priceImpact: import_zod5.z.number(),
|
|
591
|
+
/** Liquidation price */
|
|
592
|
+
liquidationPrice: import_zod5.z.number()
|
|
593
|
+
});
|
|
594
|
+
var CloseSpotPositionQuote = import_zod5.z.object({
|
|
595
|
+
/** Position decrease percentage */
|
|
596
|
+
decreasePercent: import_zod5.z.number(),
|
|
597
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
598
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
599
|
+
*/
|
|
600
|
+
requiredSwapAmount: import_zod5.z.coerce.bigint(),
|
|
601
|
+
/** Estimated amount of the withdrawn collateral */
|
|
602
|
+
estimatedWithdrawnCollateral: import_zod5.z.coerce.bigint(),
|
|
603
|
+
/** Price impact in percents */
|
|
604
|
+
priceImpact: import_zod5.z.number()
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
// src/client/schemas/state_snapshot.ts
|
|
608
|
+
var import_zod6 = __toESM(require("zod"));
|
|
609
|
+
var PoolPriceUpdate = import_zod6.default.object({
|
|
610
|
+
pool: import_zod6.default.string(),
|
|
611
|
+
price: import_zod6.default.number(),
|
|
612
|
+
sqrtPrice: import_zod6.default.coerce.bigint(),
|
|
613
|
+
time: import_zod6.default.coerce.date()
|
|
144
614
|
});
|
|
615
|
+
var StateSnapshot = import_zod6.default.object({
|
|
616
|
+
slot: import_zod6.default.coerce.bigint(),
|
|
617
|
+
blockTime: import_zod6.default.coerce.date(),
|
|
618
|
+
poolPrices: import_zod6.default.optional(import_zod6.default.record(import_zod6.default.string(), PoolPriceUpdate)),
|
|
619
|
+
tunaSpotPositions: import_zod6.default.optional(import_zod6.default.array(TunaSpotPosition)),
|
|
620
|
+
tunaLpPositions: import_zod6.default.optional(import_zod6.default.array(TunaLpPositionDtoSchema)),
|
|
621
|
+
fusionLimitOrders: import_zod6.default.optional(import_zod6.default.array(LimitOrder))
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
// src/client/schemas.ts
|
|
145
625
|
var NotificationEntity = {
|
|
146
626
|
POOL_SWAP: "pool_swap",
|
|
147
627
|
POOL_PRICE: "pool_price",
|
|
@@ -159,27 +639,6 @@ var NotificationAction = {
|
|
|
159
639
|
CREATE: "create",
|
|
160
640
|
UPDATE: "update"
|
|
161
641
|
};
|
|
162
|
-
var PoolProvider = {
|
|
163
|
-
ORCA: "orca",
|
|
164
|
-
FUSION: "fusion"
|
|
165
|
-
};
|
|
166
|
-
var TunaPositionState = {
|
|
167
|
-
OPEN: "open",
|
|
168
|
-
LIQUIDATED: "liquidated",
|
|
169
|
-
CLOSED_BY_LIMIT_ORDER: "closed_by_limit_order",
|
|
170
|
-
CLOSED: "closed"
|
|
171
|
-
};
|
|
172
|
-
var TunaSpotPositionState = {
|
|
173
|
-
OPEN: "open",
|
|
174
|
-
CLOSED: "closed"
|
|
175
|
-
};
|
|
176
|
-
var LimitOrderState = {
|
|
177
|
-
OPEN: "open",
|
|
178
|
-
PARTIALLY_FILLED: "partially_filled",
|
|
179
|
-
FILLED: "filled",
|
|
180
|
-
COMPLETE: "complete",
|
|
181
|
-
CANCELLED: "cancelled"
|
|
182
|
-
};
|
|
183
642
|
var TradeHistoryAction = {
|
|
184
643
|
SWAP: "swap",
|
|
185
644
|
LIMIT_ORDER_FILL: "limit_order_fill",
|
|
@@ -239,99 +698,91 @@ var WalletSubscriptionTopic = {
|
|
|
239
698
|
TRADE_HISTORY: "trade_history",
|
|
240
699
|
ORDER_HISTORY: "order_history"
|
|
241
700
|
};
|
|
242
|
-
var NotificationEntitySchema =
|
|
243
|
-
var NotificationActionSchema =
|
|
244
|
-
var
|
|
245
|
-
var
|
|
246
|
-
var TunaSpotPositionStateSchema = import_zod.z.enum([
|
|
247
|
-
TunaSpotPositionState.OPEN,
|
|
248
|
-
...Object.values(TunaSpotPositionState)
|
|
249
|
-
]);
|
|
250
|
-
var LimitOrderStateSchema = import_zod.z.enum([LimitOrderState.OPEN, ...Object.values(LimitOrderState)]);
|
|
251
|
-
var TradeHistoryActionSchema = import_zod.z.enum([TradeHistoryAction.SWAP, ...Object.values(TradeHistoryAction)]);
|
|
252
|
-
var TradeHistoryUIDirectionSchema = import_zod.z.enum([
|
|
701
|
+
var NotificationEntitySchema = import_zod7.z.enum([NotificationEntity.POOL_SWAP, ...Object.values(NotificationEntity)]);
|
|
702
|
+
var NotificationActionSchema = import_zod7.z.enum([NotificationAction.CREATE, ...Object.values(NotificationAction)]);
|
|
703
|
+
var TradeHistoryActionSchema = import_zod7.z.enum([TradeHistoryAction.SWAP, ...Object.values(TradeHistoryAction)]);
|
|
704
|
+
var TradeHistoryUIDirectionSchema = import_zod7.z.enum([
|
|
253
705
|
TradeHistoryUIDirection.BUY,
|
|
254
706
|
...Object.values(TradeHistoryUIDirection)
|
|
255
707
|
]);
|
|
256
|
-
var OrderHistoryOrderTypeSchema =
|
|
708
|
+
var OrderHistoryOrderTypeSchema = import_zod7.z.enum([
|
|
257
709
|
OrderHistoryOrderType.MARKET,
|
|
258
710
|
...Object.values(OrderHistoryOrderType)
|
|
259
711
|
]);
|
|
260
|
-
var OrderHistoryStatusSchema =
|
|
261
|
-
var OrderHistoryUIDirectionSchema =
|
|
712
|
+
var OrderHistoryStatusSchema = import_zod7.z.enum([OrderHistoryStatus.OPEN, ...Object.values(OrderHistoryStatus)]);
|
|
713
|
+
var OrderHistoryUIDirectionSchema = import_zod7.z.enum([
|
|
262
714
|
OrderHistoryUIDirection.BUY,
|
|
263
715
|
...Object.values(OrderHistoryUIDirection)
|
|
264
716
|
]);
|
|
265
|
-
var StakingPositionHistoryActionTypeSchema =
|
|
717
|
+
var StakingPositionHistoryActionTypeSchema = import_zod7.z.enum([
|
|
266
718
|
StakingPositionHistoryActionType.STAKE,
|
|
267
719
|
...Object.values(StakingPositionHistoryActionType)
|
|
268
720
|
]);
|
|
269
|
-
var PoolSubscriptionTopicSchema =
|
|
721
|
+
var PoolSubscriptionTopicSchema = import_zod7.z.enum([
|
|
270
722
|
PoolSubscriptionTopic.ORDER_BOOK,
|
|
271
723
|
...Object.values(PoolSubscriptionTopic)
|
|
272
724
|
]);
|
|
273
|
-
var WalletSubscriptionTopicSchema =
|
|
725
|
+
var WalletSubscriptionTopicSchema = import_zod7.z.enum([
|
|
274
726
|
WalletSubscriptionTopic.TUNA_POSITIONS,
|
|
275
727
|
...Object.values(WalletSubscriptionTopic)
|
|
276
728
|
]);
|
|
277
|
-
var PaginationMeta =
|
|
278
|
-
total:
|
|
279
|
-
});
|
|
280
|
-
var Mint =
|
|
281
|
-
symbol:
|
|
282
|
-
mint:
|
|
283
|
-
logo:
|
|
284
|
-
decimals:
|
|
285
|
-
});
|
|
286
|
-
var Market =
|
|
287
|
-
address:
|
|
288
|
-
addressLookupTable:
|
|
289
|
-
poolAddress:
|
|
290
|
-
poolFeeRate:
|
|
729
|
+
var PaginationMeta = import_zod7.z.object({
|
|
730
|
+
total: import_zod7.z.number()
|
|
731
|
+
});
|
|
732
|
+
var Mint = import_zod7.z.object({
|
|
733
|
+
symbol: import_zod7.z.string(),
|
|
734
|
+
mint: import_zod7.z.string(),
|
|
735
|
+
logo: import_zod7.z.string(),
|
|
736
|
+
decimals: import_zod7.z.number()
|
|
737
|
+
});
|
|
738
|
+
var Market = import_zod7.z.object({
|
|
739
|
+
address: import_zod7.z.string(),
|
|
740
|
+
addressLookupTable: import_zod7.z.string(),
|
|
741
|
+
poolAddress: import_zod7.z.string(),
|
|
742
|
+
poolFeeRate: import_zod7.z.number(),
|
|
291
743
|
provider: PoolProviderSchema,
|
|
292
|
-
maxLeverage:
|
|
293
|
-
maxSwapSlippage:
|
|
294
|
-
protocolFee:
|
|
295
|
-
rebalanceProtocolFee:
|
|
296
|
-
protocolFeeOnCollateral:
|
|
297
|
-
liquidationFee:
|
|
298
|
-
liquidationThreshold:
|
|
299
|
-
oraclePriceDeviationThreshold:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
date: import_zod.z.preprocess((val, ctx) => {
|
|
744
|
+
maxLeverage: import_zod7.z.number(),
|
|
745
|
+
maxSwapSlippage: import_zod7.z.number(),
|
|
746
|
+
protocolFee: import_zod7.z.number(),
|
|
747
|
+
rebalanceProtocolFee: import_zod7.z.number(),
|
|
748
|
+
protocolFeeOnCollateral: import_zod7.z.number(),
|
|
749
|
+
liquidationFee: import_zod7.z.number(),
|
|
750
|
+
liquidationThreshold: import_zod7.z.number(),
|
|
751
|
+
oraclePriceDeviationThreshold: import_zod7.z.number(),
|
|
752
|
+
maxSpotPositionSizeA: AmountWithUsdSchema,
|
|
753
|
+
maxSpotPositionSizeB: AmountWithUsdSchema,
|
|
754
|
+
borrowedFundsA: AmountWithUsdSchema,
|
|
755
|
+
borrowedFundsB: AmountWithUsdSchema,
|
|
756
|
+
availableBorrowA: AmountWithUsdSchema,
|
|
757
|
+
availableBorrowB: AmountWithUsdSchema,
|
|
758
|
+
borrowLimitA: AmountWithUsdSchema,
|
|
759
|
+
borrowLimitB: AmountWithUsdSchema,
|
|
760
|
+
disabled: import_zod7.z.boolean(),
|
|
761
|
+
createdAt: import_zod7.z.coerce.date()
|
|
762
|
+
});
|
|
763
|
+
var TokenOraclePrice = import_zod7.z.object({
|
|
764
|
+
mint: import_zod7.z.string(),
|
|
765
|
+
price: import_zod7.z.coerce.bigint(),
|
|
766
|
+
decimals: import_zod7.z.number(),
|
|
767
|
+
time: import_zod7.z.coerce.date()
|
|
768
|
+
});
|
|
769
|
+
var Vault = import_zod7.z.object({
|
|
770
|
+
address: import_zod7.z.string(),
|
|
771
|
+
mint: import_zod7.z.string(),
|
|
772
|
+
depositedFunds: AmountWithUsdSchema,
|
|
773
|
+
borrowedFunds: AmountWithUsdSchema,
|
|
774
|
+
supplyLimit: AmountWithUsdSchema,
|
|
775
|
+
borrowedShares: import_zod7.z.coerce.bigint(),
|
|
776
|
+
depositedShares: import_zod7.z.coerce.bigint(),
|
|
777
|
+
supplyApy: import_zod7.z.number(),
|
|
778
|
+
borrowApy: import_zod7.z.number(),
|
|
779
|
+
interestRate: import_zod7.z.coerce.bigint(),
|
|
780
|
+
utilization: import_zod7.z.number(),
|
|
781
|
+
pythOracleFeedId: import_zod7.z.string(),
|
|
782
|
+
pythOraclePriceUpdate: import_zod7.z.string()
|
|
783
|
+
});
|
|
784
|
+
var VaultHistoricalStats = import_zod7.z.object({
|
|
785
|
+
date: import_zod7.z.preprocess((val, ctx) => {
|
|
335
786
|
if (typeof val === "string") {
|
|
336
787
|
const [year, month, day] = val.split("-").map(Number);
|
|
337
788
|
return new Date(year, month - 1, day);
|
|
@@ -340,419 +791,277 @@ var VaultHistoricalStats = import_zod.z.object({
|
|
|
340
791
|
code: "custom",
|
|
341
792
|
message: "Not a valid date string"
|
|
342
793
|
});
|
|
343
|
-
return
|
|
344
|
-
},
|
|
345
|
-
supply:
|
|
346
|
-
borrow:
|
|
347
|
-
supplyApy:
|
|
348
|
-
borrowApr:
|
|
349
|
-
});
|
|
350
|
-
var Pool =
|
|
351
|
-
address:
|
|
794
|
+
return import_zod7.z.NEVER;
|
|
795
|
+
}, import_zod7.z.date()),
|
|
796
|
+
supply: AmountWithUsdSchema,
|
|
797
|
+
borrow: AmountWithUsdSchema,
|
|
798
|
+
supplyApy: import_zod7.z.number(),
|
|
799
|
+
borrowApr: import_zod7.z.number()
|
|
800
|
+
});
|
|
801
|
+
var Pool = import_zod7.z.object({
|
|
802
|
+
address: import_zod7.z.string(),
|
|
352
803
|
provider: PoolProviderSchema,
|
|
353
|
-
tokenAMint:
|
|
354
|
-
tokenBMint:
|
|
355
|
-
tokenAVault:
|
|
356
|
-
tokenBVault:
|
|
357
|
-
tvlUsdc:
|
|
358
|
-
priceChange24H:
|
|
359
|
-
tickSpacing:
|
|
360
|
-
feeRate:
|
|
361
|
-
olpFeeRate:
|
|
362
|
-
protocolFeeRate:
|
|
363
|
-
liquidity:
|
|
364
|
-
sqrtPrice:
|
|
365
|
-
tickCurrentIndex:
|
|
366
|
-
stats:
|
|
367
|
-
"24h":
|
|
368
|
-
volume:
|
|
369
|
-
fees:
|
|
370
|
-
rewards:
|
|
371
|
-
yieldOverTvl:
|
|
804
|
+
tokenAMint: import_zod7.z.string(),
|
|
805
|
+
tokenBMint: import_zod7.z.string(),
|
|
806
|
+
tokenAVault: import_zod7.z.string(),
|
|
807
|
+
tokenBVault: import_zod7.z.string(),
|
|
808
|
+
tvlUsdc: import_zod7.z.coerce.number(),
|
|
809
|
+
priceChange24H: import_zod7.z.number(),
|
|
810
|
+
tickSpacing: import_zod7.z.number(),
|
|
811
|
+
feeRate: import_zod7.z.number(),
|
|
812
|
+
olpFeeRate: import_zod7.z.nullable(import_zod7.z.number()),
|
|
813
|
+
protocolFeeRate: import_zod7.z.number(),
|
|
814
|
+
liquidity: import_zod7.z.coerce.bigint(),
|
|
815
|
+
sqrtPrice: import_zod7.z.coerce.bigint(),
|
|
816
|
+
tickCurrentIndex: import_zod7.z.number(),
|
|
817
|
+
stats: import_zod7.z.object({
|
|
818
|
+
"24h": import_zod7.z.object({
|
|
819
|
+
volume: import_zod7.z.coerce.number(),
|
|
820
|
+
fees: import_zod7.z.coerce.number(),
|
|
821
|
+
rewards: import_zod7.z.coerce.number(),
|
|
822
|
+
yieldOverTvl: import_zod7.z.coerce.number()
|
|
372
823
|
}),
|
|
373
|
-
"7d":
|
|
374
|
-
volume:
|
|
375
|
-
fees:
|
|
376
|
-
rewards:
|
|
377
|
-
yieldOverTvl:
|
|
824
|
+
"7d": import_zod7.z.object({
|
|
825
|
+
volume: import_zod7.z.coerce.number(),
|
|
826
|
+
fees: import_zod7.z.coerce.number(),
|
|
827
|
+
rewards: import_zod7.z.coerce.number(),
|
|
828
|
+
yieldOverTvl: import_zod7.z.coerce.number()
|
|
378
829
|
}),
|
|
379
|
-
"30d":
|
|
380
|
-
volume:
|
|
381
|
-
fees:
|
|
382
|
-
rewards:
|
|
383
|
-
yieldOverTvl:
|
|
830
|
+
"30d": import_zod7.z.object({
|
|
831
|
+
volume: import_zod7.z.coerce.number(),
|
|
832
|
+
fees: import_zod7.z.coerce.number(),
|
|
833
|
+
rewards: import_zod7.z.coerce.number(),
|
|
834
|
+
yieldOverTvl: import_zod7.z.coerce.number()
|
|
384
835
|
})
|
|
385
836
|
})
|
|
386
837
|
});
|
|
387
|
-
var Tick =
|
|
388
|
-
index:
|
|
389
|
-
liquidity:
|
|
838
|
+
var Tick = import_zod7.z.object({
|
|
839
|
+
index: import_zod7.z.number(),
|
|
840
|
+
liquidity: import_zod7.z.coerce.bigint()
|
|
390
841
|
});
|
|
391
|
-
var PoolTicks =
|
|
392
|
-
tickSpacing:
|
|
842
|
+
var PoolTicks = import_zod7.z.object({
|
|
843
|
+
tickSpacing: import_zod7.z.number(),
|
|
393
844
|
ticks: Tick.array()
|
|
394
845
|
});
|
|
395
|
-
var LendingPosition =
|
|
396
|
-
address:
|
|
397
|
-
authority:
|
|
398
|
-
mint:
|
|
399
|
-
vault:
|
|
400
|
-
shares:
|
|
401
|
-
funds:
|
|
402
|
-
earned:
|
|
403
|
-
});
|
|
404
|
-
var
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
currentLoanA: amountWithUsd,
|
|
427
|
-
currentLoanB: amountWithUsd,
|
|
428
|
-
leftoversA: amountWithUsd,
|
|
429
|
-
leftoversB: amountWithUsd,
|
|
430
|
-
yieldA: amountWithUsd,
|
|
431
|
-
yieldB: amountWithUsd,
|
|
432
|
-
compoundedYieldA: amountWithUsd,
|
|
433
|
-
compoundedYieldB: amountWithUsd,
|
|
434
|
-
totalA: amountWithUsd,
|
|
435
|
-
totalB: amountWithUsd,
|
|
436
|
-
pnlA: tokensPnl,
|
|
437
|
-
pnlB: tokensPnl,
|
|
438
|
-
pnlUsd: usdPnl,
|
|
439
|
-
openedAt: import_zod.z.coerce.date(),
|
|
440
|
-
updatedAtSlot: import_zod.z.coerce.bigint(),
|
|
441
|
-
closedAt: import_zod.z.nullable(import_zod.z.coerce.date())
|
|
442
|
-
});
|
|
443
|
-
var TunaSpotPosition = import_zod.z.object({
|
|
444
|
-
address: import_zod.z.string(),
|
|
445
|
-
authority: import_zod.z.string(),
|
|
446
|
-
version: import_zod.z.number(),
|
|
447
|
-
state: TunaSpotPositionStateSchema,
|
|
448
|
-
entrySqrtPrice: import_zod.z.coerce.bigint(),
|
|
449
|
-
lowerLimitOrderSqrtPrice: import_zod.z.coerce.bigint(),
|
|
450
|
-
upperLimitOrderSqrtPrice: import_zod.z.coerce.bigint(),
|
|
451
|
-
flags: import_zod.z.number(),
|
|
452
|
-
pool: import_zod.z.string(),
|
|
453
|
-
poolSqrtPrice: import_zod.z.coerce.bigint(),
|
|
454
|
-
collateralToken: import_zod.z.string(),
|
|
455
|
-
borrowToken: import_zod.z.string(),
|
|
456
|
-
positionToken: import_zod.z.string(),
|
|
457
|
-
collateral: amountWithUsd,
|
|
458
|
-
loanFunds: amountWithUsd,
|
|
459
|
-
currentLoan: amountWithUsd,
|
|
460
|
-
total: amountWithUsd,
|
|
461
|
-
uiLiquidationPrice: import_zod.z.nullable(import_zod.z.number()),
|
|
462
|
-
pnlUsd: usdPnl,
|
|
463
|
-
leverage: import_zod.z.number(),
|
|
464
|
-
openedAt: import_zod.z.coerce.date(),
|
|
465
|
-
openedAtSlot: import_zod.z.coerce.bigint(),
|
|
466
|
-
updatedAtSlot: import_zod.z.coerce.bigint(),
|
|
467
|
-
closedAt: import_zod.z.nullable(import_zod.z.coerce.date())
|
|
468
|
-
});
|
|
469
|
-
var PoolSwap = import_zod.z.object({
|
|
470
|
-
id: import_zod.z.string(),
|
|
471
|
-
amountIn: import_zod.z.coerce.bigint(),
|
|
472
|
-
amountOut: import_zod.z.coerce.bigint(),
|
|
473
|
-
amountUsd: import_zod.z.number(),
|
|
474
|
-
aToB: import_zod.z.boolean(),
|
|
475
|
-
pool: import_zod.z.string(),
|
|
476
|
-
time: import_zod.z.coerce.date()
|
|
477
|
-
});
|
|
478
|
-
var OrderBookEntry = import_zod.z.object({
|
|
479
|
-
concentratedAmount: import_zod.z.coerce.bigint(),
|
|
480
|
-
concentratedAmountQuote: import_zod.z.coerce.bigint(),
|
|
481
|
-
concentratedTotal: import_zod.z.coerce.bigint(),
|
|
482
|
-
concentratedTotalQuote: import_zod.z.coerce.bigint(),
|
|
483
|
-
limitAmount: import_zod.z.coerce.bigint(),
|
|
484
|
-
limitAmountQuote: import_zod.z.coerce.bigint(),
|
|
485
|
-
limitTotal: import_zod.z.coerce.bigint(),
|
|
486
|
-
limitTotalQuote: import_zod.z.coerce.bigint(),
|
|
487
|
-
price: import_zod.z.number(),
|
|
488
|
-
askSide: import_zod.z.boolean()
|
|
489
|
-
});
|
|
490
|
-
var PoolPriceUpdate = import_zod.z.object({
|
|
491
|
-
pool: import_zod.z.string(),
|
|
492
|
-
price: import_zod.z.number(),
|
|
493
|
-
sqrtPrice: import_zod.z.coerce.bigint(),
|
|
494
|
-
time: import_zod.z.coerce.date()
|
|
495
|
-
});
|
|
496
|
-
var OrderBook = import_zod.z.object({
|
|
846
|
+
var LendingPosition = import_zod7.z.object({
|
|
847
|
+
address: import_zod7.z.string(),
|
|
848
|
+
authority: import_zod7.z.string(),
|
|
849
|
+
mint: import_zod7.z.string(),
|
|
850
|
+
vault: import_zod7.z.string(),
|
|
851
|
+
shares: import_zod7.z.coerce.bigint(),
|
|
852
|
+
funds: AmountWithUsdSchema,
|
|
853
|
+
earned: AmountWithUsdSchema
|
|
854
|
+
});
|
|
855
|
+
var PoolSwap = import_zod7.z.object({
|
|
856
|
+
id: import_zod7.z.string(),
|
|
857
|
+
amountIn: import_zod7.z.coerce.bigint(),
|
|
858
|
+
amountOut: import_zod7.z.coerce.bigint(),
|
|
859
|
+
amountUsd: import_zod7.z.number(),
|
|
860
|
+
aToB: import_zod7.z.boolean(),
|
|
861
|
+
pool: import_zod7.z.string(),
|
|
862
|
+
time: import_zod7.z.coerce.date()
|
|
863
|
+
});
|
|
864
|
+
var OrderBookEntry = import_zod7.z.object({
|
|
865
|
+
concentratedAmount: import_zod7.z.coerce.bigint(),
|
|
866
|
+
concentratedAmountQuote: import_zod7.z.coerce.bigint(),
|
|
867
|
+
concentratedTotal: import_zod7.z.coerce.bigint(),
|
|
868
|
+
concentratedTotalQuote: import_zod7.z.coerce.bigint(),
|
|
869
|
+
limitAmount: import_zod7.z.coerce.bigint(),
|
|
870
|
+
limitAmountQuote: import_zod7.z.coerce.bigint(),
|
|
871
|
+
limitTotal: import_zod7.z.coerce.bigint(),
|
|
872
|
+
limitTotalQuote: import_zod7.z.coerce.bigint(),
|
|
873
|
+
price: import_zod7.z.number(),
|
|
874
|
+
askSide: import_zod7.z.boolean()
|
|
875
|
+
});
|
|
876
|
+
var OrderBook = import_zod7.z.object({
|
|
497
877
|
entries: OrderBookEntry.array(),
|
|
498
|
-
poolPrice:
|
|
878
|
+
poolPrice: import_zod7.z.number()
|
|
499
879
|
});
|
|
500
|
-
var
|
|
501
|
-
address: import_zod.z.string(),
|
|
502
|
-
mint: import_zod.z.string(),
|
|
503
|
-
pool: import_zod.z.string(),
|
|
504
|
-
state: LimitOrderStateSchema,
|
|
505
|
-
aToB: import_zod.z.boolean(),
|
|
506
|
-
tickIndex: import_zod.z.number(),
|
|
507
|
-
fillRatio: import_zod.z.number(),
|
|
508
|
-
openTxSignature: import_zod.z.string(),
|
|
509
|
-
closeTxSignature: import_zod.z.nullable(import_zod.z.string()),
|
|
510
|
-
amountIn: amountWithUsd,
|
|
511
|
-
amountOut: amountWithUsd,
|
|
512
|
-
openedAt: import_zod.z.coerce.date(),
|
|
513
|
-
closedAt: import_zod.z.nullable(import_zod.z.coerce.date())
|
|
514
|
-
});
|
|
515
|
-
var TradeHistoryEntry = import_zod.z.object({
|
|
880
|
+
var TradeHistoryEntry = import_zod7.z.object({
|
|
516
881
|
// Internal entry ID
|
|
517
|
-
id:
|
|
518
|
-
pool:
|
|
519
|
-
authority:
|
|
520
|
-
aToB:
|
|
882
|
+
id: import_zod7.z.string(),
|
|
883
|
+
pool: import_zod7.z.string(),
|
|
884
|
+
authority: import_zod7.z.string(),
|
|
885
|
+
aToB: import_zod7.z.boolean(),
|
|
521
886
|
// Trade action which created entry
|
|
522
887
|
action: TradeHistoryActionSchema,
|
|
523
888
|
// Trade direction formatted for ui display
|
|
524
889
|
uiDirection: TradeHistoryUIDirectionSchema,
|
|
525
890
|
// Trade price formatted for ui display
|
|
526
|
-
uiPrice:
|
|
527
|
-
baseToken:
|
|
528
|
-
quoteToken:
|
|
529
|
-
fee:
|
|
530
|
-
pnl:
|
|
531
|
-
|
|
532
|
-
usd:
|
|
533
|
-
bps:
|
|
891
|
+
uiPrice: import_zod7.z.number(),
|
|
892
|
+
baseToken: AmountWithUsdSchema,
|
|
893
|
+
quoteToken: AmountWithUsdSchema,
|
|
894
|
+
fee: AmountWithUsdSchema,
|
|
895
|
+
pnl: import_zod7.z.nullable(
|
|
896
|
+
import_zod7.z.object({
|
|
897
|
+
usd: import_zod7.z.number(),
|
|
898
|
+
bps: import_zod7.z.number()
|
|
534
899
|
})
|
|
535
900
|
),
|
|
536
|
-
txSignature:
|
|
537
|
-
positionAddress:
|
|
538
|
-
slot:
|
|
539
|
-
ts:
|
|
901
|
+
txSignature: import_zod7.z.nullable(import_zod7.z.string()),
|
|
902
|
+
positionAddress: import_zod7.z.nullable(import_zod7.z.string()),
|
|
903
|
+
slot: import_zod7.z.coerce.bigint(),
|
|
904
|
+
ts: import_zod7.z.coerce.date()
|
|
540
905
|
});
|
|
541
|
-
var OrderHistoryEntry =
|
|
906
|
+
var OrderHistoryEntry = import_zod7.z.object({
|
|
542
907
|
// Internal entry ID
|
|
543
|
-
id:
|
|
544
|
-
pool:
|
|
545
|
-
authority:
|
|
908
|
+
id: import_zod7.z.string(),
|
|
909
|
+
pool: import_zod7.z.string(),
|
|
910
|
+
authority: import_zod7.z.string(),
|
|
546
911
|
orderType: OrderHistoryOrderTypeSchema,
|
|
547
|
-
isReduceOnly:
|
|
548
|
-
aToB:
|
|
912
|
+
isReduceOnly: import_zod7.z.nullable(import_zod7.z.boolean()),
|
|
913
|
+
aToB: import_zod7.z.boolean(),
|
|
549
914
|
uiDirection: OrderHistoryUIDirectionSchema,
|
|
550
|
-
uiPrice:
|
|
551
|
-
uiExecutionPrice:
|
|
915
|
+
uiPrice: import_zod7.z.nullable(import_zod7.z.number()),
|
|
916
|
+
uiExecutionPrice: import_zod7.z.nullable(import_zod7.z.number()),
|
|
552
917
|
status: OrderHistoryStatusSchema,
|
|
553
|
-
baseToken:
|
|
554
|
-
quoteToken:
|
|
555
|
-
baseTokenConsumedAmount:
|
|
556
|
-
quoteTokenFilledAmount:
|
|
557
|
-
txSignature:
|
|
558
|
-
positionAddress:
|
|
559
|
-
slot:
|
|
560
|
-
ts:
|
|
561
|
-
});
|
|
562
|
-
var StakingTreasury =
|
|
563
|
-
address:
|
|
564
|
-
stakedTokenMint:
|
|
565
|
-
rewardTokenMint:
|
|
566
|
-
apy:
|
|
567
|
-
uniqueStakers:
|
|
568
|
-
totalStaked:
|
|
569
|
-
totalReward:
|
|
570
|
-
unstakeCooldownSeconds:
|
|
571
|
-
isStakingEnabled:
|
|
572
|
-
isUnstakingEnabled:
|
|
573
|
-
isWithdrawEnabled:
|
|
574
|
-
});
|
|
575
|
-
var StakingPosition =
|
|
576
|
-
address:
|
|
577
|
-
owner:
|
|
578
|
-
staked:
|
|
579
|
-
unstaked:
|
|
580
|
-
claimedReward:
|
|
581
|
-
unclaimedReward:
|
|
582
|
-
rank:
|
|
583
|
-
vesting:
|
|
584
|
-
locked:
|
|
585
|
-
unlocked:
|
|
586
|
-
unlockRate:
|
|
587
|
-
unlockEverySeconds:
|
|
588
|
-
unlockCliffSeconds:
|
|
589
|
-
lockedAt:
|
|
918
|
+
baseToken: AmountWithUsdSchema,
|
|
919
|
+
quoteToken: AmountWithUsdSchema,
|
|
920
|
+
baseTokenConsumedAmount: import_zod7.z.nullable(AmountWithUsdSchema),
|
|
921
|
+
quoteTokenFilledAmount: import_zod7.z.nullable(AmountWithUsdSchema),
|
|
922
|
+
txSignature: import_zod7.z.nullable(import_zod7.z.string()),
|
|
923
|
+
positionAddress: import_zod7.z.nullable(import_zod7.z.string()),
|
|
924
|
+
slot: import_zod7.z.coerce.bigint(),
|
|
925
|
+
ts: import_zod7.z.coerce.date()
|
|
926
|
+
});
|
|
927
|
+
var StakingTreasury = import_zod7.z.object({
|
|
928
|
+
address: import_zod7.z.string(),
|
|
929
|
+
stakedTokenMint: import_zod7.z.string(),
|
|
930
|
+
rewardTokenMint: import_zod7.z.string(),
|
|
931
|
+
apy: import_zod7.z.number(),
|
|
932
|
+
uniqueStakers: import_zod7.z.number(),
|
|
933
|
+
totalStaked: AmountWithUsdSchema,
|
|
934
|
+
totalReward: AmountWithUsdSchema,
|
|
935
|
+
unstakeCooldownSeconds: import_zod7.z.number(),
|
|
936
|
+
isStakingEnabled: import_zod7.z.boolean(),
|
|
937
|
+
isUnstakingEnabled: import_zod7.z.boolean(),
|
|
938
|
+
isWithdrawEnabled: import_zod7.z.boolean()
|
|
939
|
+
});
|
|
940
|
+
var StakingPosition = import_zod7.z.object({
|
|
941
|
+
address: import_zod7.z.string(),
|
|
942
|
+
owner: import_zod7.z.string(),
|
|
943
|
+
staked: AmountWithUsdSchema,
|
|
944
|
+
unstaked: AmountWithUsdSchema,
|
|
945
|
+
claimedReward: AmountWithUsdSchema,
|
|
946
|
+
unclaimedReward: AmountWithUsdSchema,
|
|
947
|
+
rank: import_zod7.z.nullable(import_zod7.z.number()),
|
|
948
|
+
vesting: import_zod7.z.object({
|
|
949
|
+
locked: AmountWithUsdSchema,
|
|
950
|
+
unlocked: AmountWithUsdSchema,
|
|
951
|
+
unlockRate: import_zod7.z.coerce.bigint(),
|
|
952
|
+
unlockEverySeconds: import_zod7.z.number(),
|
|
953
|
+
unlockCliffSeconds: import_zod7.z.number(),
|
|
954
|
+
lockedAt: import_zod7.z.nullable(import_zod7.z.coerce.date())
|
|
590
955
|
}),
|
|
591
|
-
lastUnstakedAt:
|
|
592
|
-
withdrawAvailableAt:
|
|
956
|
+
lastUnstakedAt: import_zod7.z.nullable(import_zod7.z.coerce.date()),
|
|
957
|
+
withdrawAvailableAt: import_zod7.z.nullable(import_zod7.z.coerce.date())
|
|
593
958
|
});
|
|
594
|
-
var StakingLeaderboardPosition =
|
|
595
|
-
rank:
|
|
596
|
-
address:
|
|
597
|
-
owner:
|
|
598
|
-
staked:
|
|
959
|
+
var StakingLeaderboardPosition = import_zod7.z.object({
|
|
960
|
+
rank: import_zod7.z.number(),
|
|
961
|
+
address: import_zod7.z.string(),
|
|
962
|
+
owner: import_zod7.z.string(),
|
|
963
|
+
staked: AmountWithUsdSchema
|
|
599
964
|
});
|
|
600
|
-
var StakingLeaderboardPage =
|
|
965
|
+
var StakingLeaderboardPage = import_zod7.z.object({
|
|
601
966
|
data: StakingLeaderboardPosition.array(),
|
|
602
967
|
meta: PaginationMeta
|
|
603
968
|
});
|
|
604
|
-
var StakingPositionHistoryAction =
|
|
605
|
-
position:
|
|
969
|
+
var StakingPositionHistoryAction = import_zod7.z.object({
|
|
970
|
+
position: import_zod7.z.string(),
|
|
606
971
|
action: StakingPositionHistoryActionTypeSchema,
|
|
607
|
-
txSignature:
|
|
608
|
-
amount:
|
|
609
|
-
time:
|
|
610
|
-
});
|
|
611
|
-
var PoolPriceCandle = import_zod.z.object({
|
|
612
|
-
time: import_zod.z.number(),
|
|
613
|
-
open: import_zod.z.number(),
|
|
614
|
-
close: import_zod.z.number(),
|
|
615
|
-
high: import_zod.z.number(),
|
|
616
|
-
low: import_zod.z.number(),
|
|
617
|
-
volume: import_zod.z.number()
|
|
618
|
-
});
|
|
619
|
-
var FeesStatsGroup = import_zod.z.object({
|
|
620
|
-
time: import_zod.z.coerce.date(),
|
|
621
|
-
addLiquidityFees: import_zod.z.number(),
|
|
622
|
-
limitOrderFees: import_zod.z.number(),
|
|
623
|
-
yieldCompoundingFees: import_zod.z.number(),
|
|
624
|
-
liquidationFees: import_zod.z.number(),
|
|
625
|
-
totalLiquidationsNetworkFees: import_zod.z.number(),
|
|
626
|
-
totalLimitOrdersNetworkFees: import_zod.z.number(),
|
|
627
|
-
totalYieldCompoundingNetworkFees: import_zod.z.number(),
|
|
628
|
-
failedNetworkFees: import_zod.z.number(),
|
|
629
|
-
processedNetworkFees: import_zod.z.number(),
|
|
630
|
-
totalCollectedFees: import_zod.z.number(),
|
|
631
|
-
totalNetworkFees: import_zod.z.number(),
|
|
632
|
-
jitoLiquidationFees: import_zod.z.number(),
|
|
633
|
-
jitoLimitOrderFees: import_zod.z.number(),
|
|
634
|
-
jitoYieldCompoundingFees: import_zod.z.number(),
|
|
635
|
-
runningAddLiquidityFees: import_zod.z.number(),
|
|
636
|
-
runningLimitOrderFees: import_zod.z.number(),
|
|
637
|
-
runningYieldCompoundingFees: import_zod.z.number(),
|
|
638
|
-
runningLiquidationFees: import_zod.z.number(),
|
|
639
|
-
runningTotalLiquidationsNetworkFees: import_zod.z.number(),
|
|
640
|
-
runningTotalLimitOrdersNetworkFees: import_zod.z.number(),
|
|
641
|
-
runningTotalYieldCompoundingNetworkFees: import_zod.z.number(),
|
|
642
|
-
runningFailedNetworkFees: import_zod.z.number(),
|
|
643
|
-
runningProcessedNetworkFees: import_zod.z.number(),
|
|
644
|
-
runningJitoLiquidationFees: import_zod.z.number(),
|
|
645
|
-
runningJitoLimitOrderFees: import_zod.z.number(),
|
|
646
|
-
runningJitoYieldCompoundingFees: import_zod.z.number(),
|
|
647
|
-
runningTotalCollectedFees: import_zod.z.number(),
|
|
648
|
-
runningTotalNetworkFees: import_zod.z.number()
|
|
649
|
-
});
|
|
650
|
-
var StakingRevenueStatsGroup = import_zod.z.object({
|
|
651
|
-
time: import_zod.z.coerce.date(),
|
|
652
|
-
totalDepositsUsd: import_zod.z.number(),
|
|
653
|
-
totalDepositsSol: import_zod.z.coerce.bigint(),
|
|
654
|
-
runningTotalDepositsUsd: import_zod.z.number(),
|
|
655
|
-
runningTotalDepositsSol: import_zod.z.coerce.bigint()
|
|
656
|
-
});
|
|
657
|
-
var IncreaseSpotPositionQuote = import_zod.z.object({
|
|
658
|
-
/** Required collateral amount */
|
|
659
|
-
collateralAmount: import_zod.z.coerce.bigint(),
|
|
660
|
-
/** Required amount to borrow */
|
|
661
|
-
borrowAmount: import_zod.z.coerce.bigint(),
|
|
662
|
-
/** Estimated position size in the position token. */
|
|
663
|
-
estimatedAmount: import_zod.z.coerce.bigint(),
|
|
664
|
-
/** Swap input amount. */
|
|
665
|
-
swapInputAmount: import_zod.z.coerce.bigint(),
|
|
666
|
-
/** Minimum swap output amount according to the provided slippage. */
|
|
667
|
-
minSwapOutputAmount: import_zod.z.coerce.bigint(),
|
|
668
|
-
/** Protocol fee in token A */
|
|
669
|
-
protocolFeeA: import_zod.z.coerce.bigint(),
|
|
670
|
-
/** Protocol fee in token B */
|
|
671
|
-
protocolFeeB: import_zod.z.coerce.bigint(),
|
|
672
|
-
/** Price impact in percents */
|
|
673
|
-
priceImpact: import_zod.z.number(),
|
|
674
|
-
/** Liquidation price */
|
|
675
|
-
uiLiquidationPrice: import_zod.z.nullable(import_zod.z.number())
|
|
972
|
+
txSignature: import_zod7.z.string(),
|
|
973
|
+
amount: import_zod7.z.coerce.bigint(),
|
|
974
|
+
time: import_zod7.z.coerce.date()
|
|
676
975
|
});
|
|
677
|
-
var
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
/** Estimated total amount of the adjusted position */
|
|
685
|
-
estimatedAmount: import_zod.z.coerce.bigint(),
|
|
686
|
-
/** Estimated amount of the withdrawn collateral */
|
|
687
|
-
estimatedWithdrawnCollateral: import_zod.z.coerce.bigint(),
|
|
688
|
-
/** Price impact in percents */
|
|
689
|
-
priceImpact: import_zod.z.number(),
|
|
690
|
-
/** Liquidation price */
|
|
691
|
-
uiLiquidationPrice: import_zod.z.nullable(import_zod.z.number())
|
|
976
|
+
var PoolPriceCandle = import_zod7.z.object({
|
|
977
|
+
time: import_zod7.z.number(),
|
|
978
|
+
open: import_zod7.z.number(),
|
|
979
|
+
close: import_zod7.z.number(),
|
|
980
|
+
high: import_zod7.z.number(),
|
|
981
|
+
low: import_zod7.z.number(),
|
|
982
|
+
volume: import_zod7.z.number()
|
|
692
983
|
});
|
|
693
|
-
var
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
984
|
+
var FeesStatsGroup = import_zod7.z.object({
|
|
985
|
+
time: import_zod7.z.coerce.date(),
|
|
986
|
+
addLiquidityFees: import_zod7.z.number(),
|
|
987
|
+
limitOrderFees: import_zod7.z.number(),
|
|
988
|
+
yieldCompoundingFees: import_zod7.z.number(),
|
|
989
|
+
liquidationFees: import_zod7.z.number(),
|
|
990
|
+
totalLiquidationsNetworkFees: import_zod7.z.number(),
|
|
991
|
+
totalLimitOrdersNetworkFees: import_zod7.z.number(),
|
|
992
|
+
totalYieldCompoundingNetworkFees: import_zod7.z.number(),
|
|
993
|
+
failedNetworkFees: import_zod7.z.number(),
|
|
994
|
+
processedNetworkFees: import_zod7.z.number(),
|
|
995
|
+
totalCollectedFees: import_zod7.z.number(),
|
|
996
|
+
totalNetworkFees: import_zod7.z.number(),
|
|
997
|
+
jitoLiquidationFees: import_zod7.z.number(),
|
|
998
|
+
jitoLimitOrderFees: import_zod7.z.number(),
|
|
999
|
+
jitoYieldCompoundingFees: import_zod7.z.number(),
|
|
1000
|
+
runningAddLiquidityFees: import_zod7.z.number(),
|
|
1001
|
+
runningLimitOrderFees: import_zod7.z.number(),
|
|
1002
|
+
runningYieldCompoundingFees: import_zod7.z.number(),
|
|
1003
|
+
runningLiquidationFees: import_zod7.z.number(),
|
|
1004
|
+
runningTotalLiquidationsNetworkFees: import_zod7.z.number(),
|
|
1005
|
+
runningTotalLimitOrdersNetworkFees: import_zod7.z.number(),
|
|
1006
|
+
runningTotalYieldCompoundingNetworkFees: import_zod7.z.number(),
|
|
1007
|
+
runningFailedNetworkFees: import_zod7.z.number(),
|
|
1008
|
+
runningProcessedNetworkFees: import_zod7.z.number(),
|
|
1009
|
+
runningJitoLiquidationFees: import_zod7.z.number(),
|
|
1010
|
+
runningJitoLimitOrderFees: import_zod7.z.number(),
|
|
1011
|
+
runningJitoYieldCompoundingFees: import_zod7.z.number(),
|
|
1012
|
+
runningTotalCollectedFees: import_zod7.z.number(),
|
|
1013
|
+
runningTotalNetworkFees: import_zod7.z.number()
|
|
704
1014
|
});
|
|
705
|
-
var
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
priceImpact: import_zod.z.number()
|
|
1015
|
+
var StakingRevenueStatsGroup = import_zod7.z.object({
|
|
1016
|
+
time: import_zod7.z.coerce.date(),
|
|
1017
|
+
totalDepositsUsd: import_zod7.z.number(),
|
|
1018
|
+
totalDepositsSol: import_zod7.z.coerce.bigint(),
|
|
1019
|
+
runningTotalDepositsUsd: import_zod7.z.number(),
|
|
1020
|
+
runningTotalDepositsSol: import_zod7.z.coerce.bigint()
|
|
712
1021
|
});
|
|
713
|
-
var
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
feeAmount:
|
|
717
|
-
feeUsd:
|
|
1022
|
+
var SwapQuoteByInput = import_zod7.z.object({
|
|
1023
|
+
estimatedAmountOut: import_zod7.z.coerce.bigint(),
|
|
1024
|
+
minAmountOut: import_zod7.z.coerce.bigint(),
|
|
1025
|
+
feeAmount: import_zod7.z.coerce.bigint(),
|
|
1026
|
+
feeUsd: import_zod7.z.number(),
|
|
718
1027
|
/** Price impact in percents */
|
|
719
|
-
priceImpact:
|
|
1028
|
+
priceImpact: import_zod7.z.number()
|
|
720
1029
|
});
|
|
721
|
-
var
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
1030
|
+
var SwapQuoteByOutput = import_zod7.z.object({
|
|
1031
|
+
estimatedAmountIn: import_zod7.z.coerce.bigint(),
|
|
1032
|
+
maxAmountIn: import_zod7.z.coerce.bigint(),
|
|
1033
|
+
feeAmount: import_zod7.z.coerce.bigint(),
|
|
1034
|
+
feeUsd: import_zod7.z.number(),
|
|
1035
|
+
/** Price impact in percents */
|
|
1036
|
+
priceImpact: import_zod7.z.number()
|
|
728
1037
|
});
|
|
729
|
-
var LimitOrderQuoteByInput =
|
|
730
|
-
amountOut:
|
|
1038
|
+
var LimitOrderQuoteByInput = import_zod7.z.object({
|
|
1039
|
+
amountOut: import_zod7.z.coerce.bigint()
|
|
731
1040
|
});
|
|
732
|
-
var LimitOrderQuoteByOutput =
|
|
733
|
-
amountIn:
|
|
1041
|
+
var LimitOrderQuoteByOutput = import_zod7.z.object({
|
|
1042
|
+
amountIn: import_zod7.z.coerce.bigint()
|
|
734
1043
|
});
|
|
735
|
-
var TradableAmount =
|
|
736
|
-
var UpdateStreamSubscriptionResult =
|
|
737
|
-
status:
|
|
1044
|
+
var TradableAmount = AmountWithUsdSchema;
|
|
1045
|
+
var UpdateStreamSubscriptionResult = import_zod7.z.object({
|
|
1046
|
+
status: import_zod7.z.string()
|
|
738
1047
|
});
|
|
739
|
-
var createNotificationSchema = (dataSchema, metaSchema) =>
|
|
1048
|
+
var createNotificationSchema = (dataSchema, metaSchema) => import_zod7.z.object({
|
|
740
1049
|
entity: NotificationEntitySchema,
|
|
741
1050
|
action: NotificationActionSchema,
|
|
742
1051
|
data: dataSchema,
|
|
743
|
-
id:
|
|
744
|
-
authority:
|
|
745
|
-
...metaSchema ? { meta: metaSchema } : { meta:
|
|
1052
|
+
id: import_zod7.z.string(),
|
|
1053
|
+
authority: import_zod7.z.nullish(import_zod7.z.string()),
|
|
1054
|
+
...metaSchema ? { meta: metaSchema } : { meta: import_zod7.z.undefined().nullable() }
|
|
746
1055
|
});
|
|
747
|
-
var OrderBookNotificationMeta =
|
|
748
|
-
pool:
|
|
749
|
-
priceStep:
|
|
750
|
-
inverted:
|
|
1056
|
+
var OrderBookNotificationMeta = import_zod7.z.object({
|
|
1057
|
+
pool: import_zod7.z.string(),
|
|
1058
|
+
priceStep: import_zod7.z.number(),
|
|
1059
|
+
inverted: import_zod7.z.boolean()
|
|
751
1060
|
});
|
|
752
1061
|
var PoolSwapNotification = createNotificationSchema(PoolSwap);
|
|
753
1062
|
var PoolPriceUpdateNotification = createNotificationSchema(PoolPriceUpdate);
|
|
754
1063
|
var OrderBookNotification = createNotificationSchema(OrderBook, OrderBookNotificationMeta);
|
|
755
|
-
var TunaPositionNotification = createNotificationSchema(
|
|
1064
|
+
var TunaPositionNotification = createNotificationSchema(TunaPositionLegacy);
|
|
756
1065
|
var TunaSpotPositionNotification = createNotificationSchema(TunaSpotPosition);
|
|
757
1066
|
var LendingPositionNotification = createNotificationSchema(LendingPosition);
|
|
758
1067
|
var LimitOrderNotification = createNotificationSchema(LimitOrder);
|
|
@@ -930,11 +1239,44 @@ var TunaApiClient = class {
|
|
|
930
1239
|
}
|
|
931
1240
|
async getUserTunaPositions(userAddress) {
|
|
932
1241
|
const url = this.buildURL(`users/${userAddress}/tuna-positions`);
|
|
933
|
-
return await this.httpRequest(url,
|
|
1242
|
+
return await this.httpRequest(url, TunaLpPositionDtoSchema.array());
|
|
934
1243
|
}
|
|
935
1244
|
async getUserTunaPositionByAddress(userAddress, tunaPositionAddress) {
|
|
936
1245
|
const url = this.buildURL(`users/${userAddress}/tuna-positions/${tunaPositionAddress}`);
|
|
937
|
-
return await this.httpRequest(url,
|
|
1246
|
+
return await this.httpRequest(url, TunaLpPositionDtoSchema);
|
|
1247
|
+
}
|
|
1248
|
+
async getUserLpPositions(userAddress, options) {
|
|
1249
|
+
const query = {};
|
|
1250
|
+
if (options) {
|
|
1251
|
+
if (options.filter) {
|
|
1252
|
+
query.filter = options.filter;
|
|
1253
|
+
}
|
|
1254
|
+
if (options.afterPosition) {
|
|
1255
|
+
query.after_position = options.afterPosition;
|
|
1256
|
+
}
|
|
1257
|
+
if (options.openedAt) {
|
|
1258
|
+
if (options.openedAt.from) {
|
|
1259
|
+
query.opened_at_min = options.openedAt.from.toISOString();
|
|
1260
|
+
}
|
|
1261
|
+
if (options.openedAt.to) {
|
|
1262
|
+
query.opened_at_max = options.openedAt.to.toISOString();
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
if (options.closedAt) {
|
|
1266
|
+
if (options.closedAt.from) {
|
|
1267
|
+
query.closed_at_min = options.closedAt.from.toISOString();
|
|
1268
|
+
}
|
|
1269
|
+
if (options.closedAt.to) {
|
|
1270
|
+
query.closed_at_max = options.closedAt.to.toISOString();
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
const url = this.appendUrlSearchParams(this.buildURL(`users/${userAddress}/lp-positions`), query);
|
|
1275
|
+
return await this.httpRequest(url, TunaLpPositionHistorical.array());
|
|
1276
|
+
}
|
|
1277
|
+
async getUserLpPositionActions(userAddress, positionAddress) {
|
|
1278
|
+
const url = this.buildURL(`users/${userAddress}/lp-positions/${positionAddress}/actions`);
|
|
1279
|
+
return await this.httpRequest(url, TunaLpPositionAction.array());
|
|
938
1280
|
}
|
|
939
1281
|
async getUserTunaSpotPositions(userAddress) {
|
|
940
1282
|
const url = this.buildURL(`users/${userAddress}/spot-positions`);
|
|
@@ -945,7 +1287,7 @@ var TunaApiClient = class {
|
|
|
945
1287
|
return await this.httpRequest(url, TunaSpotPosition);
|
|
946
1288
|
}
|
|
947
1289
|
async getUserLimitOrders(userAddress, options) {
|
|
948
|
-
|
|
1290
|
+
const query = {};
|
|
949
1291
|
if (options) {
|
|
950
1292
|
if (options.pool?.length) {
|
|
951
1293
|
query.pool = options.pool.join(",");
|
|
@@ -977,7 +1319,7 @@ var TunaApiClient = class {
|
|
|
977
1319
|
return await this.httpRequest(url, LimitOrder);
|
|
978
1320
|
}
|
|
979
1321
|
async getUserTradeHistory(userAddress, options) {
|
|
980
|
-
|
|
1322
|
+
const query = {};
|
|
981
1323
|
if (options) {
|
|
982
1324
|
if (options.pool?.length) {
|
|
983
1325
|
query.pool = options.pool.join(",");
|
|
@@ -1002,7 +1344,7 @@ var TunaApiClient = class {
|
|
|
1002
1344
|
return await this.httpRequest(url, TradeHistoryEntry.array());
|
|
1003
1345
|
}
|
|
1004
1346
|
async getUserOrderHistory(userAddress, options) {
|
|
1005
|
-
|
|
1347
|
+
const query = {};
|
|
1006
1348
|
if (options) {
|
|
1007
1349
|
if (options.pool?.length) {
|
|
1008
1350
|
query.pool = options.pool.join(",");
|
|
@@ -1051,7 +1393,7 @@ var TunaApiClient = class {
|
|
|
1051
1393
|
}
|
|
1052
1394
|
async getLimitOrderQuoteByInput(args, config) {
|
|
1053
1395
|
const { pool, amountIn, aToB, tickIndex } = args;
|
|
1054
|
-
|
|
1396
|
+
const query = {
|
|
1055
1397
|
pool,
|
|
1056
1398
|
amount_in: amountIn.toString(),
|
|
1057
1399
|
a_to_b: aToB,
|
|
@@ -1064,7 +1406,7 @@ var TunaApiClient = class {
|
|
|
1064
1406
|
}
|
|
1065
1407
|
async getLimitOrderQuoteByOutput(args, config) {
|
|
1066
1408
|
const { pool, amountOut, aToB, tickIndex } = args;
|
|
1067
|
-
|
|
1409
|
+
const query = {
|
|
1068
1410
|
pool,
|
|
1069
1411
|
amount_out: amountOut.toString(),
|
|
1070
1412
|
a_to_b: aToB,
|
|
@@ -1077,7 +1419,7 @@ var TunaApiClient = class {
|
|
|
1077
1419
|
}
|
|
1078
1420
|
async getSwapQuoteByInput(args, config) {
|
|
1079
1421
|
const { pool, amountIn, aToB, slippageToleranceBps } = args;
|
|
1080
|
-
|
|
1422
|
+
const query = {
|
|
1081
1423
|
pool,
|
|
1082
1424
|
amount_in: amountIn.toString(),
|
|
1083
1425
|
a_to_b: aToB
|
|
@@ -1092,7 +1434,7 @@ var TunaApiClient = class {
|
|
|
1092
1434
|
}
|
|
1093
1435
|
async getSwapQuoteByOutput(args, config) {
|
|
1094
1436
|
const { pool, amountOut, aToB, slippageToleranceBps } = args;
|
|
1095
|
-
|
|
1437
|
+
const query = {
|
|
1096
1438
|
pool,
|
|
1097
1439
|
amount_out: amountOut.toString(),
|
|
1098
1440
|
a_to_b: aToB
|
|
@@ -1116,7 +1458,7 @@ var TunaApiClient = class {
|
|
|
1116
1458
|
positionDebt,
|
|
1117
1459
|
slippageTolerance
|
|
1118
1460
|
} = args;
|
|
1119
|
-
|
|
1461
|
+
const query = {
|
|
1120
1462
|
market,
|
|
1121
1463
|
increase_amount: increaseAmount.toString(),
|
|
1122
1464
|
collateral_token: collateralToken,
|
|
@@ -1148,7 +1490,7 @@ var TunaApiClient = class {
|
|
|
1148
1490
|
positionDebt,
|
|
1149
1491
|
slippageTolerance
|
|
1150
1492
|
} = args;
|
|
1151
|
-
|
|
1493
|
+
const query = {
|
|
1152
1494
|
market,
|
|
1153
1495
|
decrease_amount: decreaseAmount.toString(),
|
|
1154
1496
|
collateral_token: collateralToken,
|
|
@@ -1167,7 +1509,7 @@ var TunaApiClient = class {
|
|
|
1167
1509
|
}
|
|
1168
1510
|
async getCloseSpotPositionQuote(args, config) {
|
|
1169
1511
|
const { market, decreasePercent, collateralToken, positionToken, positionAmount, positionDebt, slippageTolerance } = args;
|
|
1170
|
-
|
|
1512
|
+
const query = {
|
|
1171
1513
|
market,
|
|
1172
1514
|
decrease_percent: decreasePercent,
|
|
1173
1515
|
collateral_token: collateralToken,
|