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

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 (41) hide show
  1. package/dist/abi/{FlaunchPositionManagerV1_1_1.d.ts → FlaunchPositionManagerV1_2.d.ts} +2 -2
  2. package/dist/abi/{FlaunchPositionManagerV1_1_1.d.ts.map → FlaunchPositionManagerV1_2.d.ts.map} +1 -1
  3. package/dist/abi/{FlaunchV1_1_1.d.ts → FlaunchV1_2.d.ts} +2 -2
  4. package/dist/abi/{FlaunchV1_1_1.d.ts.map → FlaunchV1_2.d.ts.map} +1 -1
  5. package/dist/abi/FlaunchZap.d.ts +159 -151
  6. package/dist/abi/FlaunchZap.d.ts.map +1 -1
  7. package/dist/abi/index.cjs +117 -219
  8. package/dist/abi/index.cjs.map +1 -1
  9. package/dist/abi/index.js +117 -219
  10. package/dist/abi/index.js.map +1 -1
  11. package/dist/addresses/index.cjs +8 -8
  12. package/dist/addresses/index.cjs.map +1 -1
  13. package/dist/addresses/index.js +7 -7
  14. package/dist/addresses/index.js.map +1 -1
  15. package/dist/addresses.d.ts +2 -2
  16. package/dist/addresses.d.ts.map +1 -1
  17. package/dist/clients/{FlaunchPositionManagerV1_1_1Client.d.ts → FlaunchPositionManagerV1_2Client.d.ts} +9 -9
  18. package/dist/clients/FlaunchPositionManagerV1_2Client.d.ts.map +1 -0
  19. package/dist/clients/{FlaunchV1_1_1Client.d.ts → FlaunchV1_2Client.d.ts} +5 -5
  20. package/dist/clients/FlaunchV1_2Client.d.ts.map +1 -0
  21. package/dist/clients/FlaunchZapClient.d.ts +9 -0
  22. package/dist/clients/FlaunchZapClient.d.ts.map +1 -1
  23. package/dist/clients/TokenImporter.d.ts +23 -2
  24. package/dist/clients/TokenImporter.d.ts.map +1 -1
  25. package/dist/helpers/index.cjs +1 -1
  26. package/dist/helpers/index.cjs.map +1 -1
  27. package/dist/helpers/index.js +1 -1
  28. package/dist/helpers/index.js.map +1 -1
  29. package/dist/index.cjs.js +379 -395
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.esm.js +378 -394
  32. package/dist/index.esm.js.map +1 -1
  33. package/dist/index.umd.js +1 -1
  34. package/dist/index.umd.js.map +1 -1
  35. package/dist/sdk/FlaunchSDK.d.ts +64 -27
  36. package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
  37. package/dist/types.d.ts +36 -1
  38. package/dist/types.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/clients/FlaunchPositionManagerV1_1_1Client.d.ts.map +0 -1
  41. package/dist/clients/FlaunchV1_1_1Client.d.ts.map +0 -1
package/dist/index.esm.js CHANGED
@@ -5315,7 +5315,7 @@ const FlaunchPositionManagerV1_1Address = {
5315
5315
  [base.id]: "0xf785bb58059fab6fb19bdda2cb9078d9e546efdc",
5316
5316
  [baseSepolia.id]: "0x24347e0dd16357059abfc1b321df354873552fdc",
5317
5317
  };
