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