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