@flashnet/sdk 0.4.4 → 0.5.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/cjs/index.d.ts +2 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +17 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/src/api/typed-endpoints.d.ts +70 -0
- package/dist/cjs/src/api/typed-endpoints.d.ts.map +1 -1
- package/dist/cjs/src/api/typed-endpoints.js +106 -11
- package/dist/cjs/src/api/typed-endpoints.js.map +1 -1
- package/dist/cjs/src/client/FlashnetClient.d.ts +179 -1
- package/dist/cjs/src/client/FlashnetClient.d.ts.map +1 -1
- package/dist/cjs/src/client/FlashnetClient.js +477 -14
- package/dist/cjs/src/client/FlashnetClient.js.map +1 -1
- package/dist/cjs/src/config/index.js +1 -1
- package/dist/cjs/src/types/errors.js +11 -11
- package/dist/cjs/src/types/index.d.ts +412 -0
- package/dist/cjs/src/types/index.d.ts.map +1 -1
- package/dist/cjs/src/types/index.js +1 -1
- package/dist/cjs/src/utils/index.d.ts +1 -0
- package/dist/cjs/src/utils/index.d.ts.map +1 -1
- package/dist/cjs/src/utils/index.js.map +1 -1
- package/dist/cjs/src/utils/intents.d.ts +91 -0
- package/dist/cjs/src/utils/intents.d.ts.map +1 -1
- package/dist/cjs/src/utils/intents.js +117 -0
- package/dist/cjs/src/utils/intents.js.map +1 -1
- package/dist/cjs/src/utils/spark-address.js +2 -2
- package/dist/cjs/src/utils/tick-math.d.ts +240 -0
- package/dist/cjs/src/utils/tick-math.d.ts.map +1 -0
- package/dist/cjs/src/utils/tick-math.js +299 -0
- package/dist/cjs/src/utils/tick-math.js.map +1 -0
- package/dist/cjs/src/utils/tokenAddress.js +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/src/api/typed-endpoints.d.ts +70 -0
- package/dist/esm/src/api/typed-endpoints.d.ts.map +1 -1
- package/dist/esm/src/api/typed-endpoints.js +106 -11
- package/dist/esm/src/api/typed-endpoints.js.map +1 -1
- package/dist/esm/src/client/FlashnetClient.d.ts +179 -1
- package/dist/esm/src/client/FlashnetClient.d.ts.map +1 -1
- package/dist/esm/src/client/FlashnetClient.js +478 -15
- package/dist/esm/src/client/FlashnetClient.js.map +1 -1
- package/dist/esm/src/config/index.js +1 -1
- package/dist/esm/src/types/errors.js +11 -11
- package/dist/esm/src/types/index.d.ts +412 -0
- package/dist/esm/src/types/index.d.ts.map +1 -1
- package/dist/esm/src/types/index.js +1 -1
- package/dist/esm/src/utils/index.d.ts +1 -0
- package/dist/esm/src/utils/index.d.ts.map +1 -1
- package/dist/esm/src/utils/index.js.map +1 -1
- package/dist/esm/src/utils/intents.d.ts +91 -0
- package/dist/esm/src/utils/intents.d.ts.map +1 -1
- package/dist/esm/src/utils/intents.js +112 -1
- package/dist/esm/src/utils/intents.js.map +1 -1
- package/dist/esm/src/utils/spark-address.js +2 -2
- package/dist/esm/src/utils/tick-math.d.ts +240 -0
- package/dist/esm/src/utils/tick-math.d.ts.map +1 -0
- package/dist/esm/src/utils/tick-math.js +287 -0
- package/dist/esm/src/utils/tick-math.js.map +1 -0
- package/dist/esm/src/utils/tokenAddress.js +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* V3 Concentrated Liquidity Tick Math Utilities
|
|
5
|
+
*
|
|
6
|
+
* In V3 AMMs, price is represented as ticks where: price = 1.0001^tick
|
|
7
|
+
* Each tick represents a 0.01% (1 basis point) price change.
|
|
8
|
+
*
|
|
9
|
+
* Pool price convention: "amount of asset B per 1 unit of asset A" (in smallest units)
|
|
10
|
+
* For a USDB/BTC pool (A=USDB, B=BTC): price = sats per microUSDB
|
|
11
|
+
*/
|
|
12
|
+
// Constants
|
|
13
|
+
const LOG_BASE = Math.log(1.0001);
|
|
14
|
+
const MIN_TICK = -887272;
|
|
15
|
+
const MAX_TICK = 887272;
|
|
16
|
+
/**
|
|
17
|
+
* Convert a raw pool price to a tick.
|
|
18
|
+
*
|
|
19
|
+
* @param price - Pool price (amount of asset B per unit of asset A in smallest units)
|
|
20
|
+
* @returns The tick value
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // For USDB/BTC pool at ~$90k: price = 0.00111 sats per microUSDB
|
|
24
|
+
* priceToTick(0.00111) // returns approximately -68038
|
|
25
|
+
*/
|
|
26
|
+
function priceToTick(price) {
|
|
27
|
+
const priceNum = typeof price === "string" ? parseFloat(price) : price;
|
|
28
|
+
if (priceNum <= 0) {
|
|
29
|
+
throw new Error("Price must be positive");
|
|
30
|
+
}
|
|
31
|
+
const tick = Math.log(priceNum) / LOG_BASE;
|
|
32
|
+
return Math.round(tick);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Convert a tick to a raw pool price.
|
|
36
|
+
*
|
|
37
|
+
* @param tick - The tick value
|
|
38
|
+
* @returns Pool price as a string (for precision)
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* tickToPrice(-68038) // returns "0.001109..." (sats per microUSDB)
|
|
42
|
+
*/
|
|
43
|
+
function tickToPrice(tick) {
|
|
44
|
+
if (tick < MIN_TICK || tick > MAX_TICK) {
|
|
45
|
+
throw new Error(`Tick must be between ${MIN_TICK} and ${MAX_TICK}`);
|
|
46
|
+
}
|
|
47
|
+
const price = 1.0001 ** tick;
|
|
48
|
+
return price.toString();
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Round a tick down to the nearest valid tick (multiple of tick spacing).
|
|
52
|
+
*
|
|
53
|
+
* @param tick - The tick to round
|
|
54
|
+
* @param tickSpacing - The pool's tick spacing (e.g., 60)
|
|
55
|
+
* @returns Rounded tick
|
|
56
|
+
*/
|
|
57
|
+
function roundTickDown(tick, tickSpacing) {
|
|
58
|
+
return Math.floor(tick / tickSpacing) * tickSpacing;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Round a tick up to the nearest valid tick (multiple of tick spacing).
|
|
62
|
+
*
|
|
63
|
+
* @param tick - The tick to round
|
|
64
|
+
* @param tickSpacing - The pool's tick spacing (e.g., 60)
|
|
65
|
+
* @returns Rounded tick
|
|
66
|
+
*/
|
|
67
|
+
function roundTickUp(tick, tickSpacing) {
|
|
68
|
+
return Math.ceil(tick / tickSpacing) * tickSpacing;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Round a tick to the nearest valid tick (multiple of tick spacing).
|
|
72
|
+
*
|
|
73
|
+
* @param tick - The tick to round
|
|
74
|
+
* @param tickSpacing - The pool's tick spacing (e.g., 60)
|
|
75
|
+
* @returns Rounded tick
|
|
76
|
+
*/
|
|
77
|
+
function roundTick(tick, tickSpacing) {
|
|
78
|
+
return Math.round(tick / tickSpacing) * tickSpacing;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Convert a human-readable price to a V3 tick.
|
|
82
|
+
*
|
|
83
|
+
* This is the most user-friendly function for calculating ticks.
|
|
84
|
+
* Express your price as "quote per base" (e.g., "$90,000 per BTC").
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* // BTC at $90,000, pool has USDB (6 decimals) as A, BTC (8 decimals) as B
|
|
88
|
+
* humanPriceToTick({
|
|
89
|
+
* humanPrice: 90000,
|
|
90
|
+
* baseDecimals: 8, // BTC
|
|
91
|
+
* quoteDecimals: 6, // USD
|
|
92
|
+
* baseIsAssetA: false, // BTC is asset B (default)
|
|
93
|
+
* tickSpacing: 60
|
|
94
|
+
* }) // returns -68040
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* // Get tick range for $80,000 to $100,000
|
|
98
|
+
* const tickLower = humanPriceToTick({ humanPrice: 100000, baseDecimals: 8, quoteDecimals: 6, tickSpacing: 60 });
|
|
99
|
+
* const tickUpper = humanPriceToTick({ humanPrice: 80000, baseDecimals: 8, quoteDecimals: 6, tickSpacing: 60 });
|
|
100
|
+
* // Note: higher price = lower tick for this pool configuration
|
|
101
|
+
*/
|
|
102
|
+
function humanPriceToTick(options) {
|
|
103
|
+
const { humanPrice, baseDecimals, quoteDecimals, baseIsAssetA = false, tickSpacing, } = options;
|
|
104
|
+
if (humanPrice <= 0) {
|
|
105
|
+
throw new Error("Human price must be positive");
|
|
106
|
+
}
|
|
107
|
+
// Pool price is "amount of B per unit of A" in smallest units
|
|
108
|
+
// Human price is "quote per base"
|
|
109
|
+
// If base is asset B (common case: BTC/USD pool where BTC is B):
|
|
110
|
+
// pool_price = 10^(baseDecimals - quoteDecimals) / humanPrice
|
|
111
|
+
// If base is asset A:
|
|
112
|
+
// pool_price = humanPrice * 10^(quoteDecimals - baseDecimals)
|
|
113
|
+
let poolPrice;
|
|
114
|
+
if (baseIsAssetA) {
|
|
115
|
+
// Base is A, so human price is "B per A" which is the same direction as pool price
|
|
116
|
+
poolPrice = humanPrice * 10 ** (quoteDecimals - baseDecimals);
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Base is B, so human price is "A per B", need to invert
|
|
120
|
+
poolPrice = 10 ** (baseDecimals - quoteDecimals) / humanPrice;
|
|
121
|
+
}
|
|
122
|
+
let tick = priceToTick(poolPrice);
|
|
123
|
+
if (tickSpacing) {
|
|
124
|
+
tick = roundTick(tick, tickSpacing);
|
|
125
|
+
}
|
|
126
|
+
return tick;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Convert a V3 tick to a human-readable price.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* // Tick -68040 in a USDB/BTC pool
|
|
133
|
+
* tickToHumanPrice({
|
|
134
|
+
* tick: -68040,
|
|
135
|
+
* baseDecimals: 8, // BTC
|
|
136
|
+
* quoteDecimals: 6, // USD
|
|
137
|
+
* baseIsAssetA: false // BTC is asset B
|
|
138
|
+
* }) // returns approximately 90000 (dollars per BTC)
|
|
139
|
+
*/
|
|
140
|
+
function tickToHumanPrice(options) {
|
|
141
|
+
const { tick, baseDecimals, quoteDecimals, baseIsAssetA = false } = options;
|
|
142
|
+
const poolPrice = parseFloat(tickToPrice(tick));
|
|
143
|
+
// Reverse the conversion from humanPriceToTick
|
|
144
|
+
if (baseIsAssetA) {
|
|
145
|
+
return poolPrice / 10 ** (quoteDecimals - baseDecimals);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return 10 ** (baseDecimals - quoteDecimals) / poolPrice;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get a tick range from human-readable price bounds.
|
|
153
|
+
*
|
|
154
|
+
* Automatically handles the conversion and ensures tickLower < tickUpper.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* // Get tick range for $80,000 to $100,000 BTC price
|
|
158
|
+
* const range = tickRangeFromPrices({
|
|
159
|
+
* priceLower: 80000,
|
|
160
|
+
* priceUpper: 100000,
|
|
161
|
+
* baseDecimals: 8,
|
|
162
|
+
* quoteDecimals: 6,
|
|
163
|
+
* tickSpacing: 60
|
|
164
|
+
* });
|
|
165
|
+
* // returns { tickLower: -69120, tickUpper: -66840, actualPriceLower: 80180, actualPriceUpper: 99820 }
|
|
166
|
+
*/
|
|
167
|
+
function tickRangeFromPrices(options) {
|
|
168
|
+
const { priceLower, priceUpper, baseDecimals, quoteDecimals, baseIsAssetA = false, tickSpacing, } = options;
|
|
169
|
+
if (priceLower >= priceUpper) {
|
|
170
|
+
throw new Error("priceLower must be less than priceUpper");
|
|
171
|
+
}
|
|
172
|
+
const tick1 = humanPriceToTick({
|
|
173
|
+
humanPrice: priceLower,
|
|
174
|
+
baseDecimals,
|
|
175
|
+
quoteDecimals,
|
|
176
|
+
baseIsAssetA,
|
|
177
|
+
tickSpacing,
|
|
178
|
+
});
|
|
179
|
+
const tick2 = humanPriceToTick({
|
|
180
|
+
humanPrice: priceUpper,
|
|
181
|
+
baseDecimals,
|
|
182
|
+
quoteDecimals,
|
|
183
|
+
baseIsAssetA,
|
|
184
|
+
tickSpacing,
|
|
185
|
+
});
|
|
186
|
+
// Ensure tickLower < tickUpper (tick direction depends on baseIsAssetA)
|
|
187
|
+
const tickLower = Math.min(tick1, tick2);
|
|
188
|
+
const tickUpper = Math.max(tick1, tick2);
|
|
189
|
+
// Calculate actual prices at the rounded ticks
|
|
190
|
+
const actualPriceLower = tickToHumanPrice({
|
|
191
|
+
tick: baseIsAssetA ? tickLower : tickUpper,
|
|
192
|
+
baseDecimals,
|
|
193
|
+
quoteDecimals,
|
|
194
|
+
baseIsAssetA,
|
|
195
|
+
});
|
|
196
|
+
const actualPriceUpper = tickToHumanPrice({
|
|
197
|
+
tick: baseIsAssetA ? tickUpper : tickLower,
|
|
198
|
+
baseDecimals,
|
|
199
|
+
quoteDecimals,
|
|
200
|
+
baseIsAssetA,
|
|
201
|
+
});
|
|
202
|
+
return {
|
|
203
|
+
tickLower,
|
|
204
|
+
tickUpper,
|
|
205
|
+
actualPriceLower,
|
|
206
|
+
actualPriceUpper,
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//
|
|
210
|
+
// Pool Price Calculation from Amount
|
|
211
|
+
//
|
|
212
|
+
/**
|
|
213
|
+
* Calculate the pool price needed for a given position configuration.
|
|
214
|
+
*
|
|
215
|
+
* @param humanPrice - Human-readable price (e.g., 90000 for $90k/BTC)
|
|
216
|
+
* @param baseDecimals - Decimals of base token
|
|
217
|
+
* @param quoteDecimals - Decimals of quote token
|
|
218
|
+
* @param baseIsAssetA - Whether base is asset A (default: false)
|
|
219
|
+
* @returns Pool price string suitable for createConcentratedPool's initialPrice
|
|
220
|
+
*/
|
|
221
|
+
function humanPriceToPoolPrice(humanPrice, baseDecimals, quoteDecimals, baseIsAssetA = false) {
|
|
222
|
+
if (humanPrice <= 0) {
|
|
223
|
+
throw new Error("Human price must be positive");
|
|
224
|
+
}
|
|
225
|
+
let poolPrice;
|
|
226
|
+
if (baseIsAssetA) {
|
|
227
|
+
poolPrice = humanPrice * 10 ** (quoteDecimals - baseDecimals);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
poolPrice = 10 ** (baseDecimals - quoteDecimals) / humanPrice;
|
|
231
|
+
}
|
|
232
|
+
return poolPrice.toPrecision(10);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Convert pool price to human-readable price.
|
|
236
|
+
*
|
|
237
|
+
* @param poolPrice - Pool price (amount of B per unit of A in smallest units)
|
|
238
|
+
* @param baseDecimals - Decimals of base token
|
|
239
|
+
* @param quoteDecimals - Decimals of quote token
|
|
240
|
+
* @param baseIsAssetA - Whether base is asset A (default: false)
|
|
241
|
+
* @returns Human-readable price
|
|
242
|
+
*/
|
|
243
|
+
function poolPriceToHumanPrice(poolPrice, baseDecimals, quoteDecimals, baseIsAssetA = false) {
|
|
244
|
+
const price = typeof poolPrice === "string" ? parseFloat(poolPrice) : poolPrice;
|
|
245
|
+
if (baseIsAssetA) {
|
|
246
|
+
return price / 10 ** (quoteDecimals - baseDecimals);
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
return 10 ** (baseDecimals - quoteDecimals) / price;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
//
|
|
253
|
+
// Convenience exports
|
|
254
|
+
//
|
|
255
|
+
/**
|
|
256
|
+
* V3 tick math utilities namespace for cleaner imports.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* import { V3TickMath } from "@flashnet/sdk";
|
|
260
|
+
*
|
|
261
|
+
* const tick = V3TickMath.fromHumanPrice({
|
|
262
|
+
* humanPrice: 90000,
|
|
263
|
+
* baseDecimals: 8,
|
|
264
|
+
* quoteDecimals: 6,
|
|
265
|
+
* tickSpacing: 60
|
|
266
|
+
* });
|
|
267
|
+
*/
|
|
268
|
+
const V3TickMath = {
|
|
269
|
+
// Core conversions
|
|
270
|
+
priceToTick,
|
|
271
|
+
tickToPrice,
|
|
272
|
+
// Tick spacing
|
|
273
|
+
roundTickDown,
|
|
274
|
+
roundTickUp,
|
|
275
|
+
roundTick,
|
|
276
|
+
// Human-readable conversions
|
|
277
|
+
fromHumanPrice: humanPriceToTick,
|
|
278
|
+
toHumanPrice: tickToHumanPrice,
|
|
279
|
+
rangeFromPrices: tickRangeFromPrices,
|
|
280
|
+
// Pool price conversions
|
|
281
|
+
humanPriceToPoolPrice,
|
|
282
|
+
poolPriceToHumanPrice,
|
|
283
|
+
// Constants
|
|
284
|
+
MIN_TICK,
|
|
285
|
+
MAX_TICK,
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
exports.V3TickMath = V3TickMath;
|
|
289
|
+
exports.humanPriceToPoolPrice = humanPriceToPoolPrice;
|
|
290
|
+
exports.humanPriceToTick = humanPriceToTick;
|
|
291
|
+
exports.poolPriceToHumanPrice = poolPriceToHumanPrice;
|
|
292
|
+
exports.priceToTick = priceToTick;
|
|
293
|
+
exports.roundTick = roundTick;
|
|
294
|
+
exports.roundTickDown = roundTickDown;
|
|
295
|
+
exports.roundTickUp = roundTickUp;
|
|
296
|
+
exports.tickRangeFromPrices = tickRangeFromPrices;
|
|
297
|
+
exports.tickToHumanPrice = tickToHumanPrice;
|
|
298
|
+
exports.tickToPrice = tickToPrice;
|
|
299
|
+
//# sourceMappingURL=tick-math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tick-math.js","sources":["../../../../../../src/utils/tick-math.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;;;;AAQG;AAEH;AACA,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC;AACjC,MAAM,QAAQ,GAAG,OAAO;AACxB,MAAM,QAAQ,GAAG,MAAM;AAEvB;;;;;;;;;AASG;AACG,SAAU,WAAW,CAAC,KAAsB,EAAA;AAChD,IAAA,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,GAAG,UAAU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EAC1B,YAAoB,EACpB,aAAqB,EACrB,YAAY,GAAG,KAAK,EAAA;AAEpB,IAAA,MAAM,KAAK,GACT,OAAO,SAAS,KAAK,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,SAAS;IAEnE,IAAI,YAAY,EAAE;QAChB,OAAO,KAAK,GAAG,EAAE,KAAK,aAAa,GAAG,YAAY,CAAC;IACrD;SAAO;QACL,OAAO,EAAE,KAAK,YAAY,GAAG,aAAa,CAAC,GAAG,KAAK;IACrD;AACF;AAEA;AACA;AACA;AAEA;;;;;;;;;;;;AAYG;AACI,MAAM,UAAU,GAAG;;IAExB,WAAW;IACX,WAAW;;IAGX,aAAa;IACb,WAAW;IACX,SAAS;;AAGT,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,YAAY,EAAE,gBAAgB;AAC9B,IAAA,eAAe,EAAE,mBAAmB;;IAGpC,qBAAqB;IACrB,qBAAqB;;IAGrB,QAAQ;IACR,QAAQ;;;;;;;;;;;;;;;"}
|
|
@@ -66,7 +66,7 @@ function decodeSparkHumanReadableTokenIdentifier(humanReadableTokenIdentifier, n
|
|
|
66
66
|
throw new Error("Failed to decode Spark human readable token identifier");
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
|
-
//
|
|
69
|
+
// BACKWARD COMPATIBILITY LAYER
|
|
70
70
|
/**
|
|
71
71
|
* @deprecated Use SparkHumanReadableTokenIdentifierNetworkPrefix instead
|
|
72
72
|
*/
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -9,8 +9,9 @@ export { calculateThresholdPercentage, type ValidationResult, validateSingleSide
|
|
|
9
9
|
export { type AutoClawbackSummary, type ClawbackAttemptResult, ERROR_CODE_METADATA, type ErrorCodeMetadata, type ErrorRecoveryStrategy, FlashnetError, type FlashnetErrorCategory, type FlashnetErrorCode, type FlashnetErrorOptions, type FlashnetErrorResponseBody, getCategoryFromCodeRange, getErrorCategory, getErrorMetadata, getErrorRecovery, isFlashnetError, isFlashnetErrorCode, } from "./src/types/errors";
|
|
10
10
|
export { fromSmallestUnit, generateNonce, toSmallestUnit } from "./src/utils";
|
|
11
11
|
export { AuthManager } from "./src/utils/auth";
|
|
12
|
-
export { generateAddLiquidityIntentMessage, generateClaimEscrowIntentMessage, generateClawbackIntentMessage, generateConstantProductPoolInitializationIntentMessage, generateCreateEscrowIntentMessage, generateFundEscrowIntentMessage, generatePoolConfirmInitialDepositIntentMessage, generatePoolInitializationIntentMessage, generatePoolSwapIntentMessage, generateRegisterHostIntentMessage, generateRemoveLiquidityIntentMessage, generateRouteSwapIntentMessage, generateWithdrawHostFeesIntentMessage, generateWithdrawIntegratorFeesIntentMessage, } from "./src/utils/intents";
|
|
12
|
+
export { generateAddLiquidityIntentMessage, generateClaimEscrowIntentMessage, generateClawbackIntentMessage, generateCollectFeesIntentMessage, generateConstantProductPoolInitializationIntentMessage, generateCreateConcentratedPoolIntentMessage, generateCreateEscrowIntentMessage, generateDecreaseLiquidityIntentMessage, generateFundEscrowIntentMessage, generateIncreaseLiquidityIntentMessage, generatePoolConfirmInitialDepositIntentMessage, generatePoolInitializationIntentMessage, generatePoolSwapIntentMessage, generateRebalancePositionIntentMessage, generateRegisterHostIntentMessage, generateRemoveLiquidityIntentMessage, generateRouteSwapIntentMessage, generateWithdrawHostFeesIntentMessage, generateWithdrawIntegratorFeesIntentMessage, } from "./src/utils/intents";
|
|
13
13
|
export { createWalletSigner } from "./src/utils/signer";
|
|
14
14
|
export { convertSparkAddressToNetwork, convertSparkAddressToSparkNetwork, decodeSparkAddress, decodeSparkAddressNew, encodeSparkAddress, encodeSparkAddressNew, getNetworkFromAddress, getSparkNetworkFromAddress, isValidPublicKey, isValidSparkAddress, isValidSparkAddressNew, looksLikePublicKey, type SparkAddressFormat, } from "./src/utils/spark-address";
|
|
15
|
+
export { type HumanPriceToTickOptions, humanPriceToPoolPrice, humanPriceToTick, poolPriceToHumanPrice, priceToTick, roundTick, roundTickDown, roundTickUp, type TickRange, type TickRangeFromPricesOptions, type TickToHumanPriceOptions, tickRangeFromPrices, tickToHumanPrice, tickToPrice, V3TickMath, } from "./src/utils/tick-math";
|
|
15
16
|
export { decodeHumanReadableTokenIdentifier, decodeSparkHumanReadableTokenIdentifier, encodeHumanReadableTokenIdentifier, encodeSparkHumanReadableTokenIdentifier, getHumanReadableTokenIdentifier, getTokenIdentifier, getTokenIdentifierHashes, getTokenIdentifierWithHashes, type HumanReadableTokenIdentifier, SPARK_TOKEN_CREATION_ENTITY_PUBLIC_KEY, type SparkHumanReadableTokenIdentifier, } from "./src/utils/tokenAddress";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAEA,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EACL,UAAU,EACV,6BAA6B,EAC7B,WAAW,GACZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,EACrB,kCAAkC,EAClC,8BAA8B,EAC9B,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,6BAA6B,CAAC;AAErC,cAAc,cAAc,CAAC;AAC7B,mBAAmB,aAAa,CAAC;AACjC,OAAO,EACL,4BAA4B,EAC5B,KAAK,gBAAgB,EACrB,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B,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,SAAS,EACT,aAAa,EACb,WAAW,EACX,KAAK,SAAS,EACd,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,EACX,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,kCAAkC,EAClC,uCAAuC,EAEvC,kCAAkC,EAElC,uCAAuC,EACvC,+BAA+B,EAC/B,kBAAkB,EAClB,wBAAwB,EACxB,4BAA4B,EAC5B,KAAK,4BAA4B,EACjC,sCAAsC,EACtC,KAAK,iCAAiC,GACvC,MAAM,0BAA0B,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -7,8 +7,9 @@ export { calculateThresholdPercentage, validateSingleSidedPoolThreshold } from '
|
|
|
7
7
|
export { ERROR_CODE_METADATA, FlashnetError, getCategoryFromCodeRange, getErrorCategory, getErrorMetadata, getErrorRecovery, isFlashnetError, isFlashnetErrorCode } from './src/types/errors.js';
|
|
8
8
|
export { fromSmallestUnit, generateNonce, toSmallestUnit } from './src/utils/index.js';
|
|
9
9
|
export { AuthManager } from './src/utils/auth.js';
|
|
10
|
-
export { generateAddLiquidityIntentMessage, generateClaimEscrowIntentMessage, generateClawbackIntentMessage, generateConstantProductPoolInitializationIntentMessage, generateCreateEscrowIntentMessage, generateFundEscrowIntentMessage, generatePoolConfirmInitialDepositIntentMessage, generatePoolInitializationIntentMessage, generatePoolSwapIntentMessage, generateRegisterHostIntentMessage, generateRemoveLiquidityIntentMessage, generateRouteSwapIntentMessage, generateWithdrawHostFeesIntentMessage, generateWithdrawIntegratorFeesIntentMessage } from './src/utils/intents.js';
|
|
10
|
+
export { generateAddLiquidityIntentMessage, generateClaimEscrowIntentMessage, generateClawbackIntentMessage, generateCollectFeesIntentMessage, generateConstantProductPoolInitializationIntentMessage, generateCreateConcentratedPoolIntentMessage, generateCreateEscrowIntentMessage, generateDecreaseLiquidityIntentMessage, generateFundEscrowIntentMessage, generateIncreaseLiquidityIntentMessage, generatePoolConfirmInitialDepositIntentMessage, generatePoolInitializationIntentMessage, generatePoolSwapIntentMessage, generateRebalancePositionIntentMessage, generateRegisterHostIntentMessage, generateRemoveLiquidityIntentMessage, generateRouteSwapIntentMessage, generateWithdrawHostFeesIntentMessage, generateWithdrawIntegratorFeesIntentMessage } from './src/utils/intents.js';
|
|
11
11
|
export { createWalletSigner } from './src/utils/signer.js';
|
|
12
12
|
export { convertSparkAddressToNetwork, convertSparkAddressToSparkNetwork, decodeSparkAddress, decodeSparkAddressNew, encodeSparkAddress, encodeSparkAddressNew, getNetworkFromAddress, getSparkNetworkFromAddress, isValidPublicKey, isValidSparkAddress, isValidSparkAddressNew, looksLikePublicKey } from './src/utils/spark-address.js';
|
|
13
|
+
export { V3TickMath, humanPriceToPoolPrice, humanPriceToTick, poolPriceToHumanPrice, priceToTick, roundTick, roundTickDown, roundTickUp, tickRangeFromPrices, tickToHumanPrice, tickToPrice } from './src/utils/tick-math.js';
|
|
13
14
|
export { SPARK_TOKEN_CREATION_ENTITY_PUBLIC_KEY, decodeHumanReadableTokenIdentifier, decodeSparkHumanReadableTokenIdentifier, encodeHumanReadableTokenIdentifier, encodeSparkHumanReadableTokenIdentifier, getHumanReadableTokenIdentifier, getTokenIdentifier, getTokenIdentifierHashes, getTokenIdentifierWithHashes } from './src/utils/tokenAddress.js';
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
|
|
@@ -235,6 +235,76 @@ export declare class TypedAmmApi {
|
|
|
235
235
|
* @requires Bearer token
|
|
236
236
|
*/
|
|
237
237
|
listClawbackableTransfers(query?: Types.ListClawbackableTransfersQuery): Promise<Types.ListClawbackableTransfersResponse>;
|
|
238
|
+
/**
|
|
239
|
+
* Create a new concentrated liquidity pool (V3)
|
|
240
|
+
* @POST /v1/pools/concentrated
|
|
241
|
+
* @requires Bearer token
|
|
242
|
+
*/
|
|
243
|
+
createConcentratedPool(request: Types.CreateConcentratedPoolRequest): Promise<Types.CreateConcentratedPoolResponse>;
|
|
244
|
+
/**
|
|
245
|
+
* Increase liquidity in a V3 concentrated position
|
|
246
|
+
* @POST /v1/concentrated/liquidity/increase
|
|
247
|
+
* @requires Bearer token
|
|
248
|
+
*/
|
|
249
|
+
increaseLiquidity(request: Types.IncreaseLiquidityRequest): Promise<Types.IncreaseLiquidityResponse>;
|
|
250
|
+
/**
|
|
251
|
+
* Decrease liquidity in a V3 concentrated position
|
|
252
|
+
* @POST /v1/concentrated/liquidity/decrease
|
|
253
|
+
* @requires Bearer token
|
|
254
|
+
*/
|
|
255
|
+
decreaseLiquidity(request: Types.DecreaseLiquidityRequest): Promise<Types.DecreaseLiquidityResponse>;
|
|
256
|
+
/**
|
|
257
|
+
* Collect accumulated fees from a V3 position
|
|
258
|
+
* @POST /v1/concentrated/fees/collect
|
|
259
|
+
* @requires Bearer token
|
|
260
|
+
*/
|
|
261
|
+
collectFees(request: Types.CollectFeesRequest): Promise<Types.CollectFeesResponse>;
|
|
262
|
+
/**
|
|
263
|
+
* Rebalance a V3 position to a new tick range
|
|
264
|
+
* @POST /v1/concentrated/positions/rebalance
|
|
265
|
+
* @requires Bearer token
|
|
266
|
+
*/
|
|
267
|
+
rebalancePosition(request: Types.RebalancePositionRequest): Promise<Types.RebalancePositionResponse>;
|
|
268
|
+
/**
|
|
269
|
+
* List V3 concentrated liquidity positions
|
|
270
|
+
* @GET /v1/concentrated/positions
|
|
271
|
+
* @requires Bearer token
|
|
272
|
+
*/
|
|
273
|
+
listConcentratedPositions(query?: Types.ListConcentratedPositionsQuery): Promise<Types.ListConcentratedPositionsResponse>;
|
|
274
|
+
/**
|
|
275
|
+
* Get pool liquidity distribution for visualization
|
|
276
|
+
* @GET /v1/concentrated/pools/{poolId}/liquidity
|
|
277
|
+
*/
|
|
278
|
+
getPoolLiquidity(poolId: string): Promise<Types.PoolLiquidityResponse>;
|
|
279
|
+
/**
|
|
280
|
+
* Get pool ticks for simulation
|
|
281
|
+
* @GET /v1/concentrated/pools/{poolId}/ticks
|
|
282
|
+
*/
|
|
283
|
+
getPoolTicks(poolId: string): Promise<Types.PoolTicksResponse>;
|
|
284
|
+
/**
|
|
285
|
+
* Get user's free balance for a specific V3 pool
|
|
286
|
+
* @GET /v1/concentrated/balance/{poolId}
|
|
287
|
+
* @requires Bearer token
|
|
288
|
+
*/
|
|
289
|
+
getConcentratedBalance(poolId: string): Promise<Types.GetBalanceResponse>;
|
|
290
|
+
/**
|
|
291
|
+
* Get user's free balances across all V3 pools
|
|
292
|
+
* @GET /v1/concentrated/balances
|
|
293
|
+
* @requires Bearer token
|
|
294
|
+
*/
|
|
295
|
+
getConcentratedBalances(): Promise<Types.GetBalancesResponse>;
|
|
296
|
+
/**
|
|
297
|
+
* Get user's free balance for a specific V3 pool (via balances endpoint)
|
|
298
|
+
* @GET /v1/concentrated/balances/{poolId}
|
|
299
|
+
* @requires Bearer token
|
|
300
|
+
*/
|
|
301
|
+
getConcentratedBalanceByPool(poolId: string): Promise<Types.GetBalancesResponse>;
|
|
302
|
+
/**
|
|
303
|
+
* Withdraw free balance from a V3 pool to user's Spark wallet
|
|
304
|
+
* @POST /v1/concentrated/balance/withdraw
|
|
305
|
+
* @requires Bearer token
|
|
306
|
+
*/
|
|
307
|
+
withdrawConcentratedBalance(request: Types.WithdrawBalanceRequest): Promise<Types.WithdrawBalanceResponse>;
|
|
238
308
|
}
|
|
239
309
|
/**
|
|
240
310
|
* Error checking utilities
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typed-endpoints.d.ts","sourceRoot":"","sources":["../../../../src/api/typed-endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,U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KAAK,CAAC,iCAAiC,CAAC;IAOnD;;;OAGG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC;IAM5E;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,iBAAiB,CAAC;IAMpE;;;;OAIG;IACG,sBAAsB,CAC1B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC;IAMpC;;;;OAIG;IACG,uBAAuB,IAAI,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC;IAMnE;;;;OAIG;IACG,4BAA4B,CAChC,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC;IAMrC;;;;OAIG;IACG,2BAA2B,CAC/B,OAAO,EAAE,KAAK,CAAC,sBAAsB,GACpC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;CAM1C;AAED;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,KAAK,CAAC,qBAAqB,CAStC;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,sCAAgC,CAAC;AAE7D,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC,gBAAgB,CAO1E"}
|
|
@@ -6,7 +6,7 @@ class TypedAmmApi {
|
|
|
6
6
|
constructor(client) {
|
|
7
7
|
this.client = client;
|
|
8
8
|
}
|
|
9
|
-
//
|
|
9
|
+
// Authentication Endpoints
|
|
10
10
|
/**
|
|
11
11
|
* Request authentication challenge
|
|
12
12
|
* @POST /v1/auth/challenge
|
|
@@ -21,7 +21,7 @@ class TypedAmmApi {
|
|
|
21
21
|
async verify(request) {
|
|
22
22
|
return this.client.ammPost("/v1/auth/verify", request);
|
|
23
23
|
}
|
|
24
|
-
//
|
|
24
|
+
// Host Endpoints
|
|
25
25
|
/**
|
|
26
26
|
* Register a new host
|
|
27
27
|
* @POST /v1/hosts/register
|
|
@@ -69,7 +69,7 @@ class TypedAmmApi {
|
|
|
69
69
|
async getHostFeeWithdrawalHistory(query) {
|
|
70
70
|
return this.client.ammGet("/v1/hosts/fee-withdrawal-history", { params: query });
|
|
71
71
|
}
|
|
72
|
-
//
|
|
72
|
+
// Pool Endpoints
|
|
73
73
|
/**
|
|
74
74
|
* Create constant product pool
|
|
75
75
|
* @POST /v1/pools/constant-product
|
|
@@ -126,7 +126,7 @@ class TypedAmmApi {
|
|
|
126
126
|
async getAllLpPositions() {
|
|
127
127
|
return this.client.ammGet("/v1/liquidity/positions");
|
|
128
128
|
}
|
|
129
|
-
//
|
|
129
|
+
// Liquidity Endpoints
|
|
130
130
|
/**
|
|
131
131
|
* Add liquidity to pool
|
|
132
132
|
* @POST /v1/liquidity/add
|
|
@@ -157,7 +157,7 @@ class TypedAmmApi {
|
|
|
157
157
|
async simulateRemoveLiquidity(request) {
|
|
158
158
|
return this.client.ammPost("/v1/liquidity/remove/simulate", request);
|
|
159
159
|
}
|
|
160
|
-
//
|
|
160
|
+
// Swap Endpoints
|
|
161
161
|
/**
|
|
162
162
|
* Execute swap
|
|
163
163
|
* @POST /v1/swap
|
|
@@ -196,7 +196,7 @@ class TypedAmmApi {
|
|
|
196
196
|
async getUserSwaps(userPublicKey, query) {
|
|
197
197
|
return this.client.ammGet(`/v1/swaps/user/${userPublicKey}`, { params: query });
|
|
198
198
|
}
|
|
199
|
-
//
|
|
199
|
+
// Route Swap Endpoints
|
|
200
200
|
/**
|
|
201
201
|
* Execute route swap
|
|
202
202
|
* @POST /v1/route-swap
|
|
@@ -212,7 +212,7 @@ class TypedAmmApi {
|
|
|
212
212
|
async simulateRouteSwap(request) {
|
|
213
213
|
return this.client.ammPost("/v1/route-swap/simulate", request);
|
|
214
214
|
}
|
|
215
|
-
//
|
|
215
|
+
// Integrator Endpoints
|
|
216
216
|
/**
|
|
217
217
|
* Get integrator fees across all pools
|
|
218
218
|
* @GET /v1/integrators/fees
|
|
@@ -245,7 +245,7 @@ class TypedAmmApi {
|
|
|
245
245
|
async withdrawIntegratorFees(request) {
|
|
246
246
|
return this.client.ammPost("/v1/integrators/withdraw-fees", request);
|
|
247
247
|
}
|
|
248
|
-
//
|
|
248
|
+
// Escrow Endpoints
|
|
249
249
|
/**
|
|
250
250
|
* Create a new escrow contract
|
|
251
251
|
* @POST /v1/escrows/create
|
|
@@ -277,7 +277,7 @@ class TypedAmmApi {
|
|
|
277
277
|
async getEscrow(escrowId) {
|
|
278
278
|
return this.client.ammGet(`/v1/escrows/${escrowId}`);
|
|
279
279
|
}
|
|
280
|
-
//
|
|
280
|
+
// Status Endpoints
|
|
281
281
|
/**
|
|
282
282
|
* Ping settlement service
|
|
283
283
|
* @GET /v1/ping
|
|
@@ -285,7 +285,7 @@ class TypedAmmApi {
|
|
|
285
285
|
async ping() {
|
|
286
286
|
return this.client.ammGet("/v1/ping");
|
|
287
287
|
}
|
|
288
|
-
//
|
|
288
|
+
// Config Endpoints
|
|
289
289
|
/**
|
|
290
290
|
* Get feature status flags
|
|
291
291
|
* @GET /v1/config/feature-status
|
|
@@ -307,7 +307,7 @@ class TypedAmmApi {
|
|
|
307
307
|
async getAllowedAssets() {
|
|
308
308
|
return this.client.ammGet("/v1/config/allowed-assets");
|
|
309
309
|
}
|
|
310
|
-
//
|
|
310
|
+
// Clawback Endpoint
|
|
311
311
|
/**
|
|
312
312
|
* Clawback stuck funds sent to an LP wallet
|
|
313
313
|
* @POST /v1/clawback
|
|
@@ -332,6 +332,101 @@ class TypedAmmApi {
|
|
|
332
332
|
async listClawbackableTransfers(query) {
|
|
333
333
|
return this.client.ammGet("/v1/clawback-transfers/list", { params: query });
|
|
334
334
|
}
|
|
335
|
+
// V3 Concentrated Liquidity Endpoints
|
|
336
|
+
/**
|
|
337
|
+
* Create a new concentrated liquidity pool (V3)
|
|
338
|
+
* @POST /v1/pools/concentrated
|
|
339
|
+
* @requires Bearer token
|
|
340
|
+
*/
|
|
341
|
+
async createConcentratedPool(request) {
|
|
342
|
+
return this.client.ammPost("/v1/pools/concentrated", request);
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* Increase liquidity in a V3 concentrated position
|
|
346
|
+
* @POST /v1/concentrated/liquidity/increase
|
|
347
|
+
* @requires Bearer token
|
|
348
|
+
*/
|
|
349
|
+
async increaseLiquidity(request) {
|
|
350
|
+
return this.client.ammPost("/v1/concentrated/liquidity/increase", request);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Decrease liquidity in a V3 concentrated position
|
|
354
|
+
* @POST /v1/concentrated/liquidity/decrease
|
|
355
|
+
* @requires Bearer token
|
|
356
|
+
*/
|
|
357
|
+
async decreaseLiquidity(request) {
|
|
358
|
+
return this.client.ammPost("/v1/concentrated/liquidity/decrease", request);
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Collect accumulated fees from a V3 position
|
|
362
|
+
* @POST /v1/concentrated/fees/collect
|
|
363
|
+
* @requires Bearer token
|
|
364
|
+
*/
|
|
365
|
+
async collectFees(request) {
|
|
366
|
+
return this.client.ammPost("/v1/concentrated/fees/collect", request);
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Rebalance a V3 position to a new tick range
|
|
370
|
+
* @POST /v1/concentrated/positions/rebalance
|
|
371
|
+
* @requires Bearer token
|
|
372
|
+
*/
|
|
373
|
+
async rebalancePosition(request) {
|
|
374
|
+
return this.client.ammPost("/v1/concentrated/positions/rebalance", request);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* List V3 concentrated liquidity positions
|
|
378
|
+
* @GET /v1/concentrated/positions
|
|
379
|
+
* @requires Bearer token
|
|
380
|
+
*/
|
|
381
|
+
async listConcentratedPositions(query) {
|
|
382
|
+
return this.client.ammGet("/v1/concentrated/positions", { params: query });
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Get pool liquidity distribution for visualization
|
|
386
|
+
* @GET /v1/concentrated/pools/{poolId}/liquidity
|
|
387
|
+
*/
|
|
388
|
+
async getPoolLiquidity(poolId) {
|
|
389
|
+
return this.client.ammGet(`/v1/concentrated/pools/${poolId}/liquidity`);
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Get pool ticks for simulation
|
|
393
|
+
* @GET /v1/concentrated/pools/{poolId}/ticks
|
|
394
|
+
*/
|
|
395
|
+
async getPoolTicks(poolId) {
|
|
396
|
+
return this.client.ammGet(`/v1/concentrated/pools/${poolId}/ticks`);
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Get user's free balance for a specific V3 pool
|
|
400
|
+
* @GET /v1/concentrated/balance/{poolId}
|
|
401
|
+
* @requires Bearer token
|
|
402
|
+
*/
|
|
403
|
+
async getConcentratedBalance(poolId) {
|
|
404
|
+
return this.client.ammGet(`/v1/concentrated/balance/${poolId}`);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Get user's free balances across all V3 pools
|
|
408
|
+
* @GET /v1/concentrated/balances
|
|
409
|
+
* @requires Bearer token
|
|
410
|
+
*/
|
|
411
|
+
async getConcentratedBalances() {
|
|
412
|
+
return this.client.ammGet("/v1/concentrated/balances");
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Get user's free balance for a specific V3 pool (via balances endpoint)
|
|
416
|
+
* @GET /v1/concentrated/balances/{poolId}
|
|
417
|
+
* @requires Bearer token
|
|
418
|
+
*/
|
|
419
|
+
async getConcentratedBalanceByPool(poolId) {
|
|
420
|
+
return this.client.ammGet(`/v1/concentrated/balances/${poolId}`);
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Withdraw free balance from a V3 pool to user's Spark wallet
|
|
424
|
+
* @POST /v1/concentrated/balance/withdraw
|
|
425
|
+
* @requires Bearer token
|
|
426
|
+
*/
|
|
427
|
+
async withdrawConcentratedBalance(request) {
|
|
428
|
+
return this.client.ammPost("/v1/concentrated/balance/withdraw", request);
|
|
429
|
+
}
|
|
335
430
|
}
|
|
336
431
|
/**
|
|
337
432
|
* Error checking utilities
|