@flaunch/sdk 0.9.13 → 0.9.15
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/addresses/index.cjs +2 -2
- package/dist/addresses/index.js +2 -2
- package/dist/index.cjs.js +16 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +16 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +3 -3
- package/dist/index.umd.js.map +1 -1
- package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/addresses/index.cjs
CHANGED
|
@@ -5392,8 +5392,8 @@ const TokenImporterAddress = {
|
|
|
5392
5392
|
[baseSepolia.id]: "0x7981369D21975F39773f289F759F7d7CE1097139",
|
|
5393
5393
|
};
|
|
5394
5394
|
const ClankerWorldVerifierAddress = {
|
|
5395
|
-
[base.id]: "
|
|
5396
|
-
[baseSepolia.id]: "
|
|
5395
|
+
[base.id]: "0xFe55dFf581b665479ABe9Fc0A0578FB222cB4Dda",
|
|
5396
|
+
[baseSepolia.id]: "0x2874F9A30348aCAaaD55D74B0BEc9C18f04b471a",
|
|
5397
5397
|
};
|
|
5398
5398
|
const DopplerVerifierAddress = {
|
|
5399
5399
|
[base.id]: "0xedd66b080b8e9425c39d349a3fb69f480580f993",
|
package/dist/addresses/index.js
CHANGED
|
@@ -5388,8 +5388,8 @@ const TokenImporterAddress = {
|
|
|
5388
5388
|
[baseSepolia.id]: "0x7981369D21975F39773f289F759F7d7CE1097139",
|
|
5389
5389
|
};
|
|
5390
5390
|
const ClankerWorldVerifierAddress = {
|
|
5391
|
-
[base.id]: "
|
|
5392
|
-
[baseSepolia.id]: "
|
|
5391
|
+
[base.id]: "0xFe55dFf581b665479ABe9Fc0A0578FB222cB4Dda",
|
|
5392
|
+
[baseSepolia.id]: "0x2874F9A30348aCAaaD55D74B0BEc9C18f04b471a",
|
|
5393
5393
|
};
|
|
5394
5394
|
const DopplerVerifierAddress = {
|
|
5395
5395
|
[base.id]: "0xedd66b080b8e9425c39d349a3fb69f480580f993",
|
package/dist/index.cjs.js
CHANGED
|
@@ -5770,8 +5770,8 @@ const TokenImporterAddress = {
|
|
|
5770
5770
|
[baseSepolia.id]: "0x7981369D21975F39773f289F759F7d7CE1097139",
|
|
5771
5771
|
};
|
|
5772
5772
|
const ClankerWorldVerifierAddress = {
|
|
5773
|
-
[base.id]: "
|
|
5774
|
-
[baseSepolia.id]: "
|
|
5773
|
+
[base.id]: "0xFe55dFf581b665479ABe9Fc0A0578FB222cB4Dda",
|
|
5774
|
+
[baseSepolia.id]: "0x2874F9A30348aCAaaD55D74B0BEc9C18f04b471a",
|
|
5775
5775
|
};
|
|
5776
5776
|
const DopplerVerifierAddress = {
|
|
5777
5777
|
[base.id]: "0xedd66b080b8e9425c39d349a3fb69f480580f993",
|
|
@@ -28801,7 +28801,8 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
28801
28801
|
const amount0 = poolKey.currency0 === coinAddress ? coinAmount : flethAmount;
|
|
28802
28802
|
const amount1 = poolKey.currency0 === coinAddress ? flethAmount : coinAmount;
|
|
28803
28803
|
// Calculate and constrain liquidity using shared method
|
|
28804
|
-
const
|
|
28804
|
+
const slippagePercent = params.slippagePercent;
|
|
28805
|
+
const { finalLiquidity, finalAmount0, finalAmount1 } = this.calculateConstrainedLiquidity(currentTick, tickLower, tickUpper, amount0, amount1, slippagePercent);
|
|
28805
28806
|
// 6. Add liquidity
|
|
28806
28807
|
calls.push(this.createLiquidityCall(poolKey, tickLower, tickUpper, finalLiquidity, finalAmount0, finalAmount1, userAddress));
|
|
28807
28808
|
return calls;
|
|
@@ -28858,8 +28859,9 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
28858
28859
|
currentTick = poolState.tick;
|
|
28859
28860
|
// If the current sqrtPriceX96 of the pool is zero, and the initial marketcap or price is provided,
|
|
28860
28861
|
// we can use this to determine the current tick.
|
|
28861
|
-
if (poolState.sqrtPriceX96 === 0n &&
|
|
28862
|
-
("
|
|
28862
|
+
if (poolState.sqrtPriceX96 === 0n &&
|
|
28863
|
+
(("initialMarketCapUSD" in params && params.initialMarketCapUSD) ||
|
|
28864
|
+
("initialPriceUSD" in params && params.initialPriceUSD))) {
|
|
28863
28865
|
let { decimals: coinDecimals, formattedTotalSupplyInDecimals } = await this.getCoinInfo(coinAddress);
|
|
28864
28866
|
// If we have a tokenSupply set, then overwrite the value
|
|
28865
28867
|
if ("tokenSupply" in params && params.tokenSupply !== undefined) {
|
|
@@ -28991,7 +28993,8 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
28991
28993
|
const amount0 = poolKey.currency0 === coinAddress ? coinAmount : flethAmount;
|
|
28992
28994
|
const amount1 = poolKey.currency0 === coinAddress ? flethAmount : coinAmount;
|
|
28993
28995
|
// Calculate and constrain liquidity using shared method
|
|
28994
|
-
const
|
|
28996
|
+
const slippagePercent = params.slippagePercent;
|
|
28997
|
+
const { finalLiquidity, finalAmount0, finalAmount1 } = this.calculateConstrainedLiquidity(currentTick, tickLower, tickUpper, amount0, amount1, slippagePercent);
|
|
28995
28998
|
// 3. Add liquidity
|
|
28996
28999
|
calls.push(this.createLiquidityCall(poolKey, tickLower, tickUpper, finalLiquidity, finalAmount0, finalAmount1, userAddress));
|
|
28997
29000
|
return calls;
|
|
@@ -29072,7 +29075,8 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
29072
29075
|
* @param amount1 - Amount of currency1
|
|
29073
29076
|
* @returns Final liquidity and amounts
|
|
29074
29077
|
*/
|
|
29075
|
-
calculateConstrainedLiquidity(currentTick, tickLower, tickUpper, amount0, amount1
|
|
29078
|
+
calculateConstrainedLiquidity(currentTick, tickLower, tickUpper, amount0, amount1, slippagePercent = 0.05 // Default to 0.05%
|
|
29079
|
+
) {
|
|
29076
29080
|
// Calculate liquidity first using user's input amounts
|
|
29077
29081
|
const initialLiquidity = getLiquidityFromAmounts({
|
|
29078
29082
|
currentTick,
|
|
@@ -29126,8 +29130,11 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
|
|
|
29126
29130
|
finalAmount1 = constrainedAmounts.amount1;
|
|
29127
29131
|
}
|
|
29128
29132
|
// IMPORTANT: Add conservative buffer to account for contract rounding differences
|
|
29129
|
-
// Reduce liquidity by
|
|
29130
|
-
|
|
29133
|
+
// Reduce liquidity by slippagePercent to ensure contract calculations stay within user bounds
|
|
29134
|
+
// slippagePercent is passed as decimal percentage (e.g., 0.05 for 0.05%), convert to decimal
|
|
29135
|
+
const slippageAsDecimal = slippagePercent / 100;
|
|
29136
|
+
const slippageMultiplier = BigInt(Math.floor(1 / slippageAsDecimal));
|
|
29137
|
+
const liquidityBuffer = finalLiquidity / slippageMultiplier;
|
|
29131
29138
|
const conservativeLiquidity = finalLiquidity - (liquidityBuffer > 1n ? liquidityBuffer : 1n);
|
|
29132
29139
|
// Use conservative liquidity but keep user's original amounts as maximums
|
|
29133
29140
|
// The conservative liquidity ensures the contract won't need more than user provided
|