@flaunch/sdk 0.8.3-beta.6 → 0.8.3-beta.7

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.esm.js CHANGED
@@ -5316,7 +5316,7 @@ const FlaunchPositionManagerV1_1Address = {
5316
5316
  [baseSepolia.id]: "0x24347e0dd16357059abfc1b321df354873552fdc",
5317
5317
  };
5318
5318
  const FlaunchPositionManagerV1_2Address = {
5319
- [base.id]: zeroAddress, // TODO: add mainnet address
5319
+ [base.id]: "0x23321f11a6d44fd1ab790044fdfde5758c902fdc", // "1.3" from github releases
5320
5320
  [baseSepolia.id]: "0x4e7cb1e6800a7b297b38bddcecaf9ca5b6616fdc",
5321
5321
  };
5322
5322
  const AnyPositionManagerAddress = {
@@ -5381,7 +5381,7 @@ const FairLaunchAddress = {
5381
5381
  };
5382
5382
  // also supports AnyPositionManager & PositionManagerV1_2 (sepolia)
5383
5383
  const FairLaunchV1_1Address = {
5384
- [base.id]: "0x4dc442403e8c758425b93c59dc737da522f32640",
5384
+ [base.id]: "0x4dc442403e8c758425b93C59Dc737da522f32640",
5385
5385
  [baseSepolia.id]: "0x7922c1ead7c5825fb52ed6b14f397d064508acbe",
5386
5386
  };
5387
5387
  const FlaunchAddress = {
@@ -5394,7 +5394,7 @@ const FlaunchV1_1Address = {
5394
5394
  [baseSepolia.id]: "0x96be8ff5e244294a34bfa507a39190dc7a839baa",
5395
5395
  };
5396
5396
  const FlaunchV1_2Address = {
5397
- [base.id]: zeroAddress, // TODO: add mainnet address
5397
+ [base.id]: "0x516af52d0c629b5e378da4dc64ecb0744ce10109", // "1.3" from github releases
5398
5398
  [baseSepolia.id]: "0xe2ef58a54ee79dac0D4A130ea58b340124DF9438",
5399
5399
  };
5400
5400
  const AnyFlaunchAddress = {
@@ -5414,12 +5414,13 @@ const AnyBidWallAddress = {
5414
5414
  [base.id]: "0x2154c604df568A5285284D1c4918DC98C39240df",
5415
5415
  [baseSepolia.id]: "0xcfF222eA42E43F46A98755db237E4c9C2CA9B772",
5416
5416
  };
5417
+ // @deprecated: FlaunchZap used instead
5417
5418
  const FastFlaunchZapAddress = {
5418
5419
  [base.id]: "0x68d967d25806fef4aa134db031cdcc55d3e20f92",
5419
5420
  [baseSepolia.id]: "0x821d9f6075e7971cc71c379081de9d532f5f9957",
5420
5421
  };
5421
5422
  const FlaunchZapAddress = {
5422
- [base.id]: "0x2bC8cbfE237AEddc7C296436fefe239A0A22dAbF",
5423
+ [base.id]: "0xf9753e6e4fdd1869be40685690a28bff26b8b114",
5423
5424
  [baseSepolia.id]: "0x808DA25e8ecbCC2C0339B6A436AAEAe2021C235d",
5424
5425
  };
5425
5426
  const TreasuryManagerFactoryAddress = {
@@ -25556,7 +25557,25 @@ class ReadFlaunchSDK {
25556
25557
  };
25557
25558
  }
25558
25559
  }
25559
- async calculateAddLiquidityAmounts({ coinAddress, liquidityMode, coinOrEthInputAmount, inputToken, minMarketCap, maxMarketCap, currentMarketCap, }) {
25560
+ async calculateAddLiquidityAmounts(params) {
25561
+ const { coinAddress, liquidityMode, inputToken, coinOrEthInputAmount } = params;
25562
+ let minMarketCap;
25563
+ let maxMarketCap;
25564
+ let currentMarketCap;
25565
+ if ("minMarketCap" in params) {
25566
+ minMarketCap = params.minMarketCap;
25567
+ maxMarketCap = params.maxMarketCap;
25568
+ currentMarketCap = params.currentMarketCap;
25569
+ }
25570
+ else {
25571
+ const { totalSupply, decimals } = await this.getCoinInfo(coinAddress);
25572
+ const formattedTotalSupply = parseFloat(formatUnits$1(totalSupply, decimals));
25573
+ minMarketCap = (parseFloat(params.minPriceUSD) * formattedTotalSupply).toString();
25574
+ maxMarketCap = (parseFloat(params.maxPriceUSD) * formattedTotalSupply).toString();
25575
+ if (params.currentPriceUSD) {
25576
+ currentMarketCap = (params.currentPriceUSD * formattedTotalSupply).toString();
25577
+ }
25578
+ }
25560
25579
  let { tickLower, tickUpper, currentTick } = await this.calculateAddLiquidityTicks({
25561
25580
  coinAddress,
25562
25581
  liquidityMode,
@@ -25564,15 +25583,25 @@ class ReadFlaunchSDK {
25564
25583
  maxMarketCap,
25565
25584
  currentMarketCap,
25566
25585
  });
25586
+ // get the current pool state for the coin
25567
25587
  if (!currentTick) {
25568
- // get the current pool state for AnyPositionManager pool for the coin
25588
+ let version = params.version;
25589
+ // if version is not provided, check on existing managers, else default to ANY
25590
+ if (!version) {
25591
+ try {
25592
+ version = await this.getCoinVersion(coinAddress);
25593
+ }
25594
+ catch {
25595
+ version = FlaunchVersion.ANY;
25596
+ }
25597
+ }
25569
25598
  const poolState = await this.readStateView.poolSlot0({
25570
25599
  poolId: getPoolId(orderPoolKey({
25571
25600
  currency0: coinAddress,
25572
25601
  currency1: FLETHAddress[this.chainId],
25573
25602
  fee: 0,
25574
25603
  tickSpacing: TICK_SPACING,
25575
- hooks: AnyPositionManagerAddress[this.chainId],
25604
+ hooks: this.getPositionManagerAddress(version),
25576
25605
  })),
25577
25606
  });
25578
25607
  currentTick = poolState.tick;
@@ -26078,12 +26107,21 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26078
26107
  let tickLower;
26079
26108
  let tickUpper;
26080
26109
  let currentTick;
26110
+ let version = params.version;
26111
+ if (!version) {
26112
+ try {
26113
+ version = await this.getCoinVersion(coinAddress);
26114
+ }
26115
+ catch {
26116
+ version = FlaunchVersion.ANY;
26117
+ }
26118
+ }
26081
26119
  const poolKey = orderPoolKey({
26082
26120
  currency0: coinAddress,
26083
26121
  currency1: flethAddress,
26084
26122
  fee: 0,
26085
26123
  tickSpacing: this.TICK_SPACING,
26086
- hooks: AnyPositionManagerAddress[this.chainId],
26124
+ hooks: this.getPositionManagerAddress(version),
26087
26125
  });
26088
26126
  // Check if we need to calculate values or use direct values
26089
26127
  if ("tickLower" in params) {
@@ -26129,6 +26167,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26129
26167
  minMarketCap,
26130
26168
  maxMarketCap,
26131
26169
  currentMarketCap: initialMarketCapUSD?.toString(),
26170
+ version,
26132
26171
  });
26133
26172
  coinAmount = calculated.coinAmount;
26134
26173
  flethAmount = calculated.ethAmount;
@@ -26442,7 +26481,10 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26442
26481
  initialMarketCapUSD: params.initialMarketCapUSD,
26443
26482
  verifier: params.verifier,
26444
26483
  });
26445
- const addLiquidityCalls = await this.getAddLiquidityCalls(params);
26484
+ const addLiquidityCalls = await this.getAddLiquidityCalls({
26485
+ ...params,
26486
+ version: FlaunchVersion.ANY, // optimize to avoid fetching if not passed
26487
+ });
26446
26488
  return [
26447
26489
  {
26448
26490
  to: this.readWriteTokenImporter.contract.address,