@kasarlabs/ekubo-mcp 0.1.0

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.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +54 -0
  3. package/bin/ekubo-mcp.js +2 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.js +119 -0
  6. package/build/index.js.map +1 -0
  7. package/build/interfaces/index.d.ts +21 -0
  8. package/build/interfaces/index.js +2 -0
  9. package/build/interfaces/index.js.map +1 -0
  10. package/build/lib/constants/abis/core.d.ts +92 -0
  11. package/build/lib/constants/abis/core.js +1341 -0
  12. package/build/lib/constants/abis/core.js.map +1 -0
  13. package/build/lib/constants/abis/erc20.d.ts +214 -0
  14. package/build/lib/constants/abis/erc20.js +1256 -0
  15. package/build/lib/constants/abis/erc20.js.map +1 -0
  16. package/build/lib/constants/abis/index.d.ts +5 -0
  17. package/build/lib/constants/abis/index.js +6 -0
  18. package/build/lib/constants/abis/index.js.map +1 -0
  19. package/build/lib/constants/abis/nft.d.ts +92 -0
  20. package/build/lib/constants/abis/nft.js +1227 -0
  21. package/build/lib/constants/abis/nft.js.map +1 -0
  22. package/build/lib/constants/abis/positions.d.ts +92 -0
  23. package/build/lib/constants/abis/positions.js +1595 -0
  24. package/build/lib/constants/abis/positions.js.map +1 -0
  25. package/build/lib/constants/abis/router.d.ts +76 -0
  26. package/build/lib/constants/abis/router.js +524 -0
  27. package/build/lib/constants/abis/router.js.map +1 -0
  28. package/build/lib/constants/addresses.d.ts +21 -0
  29. package/build/lib/constants/addresses.js +52 -0
  30. package/build/lib/constants/addresses.js.map +1 -0
  31. package/build/lib/utils/contracts.d.ts +8 -0
  32. package/build/lib/utils/contracts.js +26 -0
  33. package/build/lib/utils/contracts.js.map +1 -0
  34. package/build/lib/utils/events.d.ts +2 -0
  35. package/build/lib/utils/events.js +21 -0
  36. package/build/lib/utils/events.js.map +1 -0
  37. package/build/lib/utils/liquidity.d.ts +14 -0
  38. package/build/lib/utils/liquidity.js +19 -0
  39. package/build/lib/utils/liquidity.js.map +1 -0
  40. package/build/lib/utils/math.d.ts +4 -0
  41. package/build/lib/utils/math.js +25 -0
  42. package/build/lib/utils/math.js.map +1 -0
  43. package/build/lib/utils/pools.d.ts +9 -0
  44. package/build/lib/utils/pools.js +18 -0
  45. package/build/lib/utils/pools.js.map +1 -0
  46. package/build/lib/utils/quote.d.ts +5 -0
  47. package/build/lib/utils/quote.js +17 -0
  48. package/build/lib/utils/quote.js.map +1 -0
  49. package/build/lib/utils/swap.d.ts +13 -0
  50. package/build/lib/utils/swap.js +37 -0
  51. package/build/lib/utils/swap.js.map +1 -0
  52. package/build/lib/utils/token.d.ts +127 -0
  53. package/build/lib/utils/token.js +150 -0
  54. package/build/lib/utils/token.js.map +1 -0
  55. package/build/schemas/index.d.ts +388 -0
  56. package/build/schemas/index.js +119 -0
  57. package/build/schemas/index.js.map +1 -0
  58. package/build/tools/read/getPoolFeesPerLiquidity.d.ts +14 -0
  59. package/build/tools/read/getPoolFeesPerLiquidity.js +31 -0
  60. package/build/tools/read/getPoolFeesPerLiquidity.js.map +1 -0
  61. package/build/tools/read/getPoolInfo.d.ts +22 -0
  62. package/build/tools/read/getPoolInfo.js +45 -0
  63. package/build/tools/read/getPoolInfo.js.map +1 -0
  64. package/build/tools/read/getPoolLiquidity.d.ts +13 -0
  65. package/build/tools/read/getPoolLiquidity.js +30 -0
  66. package/build/tools/read/getPoolLiquidity.js.map +1 -0
  67. package/build/tools/read/getTokenPrice.d.ts +16 -0
  68. package/build/tools/read/getTokenPrice.js +42 -0
  69. package/build/tools/read/getTokenPrice.js.map +1 -0
  70. package/build/tools/write/addLiquidity.d.ts +21 -0
  71. package/build/tools/write/addLiquidity.js +77 -0
  72. package/build/tools/write/addLiquidity.js.map +1 -0
  73. package/build/tools/write/createPosition.d.ts +21 -0
  74. package/build/tools/write/createPosition.js +67 -0
  75. package/build/tools/write/createPosition.js.map +1 -0
  76. package/build/tools/write/swap.d.ts +19 -0
  77. package/build/tools/write/swap.js +76 -0
  78. package/build/tools/write/swap.js.map +1 -0
  79. package/build/tools/write/transferPosition.d.ts +16 -0
  80. package/build/tools/write/transferPosition.js +35 -0
  81. package/build/tools/write/transferPosition.js.map +1 -0
  82. package/build/tools/write/withdrawLiquidity.d.ts +19 -0
  83. package/build/tools/write/withdrawLiquidity.js +65 -0
  84. package/build/tools/write/withdrawLiquidity.js.map +1 -0
  85. package/package.json +42 -0
