@crypticdot/defituna-api 1.10.5 → 1.10.7
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 +191 -28
- package/dist/index.d.ts +191 -28
- package/dist/index.js +472 -448
- package/dist/index.mjs +465 -441
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -42,6 +42,7 @@ __export(schemas_exports, {
|
|
|
42
42
|
OrderBookEntry: () => OrderBookEntry,
|
|
43
43
|
OrderBookNotification: () => OrderBookNotification,
|
|
44
44
|
OrderBookNotificationMeta: () => OrderBookNotificationMeta,
|
|
45
|
+
OrderBookWrapper: () => OrderBookWrapper,
|
|
45
46
|
OrderHistoryEntry: () => OrderHistoryEntry,
|
|
46
47
|
OrderHistoryEntryNotification: () => OrderHistoryEntryNotification,
|
|
47
48
|
OrderHistoryOrderType: () => OrderHistoryOrderType,
|
|
@@ -56,6 +57,7 @@ __export(schemas_exports, {
|
|
|
56
57
|
PoolPriceUpdate: () => PoolPriceUpdate,
|
|
57
58
|
PoolProvider: () => PoolProvider,
|
|
58
59
|
PoolProviderSchema: () => PoolProviderSchema,
|
|
60
|
+
PoolSnapshot: () => PoolSnapshot,
|
|
59
61
|
PoolSubscriptionTopic: () => PoolSubscriptionTopic,
|
|
60
62
|
PoolSubscriptionTopicSchema: () => PoolSubscriptionTopicSchema,
|
|
61
63
|
PoolSwap: () => PoolSwap,
|
|
@@ -120,7 +122,7 @@ __export(schemas_exports, {
|
|
|
120
122
|
WalletSubscriptionTopic: () => WalletSubscriptionTopic,
|
|
121
123
|
WalletSubscriptionTopicSchema: () => WalletSubscriptionTopicSchema
|
|
122
124
|
});
|
|
123
|
-
import { z as
|
|
125
|
+
import { z as z9 } from "zod";
|
|
124
126
|
|
|
125
127
|
// src/client/schemas/basic.ts
|
|
126
128
|
import { z } from "zod";
|
|
@@ -145,34 +147,53 @@ var PoolProvider = {
|
|
|
145
147
|
};
|
|
146
148
|
var PoolProviderSchema = z.enum([PoolProvider.ORCA, ...Object.values(PoolProvider)]);
|
|
147
149
|
|
|
150
|
+
// src/client/schemas/order_book.ts
|
|
151
|
+
import z2 from "zod";
|
|
152
|
+
var OrderBookEntry = z2.object({
|
|
153
|
+
concentratedAmount: z2.coerce.bigint(),
|
|
154
|
+
concentratedAmountQuote: z2.coerce.bigint(),
|
|
155
|
+
concentratedTotal: z2.coerce.bigint(),
|
|
156
|
+
concentratedTotalQuote: z2.coerce.bigint(),
|
|
157
|
+
limitAmount: z2.coerce.bigint(),
|
|
158
|
+
limitAmountQuote: z2.coerce.bigint(),
|
|
159
|
+
limitTotal: z2.coerce.bigint(),
|
|
160
|
+
limitTotalQuote: z2.coerce.bigint(),
|
|
161
|
+
price: z2.number(),
|
|
162
|
+
askSide: z2.boolean()
|
|
163
|
+
});
|
|
164
|
+
var OrderBook = z2.object({
|
|
165
|
+
entries: OrderBookEntry.array(),
|
|
166
|
+
poolPrice: z2.number()
|
|
167
|
+
});
|
|
168
|
+
|
|
148
169
|
// src/client/schemas/state_snapshot.ts
|
|
149
|
-
import
|
|
170
|
+
import z8 from "zod";
|
|
150
171
|
|
|
151
172
|
// src/client/schemas/limit_orders.ts
|
|
152
|
-
import { z as
|
|
173
|
+
import { z as z5 } from "zod";
|
|
153
174
|
|
|
154
175
|
// src/client/schemas/mint.ts
|
|
155
|
-
import { z as
|
|
156
|
-
var Mint =
|
|
157
|
-
mint:
|
|
158
|
-
symbol:
|
|
159
|
-
name:
|
|
160
|
-
logo:
|
|
161
|
-
decimals:
|
|
176
|
+
import { z as z3 } from "zod";
|
|
177
|
+
var Mint = z3.object({
|
|
178
|
+
mint: z3.string(),
|
|
179
|
+
symbol: z3.string(),
|
|
180
|
+
name: z3.string(),
|
|
181
|
+
logo: z3.string(),
|
|
182
|
+
decimals: z3.number()
|
|
162
183
|
});
|
|
163
184
|
|
|
164
185
|
// src/client/schemas/positions_shared.ts
|
|
165
|
-
import
|
|
166
|
-
var TunaPositionPoolSchema =
|
|
167
|
-
addr:
|
|
168
|
-
price:
|
|
169
|
-
tickSpacing:
|
|
186
|
+
import z4 from "zod";
|
|
187
|
+
var TunaPositionPoolSchema = z4.object({
|
|
188
|
+
addr: z4.string(),
|
|
189
|
+
price: z4.number(),
|
|
190
|
+
tickSpacing: z4.number()
|
|
170
191
|
});
|
|
171
192
|
var TunaPositionPoolToken = {
|
|
172
193
|
A: "a",
|
|
173
194
|
B: "b"
|
|
174
195
|
};
|
|
175
|
-
var TunaPositionPoolTokenSchema =
|
|
196
|
+
var TunaPositionPoolTokenSchema = z4.enum(Object.values(TunaPositionPoolToken));
|
|
176
197
|
|
|
177
198
|
// src/client/schemas/limit_orders.ts
|
|
178
199
|
var LimitOrderState = {
|
|
@@ -182,27 +203,27 @@ var LimitOrderState = {
|
|
|
182
203
|
COMPLETE: "complete",
|
|
183
204
|
CANCELLED: "cancelled"
|
|
184
205
|
};
|
|
185
|
-
var LimitOrderStateSchema =
|
|
186
|
-
var LimitOrder =
|
|
187
|
-
address:
|
|
188
|
-
orderMint:
|
|
206
|
+
var LimitOrderStateSchema = z5.enum([LimitOrderState.OPEN, ...Object.values(LimitOrderState)]);
|
|
207
|
+
var LimitOrder = z5.object({
|
|
208
|
+
address: z5.string(),
|
|
209
|
+
orderMint: z5.string(),
|
|
189
210
|
mintA: Mint,
|
|
190
211
|
mintB: Mint,
|
|
191
212
|
pool: TunaPositionPoolSchema,
|
|
192
213
|
state: LimitOrderStateSchema,
|
|
193
|
-
aToB:
|
|
194
|
-
tickIndex:
|
|
195
|
-
fillRatio:
|
|
196
|
-
openTxSignature:
|
|
197
|
-
closeTxSignature:
|
|
214
|
+
aToB: z5.boolean(),
|
|
215
|
+
tickIndex: z5.number(),
|
|
216
|
+
fillRatio: z5.number(),
|
|
217
|
+
openTxSignature: z5.string(),
|
|
218
|
+
closeTxSignature: z5.nullable(z5.string()),
|
|
198
219
|
amountIn: AmountWithUsdSchema,
|
|
199
220
|
amountOut: AmountWithUsdSchema,
|
|
200
|
-
openedAt:
|
|
201
|
-
closedAt:
|
|
221
|
+
openedAt: z5.coerce.date(),
|
|
222
|
+
closedAt: z5.nullable(z5.coerce.date())
|
|
202
223
|
});
|
|
203
224
|
|
|
204
225
|
// src/client/schemas/lp_positions.ts
|
|
205
|
-
import
|
|
226
|
+
import z6 from "zod";
|
|
206
227
|
var LpPositionLimitOrderSwap = {
|
|
207
228
|
NO_SWAP: "no_swap",
|
|
208
229
|
SWAP_TO_TOKEN_A: "swap_to_token_a",
|
|
@@ -233,46 +254,46 @@ var LpPositionsActionType = {
|
|
|
233
254
|
SET_FLAGS: "set_flags",
|
|
234
255
|
SET_REBALANCE_THRESHOLD: "set_rebalance_threshold"
|
|
235
256
|
};
|
|
236
|
-
var LpPositionLimitOrderSwapSchema =
|
|
237
|
-
var LpPositionAutoCompoundSchema =
|
|
238
|
-
var LpPositionRebalanceSchema =
|
|
239
|
-
var LpPositionsActionTypeSchema =
|
|
257
|
+
var LpPositionLimitOrderSwapSchema = z6.enum(Object.values(LpPositionLimitOrderSwap));
|
|
258
|
+
var LpPositionAutoCompoundSchema = z6.enum(Object.values(LpPositionAutoCompound));
|
|
259
|
+
var LpPositionRebalanceSchema = z6.enum(Object.values(LpPositionRebalance));
|
|
260
|
+
var LpPositionsActionTypeSchema = z6.enum(Object.values(LpPositionsActionType));
|
|
240
261
|
var TunaPositionState = {
|
|
241
262
|
OPEN: "open",
|
|
242
263
|
LIQUIDATED: "liquidated",
|
|
243
264
|
CLOSED_BY_LIMIT_ORDER: "closed_by_limit_order",
|
|
244
265
|
CLOSED: "closed"
|
|
245
266
|
};
|
|
246
|
-
var TunaPositionStateSchema =
|
|
267
|
+
var TunaPositionStateSchema = z6.enum([TunaPositionState.OPEN, ...Object.values(TunaPositionState)]);
|
|
247
268
|
var TunaLpPositionAutoCompounding = {
|
|
248
269
|
WITH_LEVERAGE: "with_leverage",
|
|
249
270
|
WITHOUT_LEVERAGE: "without_leverage"
|
|
250
271
|
};
|
|
251
|
-
var TunaLpPositionAutoCompoundingSchema =
|
|
272
|
+
var TunaLpPositionAutoCompoundingSchema = z6.enum(
|
|
252
273
|
Object.values(TunaLpPositionAutoCompounding)
|
|
253
274
|
);
|
|
254
|
-
var TunaPositionTokenPnlSchema =
|
|
255
|
-
amount:
|
|
256
|
-
bps:
|
|
275
|
+
var TunaPositionTokenPnlSchema = z6.object({
|
|
276
|
+
amount: z6.coerce.bigint(),
|
|
277
|
+
bps: z6.number()
|
|
257
278
|
});
|
|
258
|
-
var TunaLpPositionFlagsSchema =
|
|
259
|
-
lowerLimitOrderSwapToToken:
|
|
260
|
-
upperLimitOrderSwapToToken:
|
|
261
|
-
autoCompounding:
|
|
262
|
-
autoRebalancing:
|
|
279
|
+
var TunaLpPositionFlagsSchema = z6.object({
|
|
280
|
+
lowerLimitOrderSwapToToken: z6.nullable(TunaPositionPoolTokenSchema),
|
|
281
|
+
upperLimitOrderSwapToToken: z6.nullable(TunaPositionPoolTokenSchema),
|
|
282
|
+
autoCompounding: z6.nullable(TunaLpPositionAutoCompoundingSchema),
|
|
283
|
+
autoRebalancing: z6.boolean()
|
|
263
284
|
});
|
|
264
|
-
var TunaLpPositionDtoSchema =
|
|
265
|
-
address:
|
|
266
|
-
authority:
|
|
267
|
-
version:
|
|
285
|
+
var TunaLpPositionDtoSchema = z6.object({
|
|
286
|
+
address: z6.string(),
|
|
287
|
+
authority: z6.string(),
|
|
288
|
+
version: z6.number(),
|
|
268
289
|
state: TunaPositionStateSchema,
|
|
269
|
-
positionMint:
|
|
270
|
-
liquidity:
|
|
271
|
-
tickLowerIndex:
|
|
272
|
-
tickUpperIndex:
|
|
273
|
-
lowerLimitOrderPrice:
|
|
274
|
-
upperLimitOrderPrice:
|
|
275
|
-
entryPrice:
|
|
290
|
+
positionMint: z6.string(),
|
|
291
|
+
liquidity: z6.coerce.bigint(),
|
|
292
|
+
tickLowerIndex: z6.number(),
|
|
293
|
+
tickUpperIndex: z6.number(),
|
|
294
|
+
lowerLimitOrderPrice: z6.number(),
|
|
295
|
+
upperLimitOrderPrice: z6.number(),
|
|
296
|
+
entryPrice: z6.number(),
|
|
276
297
|
flags: TunaLpPositionFlagsSchema,
|
|
277
298
|
mintA: Mint,
|
|
278
299
|
mintB: Mint,
|
|
@@ -280,10 +301,10 @@ var TunaLpPositionDtoSchema = z5.object({
|
|
|
280
301
|
marketMaker: PoolProviderSchema,
|
|
281
302
|
depositedCollateralA: AmountWithUsdSchema,
|
|
282
303
|
depositedCollateralB: AmountWithUsdSchema,
|
|
283
|
-
leverage:
|
|
284
|
-
maxLeverage:
|
|
285
|
-
liquidationPriceLower:
|
|
286
|
-
liquidationPriceUpper:
|
|
304
|
+
leverage: z6.number(),
|
|
305
|
+
maxLeverage: z6.number(),
|
|
306
|
+
liquidationPriceLower: z6.number(),
|
|
307
|
+
liquidationPriceUpper: z6.number(),
|
|
287
308
|
initialDebtA: AmountWithUsdSchema,
|
|
288
309
|
initialDebtB: AmountWithUsdSchema,
|
|
289
310
|
currentDebtA: AmountWithUsdSchema,
|
|
@@ -299,50 +320,50 @@ var TunaLpPositionDtoSchema = z5.object({
|
|
|
299
320
|
pnlA: TokensPnlSchema,
|
|
300
321
|
pnlB: TokensPnlSchema,
|
|
301
322
|
pnlUsd: UsdPnlSchema,
|
|
302
|
-
openedAt:
|
|
303
|
-
closedAt:
|
|
323
|
+
openedAt: z6.coerce.date(),
|
|
324
|
+
closedAt: z6.nullable(z6.coerce.date())
|
|
304
325
|
});
|
|
305
|
-
var TunaLpPositionHistorical =
|
|
306
|
-
positionAddress:
|
|
307
|
-
authority:
|
|
308
|
-
pool:
|
|
326
|
+
var TunaLpPositionHistorical = z6.object({
|
|
327
|
+
positionAddress: z6.string(),
|
|
328
|
+
authority: z6.string(),
|
|
329
|
+
pool: z6.string(),
|
|
309
330
|
state: TunaPositionStateSchema,
|
|
310
|
-
lowerPrice:
|
|
311
|
-
upperPrice:
|
|
312
|
-
lowerLimitOrder:
|
|
313
|
-
upperLimitOrder:
|
|
331
|
+
lowerPrice: z6.number(),
|
|
332
|
+
upperPrice: z6.number(),
|
|
333
|
+
lowerLimitOrder: z6.number().nullable(),
|
|
334
|
+
upperLimitOrder: z6.number().nullable(),
|
|
314
335
|
marketMaker: PoolProviderSchema,
|
|
315
|
-
openedAt:
|
|
316
|
-
closedAt:
|
|
317
|
-
totalValueUsd:
|
|
318
|
-
leverage:
|
|
319
|
-
initialLeverage:
|
|
320
|
-
totalDepositUsd:
|
|
321
|
-
totalWithdrawnUsd:
|
|
322
|
-
feesSumUsd:
|
|
323
|
-
closedPnlSumUsd:
|
|
324
|
-
entryPrice:
|
|
325
|
-
exitPrice:
|
|
326
|
-
});
|
|
327
|
-
var TunaPositionLegacy =
|
|
328
|
-
address:
|
|
329
|
-
authority:
|
|
330
|
-
version:
|
|
336
|
+
openedAt: z6.coerce.date(),
|
|
337
|
+
closedAt: z6.coerce.date().nullable(),
|
|
338
|
+
totalValueUsd: z6.number(),
|
|
339
|
+
leverage: z6.number(),
|
|
340
|
+
initialLeverage: z6.number(),
|
|
341
|
+
totalDepositUsd: z6.number(),
|
|
342
|
+
totalWithdrawnUsd: z6.number(),
|
|
343
|
+
feesSumUsd: z6.number(),
|
|
344
|
+
closedPnlSumUsd: z6.number(),
|
|
345
|
+
entryPrice: z6.number(),
|
|
346
|
+
exitPrice: z6.number().nullable()
|
|
347
|
+
});
|
|
348
|
+
var TunaPositionLegacy = z6.object({
|
|
349
|
+
address: z6.string(),
|
|
350
|
+
authority: z6.string(),
|
|
351
|
+
version: z6.number(),
|
|
331
352
|
state: TunaPositionStateSchema,
|
|
332
|
-
positionMint:
|
|
333
|
-
liquidity:
|
|
334
|
-
tickLowerIndex:
|
|
335
|
-
tickUpperIndex:
|
|
336
|
-
entrySqrtPrice:
|
|
337
|
-
lowerLimitOrderSqrtPrice:
|
|
338
|
-
upperLimitOrderSqrtPrice:
|
|
339
|
-
flags:
|
|
340
|
-
pool:
|
|
341
|
-
poolSqrtPrice:
|
|
353
|
+
positionMint: z6.string(),
|
|
354
|
+
liquidity: z6.coerce.bigint(),
|
|
355
|
+
tickLowerIndex: z6.number(),
|
|
356
|
+
tickUpperIndex: z6.number(),
|
|
357
|
+
entrySqrtPrice: z6.coerce.bigint(),
|
|
358
|
+
lowerLimitOrderSqrtPrice: z6.coerce.bigint(),
|
|
359
|
+
upperLimitOrderSqrtPrice: z6.coerce.bigint(),
|
|
360
|
+
flags: z6.number(),
|
|
361
|
+
pool: z6.string(),
|
|
362
|
+
poolSqrtPrice: z6.coerce.bigint(),
|
|
342
363
|
depositedCollateralA: AmountWithoutUsdSchema,
|
|
343
364
|
depositedCollateralB: AmountWithoutUsdSchema,
|
|
344
|
-
depositedCollateralUsd:
|
|
345
|
-
amount:
|
|
365
|
+
depositedCollateralUsd: z6.object({
|
|
366
|
+
amount: z6.number()
|
|
346
367
|
}),
|
|
347
368
|
loanFundsA: AmountWithUsdSchema,
|
|
348
369
|
loanFundsB: AmountWithUsdSchema,
|
|
@@ -359,47 +380,47 @@ var TunaPositionLegacy = z5.object({
|
|
|
359
380
|
pnlA: TokensPnlSchema,
|
|
360
381
|
pnlB: TokensPnlSchema,
|
|
361
382
|
pnlUsd: UsdPnlSchema,
|
|
362
|
-
openedAt:
|
|
363
|
-
updatedAtSlot:
|
|
364
|
-
closedAt:
|
|
383
|
+
openedAt: z6.coerce.date(),
|
|
384
|
+
updatedAtSlot: z6.coerce.bigint(),
|
|
385
|
+
closedAt: z6.nullable(z6.coerce.date())
|
|
365
386
|
});
|
|
366
|
-
var TunaLpPositionParameters =
|
|
367
|
-
lowerPrice:
|
|
368
|
-
upperPrice:
|
|
369
|
-
lowerLimitOrder:
|
|
370
|
-
upperLimitOrder:
|
|
387
|
+
var TunaLpPositionParameters = z6.object({
|
|
388
|
+
lowerPrice: z6.number(),
|
|
389
|
+
upperPrice: z6.number(),
|
|
390
|
+
lowerLimitOrder: z6.number().nullable(),
|
|
391
|
+
upperLimitOrder: z6.number().nullable(),
|
|
371
392
|
lowerLimitOrderSwap: LpPositionLimitOrderSwapSchema,
|
|
372
393
|
upperLimitOrderSwap: LpPositionLimitOrderSwapSchema,
|
|
373
394
|
autoCompound: LpPositionAutoCompoundSchema,
|
|
374
395
|
rebalance: LpPositionRebalanceSchema,
|
|
375
|
-
rebalanceThresholdTicks:
|
|
376
|
-
});
|
|
377
|
-
var TunaLpPositionValue =
|
|
378
|
-
totalValueA:
|
|
379
|
-
totalValueB:
|
|
380
|
-
totalValueUsd:
|
|
381
|
-
loanFundsA:
|
|
382
|
-
loanFundsB:
|
|
383
|
-
loanFundsUsd:
|
|
384
|
-
leverage:
|
|
385
|
-
});
|
|
386
|
-
var TunaLpPositionTransfer =
|
|
387
|
-
amountA:
|
|
388
|
-
amountB:
|
|
389
|
-
amountUsd:
|
|
390
|
-
});
|
|
391
|
-
var TunaLpPositionTokenPrices =
|
|
392
|
-
tokenPriceA:
|
|
393
|
-
tokenPriceB:
|
|
394
|
-
});
|
|
395
|
-
var TunaLpPositionActionOpen =
|
|
396
|
+
rebalanceThresholdTicks: z6.number()
|
|
397
|
+
});
|
|
398
|
+
var TunaLpPositionValue = z6.object({
|
|
399
|
+
totalValueA: z6.number(),
|
|
400
|
+
totalValueB: z6.number(),
|
|
401
|
+
totalValueUsd: z6.number(),
|
|
402
|
+
loanFundsA: z6.number(),
|
|
403
|
+
loanFundsB: z6.number(),
|
|
404
|
+
loanFundsUsd: z6.number(),
|
|
405
|
+
leverage: z6.number()
|
|
406
|
+
});
|
|
407
|
+
var TunaLpPositionTransfer = z6.object({
|
|
408
|
+
amountA: z6.number(),
|
|
409
|
+
amountB: z6.number(),
|
|
410
|
+
amountUsd: z6.number()
|
|
411
|
+
});
|
|
412
|
+
var TunaLpPositionTokenPrices = z6.object({
|
|
413
|
+
tokenPriceA: z6.number(),
|
|
414
|
+
tokenPriceB: z6.number()
|
|
415
|
+
});
|
|
416
|
+
var TunaLpPositionActionOpen = z6.object({
|
|
396
417
|
parameters: TunaLpPositionParameters
|
|
397
418
|
});
|
|
398
|
-
var TunaLpPositionActionClose =
|
|
419
|
+
var TunaLpPositionActionClose = z6.object({
|
|
399
420
|
toOwner: TunaLpPositionTransfer.nullable(),
|
|
400
421
|
prices: TunaLpPositionTokenPrices.nullable()
|
|
401
422
|
});
|
|
402
|
-
var TunaLpPositionActionIncreaseLiquidity =
|
|
423
|
+
var TunaLpPositionActionIncreaseLiquidity = z6.object({
|
|
403
424
|
fromPosition: TunaLpPositionValue.nullable(),
|
|
404
425
|
toPosition: TunaLpPositionValue,
|
|
405
426
|
fromOwner: TunaLpPositionTransfer,
|
|
@@ -407,9 +428,9 @@ var TunaLpPositionActionIncreaseLiquidity = z5.object({
|
|
|
407
428
|
protocolFees: TunaLpPositionTransfer,
|
|
408
429
|
prices: TunaLpPositionTokenPrices
|
|
409
430
|
});
|
|
410
|
-
var TunaLpPositionActionDecreaseLiquidity =
|
|
411
|
-
withdrawPercent:
|
|
412
|
-
closedPnlUsd:
|
|
431
|
+
var TunaLpPositionActionDecreaseLiquidity = z6.object({
|
|
432
|
+
withdrawPercent: z6.number(),
|
|
433
|
+
closedPnlUsd: z6.number(),
|
|
413
434
|
fromPosition: TunaLpPositionValue,
|
|
414
435
|
toPosition: TunaLpPositionValue.nullable(),
|
|
415
436
|
toOwner: TunaLpPositionTransfer,
|
|
@@ -417,28 +438,28 @@ var TunaLpPositionActionDecreaseLiquidity = z5.object({
|
|
|
417
438
|
collectedFees: TunaLpPositionTransfer,
|
|
418
439
|
prices: TunaLpPositionTokenPrices
|
|
419
440
|
});
|
|
420
|
-
var TunaLpPositionActionLiquidate =
|
|
421
|
-
withdrawPercent:
|
|
441
|
+
var TunaLpPositionActionLiquidate = z6.object({
|
|
442
|
+
withdrawPercent: z6.number(),
|
|
422
443
|
fromPosition: TunaLpPositionValue,
|
|
423
444
|
toLending: TunaLpPositionTransfer,
|
|
424
445
|
protocolFees: TunaLpPositionTransfer,
|
|
425
446
|
prices: TunaLpPositionTokenPrices
|
|
426
447
|
});
|
|
427
|
-
var TunaLpPositionActionRepayDebt =
|
|
448
|
+
var TunaLpPositionActionRepayDebt = z6.object({
|
|
428
449
|
fromPosition: TunaLpPositionValue,
|
|
429
450
|
toPosition: TunaLpPositionValue,
|
|
430
451
|
fromOwner: TunaLpPositionTransfer,
|
|
431
452
|
toLending: TunaLpPositionTransfer,
|
|
432
453
|
prices: TunaLpPositionTokenPrices
|
|
433
454
|
});
|
|
434
|
-
var TunaLpPositionActionCollectFees =
|
|
435
|
-
closedPnlUsd:
|
|
455
|
+
var TunaLpPositionActionCollectFees = z6.object({
|
|
456
|
+
closedPnlUsd: z6.number(),
|
|
436
457
|
position: TunaLpPositionValue,
|
|
437
458
|
collectedFees: TunaLpPositionTransfer,
|
|
438
459
|
toOwner: TunaLpPositionTransfer,
|
|
439
460
|
prices: TunaLpPositionTokenPrices
|
|
440
461
|
});
|
|
441
|
-
var TunaLpPositionActionCollectAndCompoundFees =
|
|
462
|
+
var TunaLpPositionActionCollectAndCompoundFees = z6.object({
|
|
442
463
|
fromPosition: TunaLpPositionValue,
|
|
443
464
|
toPosition: TunaLpPositionValue,
|
|
444
465
|
collectedFees: TunaLpPositionTransfer,
|
|
@@ -446,15 +467,15 @@ var TunaLpPositionActionCollectAndCompoundFees = z5.object({
|
|
|
446
467
|
protocolFees: TunaLpPositionTransfer,
|
|
447
468
|
prices: TunaLpPositionTokenPrices
|
|
448
469
|
});
|
|
449
|
-
var TunaLpPositionActionParametersUpdate =
|
|
470
|
+
var TunaLpPositionActionParametersUpdate = z6.object({
|
|
450
471
|
fromParameters: TunaLpPositionParameters,
|
|
451
472
|
toParameters: TunaLpPositionParameters
|
|
452
473
|
});
|
|
453
|
-
var TunaLpPositionAction =
|
|
474
|
+
var TunaLpPositionAction = z6.object({
|
|
454
475
|
action: LpPositionsActionTypeSchema,
|
|
455
|
-
txSignature:
|
|
456
|
-
txTimestamp:
|
|
457
|
-
data:
|
|
476
|
+
txSignature: z6.string(),
|
|
477
|
+
txTimestamp: z6.coerce.date(),
|
|
478
|
+
data: z6.object({
|
|
458
479
|
/** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
|
|
459
480
|
fromPosition: TunaLpPositionValue.optional().nullable(),
|
|
460
481
|
/** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
|
|
@@ -482,30 +503,30 @@ var TunaLpPositionAction = z5.object({
|
|
|
482
503
|
/** defined for: ParametersUpdate */
|
|
483
504
|
toParameters: TunaLpPositionParameters.optional(),
|
|
484
505
|
/** defined for: DecreaseLiquidity */
|
|
485
|
-
withdrawPercent:
|
|
506
|
+
withdrawPercent: z6.number().optional(),
|
|
486
507
|
/** defined for: DecreaseLiquidity, CollectFees */
|
|
487
|
-
closedPnlUsd:
|
|
508
|
+
closedPnlUsd: z6.number().optional()
|
|
488
509
|
})
|
|
489
510
|
});
|
|
490
511
|
|
|
491
512
|
// src/client/schemas/spot_positions.ts
|
|
492
|
-
import { z as
|
|
513
|
+
import { z as z7 } from "zod";
|
|
493
514
|
var TunaSpotPositionState = {
|
|
494
515
|
OPEN: "open",
|
|
495
516
|
CLOSED: "closed"
|
|
496
517
|
};
|
|
497
|
-
var TunaSpotPositionStateSchema =
|
|
518
|
+
var TunaSpotPositionStateSchema = z7.enum([
|
|
498
519
|
TunaSpotPositionState.OPEN,
|
|
499
520
|
...Object.values(TunaSpotPositionState)
|
|
500
521
|
]);
|
|
501
|
-
var TunaSpotPosition =
|
|
502
|
-
address:
|
|
503
|
-
authority:
|
|
504
|
-
version:
|
|
522
|
+
var TunaSpotPosition = z7.object({
|
|
523
|
+
address: z7.string(),
|
|
524
|
+
authority: z7.string(),
|
|
525
|
+
version: z7.number(),
|
|
505
526
|
state: TunaSpotPositionStateSchema,
|
|
506
|
-
lowerLimitOrderPrice:
|
|
507
|
-
upperLimitOrderPrice:
|
|
508
|
-
entryPrice:
|
|
527
|
+
lowerLimitOrderPrice: z7.number(),
|
|
528
|
+
upperLimitOrderPrice: z7.number(),
|
|
529
|
+
entryPrice: z7.number(),
|
|
509
530
|
mintA: Mint,
|
|
510
531
|
mintB: Mint,
|
|
511
532
|
pool: TunaPositionPoolSchema,
|
|
@@ -516,76 +537,95 @@ var TunaSpotPosition = z6.object({
|
|
|
516
537
|
initialDebt: AmountWithUsdSchema,
|
|
517
538
|
currentDebt: AmountWithUsdSchema,
|
|
518
539
|
total: AmountWithUsdSchema,
|
|
519
|
-
leverage:
|
|
520
|
-
maxLeverage:
|
|
521
|
-
liquidationPrice:
|
|
540
|
+
leverage: z7.number(),
|
|
541
|
+
maxLeverage: z7.number(),
|
|
542
|
+
liquidationPrice: z7.number(),
|
|
522
543
|
pnlUsd: UsdPnlSchema,
|
|
523
|
-
openedAt:
|
|
524
|
-
closedAt:
|
|
544
|
+
openedAt: z7.coerce.date(),
|
|
545
|
+
closedAt: z7.nullable(z7.coerce.date())
|
|
525
546
|
});
|
|
526
|
-
var IncreaseSpotPositionQuote =
|
|
547
|
+
var IncreaseSpotPositionQuote = z7.object({
|
|
527
548
|
/** Required collateral amount */
|
|
528
|
-
collateralAmount:
|
|
549
|
+
collateralAmount: z7.coerce.bigint(),
|
|
529
550
|
/** Required amount to borrow */
|
|
530
|
-
borrowAmount:
|
|
551
|
+
borrowAmount: z7.coerce.bigint(),
|
|
531
552
|
/** Estimated position size in the position token. */
|
|
532
|
-
estimatedAmount:
|
|
553
|
+
estimatedAmount: z7.coerce.bigint(),
|
|
533
554
|
/** Swap input amount. */
|
|
534
|
-
swapInputAmount:
|
|
555
|
+
swapInputAmount: z7.coerce.bigint(),
|
|
535
556
|
/** Minimum swap output amount according to the provided slippage. */
|
|
536
|
-
minSwapOutputAmount:
|
|
557
|
+
minSwapOutputAmount: z7.coerce.bigint(),
|
|
537
558
|
/** Protocol fee in token A */
|
|
538
|
-
protocolFeeA:
|
|
559
|
+
protocolFeeA: z7.coerce.bigint(),
|
|
539
560
|
/** Protocol fee in token B */
|
|
540
|
-
protocolFeeB:
|
|
561
|
+
protocolFeeB: z7.coerce.bigint(),
|
|
541
562
|
/** Price impact in percents */
|
|
542
|
-
priceImpact:
|
|
563
|
+
priceImpact: z7.number(),
|
|
543
564
|
/** Liquidation price */
|
|
544
|
-
liquidationPrice:
|
|
565
|
+
liquidationPrice: z7.number()
|
|
545
566
|
});
|
|
546
|
-
var DecreaseSpotPositionQuote =
|
|
567
|
+
var DecreaseSpotPositionQuote = z7.object({
|
|
547
568
|
/** Confirmed position decrease percentage (100% = 1.0) */
|
|
548
|
-
decreasePercent:
|
|
569
|
+
decreasePercent: z7.number(),
|
|
549
570
|
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
550
571
|
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
551
572
|
*/
|
|
552
|
-
requiredSwapAmount:
|
|
573
|
+
requiredSwapAmount: z7.coerce.bigint(),
|
|
553
574
|
/** Estimated total amount of the adjusted position */
|
|
554
|
-
estimatedAmount:
|
|
575
|
+
estimatedAmount: z7.coerce.bigint(),
|
|
555
576
|
/** Estimated amount of the withdrawn collateral */
|
|
556
|
-
estimatedWithdrawnCollateral:
|
|
577
|
+
estimatedWithdrawnCollateral: z7.coerce.bigint(),
|
|
557
578
|
/** Price impact in percents */
|
|
558
|
-
priceImpact:
|
|
579
|
+
priceImpact: z7.number(),
|
|
559
580
|
/** Liquidation price */
|
|
560
|
-
liquidationPrice:
|
|
581
|
+
liquidationPrice: z7.number()
|
|
561
582
|
});
|
|
562
|
-
var CloseSpotPositionQuote =
|
|
583
|
+
var CloseSpotPositionQuote = z7.object({
|
|
563
584
|
/** Position decrease percentage */
|
|
564
|
-
decreasePercent:
|
|
585
|
+
decreasePercent: z7.number(),
|
|
565
586
|
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
566
587
|
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
567
588
|
*/
|
|
568
|
-
requiredSwapAmount:
|
|
589
|
+
requiredSwapAmount: z7.coerce.bigint(),
|
|
569
590
|
/** Estimated amount of the withdrawn collateral */
|
|
570
|
-
estimatedWithdrawnCollateral:
|
|
591
|
+
estimatedWithdrawnCollateral: z7.coerce.bigint(),
|
|
571
592
|
/** Price impact in percents */
|
|
572
|
-
priceImpact:
|
|
593
|
+
priceImpact: z7.number()
|
|
573
594
|
});
|
|
574
595
|
|
|
575
596
|
// src/client/schemas/state_snapshot.ts
|
|
576
|
-
var PoolPriceUpdate =
|
|
577
|
-
pool:
|
|
578
|
-
price:
|
|
579
|
-
sqrtPrice:
|
|
580
|
-
time:
|
|
581
|
-
});
|
|
582
|
-
var
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
597
|
+
var PoolPriceUpdate = z8.object({
|
|
598
|
+
pool: z8.string(),
|
|
599
|
+
price: z8.number(),
|
|
600
|
+
sqrtPrice: z8.coerce.bigint(),
|
|
601
|
+
time: z8.coerce.date()
|
|
602
|
+
});
|
|
603
|
+
var OrderBookWrapper = z8.object({
|
|
604
|
+
priceStep: z8.number(),
|
|
605
|
+
entries: z8.array(OrderBookEntry)
|
|
606
|
+
});
|
|
607
|
+
var PoolSnapshot = z8.object({
|
|
608
|
+
liquidity: z8.coerce.bigint(),
|
|
609
|
+
tickCurrentIndex: z8.number(),
|
|
610
|
+
price: z8.number(),
|
|
611
|
+
tvl: z8.number(),
|
|
612
|
+
priceChange24H: z8.number(),
|
|
613
|
+
volume24H: z8.number(),
|
|
614
|
+
fees24H: z8.number(),
|
|
615
|
+
borrowedFundsA: AmountWithUsdSchema,
|
|
616
|
+
borrowedFundsB: AmountWithUsdSchema,
|
|
617
|
+
borrowLimitA: AmountWithUsdSchema,
|
|
618
|
+
borrowLimitB: AmountWithUsdSchema
|
|
619
|
+
});
|
|
620
|
+
var StateSnapshot = z8.object({
|
|
621
|
+
slot: z8.coerce.bigint(),
|
|
622
|
+
blockTime: z8.coerce.date(),
|
|
623
|
+
poolPrices: z8.optional(z8.record(z8.string(), PoolPriceUpdate)),
|
|
624
|
+
pools: z8.optional(z8.record(z8.string(), PoolSnapshot)),
|
|
625
|
+
tunaSpotPositions: z8.optional(z8.array(TunaSpotPosition)),
|
|
626
|
+
tunaLpPositions: z8.optional(z8.array(TunaLpPositionDtoSchema)),
|
|
627
|
+
fusionLimitOrders: z8.optional(z8.array(LimitOrder)),
|
|
628
|
+
orderBooks: z8.optional(z8.record(z8.string(), OrderBookWrapper))
|
|
589
629
|
});
|
|
590
630
|
|
|
591
631
|
// src/client/schemas.ts
|
|
@@ -665,51 +705,51 @@ var WalletSubscriptionTopic = {
|
|
|
665
705
|
TRADE_HISTORY: "trade_history",
|
|
666
706
|
ORDER_HISTORY: "order_history"
|
|
667
707
|
};
|
|
668
|
-
var NotificationEntitySchema =
|
|
669
|
-
var NotificationActionSchema =
|
|
670
|
-
var TradeHistoryActionSchema =
|
|
671
|
-
var TradeHistoryUIDirectionSchema =
|
|
708
|
+
var NotificationEntitySchema = z9.enum([NotificationEntity.POOL_SWAP, ...Object.values(NotificationEntity)]);
|
|
709
|
+
var NotificationActionSchema = z9.enum([NotificationAction.CREATE, ...Object.values(NotificationAction)]);
|
|
710
|
+
var TradeHistoryActionSchema = z9.enum([TradeHistoryAction.SWAP, ...Object.values(TradeHistoryAction)]);
|
|
711
|
+
var TradeHistoryUIDirectionSchema = z9.enum([
|
|
672
712
|
TradeHistoryUIDirection.BUY,
|
|
673
713
|
...Object.values(TradeHistoryUIDirection)
|
|
674
714
|
]);
|
|
675
|
-
var OrderHistoryOrderTypeSchema =
|
|
715
|
+
var OrderHistoryOrderTypeSchema = z9.enum([
|
|
676
716
|
OrderHistoryOrderType.MARKET,
|
|
677
717
|
...Object.values(OrderHistoryOrderType)
|
|
678
718
|
]);
|
|
679
|
-
var OrderHistoryStatusSchema =
|
|
680
|
-
var OrderHistoryUIDirectionSchema =
|
|
719
|
+
var OrderHistoryStatusSchema = z9.enum([OrderHistoryStatus.OPEN, ...Object.values(OrderHistoryStatus)]);
|
|
720
|
+
var OrderHistoryUIDirectionSchema = z9.enum([
|
|
681
721
|
OrderHistoryUIDirection.BUY,
|
|
682
722
|
...Object.values(OrderHistoryUIDirection)
|
|
683
723
|
]);
|
|
684
|
-
var StakingPositionHistoryActionTypeSchema =
|
|
724
|
+
var StakingPositionHistoryActionTypeSchema = z9.enum([
|
|
685
725
|
StakingPositionHistoryActionType.STAKE,
|
|
686
726
|
...Object.values(StakingPositionHistoryActionType)
|
|
687
727
|
]);
|
|
688
|
-
var PoolSubscriptionTopicSchema =
|
|
728
|
+
var PoolSubscriptionTopicSchema = z9.enum([
|
|
689
729
|
PoolSubscriptionTopic.ORDER_BOOK,
|
|
690
730
|
...Object.values(PoolSubscriptionTopic)
|
|
691
731
|
]);
|
|
692
|
-
var WalletSubscriptionTopicSchema =
|
|
732
|
+
var WalletSubscriptionTopicSchema = z9.enum([
|
|
693
733
|
WalletSubscriptionTopic.TUNA_POSITIONS,
|
|
694
734
|
...Object.values(WalletSubscriptionTopic)
|
|
695
735
|
]);
|
|
696
|
-
var PaginationMeta =
|
|
697
|
-
total:
|
|
698
|
-
});
|
|
699
|
-
var Market =
|
|
700
|
-
address:
|
|
701
|
-
addressLookupTable:
|
|
702
|
-
poolAddress:
|
|
703
|
-
poolFeeRate:
|
|
736
|
+
var PaginationMeta = z9.object({
|
|
737
|
+
total: z9.number()
|
|
738
|
+
});
|
|
739
|
+
var Market = z9.object({
|
|
740
|
+
address: z9.string(),
|
|
741
|
+
addressLookupTable: z9.string(),
|
|
742
|
+
poolAddress: z9.string(),
|
|
743
|
+
poolFeeRate: z9.number(),
|
|
704
744
|
provider: PoolProviderSchema,
|
|
705
|
-
maxLeverage:
|
|
706
|
-
maxSwapSlippage:
|
|
707
|
-
protocolFee:
|
|
708
|
-
rebalanceProtocolFee:
|
|
709
|
-
protocolFeeOnCollateral:
|
|
710
|
-
liquidationFee:
|
|
711
|
-
liquidationThreshold:
|
|
712
|
-
oraclePriceDeviationThreshold:
|
|
745
|
+
maxLeverage: z9.number(),
|
|
746
|
+
maxSwapSlippage: z9.number(),
|
|
747
|
+
protocolFee: z9.number(),
|
|
748
|
+
rebalanceProtocolFee: z9.number(),
|
|
749
|
+
protocolFeeOnCollateral: z9.number(),
|
|
750
|
+
liquidationFee: z9.number(),
|
|
751
|
+
liquidationThreshold: z9.number(),
|
|
752
|
+
oraclePriceDeviationThreshold: z9.number(),
|
|
713
753
|
maxSpotPositionSizeA: AmountWithUsdSchema,
|
|
714
754
|
maxSpotPositionSizeB: AmountWithUsdSchema,
|
|
715
755
|
borrowedFundsA: AmountWithUsdSchema,
|
|
@@ -718,32 +758,32 @@ var Market = z8.object({
|
|
|
718
758
|
availableBorrowB: AmountWithUsdSchema,
|
|
719
759
|
borrowLimitA: AmountWithUsdSchema,
|
|
720
760
|
borrowLimitB: AmountWithUsdSchema,
|
|
721
|
-
disabled:
|
|
722
|
-
createdAt:
|
|
761
|
+
disabled: z9.boolean(),
|
|
762
|
+
createdAt: z9.coerce.date()
|
|
723
763
|
});
|
|
724
|
-
var TokenOraclePrice =
|
|
725
|
-
mint:
|
|
726
|
-
price:
|
|
727
|
-
decimals:
|
|
728
|
-
time:
|
|
764
|
+
var TokenOraclePrice = z9.object({
|
|
765
|
+
mint: z9.string(),
|
|
766
|
+
price: z9.coerce.bigint(),
|
|
767
|
+
decimals: z9.number(),
|
|
768
|
+
time: z9.coerce.date()
|
|
729
769
|
});
|
|
730
|
-
var Vault =
|
|
731
|
-
address:
|
|
732
|
-
mint:
|
|
770
|
+
var Vault = z9.object({
|
|
771
|
+
address: z9.string(),
|
|
772
|
+
mint: z9.string(),
|
|
733
773
|
depositedFunds: AmountWithUsdSchema,
|
|
734
774
|
borrowedFunds: AmountWithUsdSchema,
|
|
735
775
|
supplyLimit: AmountWithUsdSchema,
|
|
736
|
-
borrowedShares:
|
|
737
|
-
depositedShares:
|
|
738
|
-
supplyApy:
|
|
739
|
-
borrowApy:
|
|
740
|
-
interestRate:
|
|
741
|
-
utilization:
|
|
742
|
-
pythOracleFeedId:
|
|
743
|
-
pythOraclePriceUpdate:
|
|
744
|
-
});
|
|
745
|
-
var VaultHistoricalStats =
|
|
746
|
-
date:
|
|
776
|
+
borrowedShares: z9.coerce.bigint(),
|
|
777
|
+
depositedShares: z9.coerce.bigint(),
|
|
778
|
+
supplyApy: z9.number(),
|
|
779
|
+
borrowApy: z9.number(),
|
|
780
|
+
interestRate: z9.coerce.bigint(),
|
|
781
|
+
utilization: z9.number(),
|
|
782
|
+
pythOracleFeedId: z9.string(),
|
|
783
|
+
pythOraclePriceUpdate: z9.string()
|
|
784
|
+
});
|
|
785
|
+
var VaultHistoricalStats = z9.object({
|
|
786
|
+
date: z9.preprocess((val, ctx) => {
|
|
747
787
|
if (typeof val === "string") {
|
|
748
788
|
const [year, month, day] = val.split("-").map(Number);
|
|
749
789
|
return new Date(year, month - 1, day);
|
|
@@ -752,272 +792,256 @@ var VaultHistoricalStats = z8.object({
|
|
|
752
792
|
code: "custom",
|
|
753
793
|
message: "Not a valid date string"
|
|
754
794
|
});
|
|
755
|
-
return
|
|
756
|
-
},
|
|
795
|
+
return z9.NEVER;
|
|
796
|
+
}, z9.date()),
|
|
757
797
|
supply: AmountWithUsdSchema,
|
|
758
798
|
borrow: AmountWithUsdSchema,
|
|
759
|
-
supplyApy:
|
|
760
|
-
borrowApr:
|
|
799
|
+
supplyApy: z9.number(),
|
|
800
|
+
borrowApr: z9.number()
|
|
761
801
|
});
|
|
762
|
-
var Pool =
|
|
763
|
-
address:
|
|
802
|
+
var Pool = z9.object({
|
|
803
|
+
address: z9.string(),
|
|
764
804
|
provider: PoolProviderSchema,
|
|
765
|
-
tokenAMint:
|
|
766
|
-
tokenBMint:
|
|
767
|
-
tokenAVault:
|
|
768
|
-
tokenBVault:
|
|
769
|
-
tvlUsdc:
|
|
770
|
-
priceChange24H:
|
|
771
|
-
tickSpacing:
|
|
772
|
-
feeRate:
|
|
773
|
-
olpFeeRate:
|
|
774
|
-
protocolFeeRate:
|
|
775
|
-
liquidity:
|
|
776
|
-
sqrtPrice:
|
|
777
|
-
tickCurrentIndex:
|
|
778
|
-
stats:
|
|
779
|
-
"24h":
|
|
780
|
-
volume:
|
|
781
|
-
fees:
|
|
782
|
-
rewards:
|
|
783
|
-
yieldOverTvl:
|
|
805
|
+
tokenAMint: z9.string(),
|
|
806
|
+
tokenBMint: z9.string(),
|
|
807
|
+
tokenAVault: z9.string(),
|
|
808
|
+
tokenBVault: z9.string(),
|
|
809
|
+
tvlUsdc: z9.coerce.number(),
|
|
810
|
+
priceChange24H: z9.number(),
|
|
811
|
+
tickSpacing: z9.number(),
|
|
812
|
+
feeRate: z9.number(),
|
|
813
|
+
olpFeeRate: z9.nullable(z9.number()),
|
|
814
|
+
protocolFeeRate: z9.number(),
|
|
815
|
+
liquidity: z9.coerce.bigint(),
|
|
816
|
+
sqrtPrice: z9.coerce.bigint(),
|
|
817
|
+
tickCurrentIndex: z9.number(),
|
|
818
|
+
stats: z9.object({
|
|
819
|
+
"24h": z9.object({
|
|
820
|
+
volume: z9.coerce.number(),
|
|
821
|
+
fees: z9.coerce.number(),
|
|
822
|
+
rewards: z9.coerce.number(),
|
|
823
|
+
yieldOverTvl: z9.coerce.number()
|
|
784
824
|
}),
|
|
785
|
-
"7d":
|
|
786
|
-
volume:
|
|
787
|
-
fees:
|
|
788
|
-
rewards:
|
|
789
|
-
yieldOverTvl:
|
|
825
|
+
"7d": z9.object({
|
|
826
|
+
volume: z9.coerce.number(),
|
|
827
|
+
fees: z9.coerce.number(),
|
|
828
|
+
rewards: z9.coerce.number(),
|
|
829
|
+
yieldOverTvl: z9.coerce.number()
|
|
790
830
|
}),
|
|
791
|
-
"30d":
|
|
792
|
-
volume:
|
|
793
|
-
fees:
|
|
794
|
-
rewards:
|
|
795
|
-
yieldOverTvl:
|
|
831
|
+
"30d": z9.object({
|
|
832
|
+
volume: z9.coerce.number(),
|
|
833
|
+
fees: z9.coerce.number(),
|
|
834
|
+
rewards: z9.coerce.number(),
|
|
835
|
+
yieldOverTvl: z9.coerce.number()
|
|
796
836
|
})
|
|
797
837
|
})
|
|
798
838
|
});
|
|
799
|
-
var Tick =
|
|
800
|
-
index:
|
|
801
|
-
liquidity:
|
|
839
|
+
var Tick = z9.object({
|
|
840
|
+
index: z9.number(),
|
|
841
|
+
liquidity: z9.coerce.bigint()
|
|
802
842
|
});
|
|
803
|
-
var PoolTicks =
|
|
804
|
-
tickSpacing:
|
|
843
|
+
var PoolTicks = z9.object({
|
|
844
|
+
tickSpacing: z9.number(),
|
|
805
845
|
ticks: Tick.array()
|
|
806
846
|
});
|
|
807
|
-
var LendingPosition =
|
|
808
|
-
address:
|
|
809
|
-
authority:
|
|
810
|
-
mint:
|
|
811
|
-
vault:
|
|
812
|
-
shares:
|
|
847
|
+
var LendingPosition = z9.object({
|
|
848
|
+
address: z9.string(),
|
|
849
|
+
authority: z9.string(),
|
|
850
|
+
mint: z9.string(),
|
|
851
|
+
vault: z9.string(),
|
|
852
|
+
shares: z9.coerce.bigint(),
|
|
813
853
|
funds: AmountWithUsdSchema,
|
|
814
854
|
earned: AmountWithUsdSchema
|
|
815
855
|
});
|
|
816
|
-
var PoolSwap =
|
|
817
|
-
id:
|
|
818
|
-
amountIn:
|
|
819
|
-
amountOut:
|
|
820
|
-
amountUsd:
|
|
821
|
-
aToB:
|
|
822
|
-
pool:
|
|
823
|
-
time:
|
|
856
|
+
var PoolSwap = z9.object({
|
|
857
|
+
id: z9.string(),
|
|
858
|
+
amountIn: z9.coerce.bigint(),
|
|
859
|
+
amountOut: z9.coerce.bigint(),
|
|
860
|
+
amountUsd: z9.number(),
|
|
861
|
+
aToB: z9.boolean(),
|
|
862
|
+
pool: z9.string(),
|
|
863
|
+
time: z9.coerce.date()
|
|
824
864
|
});
|
|
825
|
-
var
|
|
826
|
-
concentratedAmount: z8.coerce.bigint(),
|
|
827
|
-
concentratedAmountQuote: z8.coerce.bigint(),
|
|
828
|
-
concentratedTotal: z8.coerce.bigint(),
|
|
829
|
-
concentratedTotalQuote: z8.coerce.bigint(),
|
|
830
|
-
limitAmount: z8.coerce.bigint(),
|
|
831
|
-
limitAmountQuote: z8.coerce.bigint(),
|
|
832
|
-
limitTotal: z8.coerce.bigint(),
|
|
833
|
-
limitTotalQuote: z8.coerce.bigint(),
|
|
834
|
-
price: z8.number(),
|
|
835
|
-
askSide: z8.boolean()
|
|
836
|
-
});
|
|
837
|
-
var OrderBook = z8.object({
|
|
838
|
-
entries: OrderBookEntry.array(),
|
|
839
|
-
poolPrice: z8.number()
|
|
840
|
-
});
|
|
841
|
-
var TradeHistoryEntry = z8.object({
|
|
865
|
+
var TradeHistoryEntry = z9.object({
|
|
842
866
|
// Internal entry ID
|
|
843
|
-
id:
|
|
844
|
-
pool:
|
|
845
|
-
authority:
|
|
846
|
-
aToB:
|
|
867
|
+
id: z9.string(),
|
|
868
|
+
pool: z9.string(),
|
|
869
|
+
authority: z9.string(),
|
|
870
|
+
aToB: z9.boolean(),
|
|
847
871
|
// Trade action which created entry
|
|
848
872
|
action: TradeHistoryActionSchema,
|
|
849
873
|
// Trade direction formatted for ui display
|
|
850
874
|
uiDirection: TradeHistoryUIDirectionSchema,
|
|
851
875
|
// Trade price formatted for ui display
|
|
852
|
-
uiPrice:
|
|
876
|
+
uiPrice: z9.number(),
|
|
853
877
|
baseToken: AmountWithUsdSchema,
|
|
854
878
|
quoteToken: AmountWithUsdSchema,
|
|
855
879
|
fee: AmountWithUsdSchema,
|
|
856
|
-
pnl:
|
|
857
|
-
|
|
858
|
-
usd:
|
|
859
|
-
bps:
|
|
880
|
+
pnl: z9.nullable(
|
|
881
|
+
z9.object({
|
|
882
|
+
usd: z9.number(),
|
|
883
|
+
bps: z9.number()
|
|
860
884
|
})
|
|
861
885
|
),
|
|
862
|
-
txSignature:
|
|
863
|
-
positionAddress:
|
|
864
|
-
slot:
|
|
865
|
-
ts:
|
|
886
|
+
txSignature: z9.nullable(z9.string()),
|
|
887
|
+
positionAddress: z9.nullable(z9.string()),
|
|
888
|
+
slot: z9.coerce.bigint(),
|
|
889
|
+
ts: z9.coerce.date()
|
|
866
890
|
});
|
|
867
|
-
var OrderHistoryEntry =
|
|
891
|
+
var OrderHistoryEntry = z9.object({
|
|
868
892
|
// Internal entry ID
|
|
869
|
-
id:
|
|
870
|
-
pool:
|
|
871
|
-
authority:
|
|
893
|
+
id: z9.string(),
|
|
894
|
+
pool: z9.string(),
|
|
895
|
+
authority: z9.string(),
|
|
872
896
|
orderType: OrderHistoryOrderTypeSchema,
|
|
873
|
-
isReduceOnly:
|
|
874
|
-
aToB:
|
|
897
|
+
isReduceOnly: z9.nullable(z9.boolean()),
|
|
898
|
+
aToB: z9.boolean(),
|
|
875
899
|
uiDirection: OrderHistoryUIDirectionSchema,
|
|
876
|
-
uiPrice:
|
|
877
|
-
uiExecutionPrice:
|
|
900
|
+
uiPrice: z9.nullable(z9.number()),
|
|
901
|
+
uiExecutionPrice: z9.nullable(z9.number()),
|
|
878
902
|
status: OrderHistoryStatusSchema,
|
|
879
903
|
baseToken: AmountWithUsdSchema,
|
|
880
904
|
quoteToken: AmountWithUsdSchema,
|
|
881
|
-
baseTokenConsumedAmount:
|
|
882
|
-
quoteTokenFilledAmount:
|
|
883
|
-
txSignature:
|
|
884
|
-
positionAddress:
|
|
885
|
-
slot:
|
|
886
|
-
ts:
|
|
887
|
-
});
|
|
888
|
-
var StakingTreasury =
|
|
889
|
-
address:
|
|
890
|
-
stakedTokenMint:
|
|
891
|
-
rewardTokenMint:
|
|
892
|
-
apy:
|
|
893
|
-
uniqueStakers:
|
|
905
|
+
baseTokenConsumedAmount: z9.nullable(AmountWithUsdSchema),
|
|
906
|
+
quoteTokenFilledAmount: z9.nullable(AmountWithUsdSchema),
|
|
907
|
+
txSignature: z9.nullable(z9.string()),
|
|
908
|
+
positionAddress: z9.nullable(z9.string()),
|
|
909
|
+
slot: z9.coerce.bigint(),
|
|
910
|
+
ts: z9.coerce.date()
|
|
911
|
+
});
|
|
912
|
+
var StakingTreasury = z9.object({
|
|
913
|
+
address: z9.string(),
|
|
914
|
+
stakedTokenMint: z9.string(),
|
|
915
|
+
rewardTokenMint: z9.string(),
|
|
916
|
+
apy: z9.number(),
|
|
917
|
+
uniqueStakers: z9.number(),
|
|
894
918
|
totalStaked: AmountWithUsdSchema,
|
|
895
919
|
totalReward: AmountWithUsdSchema,
|
|
896
|
-
unstakeCooldownSeconds:
|
|
897
|
-
isStakingEnabled:
|
|
898
|
-
isUnstakingEnabled:
|
|
899
|
-
isWithdrawEnabled:
|
|
900
|
-
});
|
|
901
|
-
var StakingPosition =
|
|
902
|
-
address:
|
|
903
|
-
owner:
|
|
920
|
+
unstakeCooldownSeconds: z9.number(),
|
|
921
|
+
isStakingEnabled: z9.boolean(),
|
|
922
|
+
isUnstakingEnabled: z9.boolean(),
|
|
923
|
+
isWithdrawEnabled: z9.boolean()
|
|
924
|
+
});
|
|
925
|
+
var StakingPosition = z9.object({
|
|
926
|
+
address: z9.string(),
|
|
927
|
+
owner: z9.string(),
|
|
904
928
|
staked: AmountWithUsdSchema,
|
|
905
929
|
unstaked: AmountWithUsdSchema,
|
|
906
930
|
claimedReward: AmountWithUsdSchema,
|
|
907
931
|
unclaimedReward: AmountWithUsdSchema,
|
|
908
|
-
rank:
|
|
909
|
-
vesting:
|
|
932
|
+
rank: z9.nullable(z9.number()),
|
|
933
|
+
vesting: z9.object({
|
|
910
934
|
locked: AmountWithUsdSchema,
|
|
911
935
|
unlocked: AmountWithUsdSchema,
|
|
912
|
-
unlockRate:
|
|
913
|
-
unlockEverySeconds:
|
|
914
|
-
unlockCliffSeconds:
|
|
915
|
-
lockedAt:
|
|
936
|
+
unlockRate: z9.coerce.bigint(),
|
|
937
|
+
unlockEverySeconds: z9.number(),
|
|
938
|
+
unlockCliffSeconds: z9.number(),
|
|
939
|
+
lockedAt: z9.nullable(z9.coerce.date())
|
|
916
940
|
}),
|
|
917
|
-
lastUnstakedAt:
|
|
918
|
-
withdrawAvailableAt:
|
|
941
|
+
lastUnstakedAt: z9.nullable(z9.coerce.date()),
|
|
942
|
+
withdrawAvailableAt: z9.nullable(z9.coerce.date())
|
|
919
943
|
});
|
|
920
|
-
var StakingLeaderboardPosition =
|
|
921
|
-
rank:
|
|
922
|
-
address:
|
|
923
|
-
owner:
|
|
944
|
+
var StakingLeaderboardPosition = z9.object({
|
|
945
|
+
rank: z9.number(),
|
|
946
|
+
address: z9.string(),
|
|
947
|
+
owner: z9.string(),
|
|
924
948
|
staked: AmountWithUsdSchema
|
|
925
949
|
});
|
|
926
|
-
var StakingLeaderboardPage =
|
|
950
|
+
var StakingLeaderboardPage = z9.object({
|
|
927
951
|
data: StakingLeaderboardPosition.array(),
|
|
928
952
|
meta: PaginationMeta
|
|
929
953
|
});
|
|
930
|
-
var StakingPositionHistoryAction =
|
|
931
|
-
position:
|
|
954
|
+
var StakingPositionHistoryAction = z9.object({
|
|
955
|
+
position: z9.string(),
|
|
932
956
|
action: StakingPositionHistoryActionTypeSchema,
|
|
933
|
-
txSignature:
|
|
934
|
-
amount:
|
|
935
|
-
time:
|
|
957
|
+
txSignature: z9.string(),
|
|
958
|
+
amount: z9.coerce.bigint(),
|
|
959
|
+
time: z9.coerce.date()
|
|
936
960
|
});
|
|
937
|
-
var PoolPriceCandle =
|
|
938
|
-
time:
|
|
939
|
-
open:
|
|
940
|
-
close:
|
|
941
|
-
high:
|
|
942
|
-
low:
|
|
943
|
-
volume:
|
|
944
|
-
});
|
|
945
|
-
var FeesStatsGroup =
|
|
946
|
-
time:
|
|
947
|
-
addLiquidityFees:
|
|
948
|
-
limitOrderFees:
|
|
949
|
-
yieldCompoundingFees:
|
|
950
|
-
liquidationFees:
|
|
951
|
-
totalLiquidationsNetworkFees:
|
|
952
|
-
totalLimitOrdersNetworkFees:
|
|
953
|
-
totalYieldCompoundingNetworkFees:
|
|
954
|
-
failedNetworkFees:
|
|
955
|
-
processedNetworkFees:
|
|
956
|
-
totalCollectedFees:
|
|
957
|
-
totalNetworkFees:
|
|
958
|
-
jitoLiquidationFees:
|
|
959
|
-
jitoLimitOrderFees:
|
|
960
|
-
jitoYieldCompoundingFees:
|
|
961
|
-
runningAddLiquidityFees:
|
|
962
|
-
runningLimitOrderFees:
|
|
963
|
-
runningYieldCompoundingFees:
|
|
964
|
-
runningLiquidationFees:
|
|
965
|
-
runningTotalLiquidationsNetworkFees:
|
|
966
|
-
runningTotalLimitOrdersNetworkFees:
|
|
967
|
-
runningTotalYieldCompoundingNetworkFees:
|
|
968
|
-
runningFailedNetworkFees:
|
|
969
|
-
runningProcessedNetworkFees:
|
|
970
|
-
runningJitoLiquidationFees:
|
|
971
|
-
runningJitoLimitOrderFees:
|
|
972
|
-
runningJitoYieldCompoundingFees:
|
|
973
|
-
runningTotalCollectedFees:
|
|
974
|
-
runningTotalNetworkFees:
|
|
975
|
-
});
|
|
976
|
-
var StakingRevenueStatsGroup =
|
|
977
|
-
time:
|
|
978
|
-
totalDepositsUsd:
|
|
979
|
-
totalDepositsSol:
|
|
980
|
-
runningTotalDepositsUsd:
|
|
981
|
-
runningTotalDepositsSol:
|
|
982
|
-
});
|
|
983
|
-
var SwapQuoteByInput =
|
|
984
|
-
estimatedAmountOut:
|
|
985
|
-
minAmountOut:
|
|
986
|
-
feeAmount:
|
|
987
|
-
feeUsd:
|
|
961
|
+
var PoolPriceCandle = z9.object({
|
|
962
|
+
time: z9.number(),
|
|
963
|
+
open: z9.number(),
|
|
964
|
+
close: z9.number(),
|
|
965
|
+
high: z9.number(),
|
|
966
|
+
low: z9.number(),
|
|
967
|
+
volume: z9.number()
|
|
968
|
+
});
|
|
969
|
+
var FeesStatsGroup = z9.object({
|
|
970
|
+
time: z9.coerce.date(),
|
|
971
|
+
addLiquidityFees: z9.number(),
|
|
972
|
+
limitOrderFees: z9.number(),
|
|
973
|
+
yieldCompoundingFees: z9.number(),
|
|
974
|
+
liquidationFees: z9.number(),
|
|
975
|
+
totalLiquidationsNetworkFees: z9.number(),
|
|
976
|
+
totalLimitOrdersNetworkFees: z9.number(),
|
|
977
|
+
totalYieldCompoundingNetworkFees: z9.number(),
|
|
978
|
+
failedNetworkFees: z9.number(),
|
|
979
|
+
processedNetworkFees: z9.number(),
|
|
980
|
+
totalCollectedFees: z9.number(),
|
|
981
|
+
totalNetworkFees: z9.number(),
|
|
982
|
+
jitoLiquidationFees: z9.number(),
|
|
983
|
+
jitoLimitOrderFees: z9.number(),
|
|
984
|
+
jitoYieldCompoundingFees: z9.number(),
|
|
985
|
+
runningAddLiquidityFees: z9.number(),
|
|
986
|
+
runningLimitOrderFees: z9.number(),
|
|
987
|
+
runningYieldCompoundingFees: z9.number(),
|
|
988
|
+
runningLiquidationFees: z9.number(),
|
|
989
|
+
runningTotalLiquidationsNetworkFees: z9.number(),
|
|
990
|
+
runningTotalLimitOrdersNetworkFees: z9.number(),
|
|
991
|
+
runningTotalYieldCompoundingNetworkFees: z9.number(),
|
|
992
|
+
runningFailedNetworkFees: z9.number(),
|
|
993
|
+
runningProcessedNetworkFees: z9.number(),
|
|
994
|
+
runningJitoLiquidationFees: z9.number(),
|
|
995
|
+
runningJitoLimitOrderFees: z9.number(),
|
|
996
|
+
runningJitoYieldCompoundingFees: z9.number(),
|
|
997
|
+
runningTotalCollectedFees: z9.number(),
|
|
998
|
+
runningTotalNetworkFees: z9.number()
|
|
999
|
+
});
|
|
1000
|
+
var StakingRevenueStatsGroup = z9.object({
|
|
1001
|
+
time: z9.coerce.date(),
|
|
1002
|
+
totalDepositsUsd: z9.number(),
|
|
1003
|
+
totalDepositsSol: z9.coerce.bigint(),
|
|
1004
|
+
runningTotalDepositsUsd: z9.number(),
|
|
1005
|
+
runningTotalDepositsSol: z9.coerce.bigint()
|
|
1006
|
+
});
|
|
1007
|
+
var SwapQuoteByInput = z9.object({
|
|
1008
|
+
estimatedAmountOut: z9.coerce.bigint(),
|
|
1009
|
+
minAmountOut: z9.coerce.bigint(),
|
|
1010
|
+
feeAmount: z9.coerce.bigint(),
|
|
1011
|
+
feeUsd: z9.number(),
|
|
988
1012
|
/** Price impact in percents */
|
|
989
|
-
priceImpact:
|
|
1013
|
+
priceImpact: z9.number()
|
|
990
1014
|
});
|
|
991
|
-
var SwapQuoteByOutput =
|
|
992
|
-
estimatedAmountIn:
|
|
993
|
-
maxAmountIn:
|
|
994
|
-
feeAmount:
|
|
995
|
-
feeUsd:
|
|
1015
|
+
var SwapQuoteByOutput = z9.object({
|
|
1016
|
+
estimatedAmountIn: z9.coerce.bigint(),
|
|
1017
|
+
maxAmountIn: z9.coerce.bigint(),
|
|
1018
|
+
feeAmount: z9.coerce.bigint(),
|
|
1019
|
+
feeUsd: z9.number(),
|
|
996
1020
|
/** Price impact in percents */
|
|
997
|
-
priceImpact:
|
|
1021
|
+
priceImpact: z9.number()
|
|
998
1022
|
});
|
|
999
|
-
var LimitOrderQuoteByInput =
|
|
1000
|
-
amountOut:
|
|
1023
|
+
var LimitOrderQuoteByInput = z9.object({
|
|
1024
|
+
amountOut: z9.coerce.bigint()
|
|
1001
1025
|
});
|
|
1002
|
-
var LimitOrderQuoteByOutput =
|
|
1003
|
-
amountIn:
|
|
1026
|
+
var LimitOrderQuoteByOutput = z9.object({
|
|
1027
|
+
amountIn: z9.coerce.bigint()
|
|
1004
1028
|
});
|
|
1005
1029
|
var TradableAmount = AmountWithUsdSchema;
|
|
1006
|
-
var UpdateStreamSubscriptionResult =
|
|
1007
|
-
status:
|
|
1030
|
+
var UpdateStreamSubscriptionResult = z9.object({
|
|
1031
|
+
status: z9.string()
|
|
1008
1032
|
});
|
|
1009
|
-
var createNotificationSchema = (dataSchema, metaSchema) =>
|
|
1033
|
+
var createNotificationSchema = (dataSchema, metaSchema) => z9.object({
|
|
1010
1034
|
entity: NotificationEntitySchema,
|
|
1011
1035
|
action: NotificationActionSchema,
|
|
1012
1036
|
data: dataSchema,
|
|
1013
|
-
id:
|
|
1014
|
-
authority:
|
|
1015
|
-
...metaSchema ? { meta: metaSchema } : { meta:
|
|
1037
|
+
id: z9.string(),
|
|
1038
|
+
authority: z9.nullish(z9.string()),
|
|
1039
|
+
...metaSchema ? { meta: metaSchema } : { meta: z9.undefined().nullable() }
|
|
1016
1040
|
});
|
|
1017
|
-
var OrderBookNotificationMeta =
|
|
1018
|
-
pool:
|
|
1019
|
-
priceStep:
|
|
1020
|
-
inverted:
|
|
1041
|
+
var OrderBookNotificationMeta = z9.object({
|
|
1042
|
+
pool: z9.string(),
|
|
1043
|
+
priceStep: z9.number(),
|
|
1044
|
+
inverted: z9.boolean()
|
|
1021
1045
|
});
|
|
1022
1046
|
var PoolSwapNotification = createNotificationSchema(PoolSwap);
|
|
1023
1047
|
var OrderBookNotification = createNotificationSchema(OrderBook, OrderBookNotificationMeta);
|