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