5318
- const FlaunchPositionManagerV1_1_1Address = {
5318
+ const FlaunchPositionManagerV1_2Address = {
5319
5319
  [base.id]: zeroAddress, // TODO: add mainnet address
5320
5320
  [baseSepolia.id]: "0x4e7cb1e6800a7b297b38bddcecaf9ca5b6616fdc",
5321
5321
  };
@@ -5379,7 +5379,7 @@ const FairLaunchAddress = {
5379
5379
  [base.id]: "0xCc7A4A00072ccbeEEbd999edc812C0ce498Fb63B",
5380
5380
  [baseSepolia.id]: "0x227Fc288aC56E169f2BfEA82e07F8635054d4136",
5381
5381
  };
5382
- // also supports AnyPositionManager & PositionManagerV1_1_1 (sepolia)
5382
+ // also supports AnyPositionManager & PositionManagerV1_2 (sepolia)
5383
5383
  const FairLaunchV1_1Address = {
5384
5384
  [base.id]: "0x4dc442403e8c758425b93c59dc737da522f32640",
5385
5385
  [baseSepolia.id]: "0x7922c1ead7c5825fb52ed6b14f397d064508acbe",
@@ -5393,7 +5393,7 @@ const FlaunchV1_1Address = {
5393
5393
  [base.id]: "0xb4512bf57d50fbcb64a3adf8b17a79b2a204c18c",
5394
5394
  [baseSepolia.id]: "0x96be8ff5e244294a34bfa507a39190dc7a839baa",
5395
5395
  };
5396
- const FlaunchV1_1_1Address = {
5396
+ const FlaunchV1_2Address = {
5397
5397
  [base.id]: zeroAddress, // TODO: add mainnet address
5398
5398
  [baseSepolia.id]: "0xe2ef58a54ee79dac0D4A130ea58b340124DF9438",
5399
5399
  };
@@ -5405,7 +5405,7 @@ const BidWallAddress = {
5405
5405
  [base.id]: "0x66681f10BA90496241A25e33380004f30Dfd8aa8",
5406
5406
  [baseSepolia.id]: "0xa2107050ACEf4809c88Ab744F8e667605db5ACDB",
5407
5407
  };
5408
- // also supports AnyPositionManager & PositionManagerV1_1_1 (sepolia)
5408
+ // also supports AnyPositionManager & PositionManagerV1_2 (sepolia)
5409
5409
  const BidWallV1_1Address = {
5410
5410
  [base.id]: "0x7f22353d1634223a802D1c1Ea5308Ddf5DD0ef9c",
5411
5411
  [baseSepolia.id]: "0x6f2fa01a05ff8b6efbfefd91a3b85aaf19265a00",
@@ -5419,8 +5419,8 @@ const FastFlaunchZapAddress = {
5419
5419
  [baseSepolia.id]: "0x821d9f6075e7971cc71c379081de9d532f5f9957",
5420
5420
  };
5421
5421
  const FlaunchZapAddress = {
5422
- [base.id]: "0xfa9e8528ee95eb109bffd1a2d59cb95b300a672a", // TODO: update mainnet address with permissions param
5423
- [baseSepolia.id]: "0x2871a184410F03F4e2C7C5257d839FB34169496A",
5422
+ [base.id]: "0x2bC8cbfE237AEddc7C296436fefe239A0A22dAbF",
5423
+ [baseSepolia.id]: "0x808DA25e8ecbCC2C0339B6A436AAEAe2021C235d",
5424
5424
  };
5425
5425
  const TreasuryManagerFactoryAddress = {
5426
5426
  [base.id]: "0x48af8b28DDC5e5A86c4906212fc35Fa808CA8763",
@@ -10828,358 +10828,256 @@ class AnyBidWall {
10828
10828
 
10829
10829
  const FlaunchZapAbi = [
10830
10830
  {
10831
- type: "constructor",
10832
10831
  inputs: [
10833
10832
  {
10833
+ internalType: "contract PositionManager",
10834
10834
  name: "_positionManager",
10835
10835
  type: "address",
10836
- internalType: "contract PositionManager",
10837
10836
  },
10838
10837
  {
10839
- name: "_flaunchContract",
10840
- type: "address",
10841
10838
  internalType: "contract Flaunch",
10842
- },
10843
- {
10844
- name: "_flETH",
10845
- type: "address",
10846
- internalType: "contract IFLETH",
10847
- },
10848
- {
10849
- name: "_poolSwap",
10839
+ name: "_flaunchContract",
10850
10840
  type: "address",
10851
- internalType: "contract PoolSwap",
10852
10841
  },
10842
+ { internalType: "contract IFLETH", name: "_flETH", type: "address" },
10843
+ { internalType: "contract PoolSwap", name: "_poolSwap", type: "address" },
10853
10844
  {
10845
+ internalType: "contract ITreasuryManagerFactory",
10854
10846
  name: "_treasuryManagerFactory",
10855
10847
  type: "address",
10856
- internalType: "contract ITreasuryManagerFactory",
10857
10848
  },
10858
10849
  {
10850
+ internalType: "contract IMerkleAirdrop",
10859
10851
  name: "_merkleAirdrop",
10860
10852
  type: "address",
10861
- internalType: "contract IMerkleAirdrop",
10862
10853
  },
10863
10854
  {
10855
+ internalType: "contract WhitelistFairLaunch",
10864
10856
  name: "_whitelistFairLaunch",
10865
10857
  type: "address",
10866
- internalType: "contract WhitelistFairLaunch",
10867
10858
  },
10868
10859
  ],
10869
10860
  stateMutability: "nonpayable",
10861
+ type: "constructor",
10870
10862
  },
10871
- { type: "receive", stateMutability: "payable" },
10863
+ { inputs: [], name: "CreatorCannotBeZero", type: "error" },
10864
+ { inputs: [], name: "InsufficientMemecoinsForAirdrop", type: "error" },
10872
10865
  {
10873
- type: "function",
10874
- name: "calculateFee",
10875
10866
  inputs: [
10876
- {
10877
- name: "_premineAmount",
10878
- type: "uint256",
10879
- internalType: "uint256",
10880
- },
10881
- { name: "_slippage", type: "uint256", internalType: "uint256" },
10882
- {
10883
- name: "_initialPriceParams",
10884
- type: "bytes",
10885
- internalType: "bytes",
10886
- },
10867
+ { internalType: "uint256", name: "_premineAmount", type: "uint256" },
10868
+ { internalType: "uint256", name: "_slippage", type: "uint256" },
10869
+ { internalType: "bytes", name: "_initialPriceParams", type: "bytes" },
10887
10870
  ],
10871
+ name: "calculateFee",
10888
10872
  outputs: [
10889
- { name: "ethRequired_", type: "uint256", internalType: "uint256" },
10873
+ { internalType: "uint256", name: "ethRequired_", type: "uint256" },
10890
10874
  ],
10891
10875
  stateMutability: "view",
10876
+ type: "function",
10892
10877
  },
10893
10878
  {
10894
- type: "function",
10895
- name: "deployAndInitializeManager",
10896
10879
  inputs: [
10897
10880
  {
10881
+ internalType: "address",
10898
10882
  name: "_managerImplementation",
10899
10883
  type: "address",
10900
- internalType: "address",
10901
10884
  },
10902
- { name: "_owner", type: "address", internalType: "address" },
10903
- { name: "_data", type: "bytes", internalType: "bytes" },
10904
- { name: "_permissions", type: "address", internalType: "address" },
10885
+ { internalType: "address", name: "_owner", type: "address" },
10886
+ { internalType: "bytes", name: "_data", type: "bytes" },
10887
+ { internalType: "address", name: "_permissions", type: "address" },
10905
10888
  ],
10889
+ name: "deployAndInitializeManager",
10906
10890
  outputs: [
10907
- {
10908
- name: "manager_",
10909
- type: "address",
10910
- internalType: "address payable",
10911
- },
10891
+ { internalType: "address payable", name: "manager_", type: "address" },
10912
10892
  ],
10913
10893
  stateMutability: "nonpayable",
10894
+ type: "function",
10914
10895
  },
10915
10896
  {
10916
- type: "function",
10917
- name: "flETH",
10918
10897
  inputs: [],
10919
- outputs: [{ name: "", type: "address", internalType: "contract IFLETH" }],
10898
+ name: "flETH",
10899
+ outputs: [{ internalType: "contract IFLETH", name: "", type: "address" }],
10920
10900
  stateMutability: "view",
10901
+ type: "function",
10921
10902
  },
10922
10903
  {
10923
- type: "function",
10924
- name: "flaunch",
10925
10904
  inputs: [
10926
10905
  {
10927
- name: "_flaunchParams",
10928
- type: "tuple",
10929
- internalType: "struct PositionManager.FlaunchParams",
10930
10906
  components: [
10931
- { name: "name", type: "string", internalType: "string" },
10932
- { name: "symbol", type: "string", internalType: "string" },
10933
- { name: "tokenUri", type: "string", internalType: "string" },
10907
+ { internalType: "string", name: "name", type: "string" },
10908
+ { internalType: "string", name: "symbol", type: "string" },
10909
+ { internalType: "string", name: "tokenUri", type: "string" },
10934
10910
  {
10911
+ internalType: "uint256",
10935
10912
  name: "initialTokenFairLaunch",
10936
10913
  type: "uint256",
10937
- internalType: "uint256",
10938
10914
  },
10939
10915
  {
10940
- name: "fairLaunchDuration",
10941
- type: "uint256",
10942
10916
  internalType: "uint256",
10943
- },
10944
- {
10945
- name: "premineAmount",
10917
+ name: "fairLaunchDuration",
10946
10918
  type: "uint256",
10947
- internalType: "uint256",
10948
10919
  },
10949
- { name: "creator", type: "address", internalType: "address" },
10920
+ { internalType: "uint256", name: "premineAmount", type: "uint256" },
10921
+ { internalType: "address", name: "creator", type: "address" },
10950
10922
  {
10923
+ internalType: "uint24",
10951
10924
  name: "creatorFeeAllocation",
10952
10925
  type: "uint24",
10953
- internalType: "uint24",
10954
- },
10955
- {
10956
- name: "flaunchAt",
10957
- type: "uint256",
10958
- internalType: "uint256",
10959
- },
10960
- {
10961
- name: "initialPriceParams",
10962
- type: "bytes",
10963
- internalType: "bytes",
10964
- },
10965
- {
10966
- name: "feeCalculatorParams",
10967
- type: "bytes",
10968
- internalType: "bytes",
10969
10926
  },
10927
+ { internalType: "uint256", name: "flaunchAt", type: "uint256" },
10928
+ { internalType: "bytes", name: "initialPriceParams", type: "bytes" },
10929
+ { internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
10930
+ ],
10931
+ internalType: "struct PositionManager.FlaunchParams",
10932
+ name: "_flaunchParams",
10933
+ type: "tuple",
10934
+ },
10935
+ { internalType: "bytes", name: "_premineSwapHookData", type: "bytes" },
10936
+ {
10937
+ components: [
10938
+ { internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
10939
+ { internalType: "string", name: "merkleIPFSHash", type: "string" },
10940
+ { internalType: "uint256", name: "maxTokens", type: "uint256" },
10941
+ ],
10942
+ internalType: "struct FlaunchZap.WhitelistParams",
10943
+ name: "_whitelistParams",
10944
+ type: "tuple",
10945
+ },
10946
+ {
10947
+ components: [
10948
+ { internalType: "uint256", name: "airdropIndex", type: "uint256" },
10949
+ { internalType: "uint256", name: "airdropAmount", type: "uint256" },
10950
+ { internalType: "uint256", name: "airdropEndTime", type: "uint256" },
10951
+ { internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
10952
+ { internalType: "string", name: "merkleIPFSHash", type: "string" },
10970
10953
  ],
10954
+ internalType: "struct FlaunchZap.AirdropParams",
10955
+ name: "_airdropParams",
10956
+ type: "tuple",
10957
+ },
10958
+ {
10959
+ components: [
10960
+ { internalType: "address", name: "manager", type: "address" },
10961
+ { internalType: "address", name: "permissions", type: "address" },
10962
+ { internalType: "bytes", name: "initializeData", type: "bytes" },
10963
+ { internalType: "bytes", name: "depositData", type: "bytes" },
10964
+ ],
10965
+ internalType: "struct FlaunchZap.TreasuryManagerParams",
10966
+ name: "_treasuryManagerParams",
10967
+ type: "tuple",
10971
10968
  },
10972
10969
  ],
10970
+ name: "flaunch",
10973
10971
  outputs: [
10974
- { name: "memecoin_", type: "address", internalType: "address" },
10975
- { name: "ethSpent_", type: "uint256", internalType: "uint256" },
10976
- { name: "", type: "address", internalType: "address" },
10972
+ { internalType: "address", name: "memecoin_", type: "address" },
10973
+ { internalType: "uint256", name: "ethSpent_", type: "uint256" },
10974
+ { internalType: "address", name: "deployedManager_", type: "address" },
10977
10975
  ],
10978
10976
  stateMutability: "payable",
10977
+ type: "function",
10979
10978
  },
10980
10979
  {
10981
- type: "function",
10982
- name: "flaunch",
10983
10980
  inputs: [
10984
10981
  {
10985
- name: "_flaunchParams",
10986
- type: "tuple",
10987
- internalType: "struct PositionManager.FlaunchParams",
10988
10982
  components: [
10989
- { name: "name", type: "string", internalType: "string" },
10990
- { name: "symbol", type: "string", internalType: "string" },
10991
- { name: "tokenUri", type: "string", internalType: "string" },
10983
+ { internalType: "string", name: "name", type: "string" },
10984
+ { internalType: "string", name: "symbol", type: "string" },
10985
+ { internalType: "string", name: "tokenUri", type: "string" },
10992
10986
  {
10987
+ internalType: "uint256",
10993
10988
  name: "initialTokenFairLaunch",
10994
10989
  type: "uint256",
10995
- internalType: "uint256",
10996
10990
  },
10997
10991
  {
10998
- name: "fairLaunchDuration",
10999
- type: "uint256",
11000
10992
  internalType: "uint256",
11001
- },
11002
- {
11003
- name: "premineAmount",
10993
+ name: "fairLaunchDuration",
11004
10994
  type: "uint256",
11005
- internalType: "uint256",
11006
10995
  },
11007
- { name: "creator", type: "address", internalType: "address" },
10996
+ { internalType: "uint256", name: "premineAmount", type: "uint256" },
10997
+ { internalType: "address", name: "creator", type: "address" },
11008
10998
  {
10999
+ internalType: "uint24",
11009
11000
  name: "creatorFeeAllocation",
11010
11001
  type: "uint24",
11011
- internalType: "uint24",
11012
- },
11013
- {
11014
- name: "flaunchAt",
11015
- type: "uint256",
11016
- internalType: "uint256",
11017
- },
11018
- {
11019
- name: "initialPriceParams",
11020
- type: "bytes",
11021
- internalType: "bytes",
11022
- },
11023
- {
11024
- name: "feeCalculatorParams",
11025
- type: "bytes",
11026
- internalType: "bytes",
11027
- },
11028
- ],
11029
- },
11030
- {
11031
- name: "_whitelistParams",
11032
- type: "tuple",
11033
- internalType: "struct FlaunchZap.WhitelistParams",
11034
- components: [
11035
- {
11036
- name: "merkleRoot",
11037
- type: "bytes32",
11038
- internalType: "bytes32",
11039
- },
11040
- {
11041
- name: "merkleIPFSHash",
11042
- type: "string",
11043
- internalType: "string",
11044
- },
11045
- {
11046
- name: "maxTokens",
11047
- type: "uint256",
11048
- internalType: "uint256",
11049
- },
11050
- ],
11051
- },
11052
- {
11053
- name: "_airdropParams",
11054
- type: "tuple",
11055
- internalType: "struct FlaunchZap.AirdropParams",
11056
- components: [
11057
- {
11058
- name: "airdropIndex",
11059
- type: "uint256",
11060
- internalType: "uint256",
11061
- },
11062
- {
11063
- name: "airdropAmount",
11064
- type: "uint256",
11065
- internalType: "uint256",
11066
- },
11067
- {
11068
- name: "airdropEndTime",
11069
- type: "uint256",
11070
- internalType: "uint256",
11071
- },
11072
- {
11073
- name: "merkleRoot",
11074
- type: "bytes32",
11075
- internalType: "bytes32",
11076
- },
11077
- {
11078
- name: "merkleIPFSHash",
11079
- type: "string",
11080
- internalType: "string",
11081
11002
  },
11003
+ { internalType: "uint256", name: "flaunchAt", type: "uint256" },
11004
+ { internalType: "bytes", name: "initialPriceParams", type: "bytes" },
11005
+ { internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
11082
11006
  ],
11083
- },
11084
- {
11085
- name: "_treasuryManagerParams",
11007
+ internalType: "struct PositionManager.FlaunchParams",
11008
+ name: "_flaunchParams",
11086
11009
  type: "tuple",
11087
- internalType: "struct FlaunchZap.TreasuryManagerParams",
11088
- components: [
11089
- { name: "manager", type: "address", internalType: "address" },
11090
- {
11091
- name: "permissions",
11092
- type: "address",
11093
- internalType: "address",
11094
- },
11095
- {
11096
- name: "initializeData",
11097
- type: "bytes",
11098
- internalType: "bytes",
11099
- },
11100
- { name: "depositData", type: "bytes", internalType: "bytes" },
11101
- ],
11102
11010
  },
11011
+ { internalType: "bytes", name: "_premineSwapHookData", type: "bytes" },
11103
11012
  ],
11013
+ name: "flaunch",
11104
11014
  outputs: [
11105
- { name: "memecoin_", type: "address", internalType: "address" },
11106
- { name: "ethSpent_", type: "uint256", internalType: "uint256" },
11107
- {
11108
- name: "deployedManager_",
11109
- type: "address",
11110
- internalType: "address",
11111
- },
11015
+ { internalType: "address", name: "memecoin_", type: "address" },
11016
+ { internalType: "uint256", name: "ethSpent_", type: "uint256" },
11017
+ { internalType: "address", name: "", type: "address" },
11112
11018
  ],
11113
11019
  stateMutability: "payable",
11020
+ type: "function",
11114
11021
  },
11115
11022
  {
11116
- type: "function",
11117
- name: "flaunchContract",
11118
11023
  inputs: [],
11119
- outputs: [{ name: "", type: "address", internalType: "contract Flaunch" }],
11024
+ name: "flaunchContract",
11025
+ outputs: [{ internalType: "contract Flaunch", name: "", type: "address" }],
11120
11026
  stateMutability: "view",
11027
+ type: "function",
11121
11028
  },
11122
11029
  {
11123
- type: "function",
11124
- name: "merkleAirdrop",
11125
11030
  inputs: [],
11031
+ name: "merkleAirdrop",
11126
11032
  outputs: [
11127
- {
11128
- name: "",
11129
- type: "address",
11130
- internalType: "contract IMerkleAirdrop",
11131
- },
11033
+ { internalType: "contract IMerkleAirdrop", name: "", type: "address" },
11132
11034
  ],
11133
11035
  stateMutability: "view",
11036
+ type: "function",
11134
11037
  },
11135
11038
  {
11136
- type: "function",
11137
- name: "poolSwap",
11138
11039
  inputs: [],
11139
- outputs: [{ name: "", type: "address", internalType: "contract PoolSwap" }],
11040
+ name: "poolSwap",
11041
+ outputs: [{ internalType: "contract PoolSwap", name: "", type: "address" }],
11140
11042
  stateMutability: "view",
11043
+ type: "function",
11141
11044
  },
11142
11045
  {
11143
- type: "function",
11144
- name: "positionManager",
11145
11046
  inputs: [],
11047
+ name: "positionManager",
11146
11048
  outputs: [
11147
- {
11148
- name: "",
11149
- type: "address",
11150
- internalType: "contract PositionManager",
11151
- },
11049
+ { internalType: "contract PositionManager", name: "", type: "address" },
11152
11050
  ],
11153
11051
  stateMutability: "view",
11052
+ type: "function",
11154
11053
  },
11155
11054
  {
11156
- type: "function",
11157
- name: "treasuryManagerFactory",
11158
11055
  inputs: [],
11056
+ name: "treasuryManagerFactory",
11159
11057
  outputs: [
11160
11058
  {
11059
+ internalType: "contract ITreasuryManagerFactory",
11161
11060
  name: "",
11162
11061
  type: "address",
11163
- internalType: "contract ITreasuryManagerFactory",
11164
11062
  },
11165
11063
  ],
11166
11064
  stateMutability: "view",
11065
+ type: "function",
11167
11066
  },
11168
11067
  {
11169
- type: "function",
11170
- name: "whitelistFairLaunch",
11171
11068
  inputs: [],
11069
+ name: "whitelistFairLaunch",
11172
11070
  outputs: [
11173
11071
  {
11072
+ internalType: "contract WhitelistFairLaunch",
11174
11073
  name: "",
11175
11074
  type: "address",
11176
- internalType: "contract WhitelistFairLaunch",
11177
11075
  },
11178
11076
  ],
11179
11077
  stateMutability: "view",
11078
+ type: "function",
11180
11079
  },
11181
- { type: "error", name: "CreatorCannotBeZero", inputs: [] },
11182
- { type: "error", name: "InsufficientMemecoinsForAirdrop", inputs: [] },
11080
+ { stateMutability: "payable", type: "receive" },
11183
11081
  ];
11184
11082
 
11185
11083
  /**
@@ -11189,7 +11087,7 @@ var FlaunchVersion;
11189
11087
  (function (FlaunchVersion) {
11190
11088
  FlaunchVersion["V1"] = "V1";
11191
11089
  FlaunchVersion["V1_1"] = "V1_1";
11192
- FlaunchVersion["V1_1_1"] = "V1_1_1";
11090
+ FlaunchVersion["V1_2"] = "V1_2";
11193
11091
  FlaunchVersion["ANY"] = "ANY";
11194
11092
  })(FlaunchVersion || (FlaunchVersion = {}));
11195
11093
  /**
@@ -13169,6 +13067,36 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13169
13067
  initializeData: "0x",
13170
13068
  depositData: "0x",
13171
13069
  };
13070
+ const feeCalculatorParams = params.trustedSignerSettings
13071
+ ? encodeAbiParameters([
13072
+ { type: "bool", name: "enabled" },
13073
+ { type: "uint256", name: "walletCap" },
13074
+ { type: "uint256", name: "txCap" },
13075
+ ], [
13076
+ params.trustedSignerSettings.enabled,
13077
+ params.trustedSignerSettings.walletCap ?? 0n,
13078
+ params.trustedSignerSettings.txCap ?? 0n,
13079
+ ])
13080
+ : "0x";
13081
+ const _premineSwapHookData = params.trustedSignerSettings?.enabled
13082
+ ? encodeAbiParameters([
13083
+ { type: "address", name: "referrer" },
13084
+ {
13085
+ type: "tuple",
13086
+ components: [
13087
+ { type: "uint256", name: "deadline" },
13088
+ { type: "bytes", name: "signature" },
13089
+ ],
13090
+ },
13091
+ ], [
13092
+ zeroAddress,
13093
+ {
13094
+ deadline: BigInt(params.trustedSignerSettings.premineSignedMessage?.deadline ?? 0),
13095
+ signature: params.trustedSignerSettings.premineSignedMessage?.signature ??
13096
+ "0x",
13097
+ },
13098
+ ])
13099
+ : "0x";
13172
13100
  return this.contract.write("flaunch", {
13173
13101
  _flaunchParams: {
13174
13102
  name: params.name,
@@ -13181,8 +13109,9 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13181
13109
  creatorFeeAllocation: creatorFeeAllocationInBps,
13182
13110
  flaunchAt: params.flaunchAt ?? 0n,
13183
13111
  initialPriceParams,
13184
- feeCalculatorParams: "0x",
13112
+ feeCalculatorParams,
13185
13113
  },
13114
+ _premineSwapHookData,
13186
13115
  _treasuryManagerParams: {
13187
13116
  ..._treasuryManagerParams,
13188
13117
  permissions: getPermissionsAddress(_treasuryManagerParams.permissions, this.chainId),
@@ -13231,53 +13160,14 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13231
13160
  * @returns Transaction response for the flaunch creation
13232
13161
  */
13233
13162
  async flaunchWithRevenueManager(params) {
13234
- const initialMCapInUSDCWei = parseUnits(params.initialMarketCapUSD.toString(), 6);
13235
- const initialPriceParams = encodeAbiParameters([
13236
- {
13237
- type: "uint256",
13238
- },
13239
- ], [initialMCapInUSDCWei]);
13240
- const fairLaunchInBps = BigInt(params.fairLaunchPercent * 100);
13241
- const creatorFeeAllocationInBps = params.creatorFeeAllocationPercent * 100;
13242
- const ethRequired = await this.ethRequiredToFlaunch({
13243
- premineAmount: params.premineAmount ?? 0n,
13244
- initialPriceParams,
13245
- slippagePercent: 5,
13246
- });
13247
- return this.contract.write("flaunch", {
13248
- _flaunchParams: {
13249
- name: params.name,
13250
- symbol: params.symbol,
13251
- tokenUri: params.tokenUri,
13252
- initialTokenFairLaunch: (this.TOTAL_SUPPLY * fairLaunchInBps) / 10000n,
13253
- fairLaunchDuration: BigInt(params.fairLaunchDuration),
13254
- premineAmount: params.premineAmount ?? 0n,
13255
- creator: params.creator,
13256
- creatorFeeAllocation: creatorFeeAllocationInBps,
13257
- flaunchAt: params.flaunchAt ?? 0n,
13258
- initialPriceParams,
13259
- feeCalculatorParams: "0x",
13260
- },
13261
- _treasuryManagerParams: {
13163
+ return this.flaunch({
13164
+ ...params,
13165
+ treasuryManagerParams: {
13262
13166
  manager: params.revenueManagerInstanceAddress,
13263
- permissions: getPermissionsAddress(params.treasuryManagerParams?.permissions ?? Permissions.OPEN, this.chainId),
13167
+ permissions: params.treasuryManagerParams?.permissions ?? Permissions.OPEN,
13264
13168
  initializeData: "0x",
13265
13169
  depositData: "0x",
13266
13170
  },
13267
- _whitelistParams: {
13268
- merkleRoot: zeroHash,
13269
- merkleIPFSHash: "",
13270
- maxTokens: 0n,
13271
- },
13272
- _airdropParams: {
13273
- airdropIndex: 0n,
13274
- airdropAmount: 0n,
13275
- airdropEndTime: 0n,
13276
- merkleRoot: zeroHash,
13277
- merkleIPFSHash: "",
13278
- },
13279
- }, {
13280
- value: ethRequired,
13281
13171
  });
13282
13172
  }
13283
13173
  /**
@@ -13315,19 +13205,6 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13315
13205
  * @returns Transaction response for the flaunch creation
13316
13206
  */
13317
13207
  async flaunchWithSplitManager(params) {
13318
- const initialMCapInUSDCWei = parseUnits(params.initialMarketCapUSD.toString(), 6);
13319
- const initialPriceParams = encodeAbiParameters([
13320
- {
13321
- type: "uint256",
13322
- },
13323
- ], [initialMCapInUSDCWei]);
13324
- const fairLaunchInBps = BigInt(params.fairLaunchPercent * 100);
13325
- const creatorFeeAllocationInBps = params.creatorFeeAllocationPercent * 100;
13326
- const ethRequired = await this.ethRequiredToFlaunch({
13327
- premineAmount: params.premineAmount ?? 0n,
13328
- initialPriceParams,
13329
- slippagePercent: 5,
13330
- });
13331
13208
  const VALID_SHARE_TOTAL = 10000000n; // 5 decimals as BigInt
13332
13209
  let creatorShare = (BigInt(params.creatorSplitPercent) * VALID_SHARE_TOTAL) / 100n;
13333
13210
  const recipientShares = params.splitReceivers.map((receiver) => {
@@ -13362,40 +13239,14 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13362
13239
  recipientShares,
13363
13240
  },
13364
13241
  ]);
13365
- return this.contract.write("flaunch", {
13366
- _flaunchParams: {
13367
- name: params.name,
13368
- symbol: params.symbol,
13369
- tokenUri: params.tokenUri,
13370
- initialTokenFairLaunch: (this.TOTAL_SUPPLY * fairLaunchInBps) / 10000n,
13371
- fairLaunchDuration: BigInt(params.fairLaunchDuration),
13372
- premineAmount: params.premineAmount ?? 0n,
13373
- creator: params.creator,
13374
- creatorFeeAllocation: creatorFeeAllocationInBps,
13375
- flaunchAt: params.flaunchAt ?? 0n,
13376
- initialPriceParams,
13377
- feeCalculatorParams: "0x",
13378
- },
13379
- _treasuryManagerParams: {
13242
+ return this.flaunch({
13243
+ ...params,
13244
+ treasuryManagerParams: {
13380
13245
  manager: AddressFeeSplitManagerAddress[this.chainId],
13381
- permissions: getPermissionsAddress(params.treasuryManagerParams?.permissions ?? Permissions.OPEN, this.chainId),
13246
+ permissions: params.treasuryManagerParams?.permissions ?? Permissions.OPEN,
13382
13247
  initializeData,
13383
13248
  depositData: "0x",
13384
13249
  },
13385
- _whitelistParams: {
13386
- merkleRoot: zeroHash,
13387
- merkleIPFSHash: "",
13388
- maxTokens: 0n,
13389
- },
13390
- _airdropParams: {
13391
- airdropIndex: 0n,
13392
- airdropAmount: 0n,
13393
- airdropEndTime: 0n,
13394
- merkleRoot: zeroHash,
13395
- merkleIPFSHash: "",
13396
- },
13397
- }, {
13398
- value: ethRequired,
13399
13250
  });
13400
13251
  }
13401
13252
  /**
@@ -15748,7 +15599,7 @@ class ReadWritePermit2 extends ReadPermit2 {
15748
15599
  }
15749
15600
  }
15750
15601
 
15751
- const FlaunchPositionManagerV1_1_1Abi = [
15602
+ const FlaunchPositionManagerV1_2Abi = [
15752
15603
  {
15753
15604
  inputs: [
15754
15605
  {
@@ -17302,7 +17153,7 @@ const FlaunchPositionManagerV1_1_1Abi = [
17302
17153
  { stateMutability: "payable", type: "receive" },
17303
17154
  ];
17304
17155
 
17305
- class ReadFlaunchPositionManagerV1_1_1 {
17156
+ class ReadFlaunchPositionManagerV1_2 {
17306
17157
  constructor(address, drift = createDrift$1()) {
17307
17158
  this.TOTAL_SUPPLY = 100n * 10n ** 27n; // 100 Billion tokens in wei
17308
17159
  this.drift = drift;
@@ -17310,7 +17161,7 @@ class ReadFlaunchPositionManagerV1_1_1 {
17310
17161
  throw new Error("Address is required");
17311
17162
  }
17312
17163
  this.contract = drift.contract({
17313
- abi: FlaunchPositionManagerV1_1_1Abi,
17164
+ abi: FlaunchPositionManagerV1_2Abi,
17314
17165
  address,
17315
17166
  });
17316
17167
  }
@@ -19525,21 +19376,35 @@ class ReadWriteTokenImporter extends ReadTokenImporter {
19525
19376
  constructor(chainId, address, drift = createDrift$1()) {
19526
19377
  super(chainId, address, drift);
19527
19378
  }
19528
- async initialize({ memecoin, creatorFeeAllocationPercent, initialMarketCapUSD, verifier, }) {
19379
+ async initialize(params) {
19380
+ return this.contract.write("initialize", await this.getInitializeParams(params));
19381
+ }
19382
+ async getInitializeParams(params) {
19383
+ let initialMarketCapUSD;
19384
+ if ("initialMarketCapUSD" in params) {
19385
+ initialMarketCapUSD = params.initialMarketCapUSD;
19386
+ }
19387
+ else {
19388
+ const memecoin = new ReadMemecoin(params.coinAddress, this.drift);
19389
+ const totalSupply = await memecoin.totalSupply();
19390
+ const decimals = await memecoin.decimals();
19391
+ const formattedTotalSupply = parseFloat(formatUnits$1(totalSupply, decimals));
19392
+ initialMarketCapUSD = params.initialPriceUSD * formattedTotalSupply;
19393
+ }
19529
19394
  const initialMCapInUSDCWei = parseUnits(initialMarketCapUSD.toString(), 6);
19530
- const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
19395
+ const creatorFeeAllocationInBps = params.creatorFeeAllocationPercent * 100;
19531
19396
  // Passing in the verifier here, as drift doesn't recognize the other initialize function without the verifier param
19532
- let _verifier = verifier
19533
- ? this.verifierAddress(verifier)
19397
+ let _verifier = params.verifier
19398
+ ? this.verifierAddress(params.verifier)
19534
19399
  : await this.contract.read("verifyMemecoin", {
19535
- _memecoin: memecoin,
19400
+ _memecoin: params.coinAddress,
19536
19401
  });
19537
- return this.contract.write("initialize", {
19538
- _memecoin: memecoin,
19402
+ return {
19403
+ _memecoin: params.coinAddress,
19539
19404
  _creatorFeeAllocation: creatorFeeAllocationInBps,
19540
19405
  _initialMarketCap: initialMCapInUSDCWei,
19541
19406
  _verifier,
19542
- });
19407
+ };
19543
19408
  }
19544
19409
  }
19545
19410
 
@@ -21876,7 +21741,7 @@ class ReadFlaunchV1_1 {
21876
21741
  }
21877
21742
  }
21878
21743
 
21879
- const FlaunchV1_1_1Abi = [
21744
+ const FlaunchV1_2Abi = [
21880
21745
  {
21881
21746
  inputs: [
21882
21747
  {
@@ -22572,7 +22437,7 @@ const FlaunchV1_1_1Abi = [
22572
22437
  * Provides methods to query token IDs and metadata URIs
22573
22438
  * Enhanced version of the V1 contract with additional features
22574
22439
  */
22575
- class ReadFlaunchV1_1_1 {
22440
+ class ReadFlaunchV1_2 {
22576
22441
  /**
22577
22442
  * Creates a new ReadFlaunchV1_1 instance
22578
22443
  * @param address - The address of the Flaunch V1.1 contract
@@ -22584,7 +22449,7 @@ class ReadFlaunchV1_1_1 {
22584
22449
  throw new Error("Address is required");
22585
22450
  }
22586
22451
  this.contract = drift.contract({
22587
- abi: FlaunchV1_1_1Abi,
22452
+ abi: FlaunchV1_2Abi,
22588
22453
  address,
22589
22454
  });
22590
22455
  }
@@ -24789,7 +24654,7 @@ class ReadFlaunchSDK {
24789
24654
  this.resolveIPFS = resolveIPFS;
24790
24655
  this.readPositionManager = new ReadFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift);
24791
24656
  this.readPositionManagerV1_1 = new ReadFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift);
24792
- this.readPositionManagerV1_1_1 = new ReadFlaunchPositionManagerV1_1_1(FlaunchPositionManagerV1_1_1Address[this.chainId], drift);
24657
+ this.readPositionManagerV1_2 = new ReadFlaunchPositionManagerV1_2(FlaunchPositionManagerV1_2Address[this.chainId], drift);
24793
24658
  this.readAnyPositionManager = new ReadAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift);
24794
24659
  this.readTokenImporter = new ReadTokenImporter(this.chainId, TokenImporterAddress[this.chainId], drift);
24795
24660
  this.readFeeEscrow = new ReadFeeEscrow(FeeEscrowAddress[this.chainId], drift);
@@ -24804,7 +24669,7 @@ class ReadFlaunchSDK {
24804
24669
  this.readAnyBidWall = new AnyBidWall(AnyBidWallAddress[this.chainId], drift);
24805
24670
  this.readFlaunch = new ReadFlaunch(FlaunchAddress[this.chainId], drift);
24806
24671
  this.readFlaunchV1_1 = new ReadFlaunchV1_1(FlaunchV1_1Address[this.chainId], drift);
24807
- this.readFlaunchV1_1_1 = new ReadFlaunchV1_1_1(FlaunchV1_1_1Address[this.chainId], drift);
24672
+ this.readFlaunchV1_2 = new ReadFlaunchV1_2(FlaunchV1_2Address[this.chainId], drift);
24808
24673
  this.readQuoter = new ReadQuoter(this.chainId, QuoterAddress[this.chainId], drift);
24809
24674
  this.readPermit2 = new ReadPermit2(Permit2Address[this.chainId], drift);
24810
24675
  }
@@ -24814,7 +24679,7 @@ class ReadFlaunchSDK {
24814
24679
  * @returns Promise<boolean> - True if the coin is valid, false otherwise
24815
24680
  */
24816
24681
  async isValidCoin(coinAddress) {
24817
- return ((await this.readPositionManagerV1_1_1.isValidCoin(coinAddress)) ||
24682
+ return ((await this.readPositionManagerV1_2.isValidCoin(coinAddress)) ||
24818
24683
  (await this.readPositionManagerV1_1.isValidCoin(coinAddress)) ||
24819
24684
  (await this.readPositionManager.isValidCoin(coinAddress)) ||
24820
24685
  (await this.readAnyPositionManager.isValidCoin(coinAddress)));
@@ -24825,8 +24690,8 @@ class ReadFlaunchSDK {
24825
24690
  * @returns Promise<FlaunchVersion> - The version of the coin
24826
24691
  */
24827
24692
  async getCoinVersion(coinAddress) {
24828
- if (await this.readPositionManagerV1_1_1.isValidCoin(coinAddress)) {
24829
- return FlaunchVersion.V1_1_1;
24693
+ if (await this.readPositionManagerV1_2.isValidCoin(coinAddress)) {
24694
+ return FlaunchVersion.V1_2;
24830
24695
  }
24831
24696
  else if (await this.readPositionManagerV1_1.isValidCoin(coinAddress)) {
24832
24697
  return FlaunchVersion.V1_1;
@@ -24849,12 +24714,12 @@ class ReadFlaunchSDK {
24849
24714
  return this.readPositionManager;
24850
24715
  case FlaunchVersion.V1_1:
24851
24716
  return this.readPositionManagerV1_1;
24852
- case FlaunchVersion.V1_1_1:
24853
- return this.readPositionManagerV1_1_1;
24717
+ case FlaunchVersion.V1_2:
24718
+ return this.readPositionManagerV1_2;
24854
24719
  case FlaunchVersion.ANY:
24855
24720
  return this.readAnyPositionManager;
24856
24721
  default:
24857
- return this.readPositionManagerV1_1_1;
24722
+ return this.readPositionManagerV1_2;
24858
24723
  }
24859
24724
  }
24860
24725
  /**
@@ -24867,7 +24732,7 @@ class ReadFlaunchSDK {
24867
24732
  return this.readFairLaunch;
24868
24733
  case FlaunchVersion.V1_1:
24869
24734
  return this.readFairLaunchV1_1;
24870
- case FlaunchVersion.V1_1_1:
24735
+ case FlaunchVersion.V1_2:
24871
24736
  return this.readFairLaunchV1_1;
24872
24737
  case FlaunchVersion.ANY:
24873
24738
  return this.readFairLaunchV1_1;
@@ -24885,7 +24750,7 @@ class ReadFlaunchSDK {
24885
24750
  return this.readBidWall;
24886
24751
  case FlaunchVersion.V1_1:
24887
24752
  return this.readBidWallV1_1;
24888
- case FlaunchVersion.V1_1_1:
24753
+ case FlaunchVersion.V1_2:
24889
24754
  return this.readBidWallV1_1;
24890
24755
  case FlaunchVersion.ANY:
24891
24756
  return this.readAnyBidWall;
@@ -24903,8 +24768,8 @@ class ReadFlaunchSDK {
24903
24768
  return this.readFlaunch.contract.address;
24904
24769
  case FlaunchVersion.V1_1:
24905
24770
  return this.readFlaunchV1_1.contract.address;
24906
- case FlaunchVersion.V1_1_1:
24907
- return this.readFlaunchV1_1_1.contract.address;
24771
+ case FlaunchVersion.V1_2:
24772
+ return this.readFlaunchV1_2.contract.address;
24908
24773
  case FlaunchVersion.ANY:
24909
24774
  return this.readFlaunchV1_1.contract.address;
24910
24775
  default:
@@ -25581,11 +25446,75 @@ class ReadFlaunchSDK {
25581
25446
  tokenImporterVerifyMemecoin(memecoin) {
25582
25447
  return this.readTokenImporter.verifyMemecoin(memecoin);
25583
25448
  }
25584
- async calculateAddLiquidityTicks({ coinAddress, liquidityMode, minMarketCap, maxMarketCap, }) {
25449
+ /**
25450
+ * Gets basic coin information (total supply and decimals)
25451
+ */
25452
+ async getCoinInfo(coinAddress) {
25585
25453
  const memecoin = new ReadMemecoin(coinAddress, this.drift);
25586
- const coinTotalSupply = await memecoin.totalSupply();
25587
- const coinDecimals = await memecoin.decimals();
25454
+ const [totalSupply, decimals] = await Promise.all([
25455
+ memecoin.totalSupply(),
25456
+ memecoin.decimals(),
25457
+ ]);
25458
+ return { totalSupply, decimals };
25459
+ }
25460
+ /**
25461
+ * Gets market context information needed for tick calculations
25462
+ */
25463
+ async getMarketContext(coinAddress, coinDecimals) {
25464
+ const ethUsdPrice = await this.getETHUSDCPrice();
25465
+ const isFlethZero = this.flETHIsCurrencyZero(coinAddress);
25466
+ const flETHDecimals = 18; // flETH has 18 decimals
25467
+ // Determine decimals based on token ordering
25468
+ const decimals0 = isFlethZero ? flETHDecimals : coinDecimals;
25469
+ const decimals1 = isFlethZero ? coinDecimals : flETHDecimals;
25470
+ return {
25471
+ ethUsdPrice,
25472
+ isFlethZero,
25473
+ decimals0,
25474
+ decimals1,
25475
+ };
25476
+ }
25477
+ /**
25478
+ * Converts market cap in USD to token price in ETH
25479
+ */
25480
+ marketCapToTokenPriceEth(marketCapUsd, totalSupplyDecimal, ethUsdPrice) {
25481
+ const tokenPriceUsd = marketCapUsd / totalSupplyDecimal;
25482
+ return tokenPriceUsd / ethUsdPrice;
25483
+ }
25484
+ /**
25485
+ * Converts token price in ETH to tick
25486
+ */
25487
+ convertPriceToTick(priceEth, isFlethZero, decimals0, decimals1) {
25488
+ return priceRatioToTick({
25489
+ priceInput: priceEth.toString(),
25490
+ isDirection1Per0: !isFlethZero,
25491
+ decimals0,
25492
+ decimals1,
25493
+ spacing: TICK_SPACING,
25494
+ });
25495
+ }
25496
+ /**
25497
+ * Calculates current tick from market cap if provided
25498
+ */
25499
+ calculateCurrentTickFromMarketCap(currentMarketCap, totalSupplyDecimal, marketContext) {
25500
+ if (!currentMarketCap) {
25501
+ return undefined;
25502
+ }
25503
+ const currentMarketCapNum = parseFloat(currentMarketCap);
25504
+ const currentTokenPriceEth = this.marketCapToTokenPriceEth(currentMarketCapNum, totalSupplyDecimal, marketContext.ethUsdPrice);
25505
+ return this.convertPriceToTick(currentTokenPriceEth, marketContext.isFlethZero, marketContext.decimals0, marketContext.decimals1);
25506
+ }
25507
+ async calculateAddLiquidityTicks({ coinAddress, liquidityMode, minMarketCap, maxMarketCap, currentMarketCap, }) {
25508
+ // Get coin information
25509
+ const { totalSupply: coinTotalSupply, decimals: coinDecimals } = await this.getCoinInfo(coinAddress);
25510
+ // Convert total supply to decimal format
25511
+ const totalSupplyDecimal = parseFloat(formatEther(coinTotalSupply));
25588
25512
  if (liquidityMode === LiquidityMode.FULL_RANGE) {
25513
+ let currentTick;
25514
+ if (currentMarketCap) {
25515
+ const marketContext = await this.getMarketContext(coinAddress, coinDecimals);
25516
+ currentTick = this.calculateCurrentTickFromMarketCap(currentMarketCap, totalSupplyDecimal, marketContext);
25517
+ }
25589
25518
  return {
25590
25519
  tickLower: getNearestUsableTick({
25591
25520
  tick: TickFinder.MIN_TICK,
@@ -25595,13 +25524,14 @@ class ReadFlaunchSDK {
25595
25524
  tick: TickFinder.MAX_TICK,
25596
25525
  tickSpacing: TICK_SPACING,
25597
25526
  }),
25527
+ currentTick,
25598
25528
  coinTotalSupply,
25599
25529
  coinDecimals,
25600
25530
  };
25601
25531
  }
25602
25532
  else {
25603
- const ethUsdPrice = await this.getETHUSDCPrice();
25604
- const isFlethZero = this.flETHIsCurrencyZero(coinAddress);
25533
+ // Get market context
25534
+ const marketContext = await this.getMarketContext(coinAddress, coinDecimals);
25605
25535
  const minMarketCapNum = parseFloat(minMarketCap);
25606
25536
  const maxMarketCapNum = parseFloat(maxMarketCap);
25607
25537
  if (minMarketCapNum <= 0 ||
@@ -25609,59 +25539,44 @@ class ReadFlaunchSDK {
25609
25539
  minMarketCapNum >= maxMarketCapNum) {
25610
25540
  throw new Error("[ReadFlaunchSDK.addLiquidityCalculateTicks]: Invalid market cap range");
25611
25541
  }
25612
- // Convert total supply to decimal format
25613
- const totalSupplyDecimal = parseFloat(formatEther(coinTotalSupply));
25614
- // Calculate token price in USD at min and max market caps
25615
- const minTokenPriceUsd = minMarketCapNum / totalSupplyDecimal;
25616
- const maxTokenPriceUsd = maxMarketCapNum / totalSupplyDecimal;
25617
- // Convert to token price in ETH
25618
- const minTokenPriceEth = minTokenPriceUsd / ethUsdPrice;
25619
- const maxTokenPriceEth = maxTokenPriceUsd / ethUsdPrice;
25620
- const flETHDecimals = 18; // flETH has 18 decimals
25621
- // Determine decimals based on token ordering
25622
- const decimals0 = isFlethZero ? flETHDecimals : coinDecimals;
25623
- const decimals1 = isFlethZero ? coinDecimals : flETHDecimals;
25624
- // Convert to ticks using proper price direction handling
25625
- const minTick = priceRatioToTick({
25626
- priceInput: minTokenPriceEth.toString(),
25627
- isDirection1Per0: !isFlethZero,
25628
- decimals0,
25629
- decimals1,
25630
- spacing: TICK_SPACING,
25631
- });
25632
- const maxTick = priceRatioToTick({
25633
- priceInput: maxTokenPriceEth.toString(),
25634
- isDirection1Per0: !isFlethZero,
25635
- decimals0,
25636
- decimals1,
25637
- spacing: TICK_SPACING,
25638
- });
25542
+ // Convert market caps to token prices in ETH
25543
+ const minTokenPriceEth = this.marketCapToTokenPriceEth(minMarketCapNum, totalSupplyDecimal, marketContext.ethUsdPrice);
25544
+ const maxTokenPriceEth = this.marketCapToTokenPriceEth(maxMarketCapNum, totalSupplyDecimal, marketContext.ethUsdPrice);
25545
+ // Convert to ticks
25546
+ const minTick = this.convertPriceToTick(minTokenPriceEth, marketContext.isFlethZero, marketContext.decimals0, marketContext.decimals1);
25547
+ const maxTick = this.convertPriceToTick(maxTokenPriceEth, marketContext.isFlethZero, marketContext.decimals0, marketContext.decimals1);
25548
+ // Calculate current tick if provided
25549
+ const currentTick = this.calculateCurrentTickFromMarketCap(currentMarketCap, totalSupplyDecimal, marketContext);
25639
25550
  return {
25640
25551
  tickLower: Math.min(minTick, maxTick),
25641
25552
  tickUpper: Math.max(minTick, maxTick),
25553
+ currentTick,
25642
25554
  coinTotalSupply,
25643
25555
  coinDecimals,
25644
25556
  };
25645
25557
  }
25646
25558
  }
25647
- async calculateAddLiquidityAmounts({ coinAddress, liquidityMode, coinOrEthInputAmount, inputToken, minMarketCap, maxMarketCap, }) {
25648
- const { tickLower, tickUpper } = await this.calculateAddLiquidityTicks({
25559
+ async calculateAddLiquidityAmounts({ coinAddress, liquidityMode, coinOrEthInputAmount, inputToken, minMarketCap, maxMarketCap, currentMarketCap, }) {
25560
+ let { tickLower, tickUpper, currentTick } = await this.calculateAddLiquidityTicks({
25649
25561
  coinAddress,
25650
25562
  liquidityMode,
25651
25563
  minMarketCap,
25652
25564
  maxMarketCap,
25565
+ currentMarketCap,
25653
25566
  });
25654
- // get the current pool state for AnyPositionManager pool for the coin
25655
- const poolState = await this.readStateView.poolSlot0({
25656
- poolId: getPoolId(orderPoolKey({
25657
- currency0: coinAddress,
25658
- currency1: FLETHAddress[this.chainId],
25659
- fee: 0,
25660
- tickSpacing: TICK_SPACING,
25661
- hooks: AnyPositionManagerAddress[this.chainId],
25662
- })),
25663
- });
25664
- const currentTick = poolState.tick;
25567
+ if (!currentTick) {
25568
+ // get the current pool state for AnyPositionManager pool for the coin
25569
+ const poolState = await this.readStateView.poolSlot0({
25570
+ poolId: getPoolId(orderPoolKey({
25571
+ currency0: coinAddress,
25572
+ currency1: FLETHAddress[this.chainId],
25573
+ fee: 0,
25574
+ tickSpacing: TICK_SPACING,
25575
+ hooks: AnyPositionManagerAddress[this.chainId],
25576
+ })),
25577
+ });
25578
+ currentTick = poolState.tick;
25579
+ }
25665
25580
  // Determine currency ordering
25666
25581
  const isFlETHCurrency0 = this.flETHIsCurrencyZero(coinAddress);
25667
25582
  try {
@@ -25752,6 +25667,25 @@ class ReadFlaunchSDK {
25752
25667
  throw error;
25753
25668
  }
25754
25669
  }
25670
+ /**
25671
+ * Checks if an external memecoin has been imported to Flaunch
25672
+ * @param memecoin - The address of the memecoin to check
25673
+ * @returns Promise<boolean> - True if the memecoin has been imported
25674
+ */
25675
+ async isMemecoinImported(memecoin) {
25676
+ const poolKey = orderPoolKey({
25677
+ currency0: memecoin,
25678
+ currency1: FLETHAddress[this.chainId],
25679
+ fee: 0,
25680
+ tickSpacing: TICK_SPACING,
25681
+ hooks: AnyPositionManagerAddress[this.chainId],
25682
+ });
25683
+ // check if pool's sqrtPriceX96 is not 0
25684
+ const poolState = await this.readStateView.poolSlot0({
25685
+ poolId: getPoolId(poolKey),
25686
+ });
25687
+ return poolState.sqrtPriceX96 !== 0n;
25688
+ }
25755
25689
  /**
25756
25690
  * Checks if an operator is approved for all flaunch tokens of an owner
25757
25691
  * @param version - The flaunch version to determine the correct contract address
@@ -26122,7 +26056,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26122
26056
  }
26123
26057
  /**
26124
26058
  * Imports a memecoin into the TokenImporter
26125
- * @param params.memecoin - The address of the memecoin to import
26059
+ * @param params.coinAddress - The address of the memecoin to import
26126
26060
  * @param params.creatorFeeAllocationPercent - The creator fee allocation percentage
26127
26061
  * @param params.initialMarketCapUSD - The initial market cap in USD
26128
26062
  * @param params.verifier - Optional verifier to use for importing the memecoin
@@ -26131,6 +26065,11 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26131
26065
  importMemecoin(params) {
26132
26066
  return this.readWriteTokenImporter.initialize(params);
26133
26067
  }
26068
+ /**
26069
+ * Gets the calls needed to add liquidity to AnyPositionManager for external coins
26070
+ * @param params - Parameters for adding liquidity
26071
+ * @returns Array of calls with descriptions
26072
+ */
26134
26073
  async getAddLiquidityCalls(params) {
26135
26074
  const { coinAddress } = params;
26136
26075
  const flethAddress = FLETHAddress[this.chainId];
@@ -26153,20 +26092,43 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26153
26092
  flethAmount = params.flethAmount;
26154
26093
  tickLower = params.tickLower;
26155
26094
  tickUpper = params.tickUpper;
26156
- const poolState = await this.readStateView.poolSlot0({
26157
- poolId: getPoolId(poolKey),
26158
- });
26159
- currentTick = poolState.tick;
26095
+ if (params.currentTick) {
26096
+ currentTick = params.currentTick;
26097
+ }
26098
+ else {
26099
+ const poolState = await this.readStateView.poolSlot0({
26100
+ poolId: getPoolId(poolKey),
26101
+ });
26102
+ currentTick = poolState.tick;
26103
+ }
26160
26104
  }
26161
26105
  else {
26162
26106
  // Calculate the amounts
26107
+ let minMarketCap;
26108
+ let maxMarketCap;
26109
+ let initialMarketCapUSD;
26110
+ if ("minMarketCap" in params) {
26111
+ minMarketCap = params.minMarketCap;
26112
+ maxMarketCap = params.maxMarketCap;
26113
+ initialMarketCapUSD = params.initialMarketCapUSD;
26114
+ }
26115
+ else {
26116
+ const { totalSupply, decimals } = await this.getCoinInfo(coinAddress);
26117
+ const formattedTotalSupply = parseFloat(formatUnits$1(totalSupply, decimals));
26118
+ minMarketCap = (parseFloat(params.minPriceUSD) * formattedTotalSupply).toString();
26119
+ maxMarketCap = (parseFloat(params.maxPriceUSD) * formattedTotalSupply).toString();
26120
+ if (params.initialPriceUSD) {
26121
+ initialMarketCapUSD = params.initialPriceUSD * formattedTotalSupply;
26122
+ }
26123
+ }
26163
26124
  const calculated = await this.calculateAddLiquidityAmounts({
26164
26125
  coinAddress,
26165
26126
  liquidityMode: params.liquidityMode,
26166
26127
  coinOrEthInputAmount: params.coinOrEthInputAmount,
26167
26128
  inputToken: params.inputToken,
26168
- minMarketCap: params.minMarketCap,
26169
- maxMarketCap: params.maxMarketCap,
26129
+ minMarketCap,
26130
+ maxMarketCap,
26131
+ currentMarketCap: initialMarketCapUSD?.toString(),
26170
26132
  });
26171
26133
  coinAmount = calculated.coinAmount;
26172
26134
  flethAmount = calculated.ethAmount;
@@ -26372,8 +26334,8 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26372
26334
  finalAmount1 = constrainedAmounts.amount1;
26373
26335
  }
26374
26336
  // IMPORTANT: Add conservative buffer to account for contract rounding differences
26375
- // Reduce liquidity by 0.01% to ensure contract calculations stay within user bounds
26376
- const liquidityBuffer = finalLiquidity / 10000n; // 0.01%
26337
+ // Reduce liquidity by 0.05% to ensure contract calculations stay within user bounds
26338
+ const liquidityBuffer = finalLiquidity / 2000n; // 0.05%
26377
26339
  const conservativeLiquidity = finalLiquidity - (liquidityBuffer > 1n ? liquidityBuffer : 1n);
26378
26340
  // Use conservative liquidity but keep user's original amounts as maximums
26379
26341
  // The conservative liquidity ensures the contract won't need more than user provided
@@ -26468,6 +26430,28 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26468
26430
  });
26469
26431
  return calls;
26470
26432
  }
26433
+ /**
26434
+ * Gets the calls needed to import a memecoin to Flaunch and add liquidity to AnyPositionManager as a batch
26435
+ * @param params - Parameters for importing and adding liquidity
26436
+ * @returns Array of calls with descriptions
26437
+ */
26438
+ async getImportAndAddLiquidityCalls(params) {
26439
+ const importParams = await this.readWriteTokenImporter.getInitializeParams({
26440
+ coinAddress: params.coinAddress,
26441
+ creatorFeeAllocationPercent: params.creatorFeeAllocationPercent,
26442
+ initialMarketCapUSD: params.initialMarketCapUSD,
26443
+ verifier: params.verifier,
26444
+ });
26445
+ const addLiquidityCalls = await this.getAddLiquidityCalls(params);
26446
+ return [
26447
+ {
26448
+ to: this.readWriteTokenImporter.contract.address,
26449
+ data: this.readWriteTokenImporter.contract.encodeFunctionData("initialize", importParams),
26450
+ description: "Import Memecoin to Flaunch",
26451
+ },
26452
+ ...addLiquidityCalls,
26453
+ ];
26454
+ }
26471
26455
  }
26472
26456
 
26473
26457
  /**
@@ -26513,5 +26497,5 @@ const FlaunchSDK = {
26513
26497
  ReadWriteFlaunchSDK,
26514
26498
  };
26515
26499
 
26516
- export { AddressFeeSplitManagerAddress, AnyBidWallAddress, AnyFlaunchAddress, AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, ClankerWorldVerifierAddress, ClosedPermissionsAddress, DopplerVerifierAddress, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchPositionManagerV1_1_1Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchV1_1_1Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, LiquidityMode, MemecoinAbi, MulticallAbi, PERMIT_DETAILS, PERMIT_TYPES, Permissions, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, Q192, Q96, QuoterAbi, QuoterAddress, ReadFlaunchSDK, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, StakingManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TokenImporterAddress, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniV4PositionManagerAddress, UniversalRouterAbi, UniversalRouterAddress, Verifier, VirtualsVerifierAddress, WhitelistVerifierAddress, WhitelistedPermissionsAddress, ZoraVerifierAddress, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createDrift, createFlaunch, ethToMemecoin, generateTokenUri, getAmountWithSlippage, getAmountsForLiquidity, getLiquidityFromAmounts, getNearestUsableTick, getPermissionsAddress, getPermit2TypedData, getPoolId, getSqrtPriceX96FromTick, getValidTick, maxLiquidityForAmount0Precise, maxLiquidityForAmount1, memecoinToEthWithPermit2, orderPoolKey, parseSwapData, priceRatioToTick, resolveIPFS, uint256ToBytes32, uploadFileToIPFS, uploadImageToIPFS, uploadJsonToIPFS };
26500
+ export { AddressFeeSplitManagerAddress, AnyBidWallAddress, AnyFlaunchAddress, AnyPositionManagerAbi, AnyPositionManagerAddress, BidWallAddress, BidWallV1_1Abi, BidWallV1_1Address, BidwallAbi, ClankerWorldVerifierAddress, ClosedPermissionsAddress, DopplerVerifierAddress, FLETHAddress, FLETHHooksAddress, FairLaunchAbi, FairLaunchAddress, FairLaunchV1_1Abi, FairLaunchV1_1Address, FastFlaunchZapAbi, FastFlaunchZapAddress, FeeEscrowAbi, FeeEscrowAddress, FlaunchAbi, FlaunchAddress, FlaunchPositionManagerAbi, FlaunchPositionManagerAddress, FlaunchPositionManagerV1_1Abi, FlaunchPositionManagerV1_1Address, FlaunchPositionManagerV1_2Address, FlaunchSDK, FlaunchV1_1Abi, FlaunchV1_1Address, FlaunchV1_2Address, FlaunchVersion, FlaunchZapAbi, FlaunchZapAddress, InitialPriceAbi, LiquidityMode, MemecoinAbi, MulticallAbi, PERMIT_DETAILS, PERMIT_TYPES, Permissions, Permit2Abi, Permit2Address, PoolManagerAbi, PoolManagerAddress, Q192, Q96, QuoterAbi, QuoterAddress, ReadFlaunchSDK, ReadWriteFlaunchSDK, ReferralEscrowAbi, ReferralEscrowAddress, RevenueManagerAbi, RevenueManagerAddress, StakingManagerAddress, StateViewAbi, StateViewAddress, TICK_SPACING, TickFinder, TokenImporterAddress, TreasuryManagerFactoryAbi, TreasuryManagerFactoryAddress, USDCETHPoolKeys, UniV4PositionManagerAddress, UniversalRouterAbi, UniversalRouterAddress, Verifier, VirtualsVerifierAddress, WhitelistVerifierAddress, WhitelistedPermissionsAddress, ZoraVerifierAddress, bytes32ToUint256, calculateUnderlyingTokenBalances, chainIdToChain, createDrift, createFlaunch, ethToMemecoin, generateTokenUri, getAmountWithSlippage, getAmountsForLiquidity, getLiquidityFromAmounts, getNearestUsableTick, getPermissionsAddress, getPermit2TypedData, getPoolId, getSqrtPriceX96FromTick, getValidTick, maxLiquidityForAmount0Precise, maxLiquidityForAmount1, memecoinToEthWithPermit2, orderPoolKey, parseSwapData, priceRatioToTick, resolveIPFS, uint256ToBytes32, uploadFileToIPFS, uploadImageToIPFS, uploadJsonToIPFS };
26517
26501
  //# sourceMappingURL=index.esm.js.map