@crypticdot/defituna-api 1.10.0 → 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 +1658 -1213
- package/dist/index.d.ts +1658 -1213
- package/dist/index.js +738 -634
- package/dist/index.mjs +727 -623
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,8 @@ import snakecaseKeys from "snakecase-keys";
|
|
|
11
11
|
// src/client/schemas.ts
|
|
12
12
|
var schemas_exports = {};
|
|
13
13
|
__export(schemas_exports, {
|
|
14
|
+
AmountWithUsdSchema: () => AmountWithUsdSchema,
|
|
15
|
+
AmountWithoutUsdSchema: () => AmountWithoutUsdSchema,
|
|
14
16
|
CloseSpotPositionQuote: () => CloseSpotPositionQuote,
|
|
15
17
|
DecreaseSpotPositionQuote: () => DecreaseSpotPositionQuote,
|
|
16
18
|
FeesStatsGroup: () => FeesStatsGroup,
|
|
@@ -76,6 +78,7 @@ __export(schemas_exports, {
|
|
|
76
78
|
SwapQuoteByOutput: () => SwapQuoteByOutput,
|
|
77
79
|
Tick: () => Tick,
|
|
78
80
|
TokenOraclePrice: () => TokenOraclePrice,
|
|
81
|
+
TokensPnlSchema: () => TokensPnlSchema,
|
|
79
82
|
TradableAmount: () => TradableAmount,
|
|
80
83
|
TradeHistoryAction: () => TradeHistoryAction,
|
|
81
84
|
TradeHistoryActionSchema: () => TradeHistoryActionSchema,
|
|
@@ -83,7 +86,6 @@ __export(schemas_exports, {
|
|
|
83
86
|
TradeHistoryEntryNotification: () => TradeHistoryEntryNotification,
|
|
84
87
|
TradeHistoryUIDirection: () => TradeHistoryUIDirection,
|
|
85
88
|
TradeHistoryUIDirectionSchema: () => TradeHistoryUIDirectionSchema,
|
|
86
|
-
TunaLpPosition: () => TunaLpPosition,
|
|
87
89
|
TunaLpPositionAction: () => TunaLpPositionAction,
|
|
88
90
|
TunaLpPositionActionClose: () => TunaLpPositionActionClose,
|
|
89
91
|
TunaLpPositionActionCollectAndCompoundFees: () => TunaLpPositionActionCollectAndCompoundFees,
|
|
@@ -94,71 +96,61 @@ __export(schemas_exports, {
|
|
|
94
96
|
TunaLpPositionActionOpen: () => TunaLpPositionActionOpen,
|
|
95
97
|
TunaLpPositionActionParametersUpdate: () => TunaLpPositionActionParametersUpdate,
|
|
96
98
|
TunaLpPositionActionRepayDebt: () => TunaLpPositionActionRepayDebt,
|
|
99
|
+
TunaLpPositionAutoCompounding: () => TunaLpPositionAutoCompounding,
|
|
100
|
+
TunaLpPositionAutoCompoundingSchema: () => TunaLpPositionAutoCompoundingSchema,
|
|
101
|
+
TunaLpPositionDtoSchema: () => TunaLpPositionDtoSchema,
|
|
102
|
+
TunaLpPositionFlagsSchema: () => TunaLpPositionFlagsSchema,
|
|
103
|
+
TunaLpPositionHistorical: () => TunaLpPositionHistorical,
|
|
97
104
|
TunaLpPositionParameters: () => TunaLpPositionParameters,
|
|
98
105
|
TunaLpPositionTokenPrices: () => TunaLpPositionTokenPrices,
|
|
99
106
|
TunaLpPositionTransfer: () => TunaLpPositionTransfer,
|
|
100
107
|
TunaLpPositionValue: () => TunaLpPositionValue,
|
|
101
|
-
|
|
108
|
+
TunaPositionLegacy: () => TunaPositionLegacy,
|
|
102
109
|
TunaPositionNotification: () => TunaPositionNotification,
|
|
110
|
+
TunaPositionPoolSchema: () => TunaPositionPoolSchema,
|
|
111
|
+
TunaPositionPoolToken: () => TunaPositionPoolToken,
|
|
112
|
+
TunaPositionPoolTokenSchema: () => TunaPositionPoolTokenSchema,
|
|
103
113
|
TunaPositionState: () => TunaPositionState,
|
|
104
114
|
TunaPositionStateSchema: () => TunaPositionStateSchema,
|
|
115
|
+
TunaPositionTokenPnlSchema: () => TunaPositionTokenPnlSchema,
|
|
105
116
|
TunaSpotPosition: () => TunaSpotPosition,
|
|
106
117
|
TunaSpotPositionNotification: () => TunaSpotPositionNotification,
|
|
107
118
|
TunaSpotPositionState: () => TunaSpotPositionState,
|
|
108
119
|
TunaSpotPositionStateSchema: () => TunaSpotPositionStateSchema,
|
|
109
120
|
UpdateStreamSubscriptionResult: () => UpdateStreamSubscriptionResult,
|
|
121
|
+
UsdPnlSchema: () => UsdPnlSchema,
|
|
110
122
|
Vault: () => Vault,
|
|
111
123
|
VaultHistoricalStats: () => VaultHistoricalStats,
|
|
112
124
|
WalletSubscriptionTopic: () => WalletSubscriptionTopic,
|
|
113
125
|
WalletSubscriptionTopicSchema: () => WalletSubscriptionTopicSchema
|
|
114
126
|
});
|
|
127
|
+
import { z as z8 } from "zod";
|
|
128
|
+
|
|
129
|
+
// src/client/schemas/basic.ts
|
|
115
130
|
import { z } from "zod";
|
|
116
|
-
var
|
|
117
|
-
amount: z.coerce.bigint()
|
|
118
|
-
});
|
|
119
|
-
var amountWithUsd = z.object({
|
|
131
|
+
var AmountWithUsdSchema = z.object({
|
|
120
132
|
amount: z.coerce.bigint(),
|
|
121
133
|
usd: z.number()
|
|
122
134
|
});
|
|
123
|
-
var
|
|
135
|
+
var AmountWithoutUsdSchema = z.object({
|
|
136
|
+
amount: z.coerce.bigint()
|
|
137
|
+
});
|
|
138
|
+
var TokensPnlSchema = z.object({
|
|
124
139
|
amount: z.coerce.bigint(),
|
|
125
|
-
|
|
140
|
+
rate: z.number()
|
|
126
141
|
});
|
|
127
|
-
var
|
|
142
|
+
var UsdPnlSchema = z.object({
|
|
128
143
|
amount: z.number(),
|
|
129
|
-
|
|
144
|
+
rate: z.number()
|
|
130
145
|
});
|
|
131
|
-
var NotificationEntity = {
|
|
132
|
-
POOL_SWAP: "pool_swap",
|
|
133
|
-
POOL_PRICE: "pool_price",
|
|
134
|
-
ORDER_BOOK: "order_book",
|
|
135
|
-
TUNA_POSITION: "tuna_position",
|
|
136
|
-
TUNA_SPOT_POSITION: "tuna_spot_position",
|
|
137
|
-
LENDING_POSITION: "lending_position",
|
|
138
|
-
STAKING_POSITION: "staking_position",
|
|
139
|
-
FUSION_LIMIT_ORDER: "fusion_limit_order",
|
|
140
|
-
TRADE_HISTORY_ENTRY: "trade_history_entry",
|
|
141
|
-
ORDER_HISTORY_ENTRY: "order_history_entry",
|
|
142
|
-
STATE_SNAPSHOT: "state_snapshot"
|
|
143
|
-
};
|
|
144
|
-
var NotificationAction = {
|
|
145
|
-
CREATE: "create",
|
|
146
|
-
UPDATE: "update"
|
|
147
|
-
};
|
|
148
146
|
var PoolProvider = {
|
|
149
147
|
ORCA: "orca",
|
|
150
148
|
FUSION: "fusion"
|
|
151
149
|
};
|
|
152
|
-
var
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
CLOSED: "closed"
|
|
157
|
-
};
|
|
158
|
-
var TunaSpotPositionState = {
|
|
159
|
-
OPEN: "open",
|
|
160
|
-
CLOSED: "closed"
|
|
161
|
-
};
|
|
150
|
+
var PoolProviderSchema = z.enum([PoolProvider.ORCA, ...Object.values(PoolProvider)]);
|
|
151
|
+
|
|
152
|
+
// src/client/schemas/limit_orders.ts
|
|
153
|
+
import { z as z2 } from "zod";
|
|
162
154
|
var LimitOrderState = {
|
|
163
155
|
OPEN: "open",
|
|
164
156
|
PARTIALLY_FILLED: "partially_filled",
|
|
@@ -166,65 +158,50 @@ var LimitOrderState = {
|
|
|
166
158
|
COMPLETE: "complete",
|
|
167
159
|
CANCELLED: "cancelled"
|
|
168
160
|
};
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
var
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
UNSTAKE: "unstake",
|
|
210
|
-
WITHDRAW: "withdraw",
|
|
211
|
-
CLAIM_REWARDS: "claim_rewards",
|
|
212
|
-
COMPOUND_REWARDS: "compound_rewards"
|
|
213
|
-
};
|
|
214
|
-
var PoolSubscriptionTopic = {
|
|
215
|
-
ORDER_BOOK: "order_book",
|
|
216
|
-
POOL_PRICES: "pool_prices",
|
|
217
|
-
POOL_SWAPS: "pool_swaps"
|
|
218
|
-
};
|
|
219
|
-
var WalletSubscriptionTopic = {
|
|
220
|
-
TUNA_POSITIONS: "tuna_positions",
|
|
221
|
-
TUNA_SPOT_POSITIONS: "tuna_spot_positions",
|
|
222
|
-
LENDING_POSITIONS: "lending_positions",
|
|
223
|
-
FUSION_LIMIT_ORDERS: "fusion_limit_orders",
|
|
224
|
-
STAKING_POSITION: "staking_position",
|
|
225
|
-
TRADE_HISTORY: "trade_history",
|
|
226
|
-
ORDER_HISTORY: "order_history"
|
|
161
|
+
var LimitOrderStateSchema = z2.enum([LimitOrderState.OPEN, ...Object.values(LimitOrderState)]);
|
|
162
|
+
var LimitOrder = z2.object({
|
|
163
|
+
address: z2.string(),
|
|
164
|
+
mint: z2.string(),
|
|
165
|
+
pool: z2.string(),
|
|
166
|
+
state: LimitOrderStateSchema,
|
|
167
|
+
aToB: z2.boolean(),
|
|
168
|
+
tickIndex: z2.number(),
|
|
169
|
+
fillRatio: z2.number(),
|
|
170
|
+
openTxSignature: z2.string(),
|
|
171
|
+
closeTxSignature: z2.nullable(z2.string()),
|
|
172
|
+
amountIn: AmountWithUsdSchema,
|
|
173
|
+
amountOut: AmountWithUsdSchema,
|
|
174
|
+
openedAt: z2.coerce.date(),
|
|
175
|
+
closedAt: z2.nullable(z2.coerce.date())
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// src/client/schemas/lp_positions.ts
|
|
179
|
+
import z5 from "zod";
|
|
180
|
+
|
|
181
|
+
// src/client/schemas/mint.ts
|
|
182
|
+
import { z as z3 } from "zod";
|
|
183
|
+
var Mint = z3.object({
|
|
184
|
+
mint: z3.string(),
|
|
185
|
+
symbol: z3.string(),
|
|
186
|
+
name: z3.string(),
|
|
187
|
+
logo: z3.string(),
|
|
188
|
+
decimals: z3.number()
|
|
189
|
+
});
|
|
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()
|
|
197
|
+
});
|
|
198
|
+
var TunaPositionPoolToken = {
|
|
199
|
+
A: "a",
|
|
200
|
+
B: "b"
|
|
227
201
|
};
|
|
202
|
+
var TunaPositionPoolTokenSchema = z4.enum(Object.values(TunaPositionPoolToken));
|
|
203
|
+
|
|
204
|
+
// src/client/schemas/lp_positions.ts
|
|
228
205
|
var LpPositionLimitOrderSwap = {
|
|
229
206
|
NO_SWAP: "no_swap",
|
|
230
207
|
SWAP_TO_TOKEN_A: "swap_to_token_a",
|
|
@@ -255,270 +232,173 @@ var LpPositionsActionType = {
|
|
|
255
232
|
SET_FLAGS: "set_flags",
|
|
256
233
|
SET_REBALANCE_THRESHOLD: "set_rebalance_threshold"
|
|
257
234
|
};
|
|
258
|
-
var
|
|
259
|
-
var
|
|
260
|
-
var
|
|
261
|
-
var
|
|
262
|
-
var
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
var
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
...Object.values(OrderHistoryUIDirection)
|
|
280
|
-
]);
|
|
281
|
-
var StakingPositionHistoryActionTypeSchema = z.enum([
|
|
282
|
-
StakingPositionHistoryActionType.STAKE,
|
|
283
|
-
...Object.values(StakingPositionHistoryActionType)
|
|
284
|
-
]);
|
|
285
|
-
var PoolSubscriptionTopicSchema = z.enum([
|
|
286
|
-
PoolSubscriptionTopic.ORDER_BOOK,
|
|
287
|
-
...Object.values(PoolSubscriptionTopic)
|
|
288
|
-
]);
|
|
289
|
-
var WalletSubscriptionTopicSchema = z.enum([
|
|
290
|
-
WalletSubscriptionTopic.TUNA_POSITIONS,
|
|
291
|
-
...Object.values(WalletSubscriptionTopic)
|
|
292
|
-
]);
|
|
293
|
-
var LpPositionLimitOrderSwapSchema = z.enum(Object.values(LpPositionLimitOrderSwap));
|
|
294
|
-
var LpPositionAutoCompoundSchema = z.enum(Object.values(LpPositionAutoCompound));
|
|
295
|
-
var LpPositionRebalanceSchema = z.enum(Object.values(LpPositionRebalance));
|
|
296
|
-
var LpPositionsActionTypeSchema = z.enum(Object.values(LpPositionsActionType));
|
|
297
|
-
var PaginationMeta = z.object({
|
|
298
|
-
total: z.number()
|
|
299
|
-
});
|
|
300
|
-
var Mint = z.object({
|
|
301
|
-
symbol: z.string(),
|
|
302
|
-
mint: z.string(),
|
|
303
|
-
logo: z.string(),
|
|
304
|
-
decimals: z.number()
|
|
305
|
-
});
|
|
306
|
-
var Market = z.object({
|
|
307
|
-
address: z.string(),
|
|
308
|
-
addressLookupTable: z.string(),
|
|
309
|
-
poolAddress: z.string(),
|
|
310
|
-
poolFeeRate: z.number(),
|
|
311
|
-
provider: PoolProviderSchema,
|
|
312
|
-
maxLeverage: z.number(),
|
|
313
|
-
maxSwapSlippage: z.number(),
|
|
314
|
-
protocolFee: z.number(),
|
|
315
|
-
rebalanceProtocolFee: z.number(),
|
|
316
|
-
protocolFeeOnCollateral: z.number(),
|
|
317
|
-
liquidationFee: z.number(),
|
|
318
|
-
liquidationThreshold: z.number(),
|
|
319
|
-
oraclePriceDeviationThreshold: z.number(),
|
|
320
|
-
limitOrderExecutionFee: z.number(),
|
|
321
|
-
maxSpotPositionSizeA: amountWithUsd,
|
|
322
|
-
maxSpotPositionSizeB: amountWithUsd,
|
|
323
|
-
borrowedFundsA: amountWithUsd,
|
|
324
|
-
borrowedFundsB: amountWithUsd,
|
|
325
|
-
availableBorrowA: amountWithUsd,
|
|
326
|
-
availableBorrowB: amountWithUsd,
|
|
327
|
-
borrowLimitA: amountWithUsd,
|
|
328
|
-
borrowLimitB: amountWithUsd,
|
|
329
|
-
disabled: z.boolean(),
|
|
330
|
-
createdAt: z.coerce.date()
|
|
331
|
-
});
|
|
332
|
-
var TokenOraclePrice = z.object({
|
|
333
|
-
mint: z.string(),
|
|
334
|
-
price: z.coerce.bigint(),
|
|
335
|
-
decimals: z.number(),
|
|
336
|
-
time: z.coerce.date()
|
|
337
|
-
});
|
|
338
|
-
var Vault = z.object({
|
|
339
|
-
address: z.string(),
|
|
340
|
-
mint: z.string(),
|
|
341
|
-
depositedFunds: amountWithUsd,
|
|
342
|
-
borrowedFunds: amountWithUsd,
|
|
343
|
-
supplyLimit: amountWithUsd,
|
|
344
|
-
borrowedShares: z.coerce.bigint(),
|
|
345
|
-
depositedShares: z.coerce.bigint(),
|
|
346
|
-
supplyApy: z.number(),
|
|
347
|
-
borrowApy: z.number(),
|
|
348
|
-
interestRate: z.coerce.bigint(),
|
|
349
|
-
utilization: z.number(),
|
|
350
|
-
pythOracleFeedId: z.string(),
|
|
351
|
-
pythOraclePriceUpdate: z.string()
|
|
352
|
-
});
|
|
353
|
-
var VaultHistoricalStats = z.object({
|
|
354
|
-
date: z.preprocess((val, ctx) => {
|
|
355
|
-
if (typeof val === "string") {
|
|
356
|
-
const [year, month, day] = val.split("-").map(Number);
|
|
357
|
-
return new Date(year, month - 1, day);
|
|
358
|
-
}
|
|
359
|
-
ctx.addIssue({
|
|
360
|
-
code: "custom",
|
|
361
|
-
message: "Not a valid date string"
|
|
362
|
-
});
|
|
363
|
-
return z.NEVER;
|
|
364
|
-
}, z.date()),
|
|
365
|
-
supply: amountWithUsd,
|
|
366
|
-
borrow: amountWithUsd,
|
|
367
|
-
supplyApy: z.number(),
|
|
368
|
-
borrowApr: z.number()
|
|
369
|
-
});
|
|
370
|
-
var Pool = z.object({
|
|
371
|
-
address: z.string(),
|
|
372
|
-
provider: PoolProviderSchema,
|
|
373
|
-
tokenAMint: z.string(),
|
|
374
|
-
tokenBMint: z.string(),
|
|
375
|
-
tokenAVault: z.string(),
|
|
376
|
-
tokenBVault: z.string(),
|
|
377
|
-
tvlUsdc: z.coerce.number(),
|
|
378
|
-
priceChange24H: z.number(),
|
|
379
|
-
tickSpacing: z.number(),
|
|
380
|
-
feeRate: z.number(),
|
|
381
|
-
olpFeeRate: z.nullable(z.number()),
|
|
382
|
-
protocolFeeRate: z.number(),
|
|
383
|
-
liquidity: z.coerce.bigint(),
|
|
384
|
-
sqrtPrice: z.coerce.bigint(),
|
|
385
|
-
tickCurrentIndex: z.number(),
|
|
386
|
-
stats: z.object({
|
|
387
|
-
"24h": z.object({
|
|
388
|
-
volume: z.coerce.number(),
|
|
389
|
-
fees: z.coerce.number(),
|
|
390
|
-
rewards: z.coerce.number(),
|
|
391
|
-
yieldOverTvl: z.coerce.number()
|
|
392
|
-
}),
|
|
393
|
-
"7d": z.object({
|
|
394
|
-
volume: z.coerce.number(),
|
|
395
|
-
fees: z.coerce.number(),
|
|
396
|
-
rewards: z.coerce.number(),
|
|
397
|
-
yieldOverTvl: z.coerce.number()
|
|
398
|
-
}),
|
|
399
|
-
"30d": z.object({
|
|
400
|
-
volume: z.coerce.number(),
|
|
401
|
-
fees: z.coerce.number(),
|
|
402
|
-
rewards: z.coerce.number(),
|
|
403
|
-
yieldOverTvl: z.coerce.number()
|
|
404
|
-
})
|
|
405
|
-
})
|
|
406
|
-
});
|
|
407
|
-
var Tick = z.object({
|
|
408
|
-
index: z.number(),
|
|
409
|
-
liquidity: z.coerce.bigint()
|
|
410
|
-
});
|
|
411
|
-
var PoolTicks = z.object({
|
|
412
|
-
tickSpacing: z.number(),
|
|
413
|
-
ticks: Tick.array()
|
|
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));
|
|
239
|
+
var TunaPositionState = {
|
|
240
|
+
OPEN: "open",
|
|
241
|
+
LIQUIDATED: "liquidated",
|
|
242
|
+
CLOSED_BY_LIMIT_ORDER: "closed_by_limit_order",
|
|
243
|
+
CLOSED: "closed"
|
|
244
|
+
};
|
|
245
|
+
var TunaPositionStateSchema = z5.enum([TunaPositionState.OPEN, ...Object.values(TunaPositionState)]);
|
|
246
|
+
var TunaLpPositionAutoCompounding = {
|
|
247
|
+
WITH_LEVERAGE: "with_leverage",
|
|
248
|
+
WITHOUT_LEVERAGE: "without_leverage"
|
|
249
|
+
};
|
|
250
|
+
var TunaLpPositionAutoCompoundingSchema = z5.enum(
|
|
251
|
+
Object.values(TunaLpPositionAutoCompounding)
|
|
252
|
+
);
|
|
253
|
+
var TunaPositionTokenPnlSchema = z5.object({
|
|
254
|
+
amount: z5.coerce.bigint(),
|
|
255
|
+
bps: z5.number()
|
|
414
256
|
});
|
|
415
|
-
var
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
shares: z.coerce.bigint(),
|
|
421
|
-
funds: amountWithUsd,
|
|
422
|
-
earned: amountWithUsd
|
|
257
|
+
var TunaLpPositionFlagsSchema = z5.object({
|
|
258
|
+
lowerLimitOrderSwapToToken: z5.nullable(TunaPositionPoolTokenSchema),
|
|
259
|
+
upperLimitOrderSwapToToken: z5.nullable(TunaPositionPoolTokenSchema),
|
|
260
|
+
autoCompounding: z5.nullable(TunaLpPositionAutoCompoundingSchema),
|
|
261
|
+
autoRebalancing: z5.boolean()
|
|
423
262
|
});
|
|
424
|
-
var
|
|
425
|
-
address:
|
|
426
|
-
authority:
|
|
427
|
-
version:
|
|
263
|
+
var TunaLpPositionDtoSchema = z5.object({
|
|
264
|
+
address: z5.string(),
|
|
265
|
+
authority: z5.string(),
|
|
266
|
+
version: z5.number(),
|
|
428
267
|
state: TunaPositionStateSchema,
|
|
429
|
-
positionMint:
|
|
430
|
-
liquidity:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
flags:
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
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(),
|
|
275
|
+
flags: TunaLpPositionFlagsSchema,
|
|
276
|
+
mintA: Mint,
|
|
277
|
+
mintB: Mint,
|
|
278
|
+
pool: TunaPositionPoolSchema,
|
|
279
|
+
marketMaker: PoolProviderSchema,
|
|
280
|
+
depositedCollateralA: AmountWithUsdSchema,
|
|
281
|
+
depositedCollateralB: AmountWithUsdSchema,
|
|
282
|
+
leverage: z5.number(),
|
|
283
|
+
maxLeverage: z5.number(),
|
|
284
|
+
liquidationPriceLower: z5.number(),
|
|
285
|
+
liquidationPriceUpper: z5.number(),
|
|
286
|
+
initialDebtA: AmountWithUsdSchema,
|
|
287
|
+
initialDebtB: AmountWithUsdSchema,
|
|
288
|
+
currentDebtA: AmountWithUsdSchema,
|
|
289
|
+
currentDebtB: AmountWithUsdSchema,
|
|
290
|
+
leftoversA: AmountWithUsdSchema,
|
|
291
|
+
leftoversB: AmountWithUsdSchema,
|
|
292
|
+
yieldA: AmountWithUsdSchema,
|
|
293
|
+
yieldB: AmountWithUsdSchema,
|
|
294
|
+
compoundedYieldA: AmountWithUsdSchema,
|
|
295
|
+
compoundedYieldB: AmountWithUsdSchema,
|
|
296
|
+
totalA: AmountWithUsdSchema,
|
|
297
|
+
totalB: AmountWithUsdSchema,
|
|
298
|
+
pnlA: TokensPnlSchema,
|
|
299
|
+
pnlB: TokensPnlSchema,
|
|
300
|
+
pnlUsd: UsdPnlSchema,
|
|
301
|
+
openedAt: z5.coerce.date(),
|
|
302
|
+
closedAt: z5.nullable(z5.coerce.date())
|
|
462
303
|
});
|
|
463
|
-
var
|
|
464
|
-
positionAddress:
|
|
465
|
-
authority:
|
|
466
|
-
pool:
|
|
304
|
+
var TunaLpPositionHistorical = z5.object({
|
|
305
|
+
positionAddress: z5.string(),
|
|
306
|
+
authority: z5.string(),
|
|
307
|
+
pool: z5.string(),
|
|
467
308
|
state: TunaPositionStateSchema,
|
|
468
|
-
lowerPrice:
|
|
469
|
-
upperPrice:
|
|
470
|
-
lowerLimitOrder:
|
|
471
|
-
upperLimitOrder:
|
|
309
|
+
lowerPrice: z5.number(),
|
|
310
|
+
upperPrice: z5.number(),
|
|
311
|
+
lowerLimitOrder: z5.number().nullable(),
|
|
312
|
+
upperLimitOrder: z5.number().nullable(),
|
|
472
313
|
marketMaker: PoolProviderSchema,
|
|
473
|
-
openedAt:
|
|
474
|
-
closedAt:
|
|
475
|
-
totalValueUsd:
|
|
476
|
-
leverage:
|
|
477
|
-
initialLeverage:
|
|
478
|
-
totalDepositUsd:
|
|
479
|
-
totalWithdrawnUsd:
|
|
480
|
-
feesSumUsd:
|
|
481
|
-
closedPnlSumUsd:
|
|
482
|
-
entryPrice:
|
|
483
|
-
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()
|
|
325
|
+
});
|
|
326
|
+
var TunaPositionLegacy = z5.object({
|
|
327
|
+
address: z5.string(),
|
|
328
|
+
authority: z5.string(),
|
|
329
|
+
version: z5.number(),
|
|
330
|
+
state: TunaPositionStateSchema,
|
|
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(),
|
|
341
|
+
depositedCollateralA: AmountWithoutUsdSchema,
|
|
342
|
+
depositedCollateralB: AmountWithoutUsdSchema,
|
|
343
|
+
depositedCollateralUsd: z5.object({
|
|
344
|
+
amount: z5.number()
|
|
345
|
+
}),
|
|
346
|
+
loanFundsA: AmountWithUsdSchema,
|
|
347
|
+
loanFundsB: AmountWithUsdSchema,
|
|
348
|
+
currentLoanA: AmountWithUsdSchema,
|
|
349
|
+
currentLoanB: AmountWithUsdSchema,
|
|
350
|
+
leftoversA: AmountWithUsdSchema,
|
|
351
|
+
leftoversB: AmountWithUsdSchema,
|
|
352
|
+
yieldA: AmountWithUsdSchema,
|
|
353
|
+
yieldB: AmountWithUsdSchema,
|
|
354
|
+
compoundedYieldA: AmountWithUsdSchema,
|
|
355
|
+
compoundedYieldB: AmountWithUsdSchema,
|
|
356
|
+
totalA: AmountWithUsdSchema,
|
|
357
|
+
totalB: AmountWithUsdSchema,
|
|
358
|
+
pnlA: TokensPnlSchema,
|
|
359
|
+
pnlB: TokensPnlSchema,
|
|
360
|
+
pnlUsd: UsdPnlSchema,
|
|
361
|
+
openedAt: z5.coerce.date(),
|
|
362
|
+
updatedAtSlot: z5.coerce.bigint(),
|
|
363
|
+
closedAt: z5.nullable(z5.coerce.date())
|
|
484
364
|
});
|
|
485
|
-
var TunaLpPositionParameters =
|
|
486
|
-
lowerPrice:
|
|
487
|
-
upperPrice:
|
|
488
|
-
lowerLimitOrder:
|
|
489
|
-
upperLimitOrder:
|
|
365
|
+
var TunaLpPositionParameters = z5.object({
|
|
366
|
+
lowerPrice: z5.number(),
|
|
367
|
+
upperPrice: z5.number(),
|
|
368
|
+
lowerLimitOrder: z5.number().nullable(),
|
|
369
|
+
upperLimitOrder: z5.number().nullable(),
|
|
490
370
|
lowerLimitOrderSwap: LpPositionLimitOrderSwapSchema,
|
|
491
371
|
upperLimitOrderSwap: LpPositionLimitOrderSwapSchema,
|
|
492
372
|
autoCompound: LpPositionAutoCompoundSchema,
|
|
493
373
|
rebalance: LpPositionRebalanceSchema,
|
|
494
|
-
rebalanceThresholdTicks:
|
|
374
|
+
rebalanceThresholdTicks: z5.number()
|
|
495
375
|
});
|
|
496
|
-
var TunaLpPositionValue =
|
|
497
|
-
totalValueA:
|
|
498
|
-
totalValueB:
|
|
499
|
-
totalValueUsd:
|
|
500
|
-
loanFundsA:
|
|
501
|
-
loanFundsB:
|
|
502
|
-
loanFundsUsd:
|
|
503
|
-
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()
|
|
504
384
|
});
|
|
505
|
-
var TunaLpPositionTransfer =
|
|
506
|
-
amountA:
|
|
507
|
-
amountB:
|
|
508
|
-
amountUsd:
|
|
385
|
+
var TunaLpPositionTransfer = z5.object({
|
|
386
|
+
amountA: z5.number(),
|
|
387
|
+
amountB: z5.number(),
|
|
388
|
+
amountUsd: z5.number()
|
|
509
389
|
});
|
|
510
|
-
var TunaLpPositionTokenPrices =
|
|
511
|
-
tokenPriceA:
|
|
512
|
-
tokenPriceB:
|
|
390
|
+
var TunaLpPositionTokenPrices = z5.object({
|
|
391
|
+
tokenPriceA: z5.number(),
|
|
392
|
+
tokenPriceB: z5.number()
|
|
513
393
|
});
|
|
514
|
-
var TunaLpPositionActionOpen =
|
|
394
|
+
var TunaLpPositionActionOpen = z5.object({
|
|
515
395
|
parameters: TunaLpPositionParameters
|
|
516
396
|
});
|
|
517
|
-
var TunaLpPositionActionClose =
|
|
397
|
+
var TunaLpPositionActionClose = z5.object({
|
|
518
398
|
toOwner: TunaLpPositionTransfer.nullable(),
|
|
519
399
|
prices: TunaLpPositionTokenPrices.nullable()
|
|
520
400
|
});
|
|
521
|
-
var TunaLpPositionActionIncreaseLiquidity =
|
|
401
|
+
var TunaLpPositionActionIncreaseLiquidity = z5.object({
|
|
522
402
|
fromPosition: TunaLpPositionValue.nullable(),
|
|
523
403
|
toPosition: TunaLpPositionValue,
|
|
524
404
|
fromOwner: TunaLpPositionTransfer,
|
|
@@ -526,9 +406,9 @@ var TunaLpPositionActionIncreaseLiquidity = z.object({
|
|
|
526
406
|
protocolFees: TunaLpPositionTransfer,
|
|
527
407
|
prices: TunaLpPositionTokenPrices
|
|
528
408
|
});
|
|
529
|
-
var TunaLpPositionActionDecreaseLiquidity =
|
|
530
|
-
withdrawPercent:
|
|
531
|
-
closedPnlUsd:
|
|
409
|
+
var TunaLpPositionActionDecreaseLiquidity = z5.object({
|
|
410
|
+
withdrawPercent: z5.number(),
|
|
411
|
+
closedPnlUsd: z5.number(),
|
|
532
412
|
fromPosition: TunaLpPositionValue,
|
|
533
413
|
toPosition: TunaLpPositionValue.nullable(),
|
|
534
414
|
toOwner: TunaLpPositionTransfer,
|
|
@@ -536,28 +416,28 @@ var TunaLpPositionActionDecreaseLiquidity = z.object({
|
|
|
536
416
|
collectedFees: TunaLpPositionTransfer,
|
|
537
417
|
prices: TunaLpPositionTokenPrices
|
|
538
418
|
});
|
|
539
|
-
var TunaLpPositionActionLiquidate =
|
|
540
|
-
withdrawPercent:
|
|
419
|
+
var TunaLpPositionActionLiquidate = z5.object({
|
|
420
|
+
withdrawPercent: z5.number(),
|
|
541
421
|
fromPosition: TunaLpPositionValue,
|
|
542
422
|
toLending: TunaLpPositionTransfer,
|
|
543
423
|
protocolFees: TunaLpPositionTransfer,
|
|
544
424
|
prices: TunaLpPositionTokenPrices
|
|
545
425
|
});
|
|
546
|
-
var TunaLpPositionActionRepayDebt =
|
|
426
|
+
var TunaLpPositionActionRepayDebt = z5.object({
|
|
547
427
|
fromPosition: TunaLpPositionValue,
|
|
548
428
|
toPosition: TunaLpPositionValue,
|
|
549
429
|
fromOwner: TunaLpPositionTransfer,
|
|
550
430
|
toLending: TunaLpPositionTransfer,
|
|
551
431
|
prices: TunaLpPositionTokenPrices
|
|
552
432
|
});
|
|
553
|
-
var TunaLpPositionActionCollectFees =
|
|
554
|
-
closedPnlUsd:
|
|
433
|
+
var TunaLpPositionActionCollectFees = z5.object({
|
|
434
|
+
closedPnlUsd: z5.number(),
|
|
555
435
|
position: TunaLpPositionValue,
|
|
556
436
|
collectedFees: TunaLpPositionTransfer,
|
|
557
437
|
toOwner: TunaLpPositionTransfer,
|
|
558
438
|
prices: TunaLpPositionTokenPrices
|
|
559
439
|
});
|
|
560
|
-
var TunaLpPositionActionCollectAndCompoundFees =
|
|
440
|
+
var TunaLpPositionActionCollectAndCompoundFees = z5.object({
|
|
561
441
|
fromPosition: TunaLpPositionValue,
|
|
562
442
|
toPosition: TunaLpPositionValue,
|
|
563
443
|
collectedFees: TunaLpPositionTransfer,
|
|
@@ -565,15 +445,15 @@ var TunaLpPositionActionCollectAndCompoundFees = z.object({
|
|
|
565
445
|
protocolFees: TunaLpPositionTransfer,
|
|
566
446
|
prices: TunaLpPositionTokenPrices
|
|
567
447
|
});
|
|
568
|
-
var TunaLpPositionActionParametersUpdate =
|
|
448
|
+
var TunaLpPositionActionParametersUpdate = z5.object({
|
|
569
449
|
fromParameters: TunaLpPositionParameters,
|
|
570
450
|
toParameters: TunaLpPositionParameters
|
|
571
451
|
});
|
|
572
|
-
var TunaLpPositionAction =
|
|
452
|
+
var TunaLpPositionAction = z5.object({
|
|
573
453
|
action: LpPositionsActionTypeSchema,
|
|
574
|
-
txSignature:
|
|
575
|
-
txTimestamp:
|
|
576
|
-
data:
|
|
454
|
+
txSignature: z5.string(),
|
|
455
|
+
txTimestamp: z5.coerce.date(),
|
|
456
|
+
data: z5.object({
|
|
577
457
|
/** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
|
|
578
458
|
fromPosition: TunaLpPositionValue.optional().nullable(),
|
|
579
459
|
/** defined for: IncreaseLiquidity, DecreaseLiquidity, Liquidate, ExecuteLimitOrder, RepayDebt, CollectAndCompoundFees */
|
|
@@ -601,324 +481,548 @@ var TunaLpPositionAction = z.object({
|
|
|
601
481
|
/** defined for: ParametersUpdate */
|
|
602
482
|
toParameters: TunaLpPositionParameters.optional(),
|
|
603
483
|
/** defined for: DecreaseLiquidity */
|
|
604
|
-
withdrawPercent:
|
|
484
|
+
withdrawPercent: z5.number().optional(),
|
|
605
485
|
/** defined for: DecreaseLiquidity, CollectFees */
|
|
606
|
-
closedPnlUsd:
|
|
486
|
+
closedPnlUsd: z5.number().optional()
|
|
607
487
|
})
|
|
608
488
|
});
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
489
|
+
|
|
490
|
+
// src/client/schemas/spot_positions.ts
|
|
491
|
+
import { z as z6 } from "zod";
|
|
492
|
+
var TunaSpotPositionState = {
|
|
493
|
+
OPEN: "open",
|
|
494
|
+
CLOSED: "closed"
|
|
495
|
+
};
|
|
496
|
+
var TunaSpotPositionStateSchema = z6.enum([
|
|
497
|
+
TunaSpotPositionState.OPEN,
|
|
498
|
+
...Object.values(TunaSpotPositionState)
|
|
499
|
+
]);
|
|
500
|
+
var TunaSpotPosition = z6.object({
|
|
501
|
+
address: z6.string(),
|
|
502
|
+
authority: z6.string(),
|
|
503
|
+
version: z6.number(),
|
|
613
504
|
state: TunaSpotPositionStateSchema,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
total:
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
505
|
+
lowerLimitOrderPrice: z6.number(),
|
|
506
|
+
upperLimitOrderPrice: z6.number(),
|
|
507
|
+
entryPrice: z6.number(),
|
|
508
|
+
mintA: Mint,
|
|
509
|
+
mintB: Mint,
|
|
510
|
+
pool: TunaPositionPoolSchema,
|
|
511
|
+
positionToken: TunaPositionPoolToken,
|
|
512
|
+
collateralToken: TunaPositionPoolToken,
|
|
513
|
+
marketMaker: PoolProviderSchema,
|
|
514
|
+
depositedCollateral: AmountWithUsdSchema,
|
|
515
|
+
initialDebt: AmountWithUsdSchema,
|
|
516
|
+
currentDebt: AmountWithUsdSchema,
|
|
517
|
+
total: AmountWithUsdSchema,
|
|
518
|
+
leverage: z6.number(),
|
|
519
|
+
maxLeverage: z6.number(),
|
|
520
|
+
liquidationPrice: z6.number(),
|
|
521
|
+
pnlUsd: UsdPnlSchema,
|
|
522
|
+
openedAt: z6.coerce.date(),
|
|
523
|
+
closedAt: z6.nullable(z6.coerce.date())
|
|
524
|
+
});
|
|
525
|
+
var IncreaseSpotPositionQuote = z6.object({
|
|
526
|
+
/** Required collateral amount */
|
|
527
|
+
collateralAmount: z6.coerce.bigint(),
|
|
528
|
+
/** Required amount to borrow */
|
|
529
|
+
borrowAmount: z6.coerce.bigint(),
|
|
530
|
+
/** Estimated position size in the position token. */
|
|
531
|
+
estimatedAmount: z6.coerce.bigint(),
|
|
532
|
+
/** Swap input amount. */
|
|
533
|
+
swapInputAmount: z6.coerce.bigint(),
|
|
534
|
+
/** Minimum swap output amount according to the provided slippage. */
|
|
535
|
+
minSwapOutputAmount: z6.coerce.bigint(),
|
|
536
|
+
/** Protocol fee in token A */
|
|
537
|
+
protocolFeeA: z6.coerce.bigint(),
|
|
538
|
+
/** Protocol fee in token B */
|
|
539
|
+
protocolFeeB: z6.coerce.bigint(),
|
|
540
|
+
/** Price impact in percents */
|
|
541
|
+
priceImpact: z6.number(),
|
|
542
|
+
/** Liquidation price */
|
|
543
|
+
liquidationPrice: z6.number()
|
|
634
544
|
});
|
|
635
|
-
var
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
545
|
+
var DecreaseSpotPositionQuote = z6.object({
|
|
546
|
+
/** Confirmed position decrease percentage (100% = 1.0) */
|
|
547
|
+
decreasePercent: z6.number(),
|
|
548
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
549
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
550
|
+
*/
|
|
551
|
+
requiredSwapAmount: z6.coerce.bigint(),
|
|
552
|
+
/** Estimated total amount of the adjusted position */
|
|
553
|
+
estimatedAmount: z6.coerce.bigint(),
|
|
554
|
+
/** Estimated amount of the withdrawn collateral */
|
|
555
|
+
estimatedWithdrawnCollateral: z6.coerce.bigint(),
|
|
556
|
+
/** Price impact in percents */
|
|
557
|
+
priceImpact: z6.number(),
|
|
558
|
+
/** Liquidation price */
|
|
559
|
+
liquidationPrice: z6.number()
|
|
643
560
|
});
|
|
644
|
-
var
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
561
|
+
var CloseSpotPositionQuote = z6.object({
|
|
562
|
+
/** Position decrease percentage */
|
|
563
|
+
decreasePercent: z6.number(),
|
|
564
|
+
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
565
|
+
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
566
|
+
*/
|
|
567
|
+
requiredSwapAmount: z6.coerce.bigint(),
|
|
568
|
+
/** Estimated amount of the withdrawn collateral */
|
|
569
|
+
estimatedWithdrawnCollateral: z6.coerce.bigint(),
|
|
570
|
+
/** Price impact in percents */
|
|
571
|
+
priceImpact: z6.number()
|
|
655
572
|
});
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
573
|
+
|
|
574
|
+
// src/client/schemas/state_snapshot.ts
|
|
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()
|
|
661
581
|
});
|
|
662
|
-
var
|
|
663
|
-
|
|
664
|
-
|
|
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))
|
|
665
589
|
});
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
590
|
+
|
|
591
|
+
// src/client/schemas.ts
|
|
592
|
+
var NotificationEntity = {
|
|
593
|
+
POOL_SWAP: "pool_swap",
|
|
594
|
+
POOL_PRICE: "pool_price",
|
|
595
|
+
ORDER_BOOK: "order_book",
|
|
596
|
+
TUNA_POSITION: "tuna_position",
|
|
597
|
+
TUNA_SPOT_POSITION: "tuna_spot_position",
|
|
598
|
+
LENDING_POSITION: "lending_position",
|
|
599
|
+
STAKING_POSITION: "staking_position",
|
|
600
|
+
FUSION_LIMIT_ORDER: "fusion_limit_order",
|
|
601
|
+
TRADE_HISTORY_ENTRY: "trade_history_entry",
|
|
602
|
+
ORDER_HISTORY_ENTRY: "order_history_entry",
|
|
603
|
+
STATE_SNAPSHOT: "state_snapshot"
|
|
604
|
+
};
|
|
605
|
+
var NotificationAction = {
|
|
606
|
+
CREATE: "create",
|
|
607
|
+
UPDATE: "update"
|
|
608
|
+
};
|
|
609
|
+
var TradeHistoryAction = {
|
|
610
|
+
SWAP: "swap",
|
|
611
|
+
LIMIT_ORDER_FILL: "limit_order_fill",
|
|
612
|
+
POSITION_INCREASE: "position_increase",
|
|
613
|
+
POSITION_DECREASE: "position_decrease",
|
|
614
|
+
TAKE_PROFIT: "take_profit",
|
|
615
|
+
STOP_LOSS: "stop_loss",
|
|
616
|
+
LIQUIDATION: "liquidation"
|
|
617
|
+
};
|
|
618
|
+
var TradeHistoryUIDirection = {
|
|
619
|
+
BUY: "buy",
|
|
620
|
+
SELL: "sell",
|
|
621
|
+
OPEN_LONG: "open_long",
|
|
622
|
+
CLOSE_LONG: "close_long",
|
|
623
|
+
OPEN_SHORT: "open_short",
|
|
624
|
+
CLOSE_SHORT: "close_short"
|
|
625
|
+
};
|
|
626
|
+
var OrderHistoryOrderType = {
|
|
627
|
+
MARKET: "market",
|
|
628
|
+
LIMIT: "limit",
|
|
629
|
+
TAKE_PROFIT_MARKET: "take_profit_market",
|
|
630
|
+
STOP_LOSS_MARKET: "stop_loss_market",
|
|
631
|
+
LIQUIDATION_MARKET: "liquidation_market"
|
|
632
|
+
};
|
|
633
|
+
var OrderHistoryStatus = {
|
|
634
|
+
OPEN: "open",
|
|
635
|
+
PARTIALLY_FILLED: "partially_filled",
|
|
636
|
+
FILLED: "filled",
|
|
637
|
+
CANCELLED: "cancelled",
|
|
638
|
+
CLAIMED: "claimed",
|
|
639
|
+
REJECTED: "rejected"
|
|
640
|
+
};
|
|
641
|
+
var OrderHistoryUIDirection = {
|
|
642
|
+
BUY: "buy",
|
|
643
|
+
SELL: "sell",
|
|
644
|
+
LONG: "long",
|
|
645
|
+
SHORT: "short"
|
|
646
|
+
};
|
|
647
|
+
var StakingPositionHistoryActionType = {
|
|
648
|
+
STAKE: "stake",
|
|
649
|
+
UNSTAKE: "unstake",
|
|
650
|
+
WITHDRAW: "withdraw",
|
|
651
|
+
CLAIM_REWARDS: "claim_rewards",
|
|
652
|
+
COMPOUND_REWARDS: "compound_rewards"
|
|
653
|
+
};
|
|
654
|
+
var PoolSubscriptionTopic = {
|
|
655
|
+
ORDER_BOOK: "order_book",
|
|
656
|
+
POOL_PRICES: "pool_prices",
|
|
657
|
+
POOL_SWAPS: "pool_swaps"
|
|
658
|
+
};
|
|
659
|
+
var WalletSubscriptionTopic = {
|
|
660
|
+
TUNA_POSITIONS: "tuna_positions",
|
|
661
|
+
TUNA_SPOT_POSITIONS: "tuna_spot_positions",
|
|
662
|
+
LENDING_POSITIONS: "lending_positions",
|
|
663
|
+
FUSION_LIMIT_ORDERS: "fusion_limit_orders",
|
|
664
|
+
STAKING_POSITION: "staking_position",
|
|
665
|
+
TRADE_HISTORY: "trade_history",
|
|
666
|
+
ORDER_HISTORY: "order_history"
|
|
667
|
+
};
|
|
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([
|
|
672
|
+
TradeHistoryUIDirection.BUY,
|
|
673
|
+
...Object.values(TradeHistoryUIDirection)
|
|
674
|
+
]);
|
|
675
|
+
var OrderHistoryOrderTypeSchema = z8.enum([
|
|
676
|
+
OrderHistoryOrderType.MARKET,
|
|
677
|
+
...Object.values(OrderHistoryOrderType)
|
|
678
|
+
]);
|
|
679
|
+
var OrderHistoryStatusSchema = z8.enum([OrderHistoryStatus.OPEN, ...Object.values(OrderHistoryStatus)]);
|
|
680
|
+
var OrderHistoryUIDirectionSchema = z8.enum([
|
|
681
|
+
OrderHistoryUIDirection.BUY,
|
|
682
|
+
...Object.values(OrderHistoryUIDirection)
|
|
683
|
+
]);
|
|
684
|
+
var StakingPositionHistoryActionTypeSchema = z8.enum([
|
|
685
|
+
StakingPositionHistoryActionType.STAKE,
|
|
686
|
+
...Object.values(StakingPositionHistoryActionType)
|
|
687
|
+
]);
|
|
688
|
+
var PoolSubscriptionTopicSchema = z8.enum([
|
|
689
|
+
PoolSubscriptionTopic.ORDER_BOOK,
|
|
690
|
+
...Object.values(PoolSubscriptionTopic)
|
|
691
|
+
]);
|
|
692
|
+
var WalletSubscriptionTopicSchema = z8.enum([
|
|
693
|
+
WalletSubscriptionTopic.TUNA_POSITIONS,
|
|
694
|
+
...Object.values(WalletSubscriptionTopic)
|
|
695
|
+
]);
|
|
696
|
+
var PaginationMeta = z8.object({
|
|
697
|
+
total: z8.number()
|
|
698
|
+
});
|
|
699
|
+
var Market = z8.object({
|
|
700
|
+
address: z8.string(),
|
|
701
|
+
addressLookupTable: z8.string(),
|
|
702
|
+
poolAddress: z8.string(),
|
|
703
|
+
poolFeeRate: z8.number(),
|
|
704
|
+
provider: PoolProviderSchema,
|
|
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(),
|
|
713
|
+
maxSpotPositionSizeA: AmountWithUsdSchema,
|
|
714
|
+
maxSpotPositionSizeB: AmountWithUsdSchema,
|
|
715
|
+
borrowedFundsA: AmountWithUsdSchema,
|
|
716
|
+
borrowedFundsB: AmountWithUsdSchema,
|
|
717
|
+
availableBorrowA: AmountWithUsdSchema,
|
|
718
|
+
availableBorrowB: AmountWithUsdSchema,
|
|
719
|
+
borrowLimitA: AmountWithUsdSchema,
|
|
720
|
+
borrowLimitB: AmountWithUsdSchema,
|
|
721
|
+
disabled: z8.boolean(),
|
|
722
|
+
createdAt: z8.coerce.date()
|
|
723
|
+
});
|
|
724
|
+
var TokenOraclePrice = z8.object({
|
|
725
|
+
mint: z8.string(),
|
|
726
|
+
price: z8.coerce.bigint(),
|
|
727
|
+
decimals: z8.number(),
|
|
728
|
+
time: z8.coerce.date()
|
|
729
|
+
});
|
|
730
|
+
var Vault = z8.object({
|
|
731
|
+
address: z8.string(),
|
|
732
|
+
mint: z8.string(),
|
|
733
|
+
depositedFunds: AmountWithUsdSchema,
|
|
734
|
+
borrowedFunds: AmountWithUsdSchema,
|
|
735
|
+
supplyLimit: AmountWithUsdSchema,
|
|
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()
|
|
744
|
+
});
|
|
745
|
+
var VaultHistoricalStats = z8.object({
|
|
746
|
+
date: z8.preprocess((val, ctx) => {
|
|
747
|
+
if (typeof val === "string") {
|
|
748
|
+
const [year, month, day] = val.split("-").map(Number);
|
|
749
|
+
return new Date(year, month - 1, day);
|
|
750
|
+
}
|
|
751
|
+
ctx.addIssue({
|
|
752
|
+
code: "custom",
|
|
753
|
+
message: "Not a valid date string"
|
|
754
|
+
});
|
|
755
|
+
return z8.NEVER;
|
|
756
|
+
}, z8.date()),
|
|
757
|
+
supply: AmountWithUsdSchema,
|
|
758
|
+
borrow: AmountWithUsdSchema,
|
|
759
|
+
supplyApy: z8.number(),
|
|
760
|
+
borrowApr: z8.number()
|
|
761
|
+
});
|
|
762
|
+
var Pool = z8.object({
|
|
763
|
+
address: z8.string(),
|
|
764
|
+
provider: PoolProviderSchema,
|
|
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()
|
|
784
|
+
}),
|
|
785
|
+
"7d": z8.object({
|
|
786
|
+
volume: z8.coerce.number(),
|
|
787
|
+
fees: z8.coerce.number(),
|
|
788
|
+
rewards: z8.coerce.number(),
|
|
789
|
+
yieldOverTvl: z8.coerce.number()
|
|
790
|
+
}),
|
|
791
|
+
"30d": z8.object({
|
|
792
|
+
volume: z8.coerce.number(),
|
|
793
|
+
fees: z8.coerce.number(),
|
|
794
|
+
rewards: z8.coerce.number(),
|
|
795
|
+
yieldOverTvl: z8.coerce.number()
|
|
796
|
+
})
|
|
797
|
+
})
|
|
798
|
+
});
|
|
799
|
+
var Tick = z8.object({
|
|
800
|
+
index: z8.number(),
|
|
801
|
+
liquidity: z8.coerce.bigint()
|
|
802
|
+
});
|
|
803
|
+
var PoolTicks = z8.object({
|
|
804
|
+
tickSpacing: z8.number(),
|
|
805
|
+
ticks: Tick.array()
|
|
806
|
+
});
|
|
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(),
|
|
813
|
+
funds: AmountWithUsdSchema,
|
|
814
|
+
earned: AmountWithUsdSchema
|
|
680
815
|
});
|
|
681
|
-
var
|
|
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()
|
|
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()
|
|
840
|
+
});
|
|
841
|
+
var TradeHistoryEntry = z8.object({
|
|
682
842
|
// Internal entry ID
|
|
683
|
-
id:
|
|
684
|
-
pool:
|
|
685
|
-
authority:
|
|
686
|
-
aToB:
|
|
843
|
+
id: z8.string(),
|
|
844
|
+
pool: z8.string(),
|
|
845
|
+
authority: z8.string(),
|
|
846
|
+
aToB: z8.boolean(),
|
|
687
847
|
// Trade action which created entry
|
|
688
848
|
action: TradeHistoryActionSchema,
|
|
689
849
|
// Trade direction formatted for ui display
|
|
690
850
|
uiDirection: TradeHistoryUIDirectionSchema,
|
|
691
851
|
// Trade price formatted for ui display
|
|
692
|
-
uiPrice:
|
|
693
|
-
baseToken:
|
|
694
|
-
quoteToken:
|
|
695
|
-
fee:
|
|
696
|
-
pnl:
|
|
697
|
-
|
|
698
|
-
usd:
|
|
699
|
-
bps:
|
|
852
|
+
uiPrice: z8.number(),
|
|
853
|
+
baseToken: AmountWithUsdSchema,
|
|
854
|
+
quoteToken: AmountWithUsdSchema,
|
|
855
|
+
fee: AmountWithUsdSchema,
|
|
856
|
+
pnl: z8.nullable(
|
|
857
|
+
z8.object({
|
|
858
|
+
usd: z8.number(),
|
|
859
|
+
bps: z8.number()
|
|
700
860
|
})
|
|
701
861
|
),
|
|
702
|
-
txSignature:
|
|
703
|
-
positionAddress:
|
|
704
|
-
slot:
|
|
705
|
-
ts:
|
|
862
|
+
txSignature: z8.nullable(z8.string()),
|
|
863
|
+
positionAddress: z8.nullable(z8.string()),
|
|
864
|
+
slot: z8.coerce.bigint(),
|
|
865
|
+
ts: z8.coerce.date()
|
|
706
866
|
});
|
|
707
|
-
var OrderHistoryEntry =
|
|
867
|
+
var OrderHistoryEntry = z8.object({
|
|
708
868
|
// Internal entry ID
|
|
709
|
-
id:
|
|
710
|
-
pool:
|
|
711
|
-
authority:
|
|
869
|
+
id: z8.string(),
|
|
870
|
+
pool: z8.string(),
|
|
871
|
+
authority: z8.string(),
|
|
712
872
|
orderType: OrderHistoryOrderTypeSchema,
|
|
713
|
-
isReduceOnly:
|
|
714
|
-
aToB:
|
|
873
|
+
isReduceOnly: z8.nullable(z8.boolean()),
|
|
874
|
+
aToB: z8.boolean(),
|
|
715
875
|
uiDirection: OrderHistoryUIDirectionSchema,
|
|
716
|
-
uiPrice:
|
|
717
|
-
uiExecutionPrice:
|
|
876
|
+
uiPrice: z8.nullable(z8.number()),
|
|
877
|
+
uiExecutionPrice: z8.nullable(z8.number()),
|
|
718
878
|
status: OrderHistoryStatusSchema,
|
|
719
|
-
baseToken:
|
|
720
|
-
quoteToken:
|
|
721
|
-
baseTokenConsumedAmount:
|
|
722
|
-
quoteTokenFilledAmount:
|
|
723
|
-
txSignature:
|
|
724
|
-
positionAddress:
|
|
725
|
-
slot:
|
|
726
|
-
ts:
|
|
879
|
+
baseToken: AmountWithUsdSchema,
|
|
880
|
+
quoteToken: AmountWithUsdSchema,
|
|
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()
|
|
727
887
|
});
|
|
728
|
-
var StakingTreasury =
|
|
729
|
-
address:
|
|
730
|
-
stakedTokenMint:
|
|
731
|
-
rewardTokenMint:
|
|
732
|
-
apy:
|
|
733
|
-
uniqueStakers:
|
|
734
|
-
totalStaked:
|
|
735
|
-
totalReward:
|
|
736
|
-
unstakeCooldownSeconds:
|
|
737
|
-
isStakingEnabled:
|
|
738
|
-
isUnstakingEnabled:
|
|
739
|
-
isWithdrawEnabled:
|
|
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(),
|
|
894
|
+
totalStaked: AmountWithUsdSchema,
|
|
895
|
+
totalReward: AmountWithUsdSchema,
|
|
896
|
+
unstakeCooldownSeconds: z8.number(),
|
|
897
|
+
isStakingEnabled: z8.boolean(),
|
|
898
|
+
isUnstakingEnabled: z8.boolean(),
|
|
899
|
+
isWithdrawEnabled: z8.boolean()
|
|
740
900
|
});
|
|
741
|
-
var StakingPosition =
|
|
742
|
-
address:
|
|
743
|
-
owner:
|
|
744
|
-
staked:
|
|
745
|
-
unstaked:
|
|
746
|
-
claimedReward:
|
|
747
|
-
unclaimedReward:
|
|
748
|
-
rank:
|
|
749
|
-
vesting:
|
|
750
|
-
locked:
|
|
751
|
-
unlocked:
|
|
752
|
-
unlockRate:
|
|
753
|
-
unlockEverySeconds:
|
|
754
|
-
unlockCliffSeconds:
|
|
755
|
-
lockedAt:
|
|
901
|
+
var StakingPosition = z8.object({
|
|
902
|
+
address: z8.string(),
|
|
903
|
+
owner: z8.string(),
|
|
904
|
+
staked: AmountWithUsdSchema,
|
|
905
|
+
unstaked: AmountWithUsdSchema,
|
|
906
|
+
claimedReward: AmountWithUsdSchema,
|
|
907
|
+
unclaimedReward: AmountWithUsdSchema,
|
|
908
|
+
rank: z8.nullable(z8.number()),
|
|
909
|
+
vesting: z8.object({
|
|
910
|
+
locked: AmountWithUsdSchema,
|
|
911
|
+
unlocked: AmountWithUsdSchema,
|
|
912
|
+
unlockRate: z8.coerce.bigint(),
|
|
913
|
+
unlockEverySeconds: z8.number(),
|
|
914
|
+
unlockCliffSeconds: z8.number(),
|
|
915
|
+
lockedAt: z8.nullable(z8.coerce.date())
|
|
756
916
|
}),
|
|
757
|
-
lastUnstakedAt:
|
|
758
|
-
withdrawAvailableAt:
|
|
917
|
+
lastUnstakedAt: z8.nullable(z8.coerce.date()),
|
|
918
|
+
withdrawAvailableAt: z8.nullable(z8.coerce.date())
|
|
759
919
|
});
|
|
760
|
-
var StakingLeaderboardPosition =
|
|
761
|
-
rank:
|
|
762
|
-
address:
|
|
763
|
-
owner:
|
|
764
|
-
staked:
|
|
920
|
+
var StakingLeaderboardPosition = z8.object({
|
|
921
|
+
rank: z8.number(),
|
|
922
|
+
address: z8.string(),
|
|
923
|
+
owner: z8.string(),
|
|
924
|
+
staked: AmountWithUsdSchema
|
|
765
925
|
});
|
|
766
|
-
var StakingLeaderboardPage =
|
|
926
|
+
var StakingLeaderboardPage = z8.object({
|
|
767
927
|
data: StakingLeaderboardPosition.array(),
|
|
768
928
|
meta: PaginationMeta
|
|
769
929
|
});
|
|
770
|
-
var StakingPositionHistoryAction =
|
|
771
|
-
position:
|
|
930
|
+
var StakingPositionHistoryAction = z8.object({
|
|
931
|
+
position: z8.string(),
|
|
772
932
|
action: StakingPositionHistoryActionTypeSchema,
|
|
773
|
-
txSignature:
|
|
774
|
-
amount:
|
|
775
|
-
time:
|
|
933
|
+
txSignature: z8.string(),
|
|
934
|
+
amount: z8.coerce.bigint(),
|
|
935
|
+
time: z8.coerce.date()
|
|
776
936
|
});
|
|
777
|
-
var PoolPriceCandle =
|
|
778
|
-
time:
|
|
779
|
-
open:
|
|
780
|
-
close:
|
|
781
|
-
high:
|
|
782
|
-
low:
|
|
783
|
-
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()
|
|
784
944
|
});
|
|
785
|
-
var FeesStatsGroup =
|
|
786
|
-
time:
|
|
787
|
-
addLiquidityFees:
|
|
788
|
-
limitOrderFees:
|
|
789
|
-
yieldCompoundingFees:
|
|
790
|
-
liquidationFees:
|
|
791
|
-
totalLiquidationsNetworkFees:
|
|
792
|
-
totalLimitOrdersNetworkFees:
|
|
793
|
-
totalYieldCompoundingNetworkFees:
|
|
794
|
-
failedNetworkFees:
|
|
795
|
-
processedNetworkFees:
|
|
796
|
-
totalCollectedFees:
|
|
797
|
-
totalNetworkFees:
|
|
798
|
-
jitoLiquidationFees:
|
|
799
|
-
jitoLimitOrderFees:
|
|
800
|
-
jitoYieldCompoundingFees:
|
|
801
|
-
runningAddLiquidityFees:
|
|
802
|
-
runningLimitOrderFees:
|
|
803
|
-
runningYieldCompoundingFees:
|
|
804
|
-
runningLiquidationFees:
|
|
805
|
-
runningTotalLiquidationsNetworkFees:
|
|
806
|
-
runningTotalLimitOrdersNetworkFees:
|
|
807
|
-
runningTotalYieldCompoundingNetworkFees:
|
|
808
|
-
runningFailedNetworkFees:
|
|
809
|
-
runningProcessedNetworkFees:
|
|
810
|
-
runningJitoLiquidationFees:
|
|
811
|
-
runningJitoLimitOrderFees:
|
|
812
|
-
runningJitoYieldCompoundingFees:
|
|
813
|
-
runningTotalCollectedFees:
|
|
814
|
-
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()
|
|
815
975
|
});
|
|
816
|
-
var StakingRevenueStatsGroup =
|
|
817
|
-
time:
|
|
818
|
-
totalDepositsUsd:
|
|
819
|
-
totalDepositsSol:
|
|
820
|
-
runningTotalDepositsUsd:
|
|
821
|
-
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()
|
|
822
982
|
});
|
|
823
|
-
var
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
/** Estimated position size in the position token. */
|
|
829
|
-
estimatedAmount: z.coerce.bigint(),
|
|
830
|
-
/** Swap input amount. */
|
|
831
|
-
swapInputAmount: z.coerce.bigint(),
|
|
832
|
-
/** Minimum swap output amount according to the provided slippage. */
|
|
833
|
-
minSwapOutputAmount: z.coerce.bigint(),
|
|
834
|
-
/** Protocol fee in token A */
|
|
835
|
-
protocolFeeA: z.coerce.bigint(),
|
|
836
|
-
/** Protocol fee in token B */
|
|
837
|
-
protocolFeeB: z.coerce.bigint(),
|
|
983
|
+
var SwapQuoteByInput = z8.object({
|
|
984
|
+
estimatedAmountOut: z8.coerce.bigint(),
|
|
985
|
+
minAmountOut: z8.coerce.bigint(),
|
|
986
|
+
feeAmount: z8.coerce.bigint(),
|
|
987
|
+
feeUsd: z8.number(),
|
|
838
988
|
/** Price impact in percents */
|
|
839
|
-
priceImpact:
|
|
840
|
-
/** Liquidation price */
|
|
841
|
-
uiLiquidationPrice: z.nullable(z.number())
|
|
989
|
+
priceImpact: z8.number()
|
|
842
990
|
});
|
|
843
|
-
var
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
*/
|
|
849
|
-
requiredSwapAmount: z.coerce.bigint(),
|
|
850
|
-
/** Estimated total amount of the adjusted position */
|
|
851
|
-
estimatedAmount: z.coerce.bigint(),
|
|
852
|
-
/** Estimated amount of the withdrawn collateral */
|
|
853
|
-
estimatedWithdrawnCollateral: z.coerce.bigint(),
|
|
991
|
+
var SwapQuoteByOutput = z8.object({
|
|
992
|
+
estimatedAmountIn: z8.coerce.bigint(),
|
|
993
|
+
maxAmountIn: z8.coerce.bigint(),
|
|
994
|
+
feeAmount: z8.coerce.bigint(),
|
|
995
|
+
feeUsd: z8.number(),
|
|
854
996
|
/** Price impact in percents */
|
|
855
|
-
priceImpact:
|
|
856
|
-
/** Liquidation price */
|
|
857
|
-
uiLiquidationPrice: z.nullable(z.number())
|
|
858
|
-
});
|
|
859
|
-
var CloseSpotPositionQuote = z.object({
|
|
860
|
-
/** Position decrease percentage */
|
|
861
|
-
decreasePercent: z.number(),
|
|
862
|
-
/** The maximum acceptable swap input amount for position decrease according to the provided slippage
|
|
863
|
-
* (if collateral_token == position_token) OR the minimum swap output amount (if collateral_token != position_token).
|
|
864
|
-
*/
|
|
865
|
-
requiredSwapAmount: z.coerce.bigint(),
|
|
866
|
-
/** Estimated amount of the withdrawn collateral */
|
|
867
|
-
estimatedWithdrawnCollateral: z.coerce.bigint(),
|
|
868
|
-
/** Price impact in percents */
|
|
869
|
-
priceImpact: z.number()
|
|
870
|
-
});
|
|
871
|
-
var SwapQuoteByInput = z.object({
|
|
872
|
-
estimatedAmountOut: z.coerce.bigint(),
|
|
873
|
-
minAmountOut: z.coerce.bigint(),
|
|
874
|
-
feeAmount: z.coerce.bigint(),
|
|
875
|
-
feeUsd: z.number(),
|
|
876
|
-
/** Price impact in percents */
|
|
877
|
-
priceImpact: z.number()
|
|
878
|
-
});
|
|
879
|
-
var SwapQuoteByOutput = z.object({
|
|
880
|
-
estimatedAmountIn: z.coerce.bigint(),
|
|
881
|
-
maxAmountIn: z.coerce.bigint(),
|
|
882
|
-
feeAmount: z.coerce.bigint(),
|
|
883
|
-
feeUsd: z.number(),
|
|
884
|
-
/** Price impact in percents */
|
|
885
|
-
priceImpact: z.number()
|
|
886
|
-
});
|
|
887
|
-
var StateSnapshot = z.object({
|
|
888
|
-
slot: z.coerce.bigint(),
|
|
889
|
-
blockTime: z.coerce.date(),
|
|
890
|
-
poolPrices: z.optional(z.record(z.string(), PoolPriceUpdate)),
|
|
891
|
-
tunaSpotPositions: z.optional(z.array(TunaSpotPosition)),
|
|
892
|
-
tunaLpPositions: z.optional(z.array(TunaPosition)),
|
|
893
|
-
fusionLimitOrders: z.optional(z.array(LimitOrder))
|
|
997
|
+
priceImpact: z8.number()
|
|
894
998
|
});
|
|
895
|
-
var LimitOrderQuoteByInput =
|
|
896
|
-
amountOut:
|
|
999
|
+
var LimitOrderQuoteByInput = z8.object({
|
|
1000
|
+
amountOut: z8.coerce.bigint()
|
|
897
1001
|
});
|
|
898
|
-
var LimitOrderQuoteByOutput =
|
|
899
|
-
amountIn:
|
|
1002
|
+
var LimitOrderQuoteByOutput = z8.object({
|
|
1003
|
+
amountIn: z8.coerce.bigint()
|
|
900
1004
|
});
|
|
901
|
-
var TradableAmount =
|
|
902
|
-
var UpdateStreamSubscriptionResult =
|
|
903
|
-
status:
|
|
1005
|
+
var TradableAmount = AmountWithUsdSchema;
|
|
1006
|
+
var UpdateStreamSubscriptionResult = z8.object({
|
|
1007
|
+
status: z8.string()
|
|
904
1008
|
});
|
|
905
|
-
var createNotificationSchema = (dataSchema, metaSchema) =>
|
|
1009
|
+
var createNotificationSchema = (dataSchema, metaSchema) => z8.object({
|
|
906
1010
|
entity: NotificationEntitySchema,
|
|
907
1011
|
action: NotificationActionSchema,
|
|
908
1012
|
data: dataSchema,
|
|
909
|
-
id:
|
|
910
|
-
authority:
|
|
911
|
-
...metaSchema ? { meta: metaSchema } : { meta:
|
|
1013
|
+
id: z8.string(),
|
|
1014
|
+
authority: z8.nullish(z8.string()),
|
|
1015
|
+
...metaSchema ? { meta: metaSchema } : { meta: z8.undefined().nullable() }
|
|
912
1016
|
});
|
|
913
|
-
var OrderBookNotificationMeta =
|
|
914
|
-
pool:
|
|
915
|
-
priceStep:
|
|
916
|
-
inverted:
|
|
1017
|
+
var OrderBookNotificationMeta = z8.object({
|
|
1018
|
+
pool: z8.string(),
|
|
1019
|
+
priceStep: z8.number(),
|
|
1020
|
+
inverted: z8.boolean()
|
|
917
1021
|
});
|
|
918
1022
|
var PoolSwapNotification = createNotificationSchema(PoolSwap);
|
|
919
1023
|
var PoolPriceUpdateNotification = createNotificationSchema(PoolPriceUpdate);
|
|
920
1024
|
var OrderBookNotification = createNotificationSchema(OrderBook, OrderBookNotificationMeta);
|
|
921
|
-
var TunaPositionNotification = createNotificationSchema(
|
|
1025
|
+
var TunaPositionNotification = createNotificationSchema(TunaPositionLegacy);
|
|
922
1026
|
var TunaSpotPositionNotification = createNotificationSchema(TunaSpotPosition);
|
|
923
1027
|
var LendingPositionNotification = createNotificationSchema(LendingPosition);
|
|
924
1028
|
var LimitOrderNotification = createNotificationSchema(LimitOrder);
|
|
@@ -1096,11 +1200,11 @@ var TunaApiClient = class {
|
|
|
1096
1200
|
}
|
|
1097
1201
|
async getUserTunaPositions(userAddress) {
|
|
1098
1202
|
const url = this.buildURL(`users/${userAddress}/tuna-positions`);
|
|
1099
|
-
return await this.httpRequest(url,
|
|
1203
|
+
return await this.httpRequest(url, TunaLpPositionDtoSchema.array());
|
|
1100
1204
|
}
|
|
1101
1205
|
async getUserTunaPositionByAddress(userAddress, tunaPositionAddress) {
|
|
1102
1206
|
const url = this.buildURL(`users/${userAddress}/tuna-positions/${tunaPositionAddress}`);
|
|
1103
|
-
return await this.httpRequest(url,
|
|
1207
|
+
return await this.httpRequest(url, TunaLpPositionDtoSchema);
|
|
1104
1208
|
}
|
|
1105
1209
|
async getUserLpPositions(userAddress, options) {
|
|
1106
1210
|
const query = {};
|
|
@@ -1129,7 +1233,7 @@ var TunaApiClient = class {
|
|
|
1129
1233
|
}
|
|
1130
1234
|
}
|
|
1131
1235
|
const url = this.appendUrlSearchParams(this.buildURL(`users/${userAddress}/lp-positions`), query);
|
|
1132
|
-
return await this.httpRequest(url,
|
|
1236
|
+
return await this.httpRequest(url, TunaLpPositionHistorical.array());
|
|
1133
1237
|
}
|
|
1134
1238
|
async getUserLpPositionActions(userAddress, positionAddress) {
|
|
1135
1239
|
const url = this.buildURL(`users/${userAddress}/lp-positions/${positionAddress}/actions`);
|