@@ -0,0 +1,388 @@
1
+ import { z } from 'zod';
2
+ export declare const assetSchema: z.ZodObject<{
3
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
4
+ assetValue: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ assetType: "SYMBOL" | "ADDRESS";
7
+ assetValue: string;
8
+ }, {
9
+ assetType: "SYMBOL" | "ADDRESS";
10
+ assetValue: string;
11
+ }>;
12
+ export declare const poolKeySchema: z.ZodObject<{
13
+ token0: z.ZodObject<{
14
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
15
+ assetValue: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ assetType: "SYMBOL" | "ADDRESS";
18
+ assetValue: string;
19
+ }, {
20
+ assetType: "SYMBOL" | "ADDRESS";
21
+ assetValue: string;
22
+ }>;
23
+ token1: z.ZodObject<{
24
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
25
+ assetValue: z.ZodString;
26
+ }, "strip", z.ZodTypeAny, {
27
+ assetType: "SYMBOL" | "ADDRESS";
28
+ assetValue: string;
29
+ }, {
30
+ assetType: "SYMBOL" | "ADDRESS";
31
+ assetValue: string;
32
+ }>;
33
+ } & {
34
+ fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
35
+ tick_spacing: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
36
+ extension: z.ZodDefault<z.ZodOptional<z.ZodString>>;
37
+ }, "strip", z.ZodTypeAny, {
38
+ token0: {
39
+ assetType: "SYMBOL" | "ADDRESS";
40
+ assetValue: string;
41
+ };
42
+ token1: {
43
+ assetType: "SYMBOL" | "ADDRESS";
44
+ assetValue: string;
45
+ };
46
+ fee: number;
47
+ tick_spacing: number;
48
+ extension: string;
49
+ }, {
50
+ token0: {
51
+ assetType: "SYMBOL" | "ADDRESS";
52
+ assetValue: string;
53
+ };
54
+ token1: {
55
+ assetType: "SYMBOL" | "ADDRESS";
56
+ assetValue: string;
57
+ };
58
+ fee?: number | undefined;
59
+ tick_spacing?: number | undefined;
60
+ extension?: string | undefined;
61
+ }>;
62
+ export type PoolKey = z.infer<typeof poolKeySchema>;
63
+ export declare const getTokenPriceSchema: z.ZodObject<{
64
+ token: z.ZodObject<{
65
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
66
+ assetValue: z.ZodString;
67
+ }, "strip", z.ZodTypeAny, {
68
+ assetType: "SYMBOL" | "ADDRESS";
69
+ assetValue: string;
70
+ }, {
71
+ assetType: "SYMBOL" | "ADDRESS";
72
+ assetValue: string;
73
+ }>;
74
+ quote_currency: z.ZodObject<{
75
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
76
+ assetValue: z.ZodString;
77
+ }, "strip", z.ZodTypeAny, {
78
+ assetType: "SYMBOL" | "ADDRESS";
79
+ assetValue: string;
80
+ }, {
81
+ assetType: "SYMBOL" | "ADDRESS";
82
+ assetValue: string;
83
+ }>;
84
+ } & {
85
+ fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
86
+ tick_spacing: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
87
+ extension: z.ZodDefault<z.ZodOptional<z.ZodString>>;
88
+ }, "strip", z.ZodTypeAny, {
89
+ fee: number;
90
+ tick_spacing: number;
91
+ extension: string;
92
+ token: {
93
+ assetType: "SYMBOL" | "ADDRESS";
94
+ assetValue: string;
95
+ };
96
+ quote_currency: {
97
+ assetType: "SYMBOL" | "ADDRESS";
98
+ assetValue: string;
99
+ };
100
+ }, {
101
+ token: {
102
+ assetType: "SYMBOL" | "ADDRESS";
103
+ assetValue: string;
104
+ };
105
+ quote_currency: {
106
+ assetType: "SYMBOL" | "ADDRESS";
107
+ assetValue: string;
108
+ };
109
+ fee?: number | undefined;
110
+ tick_spacing?: number | undefined;
111
+ extension?: string | undefined;
112
+ }>;
113
+ export type GetTokenPriceSchema = z.infer<typeof getTokenPriceSchema>;
114
+ export declare const swapTokensSchema: z.ZodObject<{
115
+ token_in: z.ZodObject<{
116
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
117
+ assetValue: z.ZodString;
118
+ }, "strip", z.ZodTypeAny, {
119
+ assetType: "SYMBOL" | "ADDRESS";
120
+ assetValue: string;
121
+ }, {
122
+ assetType: "SYMBOL" | "ADDRESS";
123
+ assetValue: string;
124
+ }>;
125
+ token_out: z.ZodObject<{
126
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
127
+ assetValue: z.ZodString;
128
+ }, "strip", z.ZodTypeAny, {
129
+ assetType: "SYMBOL" | "ADDRESS";
130
+ assetValue: string;
131
+ }, {
132
+ assetType: "SYMBOL" | "ADDRESS";
133
+ assetValue: string;
134
+ }>;
135
+ amount: z.ZodString;
136
+ is_amount_in: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
137
+ slippage_tolerance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
138
+ } & {
139
+ fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
140
+ tick_spacing: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
141
+ extension: z.ZodDefault<z.ZodOptional<z.ZodString>>;
142
+ }, "strip", z.ZodTypeAny, {
143
+ fee: number;
144
+ tick_spacing: number;
145
+ extension: string;
146
+ token_in: {
147
+ assetType: "SYMBOL" | "ADDRESS";
148
+ assetValue: string;
149
+ };
150
+ token_out: {
151
+ assetType: "SYMBOL" | "ADDRESS";
152
+ assetValue: string;
153
+ };
154
+ amount: string;
155
+ is_amount_in: boolean;
156
+ slippage_tolerance: number;
157
+ }, {
158
+ token_in: {
159
+ assetType: "SYMBOL" | "ADDRESS";
160
+ assetValue: string;
161
+ };
162
+ token_out: {
163
+ assetType: "SYMBOL" | "ADDRESS";
164
+ assetValue: string;
165
+ };
166
+ amount: string;
167
+ fee?: number | undefined;
168
+ tick_spacing?: number | undefined;
169
+ extension?: string | undefined;
170
+ is_amount_in?: boolean | undefined;
171
+ slippage_tolerance?: number | undefined;
172
+ }>;
173
+ export type SwapTokensSchema = z.infer<typeof swapTokensSchema>;
174
+ export declare const addLiquiditySchema: z.ZodObject<{
175
+ position_id: z.ZodNumber;
176
+ amount0: z.ZodString;
177
+ amount1: z.ZodString;
178
+ } & {
179
+ token0: z.ZodObject<{
180
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
181
+ assetValue: z.ZodString;
182
+ }, "strip", z.ZodTypeAny, {
183
+ assetType: "SYMBOL" | "ADDRESS";
184
+ assetValue: string;
185
+ }, {
186
+ assetType: "SYMBOL" | "ADDRESS";
187
+ assetValue: string;
188
+ }>;
189
+ token1: z.ZodObject<{
190
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
191
+ assetValue: z.ZodString;
192
+ }, "strip", z.ZodTypeAny, {
193
+ assetType: "SYMBOL" | "ADDRESS";
194
+ assetValue: string;
195
+ }, {
196
+ assetType: "SYMBOL" | "ADDRESS";
197
+ assetValue: string;
198
+ }>;
199
+ } & {
200
+ lower_tick: z.ZodNumber;
201
+ upper_tick: z.ZodNumber;
202
+ } & {
203
+ fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
204
+ tick_spacing: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
205
+ extension: z.ZodDefault<z.ZodOptional<z.ZodString>>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ position_id: number;
208
+ amount0: string;
209
+ amount1: string;
210
+ token0: {
211
+ assetType: "SYMBOL" | "ADDRESS";
212
+ assetValue: string;
213
+ };
214
+ token1: {
215
+ assetType: "SYMBOL" | "ADDRESS";
216
+ assetValue: string;
217
+ };
218
+ lower_tick: number;
219
+ upper_tick: number;
220
+ fee: number;
221
+ tick_spacing: number;
222
+ extension: string;
223
+ }, {
224
+ position_id: number;
225
+ amount0: string;
226
+ amount1: string;
227
+ token0: {
228
+ assetType: "SYMBOL" | "ADDRESS";
229
+ assetValue: string;
230
+ };
231
+ token1: {
232
+ assetType: "SYMBOL" | "ADDRESS";
233
+ assetValue: string;
234
+ };
235
+ lower_tick: number;
236
+ upper_tick: number;
237
+ fee?: number | undefined;
238
+ tick_spacing?: number | undefined;
239
+ extension?: string | undefined;
240
+ }>;
241
+ export type AddLiquiditySchema = z.infer<typeof addLiquiditySchema>;
242
+ export declare const withdrawLiquiditySchema: z.ZodObject<{
243
+ position_id: z.ZodNumber;
244
+ liquidity_amount: z.ZodString;
245
+ fees_only: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
246
+ collect_fees: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
247
+ } & {
248
+ token0: z.ZodObject<{
249
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
250
+ assetValue: z.ZodString;
251
+ }, "strip", z.ZodTypeAny, {
252
+ assetType: "SYMBOL" | "ADDRESS";
253
+ assetValue: string;
254
+ }, {
255
+ assetType: "SYMBOL" | "ADDRESS";
256
+ assetValue: string;
257
+ }>;
258
+ token1: z.ZodObject<{
259
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
260
+ assetValue: z.ZodString;
261
+ }, "strip", z.ZodTypeAny, {
262
+ assetType: "SYMBOL" | "ADDRESS";
263
+ assetValue: string;
264
+ }, {
265
+ assetType: "SYMBOL" | "ADDRESS";
266
+ assetValue: string;
267
+ }>;
268
+ } & {
269
+ lower_tick: z.ZodNumber;
270
+ upper_tick: z.ZodNumber;
271
+ } & {
272
+ fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
273
+ tick_spacing: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
274
+ extension: z.ZodDefault<z.ZodOptional<z.ZodString>>;
275
+ }, "strip", z.ZodTypeAny, {
276
+ position_id: number;
277
+ token0: {
278
+ assetType: "SYMBOL" | "ADDRESS";
279
+ assetValue: string;
280
+ };
281
+ token1: {
282
+ assetType: "SYMBOL" | "ADDRESS";
283
+ assetValue: string;
284
+ };
285
+ lower_tick: number;
286
+ upper_tick: number;
287
+ fee: number;
288
+ tick_spacing: number;
289
+ extension: string;
290
+ liquidity_amount: string;
291
+ fees_only: boolean;
292
+ collect_fees: boolean;
293
+ }, {
294
+ position_id: number;
295
+ token0: {
296
+ assetType: "SYMBOL" | "ADDRESS";
297
+ assetValue: string;
298
+ };
299
+ token1: {
300
+ assetType: "SYMBOL" | "ADDRESS";
301
+ assetValue: string;
302
+ };
303
+ lower_tick: number;
304
+ upper_tick: number;
305
+ liquidity_amount: string;
306
+ fee?: number | undefined;
307
+ tick_spacing?: number | undefined;
308
+ extension?: string | undefined;
309
+ fees_only?: boolean | undefined;
310
+ collect_fees?: boolean | undefined;
311
+ }>;
312
+ export type WithdrawLiquiditySchema = z.infer<typeof withdrawLiquiditySchema>;
313
+ export declare const transferPositionSchema: z.ZodObject<{
314
+ position_id: z.ZodNumber;
315
+ to_address: z.ZodString;
316
+ }, "strip", z.ZodTypeAny, {
317
+ position_id: number;
318
+ to_address: string;
319
+ }, {
320
+ position_id: number;
321
+ to_address: string;
322
+ }>;
323
+ export type TransferPositionSchema = z.infer<typeof transferPositionSchema>;
324
+ export declare const createPositionSchema: z.ZodObject<{
325
+ amount0: z.ZodString;
326
+ amount1: z.ZodString;
327
+ } & {
328
+ token0: z.ZodObject<{
329
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
330
+ assetValue: z.ZodString;
331
+ }, "strip", z.ZodTypeAny, {
332
+ assetType: "SYMBOL" | "ADDRESS";
333
+ assetValue: string;
334
+ }, {
335
+ assetType: "SYMBOL" | "ADDRESS";
336
+ assetValue: string;
337
+ }>;
338
+ token1: z.ZodObject<{
339
+ assetType: z.ZodEnum<["SYMBOL", "ADDRESS"]>;
340
+ assetValue: z.ZodString;
341
+ }, "strip", z.ZodTypeAny, {
342
+ assetType: "SYMBOL" | "ADDRESS";
343
+ assetValue: string;
344
+ }, {
345
+ assetType: "SYMBOL" | "ADDRESS";
346
+ assetValue: string;
347
+ }>;
348
+ } & {
349
+ lower_tick: z.ZodNumber;
350
+ upper_tick: z.ZodNumber;
351
+ } & {
352
+ fee: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
353
+ tick_spacing: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
354
+ extension: z.ZodDefault<z.ZodOptional<z.ZodString>>;
355
+ }, "strip", z.ZodTypeAny, {
356
+ amount0: string;
357
+ amount1: string;
358
+ token0: {
359
+ assetType: "SYMBOL" | "ADDRESS";
360
+ assetValue: string;
361
+ };
362
+ token1: {
363
+ assetType: "SYMBOL" | "ADDRESS";
364
+ assetValue: string;
365
+ };
366
+ lower_tick: number;
367
+ upper_tick: number;
368
+ fee: number;
369
+ tick_spacing: number;
370
+ extension: string;
371
+ }, {
372
+ amount0: string;
373
+ amount1: string;
374
+ token0: {
375
+ assetType: "SYMBOL" | "ADDRESS";
376
+ assetValue: string;
377
+ };
378
+ token1: {
379
+ assetType: "SYMBOL" | "ADDRESS";
380
+ assetValue: string;
381
+ };
382
+ lower_tick: number;
383
+ upper_tick: number;
384
+ fee?: number | undefined;
385
+ tick_spacing?: number | undefined;
386
+ extension?: string | undefined;
387
+ }>;
388
+ export type CreatePositionSchema = z.infer<typeof createPositionSchema>;
@@ -0,0 +1,119 @@
1
+ import { z } from 'zod';
2
+ export const assetSchema = z.object({
3
+ assetType: z
4
+ .enum(['SYMBOL', 'ADDRESS'])
5
+ .describe('The type of the asset concerned by the allowance: SYMBOL or ADDRESS'),
6
+ assetValue: z
7
+ .string()
8
+ .describe('The symbol (e.g., "ETH", "USDC") or the contract address of the token'),
9
+ });
10
+ const poolParamsSchema = z.object({
11
+ fee: z
12
+ .number()
13
+ .optional()
14
+ .default(0.05)
15
+ .describe('The fee tier as a percentage (e.g., 0.05 for 0.05%, 0.3 for 0.3%, 1 for 1%, defaults to 0.05)'),
16
+ tick_spacing: z
17
+ .number()
18
+ .optional()
19
+ .default(0.1)
20
+ .describe('The tick spacing as a percentage (e.g., 0.01 for 0.01%, 0.1 for 0.1%, 1 for 1%, defaults to 0.1)'),
21
+ extension: z
22
+ .string()
23
+ .optional()
24
+ .default('0x0')
25
+ .describe('The extension contract address (default: "0x0")'),
26
+ });
27
+ const tokenPairSchema = z.object({
28
+ token0: assetSchema.describe('The asset information (symbol or contract address) of the first token'),
29
+ token1: assetSchema.describe('The asset information (symbol or contract address) of the second token'),
30
+ });
31
+ const positionRangeSchema = z.object({
32
+ lower_tick: z.number().describe('The lower tick of the position range'),
33
+ upper_tick: z.number().describe('The upper tick of the position range'),
34
+ });
35
+ export const poolKeySchema = z
36
+ .object({
37
+ token0: assetSchema.describe('The asset information (symbol or contract address) of the first token in the pool'),
38
+ token1: assetSchema.describe('The asset information (symbol or contract address) of the second token in the pool'),
39
+ })
40
+ .merge(poolParamsSchema);
41
+ export const getTokenPriceSchema = z
42
+ .object({
43
+ token: assetSchema.describe('The asset information (symbol or contract address) of the token to get the price for'),
44
+ quote_currency: assetSchema.describe('The asset information (symbol or contract address) of the quote currency (e.g., USDC, ETH)'),
45
+ })
46
+ .merge(poolParamsSchema);
47
+ export const swapTokensSchema = z
48
+ .object({
49
+ token_in: assetSchema.describe('The asset information (symbol or contract address) of the token to sell'),
50
+ token_out: assetSchema.describe('The asset information (symbol or contract address) of the token to buy'),
51
+ amount: z
52
+ .string()
53
+ .describe('The amount to swap (in token decimals, e.g., "1000000" for 1 USDC with 6 decimals)'),
54
+ is_amount_in: z
55
+ .boolean()
56
+ .optional()
57
+ .default(true)
58
+ .describe('If true, amount is input token amount. If false, amount is desired output token amount'),
59
+ slippage_tolerance: z
60
+ .number()
61
+ .optional()
62
+ .default(0.5)
63
+ .describe('Maximum slippage tolerance as a percentage (e.g., 0.5 for 0.5%, defaults to 0.5%)'),
64
+ })
65
+ .merge(poolParamsSchema);
66
+ export const addLiquiditySchema = z
67
+ .object({
68
+ position_id: z
69
+ .number()
70
+ .describe('The NFT position ID (u64) to add liquidity to'),
71
+ amount0: z
72
+ .string()
73
+ .describe('The amount of token0 to add (in token decimals)'),
74
+ amount1: z
75
+ .string()
76
+ .describe('The amount of token1 to add (in token decimals)'),
77
+ })
78
+ .merge(tokenPairSchema)
79
+ .merge(positionRangeSchema)
80
+ .merge(poolParamsSchema);
81
+ export const withdrawLiquiditySchema = z
82
+ .object({
83
+ position_id: z.number().describe('The NFT position ID (u64)'),
84
+ liquidity_amount: z
85
+ .string()
86
+ .describe('The amount of liquidity to remove (as a string to handle large numbers, set to "0" for fees only)'),
87
+ fees_only: z
88
+ .boolean()
89
+ .optional()
90
+ .default(false)
91
+ .describe('Set to true to only collect fees without withdrawing liquidity (defaults to false)'),
92
+ collect_fees: z
93
+ .boolean()
94
+ .optional()
95
+ .default(true)
96
+ .describe('Whether to collect accumulated fees (defaults to true)'),
97
+ })
98
+ .merge(tokenPairSchema)
99
+ .merge(positionRangeSchema)
100
+ .merge(poolParamsSchema);
101
+ export const transferPositionSchema = z.object({
102
+ position_id: z.number().describe('The NFT position ID to transfer (u64)'),
103
+ to_address: z
104
+ .string()
105
+ .describe('The recipient address to transfer the position to'),
106
+ });
107
+ export const createPositionSchema = z
108
+ .object({
109
+ amount0: z
110
+ .string()
111
+ .describe('The amount of token0 to add (in token decimals)'),
112
+ amount1: z
113
+ .string()
114
+ .describe('The amount of token1 to add (in token decimals)'),
115
+ })
116
+ .merge(tokenPairSchema)
117
+ .merge(positionRangeSchema)
118
+ .merge(poolParamsSchema);
119
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAA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Key } from '../../schemas/index.js';
3
+ export declare const getPoolFeesPerLiquidity: (env: onchainRead, params: PoolKey) => Promise<{
4
+ status: string;
5
+ data: {
6
+ fee_growth_global_0: any;
7
+ fee_growth_global_1: any;
8
+ };
9
+ error?: undefined;
10
+ } | {
11
+ status: string;
12
+ error: any;
13
+ data?: undefined;
14
+ }>;
@@ -0,0 +1,31 @@
1
+ import { getContract } from '../../lib/utils/contracts.js';
2
+ import { preparePoolKeyFromParams } from '../../lib/utils/pools.js';
3
+ export const getPoolFeesPerLiquidity = async (env, params) => {
4
+ const provider = env.provider;
5
+ try {
6
+ const contract = await getContract(provider, 'core');
7
+ const { poolKey } = await preparePoolKeyFromParams(env.provider, {
8
+ token0: params.token0,
9
+ token1: params.token1,
10
+ fee: params.fee,
11
+ tick_spacing: params.tick_spacing,
12
+ extension: params.extension,
13
+ });
14
+ const feesResult = await contract.get_pool_fees_per_liquidity(poolKey);
15
+ return {
16
+ status: 'success',
17
+ data: {
18
+ fee_growth_global_0: feesResult.value0.toString(),
19
+ fee_growth_global_1: feesResult.value1.toString(),
20
+ },
21
+ };
22
+ }
23
+ catch (error) {
24
+ console.error('Error getting pool fees per liquidity:', error);
25
+ return {
26
+ status: 'failure',
27
+ error: error.message,
28
+ };
29
+ }
30
+ };
31
+ //# sourceMappingURL=getPoolFeesPerLiquidity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPoolFeesPerLiquidity.js","sourceRoot":"","sources":["../../../src/tools/read/getPoolFeesPerLiquidity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC1C,GAAgB,EAChB,MAAe,EACf,EAAE;IACF,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;IAC9B,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAErD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,wBAAwB,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC/D,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CAAC,CAAC;QAEH,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,2BAA2B,CAAC,OAAO,CAAC,CAAC;QAEvE,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE;gBACJ,mBAAmB,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;gBACjD,mBAAmB,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;aAClD;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;QAC/D,OAAO;YACL,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { onchainRead } from '@kasarlabs/ask-starknet-core';
2
+ import { PoolKey } from '../../schemas/index.js';
3
+ export declare const getPoolInfo: (env: onchainRead, params: PoolKey) => Promise<{
4
+ status: string;
5
+ data: {
6
+ token0: string;
7
+ token1: string;
8
+ sqrt_price: any;
9
+ price: number;
10
+ liquidity: any;
11
+ fees_per_liquidity: {
12
+ fee_growth_global_0: any;
13
+ fee_growth_global_1: any;
14
+ };
15
+ current_tick: number;
16
+ };
17
+ error?: undefined;
18
+ } | {
19
+ status: string;
20
+ error: any;
21
+ data?: undefined;
22
+ }>;
@@ -0,0 +1,45 @@
1
+ import { calculateTickFromSqrtPrice, calculateActualPrice, } from '../../lib/utils/math.js';
2
+ import { getContract } from '../../lib/utils/contracts.js';
3
+ import { preparePoolKeyFromParams } from '../../lib/utils/pools.js';
4
+ export const getPoolInfo = async (env, params) => {
5
+ const provider = env.provider;
6
+ try {
7
+ const contract = await getContract(provider, 'core');
8
+ const { poolKey, token0, token1 } = await preparePoolKeyFromParams(env.provider, {
9
+ token0: params.token0,
10
+ token1: params.token1,
11
+ fee: params.fee,
12
+ tick_spacing: params.tick_spacing,
13
+ extension: params.extension,
14
+ });
15
+ const priceResult = await contract.get_pool_price(poolKey);
16
+ const liquidityResult = await contract.get_pool_liquidity(poolKey);
17
+ const feesResult = await contract.get_pool_fees_per_liquidity(poolKey);
18
+ const sqrtPrice = priceResult.sqrt_ratio;
19
+ const currentTick = calculateTickFromSqrtPrice(sqrtPrice);
20
+ const readablePrice = calculateActualPrice(sqrtPrice, token0.decimals, token1.decimals);
21
+ return {
22
+ status: 'success',
23
+ data: {
24
+ token0: token0.symbol,
25
+ token1: token1.symbol,
26
+ sqrt_price: sqrtPrice.toString(),
27
+ price: readablePrice,
28
+ liquidity: liquidityResult.toString(),
29
+ fees_per_liquidity: {
30
+ fee_growth_global_0: feesResult.value0.toString(),
31
+ fee_growth_global_1: feesResult.value1.toString(),
32
+ },
33
+ current_tick: currentTick,
34
+ },
35
+ };
36
+ }
37
+ catch (error) {
38
+ console.error('Error getting pool information:', error);
39
+ return {
40
+ status: 'failed',
41
+ error: error.message,
42
+ };
43
+ }
44
+ };
45
+ //# sourceMappingURL=getPoolInfo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPoolInfo.js","sourceRoot":"","sources":["../../../src/tools/read/getPoolInfo.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BA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EAAE;oBAClB,mBAAmB,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;oBACjD,mBAAmB,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE;iBAClD;gBACD,YAAY,EAAE,WAAW;aAC1B;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;QACxD,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,KAAK,CAAC,OAAO;SACrB,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { onchainRead } from '@kasarlabs/ask-starknet-core';
2
+ import { PoolKey } from '../../schemas/index.js';
3
+ export declare const getPoolLiquidity: (env: onchainRead, params: PoolKey) => Promise<{
4
+ status: string;
5
+ data: {
6
+ liquidity: any;
7
+ };
8
+ error?: undefined;
9
+ } | {
10
+ status: string;
11
+ error: any;
12
+ data?: undefined;
13
+ }>;
@@ -0,0 +1,30 @@
1
+ import { getContract } from '../../lib/utils/contracts.js';
2
+ import { preparePoolKeyFromParams } from '../../lib/utils/pools.js';
3
+ export const getPoolLiquidity = async (env, params) => {
4
+ const provider = env.provider;
5
+ try {
6
+ const contract = await getContract(provider, 'core');
7
+ const { poolKey } = await preparePoolKeyFromParams(env.provider, {
8
+ token0: params.token0,
9
+ token1: params.token1,
10
+ fee: params.fee,
11
+ tick_spacing: params.tick_spacing,
12
+ extension: params.extension,
13
+ });
14
+ const liquidityResult = await contract.get_pool_liquidity(poolKey);
15
+ return {
16
+ status: 'success',
17
+ data: {
18
+ liquidity: liquidityResult.toString(),
19
+ },
20
+ };
21
+ }
22
+ catch (error) {
23
+ console.error('Error getting pool liquidity:', error);
24
+ return {
25
+ status: 'failure',
26
+ error: error.message,
27
+ };
28
+ }
29
+ };
30
+ //# sourceMappingURL=getPoolLiquidity.js.map