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