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

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 +13 -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 +351 -388
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.esm.js +350 -387
  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 +51 -27
  36. package/dist/sdk/FlaunchSDK.d.ts.map +1 -1
  37. package/dist/types.d.ts +23 -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.cjs.js CHANGED
@@ -5323,7 +5323,7 @@ const FlaunchPositionManagerV1_1Address = {
5323
5323
  [base.id]: "0xf785bb58059fab6fb19bdda2cb9078d9e546efdc",
5324
5324
  [baseSepolia.id]: "0x24347e0dd16357059abfc1b321df354873552fdc",
5325
5325
  };
5326
- const FlaunchPositionManagerV1_1_1Address = {
5326
+ const FlaunchPositionManagerV1_2Address = {
5327
5327
  [base.id]: viem.zeroAddress, // TODO: add mainnet address
5328
5328
  [baseSepolia.id]: "0x4e7cb1e6800a7b297b38bddcecaf9ca5b6616fdc",
5329
5329
  };
@@ -5387,7 +5387,7 @@ const FairLaunchAddress = {
5387
5387
  [base.id]: "0xCc7A4A00072ccbeEEbd999edc812C0ce498Fb63B",
5388
5388
  [baseSepolia.id]: "0x227Fc288aC56E169f2BfEA82e07F8635054d4136",
5389
5389
  };
5390
- // also supports AnyPositionManager & PositionManagerV1_1_1 (sepolia)
5390
+ // also supports AnyPositionManager & PositionManagerV1_2 (sepolia)
5391
5391
  const FairLaunchV1_1Address = {
5392
5392
  [base.id]: "0x4dc442403e8c758425b93c59dc737da522f32640",
5393
5393
  [baseSepolia.id]: "0x7922c1ead7c5825fb52ed6b14f397d064508acbe",
@@ -5401,7 +5401,7 @@ const FlaunchV1_1Address = {
5401
5401
  [base.id]: "0xb4512bf57d50fbcb64a3adf8b17a79b2a204c18c",
5402
5402
  [baseSepolia.id]: "0x96be8ff5e244294a34bfa507a39190dc7a839baa",
5403
5403
  };
5404
- const FlaunchV1_1_1Address = {
5404
+ const FlaunchV1_2Address = {
5405
5405
  [base.id]: viem.zeroAddress, // TODO: add mainnet address
5406
5406
  [baseSepolia.id]: "0xe2ef58a54ee79dac0D4A130ea58b340124DF9438",
5407
5407
  };
@@ -5413,7 +5413,7 @@ const BidWallAddress = {
5413
5413
  [base.id]: "0x66681f10BA90496241A25e33380004f30Dfd8aa8",
5414
5414
  [baseSepolia.id]: "0xa2107050ACEf4809c88Ab744F8e667605db5ACDB",
5415
5415
  };
5416
- // also supports AnyPositionManager & PositionManagerV1_1_1 (sepolia)
5416
+ // also supports AnyPositionManager & PositionManagerV1_2 (sepolia)
5417
5417
  const BidWallV1_1Address = {
5418
5418
  [base.id]: "0x7f22353d1634223a802D1c1Ea5308Ddf5DD0ef9c",
5419
5419
  [baseSepolia.id]: "0x6f2fa01a05ff8b6efbfefd91a3b85aaf19265a00",
@@ -5427,8 +5427,8 @@ const FastFlaunchZapAddress = {
5427
5427
  [baseSepolia.id]: "0x821d9f6075e7971cc71c379081de9d532f5f9957",
5428
5428
  };
5429
5429
  const FlaunchZapAddress = {
5430
- [base.id]: "0xfa9e8528ee95eb109bffd1a2d59cb95b300a672a", // TODO: update mainnet address with permissions param
5431
- [baseSepolia.id]: "0x2871a184410F03F4e2C7C5257d839FB34169496A",
5430
+ [base.id]: "0x2bC8cbfE237AEddc7C296436fefe239A0A22dAbF",
5431
+ [baseSepolia.id]: "0x808DA25e8ecbCC2C0339B6A436AAEAe2021C235d",
5432
5432
  };
5433
5433
  const TreasuryManagerFactoryAddress = {
5434
5434
  [base.id]: "0x48af8b28DDC5e5A86c4906212fc35Fa808CA8763",
@@ -10836,358 +10836,256 @@ class AnyBidWall {
10836
10836
 
10837
10837
  const FlaunchZapAbi = [
10838
10838
  {
10839
- type: "constructor",
10840
10839
  inputs: [
10841
10840
  {
10841
+ internalType: "contract PositionManager",
10842
10842
  name: "_positionManager",
10843
10843
  type: "address",
10844
- internalType: "contract PositionManager",
10845
10844
  },
10846
10845
  {
10847
- name: "_flaunchContract",
10848
- type: "address",
10849
10846
  internalType: "contract Flaunch",
10850
- },
10851
- {
10852
- name: "_flETH",
10853
- type: "address",
10854
- internalType: "contract IFLETH",
10855
- },
10856
- {
10857
- name: "_poolSwap",
10847
+ name: "_flaunchContract",
10858
10848
  type: "address",
10859
- internalType: "contract PoolSwap",
10860
10849
  },
10850
+ { internalType: "contract IFLETH", name: "_flETH", type: "address" },
10851
+ { internalType: "contract PoolSwap", name: "_poolSwap", type: "address" },
10861
10852
  {
10853
+ internalType: "contract ITreasuryManagerFactory",
10862
10854
  name: "_treasuryManagerFactory",
10863
10855
  type: "address",
10864
- internalType: "contract ITreasuryManagerFactory",
10865
10856
  },
10866
10857
  {
10858
+ internalType: "contract IMerkleAirdrop",
10867
10859
  name: "_merkleAirdrop",
10868
10860
  type: "address",
10869
- internalType: "contract IMerkleAirdrop",
10870
10861
  },
10871
10862
  {
10863
+ internalType: "contract WhitelistFairLaunch",
10872
10864
  name: "_whitelistFairLaunch",
10873
10865
  type: "address",
10874
- internalType: "contract WhitelistFairLaunch",
10875
10866
  },
10876
10867
  ],
10877
10868
  stateMutability: "nonpayable",
10869
+ type: "constructor",
10878
10870
  },
10879
- { type: "receive", stateMutability: "payable" },
10871
+ { inputs: [], name: "CreatorCannotBeZero", type: "error" },
10872
+ { inputs: [], name: "InsufficientMemecoinsForAirdrop", type: "error" },
10880
10873
  {
10881
- type: "function",
10882
- name: "calculateFee",
10883
10874
  inputs: [
10884
- {
10885
- name: "_premineAmount",
10886
- type: "uint256",
10887
- internalType: "uint256",
10888
- },
10889
- { name: "_slippage", type: "uint256", internalType: "uint256" },
10890
- {
10891
- name: "_initialPriceParams",
10892
- type: "bytes",
10893
- internalType: "bytes",
10894
- },
10875
+ { internalType: "uint256", name: "_premineAmount", type: "uint256" },
10876
+ { internalType: "uint256", name: "_slippage", type: "uint256" },
10877
+ { internalType: "bytes", name: "_initialPriceParams", type: "bytes" },
10895
10878
  ],
10879
+ name: "calculateFee",
10896
10880
  outputs: [
10897
- { name: "ethRequired_", type: "uint256", internalType: "uint256" },
10881
+ { internalType: "uint256", name: "ethRequired_", type: "uint256" },
10898
10882
  ],
10899
10883
  stateMutability: "view",
10884
+ type: "function",
10900
10885
  },
10901
10886
  {
10902
- type: "function",
10903
- name: "deployAndInitializeManager",
10904
10887
  inputs: [
10905
10888
  {
10889
+ internalType: "address",
10906
10890
  name: "_managerImplementation",
10907
10891
  type: "address",
10908
- internalType: "address",
10909
10892
  },
10910
- { name: "_owner", type: "address", internalType: "address" },
10911
- { name: "_data", type: "bytes", internalType: "bytes" },
10912
- { name: "_permissions", type: "address", internalType: "address" },
10893
+ { internalType: "address", name: "_owner", type: "address" },
10894
+ { internalType: "bytes", name: "_data", type: "bytes" },
10895
+ { internalType: "address", name: "_permissions", type: "address" },
10913
10896
  ],
10897
+ name: "deployAndInitializeManager",
10914
10898
  outputs: [
10915
- {
10916
- name: "manager_",
10917
- type: "address",
10918
- internalType: "address payable",
10919
- },
10899
+ { internalType: "address payable", name: "manager_", type: "address" },
10920
10900
  ],
10921
10901
  stateMutability: "nonpayable",
10902
+ type: "function",
10922
10903
  },
10923
10904
  {
10924
- type: "function",
10925
- name: "flETH",
10926
10905
  inputs: [],
10927
- outputs: [{ name: "", type: "address", internalType: "contract IFLETH" }],
10906
+ name: "flETH",
10907
+ outputs: [{ internalType: "contract IFLETH", name: "", type: "address" }],
10928
10908
  stateMutability: "view",
10909
+ type: "function",
10929
10910
  },
10930
10911
  {
10931
- type: "function",
10932
- name: "flaunch",
10933
10912
  inputs: [
10934
10913
  {
10935
- name: "_flaunchParams",
10936
- type: "tuple",
10937
- internalType: "struct PositionManager.FlaunchParams",
10938
10914
  components: [
10939
- { name: "name", type: "string", internalType: "string" },
10940
- { name: "symbol", type: "string", internalType: "string" },
10941
- { name: "tokenUri", type: "string", internalType: "string" },
10915
+ { internalType: "string", name: "name", type: "string" },
10916
+ { internalType: "string", name: "symbol", type: "string" },
10917
+ { internalType: "string", name: "tokenUri", type: "string" },
10942
10918
  {
10919
+ internalType: "uint256",
10943
10920
  name: "initialTokenFairLaunch",
10944
10921
  type: "uint256",
10945
- internalType: "uint256",
10946
10922
  },
10947
10923
  {
10948
- name: "fairLaunchDuration",
10949
- type: "uint256",
10950
10924
  internalType: "uint256",
10951
- },
10952
- {
10953
- name: "premineAmount",
10925
+ name: "fairLaunchDuration",
10954
10926
  type: "uint256",
10955
- internalType: "uint256",
10956
10927
  },
10957
- { name: "creator", type: "address", internalType: "address" },
10928
+ { internalType: "uint256", name: "premineAmount", type: "uint256" },
10929
+ { internalType: "address", name: "creator", type: "address" },
10958
10930
  {
10931
+ internalType: "uint24",
10959
10932
  name: "creatorFeeAllocation",
10960
10933
  type: "uint24",
10961
- internalType: "uint24",
10962
- },
10963
- {
10964
- name: "flaunchAt",
10965
- type: "uint256",
10966
- internalType: "uint256",
10967
- },
10968
- {
10969
- name: "initialPriceParams",
10970
- type: "bytes",
10971
- internalType: "bytes",
10972
- },
10973
- {
10974
- name: "feeCalculatorParams",
10975
- type: "bytes",
10976
- internalType: "bytes",
10977
10934
  },
10935
+ { internalType: "uint256", name: "flaunchAt", type: "uint256" },
10936
+ { internalType: "bytes", name: "initialPriceParams", type: "bytes" },
10937
+ { internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
10938
+ ],
10939
+ internalType: "struct PositionManager.FlaunchParams",
10940
+ name: "_flaunchParams",
10941
+ type: "tuple",
10942
+ },
10943
+ { internalType: "bytes", name: "_premineSwapHookData", type: "bytes" },
10944
+ {
10945
+ components: [
10946
+ { internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
10947
+ { internalType: "string", name: "merkleIPFSHash", type: "string" },
10948
+ { internalType: "uint256", name: "maxTokens", type: "uint256" },
10949
+ ],
10950
+ internalType: "struct FlaunchZap.WhitelistParams",
10951
+ name: "_whitelistParams",
10952
+ type: "tuple",
10953
+ },
10954
+ {
10955
+ components: [
10956
+ { internalType: "uint256", name: "airdropIndex", type: "uint256" },
10957
+ { internalType: "uint256", name: "airdropAmount", type: "uint256" },
10958
+ { internalType: "uint256", name: "airdropEndTime", type: "uint256" },
10959
+ { internalType: "bytes32", name: "merkleRoot", type: "bytes32" },
10960
+ { internalType: "string", name: "merkleIPFSHash", type: "string" },
10978
10961
  ],
10962
+ internalType: "struct FlaunchZap.AirdropParams",
10963
+ name: "_airdropParams",
10964
+ type: "tuple",
10965
+ },
10966
+ {
10967
+ components: [
10968
+ { internalType: "address", name: "manager", type: "address" },
10969
+ { internalType: "address", name: "permissions", type: "address" },
10970
+ { internalType: "bytes", name: "initializeData", type: "bytes" },
10971
+ { internalType: "bytes", name: "depositData", type: "bytes" },
10972
+ ],
10973
+ internalType: "struct FlaunchZap.TreasuryManagerParams",
10974
+ name: "_treasuryManagerParams",
10975
+ type: "tuple",
10979
10976
  },
10980
10977
  ],
10978
+ name: "flaunch",
10981
10979
  outputs: [
10982
- { name: "memecoin_", type: "address", internalType: "address" },
10983
- { name: "ethSpent_", type: "uint256", internalType: "uint256" },
10984
- { name: "", type: "address", internalType: "address" },
10980
+ { internalType: "address", name: "memecoin_", type: "address" },
10981
+ { internalType: "uint256", name: "ethSpent_", type: "uint256" },
10982
+ { internalType: "address", name: "deployedManager_", type: "address" },
10985
10983
  ],
10986
10984
  stateMutability: "payable",
10985
+ type: "function",
10987
10986
  },
10988
10987
  {
10989
- type: "function",
10990
- name: "flaunch",
10991
10988
  inputs: [
10992
10989
  {
10993
- name: "_flaunchParams",
10994
- type: "tuple",
10995
- internalType: "struct PositionManager.FlaunchParams",
10996
10990
  components: [
10997
- { name: "name", type: "string", internalType: "string" },
10998
- { name: "symbol", type: "string", internalType: "string" },
10999
- { name: "tokenUri", type: "string", internalType: "string" },
10991
+ { internalType: "string", name: "name", type: "string" },
10992
+ { internalType: "string", name: "symbol", type: "string" },
10993
+ { internalType: "string", name: "tokenUri", type: "string" },
11000
10994
  {
10995
+ internalType: "uint256",
11001
10996
  name: "initialTokenFairLaunch",
11002
10997
  type: "uint256",
11003
- internalType: "uint256",
11004
10998
  },
11005
10999
  {
11000
+ internalType: "uint256",
11006
11001
  name: "fairLaunchDuration",
11007
11002
  type: "uint256",
11008
- internalType: "uint256",
11009
11003
  },
11004
+ { internalType: "uint256", name: "premineAmount", type: "uint256" },
11005
+ { internalType: "address", name: "creator", type: "address" },
11010
11006
  {
11011
- name: "premineAmount",
11012
- type: "uint256",
11013
- internalType: "uint256",
11014
- },
11015
- { name: "creator", type: "address", internalType: "address" },
11016
- {
11007
+ internalType: "uint24",
11017
11008
  name: "creatorFeeAllocation",
11018
11009
  type: "uint24",
11019
- internalType: "uint24",
11020
- },
11021
- {
11022
- name: "flaunchAt",
11023
- type: "uint256",
11024
- internalType: "uint256",
11025
- },
11026
- {
11027
- name: "initialPriceParams",
11028
- type: "bytes",
11029
- internalType: "bytes",
11030
- },
11031
- {
11032
- name: "feeCalculatorParams",
11033
- type: "bytes",
11034
- internalType: "bytes",
11035
- },
11036
- ],
11037
- },
11038
- {
11039
- name: "_whitelistParams",
11040
- type: "tuple",
11041
- internalType: "struct FlaunchZap.WhitelistParams",
11042
- components: [
11043
- {
11044
- name: "merkleRoot",
11045
- type: "bytes32",
11046
- internalType: "bytes32",
11047
- },
11048
- {
11049
- name: "merkleIPFSHash",
11050
- type: "string",
11051
- internalType: "string",
11052
- },
11053
- {
11054
- name: "maxTokens",
11055
- type: "uint256",
11056
- internalType: "uint256",
11057
- },
11058
- ],
11059
- },
11060
- {
11061
- name: "_airdropParams",
11062
- type: "tuple",
11063
- internalType: "struct FlaunchZap.AirdropParams",
11064
- components: [
11065
- {
11066
- name: "airdropIndex",
11067
- type: "uint256",
11068
- internalType: "uint256",
11069
- },
11070
- {
11071
- name: "airdropAmount",
11072
- type: "uint256",
11073
- internalType: "uint256",
11074
- },
11075
- {
11076
- name: "airdropEndTime",
11077
- type: "uint256",
11078
- internalType: "uint256",
11079
- },
11080
- {
11081
- name: "merkleRoot",
11082
- type: "bytes32",
11083
- internalType: "bytes32",
11084
- },
11085
- {
11086
- name: "merkleIPFSHash",
11087
- type: "string",
11088
- internalType: "string",
11089
11010
  },
11011
+ { internalType: "uint256", name: "flaunchAt", type: "uint256" },
11012
+ { internalType: "bytes", name: "initialPriceParams", type: "bytes" },
11013
+ { internalType: "bytes", name: "feeCalculatorParams", type: "bytes" },
11090
11014
  ],
11091
- },
11092
- {
11093
- name: "_treasuryManagerParams",
11015
+ internalType: "struct PositionManager.FlaunchParams",
11016
+ name: "_flaunchParams",
11094
11017
  type: "tuple",
11095
- internalType: "struct FlaunchZap.TreasuryManagerParams",
11096
- components: [
11097
- { name: "manager", type: "address", internalType: "address" },
11098
- {
11099
- name: "permissions",
11100
- type: "address",
11101
- internalType: "address",
11102
- },
11103
- {
11104
- name: "initializeData",
11105
- type: "bytes",
11106
- internalType: "bytes",
11107
- },
11108
- { name: "depositData", type: "bytes", internalType: "bytes" },
11109
- ],
11110
11018
  },
11019
+ { internalType: "bytes", name: "_premineSwapHookData", type: "bytes" },
11111
11020
  ],
11021
+ name: "flaunch",
11112
11022
  outputs: [
11113
- { name: "memecoin_", type: "address", internalType: "address" },
11114
- { name: "ethSpent_", type: "uint256", internalType: "uint256" },
11115
- {
11116
- name: "deployedManager_",
11117
- type: "address",
11118
- internalType: "address",
11119
- },
11023
+ { internalType: "address", name: "memecoin_", type: "address" },
11024
+ { internalType: "uint256", name: "ethSpent_", type: "uint256" },
11025
+ { internalType: "address", name: "", type: "address" },
11120
11026
  ],
11121
11027
  stateMutability: "payable",
11028
+ type: "function",
11122
11029
  },
11123
11030
  {
11124
- type: "function",
11125
- name: "flaunchContract",
11126
11031
  inputs: [],
11127
- outputs: [{ name: "", type: "address", internalType: "contract Flaunch" }],
11032
+ name: "flaunchContract",
11033
+ outputs: [{ internalType: "contract Flaunch", name: "", type: "address" }],
11128
11034
  stateMutability: "view",
11035
+ type: "function",
11129
11036
  },
11130
11037
  {
11131
- type: "function",
11132
- name: "merkleAirdrop",
11133
11038
  inputs: [],
11039
+ name: "merkleAirdrop",
11134
11040
  outputs: [
11135
- {
11136
- name: "",
11137
- type: "address",
11138
- internalType: "contract IMerkleAirdrop",
11139
- },
11041
+ { internalType: "contract IMerkleAirdrop", name: "", type: "address" },
11140
11042
  ],
11141
11043
  stateMutability: "view",
11044
+ type: "function",
11142
11045
  },
11143
11046
  {
11144
- type: "function",
11145
- name: "poolSwap",
11146
11047
  inputs: [],
11147
- outputs: [{ name: "", type: "address", internalType: "contract PoolSwap" }],
11048
+ name: "poolSwap",
11049
+ outputs: [{ internalType: "contract PoolSwap", name: "", type: "address" }],
11148
11050
  stateMutability: "view",
11051
+ type: "function",
11149
11052
  },
11150
11053
  {
11151
- type: "function",
11152
- name: "positionManager",
11153
11054
  inputs: [],
11055
+ name: "positionManager",
11154
11056
  outputs: [
11155
- {
11156
- name: "",
11157
- type: "address",
11158
- internalType: "contract PositionManager",
11159
- },
11057
+ { internalType: "contract PositionManager", name: "", type: "address" },
11160
11058
  ],
11161
11059
  stateMutability: "view",
11060
+ type: "function",
11162
11061
  },
11163
11062
  {
11164
- type: "function",
11165
- name: "treasuryManagerFactory",
11166
11063
  inputs: [],
11064
+ name: "treasuryManagerFactory",
11167
11065
  outputs: [
11168
11066
  {
11067
+ internalType: "contract ITreasuryManagerFactory",
11169
11068
  name: "",
11170
11069
  type: "address",
11171
- internalType: "contract ITreasuryManagerFactory",
11172
11070
  },
11173
11071
  ],
11174
11072
  stateMutability: "view",
11073
+ type: "function",
11175
11074
  },
11176
11075
  {
11177
- type: "function",
11178
- name: "whitelistFairLaunch",
11179
11076
  inputs: [],
11077
+ name: "whitelistFairLaunch",
11180
11078
  outputs: [
11181
11079
  {
11080
+ internalType: "contract WhitelistFairLaunch",
11182
11081
  name: "",
11183
11082
  type: "address",
11184
- internalType: "contract WhitelistFairLaunch",
11185
11083
  },
11186
11084
  ],
11187
11085
  stateMutability: "view",
11086
+ type: "function",
11188
11087
  },
11189
- { type: "error", name: "CreatorCannotBeZero", inputs: [] },
11190
- { type: "error", name: "InsufficientMemecoinsForAirdrop", inputs: [] },
11088
+ { stateMutability: "payable", type: "receive" },
11191
11089
  ];
11192
11090
 
11193
11091
  /**
@@ -11197,7 +11095,7 @@ exports.FlaunchVersion = void 0;
11197
11095
  (function (FlaunchVersion) {
11198
11096
  FlaunchVersion["V1"] = "V1";
11199
11097
  FlaunchVersion["V1_1"] = "V1_1";
11200
- FlaunchVersion["V1_1_1"] = "V1_1_1";
11098
+ FlaunchVersion["V1_2"] = "V1_2";
11201
11099
  FlaunchVersion["ANY"] = "ANY";
11202
11100
  })(exports.FlaunchVersion || (exports.FlaunchVersion = {}));
11203
11101
  /**
@@ -13177,6 +13075,36 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13177
13075
  initializeData: "0x",
13178
13076
  depositData: "0x",
13179
13077
  };
13078
+ const feeCalculatorParams = params.trustedSignerSettings
13079
+ ? viem.encodeAbiParameters([
13080
+ { type: "bool", name: "enabled" },
13081
+ { type: "uint256", name: "walletCap" },
13082
+ { type: "uint256", name: "txCap" },
13083
+ ], [
13084
+ params.trustedSignerSettings.enabled,
13085
+ params.trustedSignerSettings.walletCap ?? 0n,
13086
+ params.trustedSignerSettings.txCap ?? 0n,
13087
+ ])
13088
+ : "0x";
13089
+ const _premineSwapHookData = params.trustedSignerSettings?.enabled
13090
+ ? viem.encodeAbiParameters([
13091
+ { type: "address", name: "referrer" },
13092
+ {
13093
+ type: "tuple",
13094
+ components: [
13095
+ { type: "uint256", name: "deadline" },
13096
+ { type: "bytes", name: "signature" },
13097
+ ],
13098
+ },
13099
+ ], [
13100
+ viem.zeroAddress,
13101
+ {
13102
+ deadline: BigInt(params.trustedSignerSettings.premineSignedMessage?.deadline ?? 0),
13103
+ signature: params.trustedSignerSettings.premineSignedMessage?.signature ??
13104
+ "0x",
13105
+ },
13106
+ ])
13107
+ : "0x";
13180
13108
  return this.contract.write("flaunch", {
13181
13109
  _flaunchParams: {
13182
13110
  name: params.name,
@@ -13189,8 +13117,9 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13189
13117
  creatorFeeAllocation: creatorFeeAllocationInBps,
13190
13118
  flaunchAt: params.flaunchAt ?? 0n,
13191
13119
  initialPriceParams,
13192
- feeCalculatorParams: "0x",
13120
+ feeCalculatorParams,
13193
13121
  },
13122
+ _premineSwapHookData,
13194
13123
  _treasuryManagerParams: {
13195
13124
  ..._treasuryManagerParams,
13196
13125
  permissions: getPermissionsAddress(_treasuryManagerParams.permissions, this.chainId),
@@ -13239,53 +13168,14 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13239
13168
  * @returns Transaction response for the flaunch creation
13240
13169
  */
13241
13170
  async flaunchWithRevenueManager(params) {
13242
- const initialMCapInUSDCWei = viem.parseUnits(params.initialMarketCapUSD.toString(), 6);
13243
- const initialPriceParams = viem.encodeAbiParameters([
13244
- {
13245
- type: "uint256",
13246
- },
13247
- ], [initialMCapInUSDCWei]);
13248
- const fairLaunchInBps = BigInt(params.fairLaunchPercent * 100);
13249
- const creatorFeeAllocationInBps = params.creatorFeeAllocationPercent * 100;
13250
- const ethRequired = await this.ethRequiredToFlaunch({
13251
- premineAmount: params.premineAmount ?? 0n,
13252
- initialPriceParams,
13253
- slippagePercent: 5,
13254
- });
13255
- return this.contract.write("flaunch", {
13256
- _flaunchParams: {
13257
- name: params.name,
13258
- symbol: params.symbol,
13259
- tokenUri: params.tokenUri,
13260
- initialTokenFairLaunch: (this.TOTAL_SUPPLY * fairLaunchInBps) / 10000n,
13261
- fairLaunchDuration: BigInt(params.fairLaunchDuration),
13262
- premineAmount: params.premineAmount ?? 0n,
13263
- creator: params.creator,
13264
- creatorFeeAllocation: creatorFeeAllocationInBps,
13265
- flaunchAt: params.flaunchAt ?? 0n,
13266
- initialPriceParams,
13267
- feeCalculatorParams: "0x",
13268
- },
13269
- _treasuryManagerParams: {
13171
+ return this.flaunch({
13172
+ ...params,
13173
+ treasuryManagerParams: {
13270
13174
  manager: params.revenueManagerInstanceAddress,
13271
- permissions: getPermissionsAddress(params.treasuryManagerParams?.permissions ?? exports.Permissions.OPEN, this.chainId),
13175
+ permissions: params.treasuryManagerParams?.permissions ?? exports.Permissions.OPEN,
13272
13176
  initializeData: "0x",
13273
13177
  depositData: "0x",
13274
13178
  },
13275
- _whitelistParams: {
13276
- merkleRoot: viem.zeroHash,
13277
- merkleIPFSHash: "",
13278
- maxTokens: 0n,
13279
- },
13280
- _airdropParams: {
13281
- airdropIndex: 0n,
13282
- airdropAmount: 0n,
13283
- airdropEndTime: 0n,
13284
- merkleRoot: viem.zeroHash,
13285
- merkleIPFSHash: "",
13286
- },
13287
- }, {
13288
- value: ethRequired,
13289
13179
  });
13290
13180
  }
13291
13181
  /**
@@ -13323,19 +13213,6 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13323
13213
  * @returns Transaction response for the flaunch creation
13324
13214
  */
13325
13215
  async flaunchWithSplitManager(params) {
13326
- const initialMCapInUSDCWei = viem.parseUnits(params.initialMarketCapUSD.toString(), 6);
13327
- const initialPriceParams = viem.encodeAbiParameters([
13328
- {
13329
- type: "uint256",
13330
- },
13331
- ], [initialMCapInUSDCWei]);
13332
- const fairLaunchInBps = BigInt(params.fairLaunchPercent * 100);
13333
- const creatorFeeAllocationInBps = params.creatorFeeAllocationPercent * 100;
13334
- const ethRequired = await this.ethRequiredToFlaunch({
13335
- premineAmount: params.premineAmount ?? 0n,
13336
- initialPriceParams,
13337
- slippagePercent: 5,
13338
- });
13339
13216
  const VALID_SHARE_TOTAL = 10000000n; // 5 decimals as BigInt
13340
13217
  let creatorShare = (BigInt(params.creatorSplitPercent) * VALID_SHARE_TOTAL) / 100n;
13341
13218
  const recipientShares = params.splitReceivers.map((receiver) => {
@@ -13370,40 +13247,14 @@ class ReadWriteFlaunchZap extends ReadFlaunchZap {
13370
13247
  recipientShares,
13371
13248
  },
13372
13249
  ]);
13373
- return this.contract.write("flaunch", {
13374
- _flaunchParams: {
13375
- name: params.name,
13376
- symbol: params.symbol,
13377
- tokenUri: params.tokenUri,
13378
- initialTokenFairLaunch: (this.TOTAL_SUPPLY * fairLaunchInBps) / 10000n,
13379
- fairLaunchDuration: BigInt(params.fairLaunchDuration),
13380
- premineAmount: params.premineAmount ?? 0n,
13381
- creator: params.creator,
13382
- creatorFeeAllocation: creatorFeeAllocationInBps,
13383
- flaunchAt: params.flaunchAt ?? 0n,
13384
- initialPriceParams,
13385
- feeCalculatorParams: "0x",
13386
- },
13387
- _treasuryManagerParams: {
13250
+ return this.flaunch({
13251
+ ...params,
13252
+ treasuryManagerParams: {
13388
13253
  manager: AddressFeeSplitManagerAddress[this.chainId],
13389
- permissions: getPermissionsAddress(params.treasuryManagerParams?.permissions ?? exports.Permissions.OPEN, this.chainId),
13254
+ permissions: params.treasuryManagerParams?.permissions ?? exports.Permissions.OPEN,
13390
13255
  initializeData,
13391
13256
  depositData: "0x",
13392
13257
  },
13393
- _whitelistParams: {
13394
- merkleRoot: viem.zeroHash,
13395
- merkleIPFSHash: "",
13396
- maxTokens: 0n,
13397
- },
13398
- _airdropParams: {
13399
- airdropIndex: 0n,
13400
- airdropAmount: 0n,
13401
- airdropEndTime: 0n,
13402
- merkleRoot: viem.zeroHash,
13403
- merkleIPFSHash: "",
13404
- },
13405
- }, {
13406
- value: ethRequired,
13407
13258
  });
13408
13259
  }
13409
13260
  /**
@@ -15756,7 +15607,7 @@ class ReadWritePermit2 extends ReadPermit2 {
15756
15607
  }
15757
15608
  }
15758
15609
 
15759
- const FlaunchPositionManagerV1_1_1Abi = [
15610
+ const FlaunchPositionManagerV1_2Abi = [
15760
15611
  {
15761
15612
  inputs: [
15762
15613
  {
@@ -17310,7 +17161,7 @@ const FlaunchPositionManagerV1_1_1Abi = [
17310
17161
  { stateMutability: "payable", type: "receive" },
17311
17162
  ];
17312
17163
 
17313
- class ReadFlaunchPositionManagerV1_1_1 {
17164
+ class ReadFlaunchPositionManagerV1_2 {
17314
17165
  constructor(address, drift$1 = drift.createDrift()) {
17315
17166
  this.TOTAL_SUPPLY = 100n * 10n ** 27n; // 100 Billion tokens in wei
17316
17167
  this.drift = drift$1;
@@ -17318,7 +17169,7 @@ class ReadFlaunchPositionManagerV1_1_1 {
17318
17169
  throw new Error("Address is required");
17319
17170
  }
17320
17171
  this.contract = drift$1.contract({
17321
- abi: FlaunchPositionManagerV1_1_1Abi,
17172
+ abi: FlaunchPositionManagerV1_2Abi,
17322
17173
  address,
17323
17174
  });
17324
17175
  }
@@ -19533,7 +19384,15 @@ class ReadWriteTokenImporter extends ReadTokenImporter {
19533
19384
  constructor(chainId, address, drift$1 = drift.createDrift()) {
19534
19385
  super(chainId, address, drift$1);
19535
19386
  }
19536
- async initialize({ memecoin, creatorFeeAllocationPercent, initialMarketCapUSD, verifier, }) {
19387
+ async initialize({ coinAddress, creatorFeeAllocationPercent, initialMarketCapUSD, verifier, }) {
19388
+ return this.contract.write("initialize", await this.getInitializeParams({
19389
+ memecoin: coinAddress,
19390
+ creatorFeeAllocationPercent,
19391
+ initialMarketCapUSD,
19392
+ verifier,
19393
+ }));
19394
+ }
19395
+ async getInitializeParams({ memecoin, creatorFeeAllocationPercent, initialMarketCapUSD, verifier, }) {
19537
19396
  const initialMCapInUSDCWei = viem.parseUnits(initialMarketCapUSD.toString(), 6);
19538
19397
  const creatorFeeAllocationInBps = creatorFeeAllocationPercent * 100;
19539
19398
  // Passing in the verifier here, as drift doesn't recognize the other initialize function without the verifier param
@@ -19542,12 +19401,12 @@ class ReadWriteTokenImporter extends ReadTokenImporter {
19542
19401
  : await this.contract.read("verifyMemecoin", {
19543
19402
  _memecoin: memecoin,
19544
19403
  });
19545
- return this.contract.write("initialize", {
19404
+ return {
19546
19405
  _memecoin: memecoin,
19547
19406
  _creatorFeeAllocation: creatorFeeAllocationInBps,
19548
19407
  _initialMarketCap: initialMCapInUSDCWei,
19549
19408
  _verifier,
19550
- });
19409
+ };
19551
19410
  }
19552
19411
  }
19553
19412
 
@@ -21884,7 +21743,7 @@ class ReadFlaunchV1_1 {
21884
21743
  }
21885
21744
  }
21886
21745
 
21887
- const FlaunchV1_1_1Abi = [
21746
+ const FlaunchV1_2Abi = [
21888
21747
  {
21889
21748
  inputs: [
21890
21749
  {
@@ -22580,7 +22439,7 @@ const FlaunchV1_1_1Abi = [
22580
22439
  * Provides methods to query token IDs and metadata URIs
22581
22440
  * Enhanced version of the V1 contract with additional features
22582
22441
  */
22583
- class ReadFlaunchV1_1_1 {
22442
+ class ReadFlaunchV1_2 {
22584
22443
  /**
22585
22444
  * Creates a new ReadFlaunchV1_1 instance
22586
22445
  * @param address - The address of the Flaunch V1.1 contract
@@ -22592,7 +22451,7 @@ class ReadFlaunchV1_1_1 {
22592
22451
  throw new Error("Address is required");
22593
22452
  }
22594
22453
  this.contract = drift$1.contract({
22595
- abi: FlaunchV1_1_1Abi,
22454
+ abi: FlaunchV1_2Abi,
22596
22455
  address,
22597
22456
  });
22598
22457
  }
@@ -24797,7 +24656,7 @@ class ReadFlaunchSDK {
24797
24656
  this.resolveIPFS = resolveIPFS;
24798
24657
  this.readPositionManager = new ReadFlaunchPositionManager(FlaunchPositionManagerAddress[this.chainId], drift$1);
24799
24658
  this.readPositionManagerV1_1 = new ReadFlaunchPositionManagerV1_1(FlaunchPositionManagerV1_1Address[this.chainId], drift$1);
24800
- this.readPositionManagerV1_1_1 = new ReadFlaunchPositionManagerV1_1_1(FlaunchPositionManagerV1_1_1Address[this.chainId], drift$1);
24659
+ this.readPositionManagerV1_2 = new ReadFlaunchPositionManagerV1_2(FlaunchPositionManagerV1_2Address[this.chainId], drift$1);
24801
24660
  this.readAnyPositionManager = new ReadAnyPositionManager(AnyPositionManagerAddress[this.chainId], drift$1);
24802
24661
  this.readTokenImporter = new ReadTokenImporter(this.chainId, TokenImporterAddress[this.chainId], drift$1);
24803
24662
  this.readFeeEscrow = new ReadFeeEscrow(FeeEscrowAddress[this.chainId], drift$1);
@@ -24812,7 +24671,7 @@ class ReadFlaunchSDK {
24812
24671
  this.readAnyBidWall = new AnyBidWall(AnyBidWallAddress[this.chainId], drift$1);
24813
24672
  this.readFlaunch = new ReadFlaunch(FlaunchAddress[this.chainId], drift$1);
24814
24673
  this.readFlaunchV1_1 = new ReadFlaunchV1_1(FlaunchV1_1Address[this.chainId], drift$1);
24815
- this.readFlaunchV1_1_1 = new ReadFlaunchV1_1_1(FlaunchV1_1_1Address[this.chainId], drift$1);
24674
+ this.readFlaunchV1_2 = new ReadFlaunchV1_2(FlaunchV1_2Address[this.chainId], drift$1);
24816
24675
  this.readQuoter = new ReadQuoter(this.chainId, QuoterAddress[this.chainId], drift$1);
24817
24676
  this.readPermit2 = new ReadPermit2(Permit2Address[this.chainId], drift$1);
24818
24677
  }
@@ -24822,7 +24681,7 @@ class ReadFlaunchSDK {
24822
24681
  * @returns Promise<boolean> - True if the coin is valid, false otherwise
24823
24682
  */
24824
24683
  async isValidCoin(coinAddress) {
24825
- return ((await this.readPositionManagerV1_1_1.isValidCoin(coinAddress)) ||
24684
+ return ((await this.readPositionManagerV1_2.isValidCoin(coinAddress)) ||
24826
24685
  (await this.readPositionManagerV1_1.isValidCoin(coinAddress)) ||
24827
24686
  (await this.readPositionManager.isValidCoin(coinAddress)) ||
24828
24687
  (await this.readAnyPositionManager.isValidCoin(coinAddress)));
@@ -24833,8 +24692,8 @@ class ReadFlaunchSDK {
24833
24692
  * @returns Promise<FlaunchVersion> - The version of the coin
24834
24693
  */
24835
24694
  async getCoinVersion(coinAddress) {
24836
- if (await this.readPositionManagerV1_1_1.isValidCoin(coinAddress)) {
24837
- return exports.FlaunchVersion.V1_1_1;
24695
+ if (await this.readPositionManagerV1_2.isValidCoin(coinAddress)) {
24696
+ return exports.FlaunchVersion.V1_2;
24838
24697
  }
24839
24698
  else if (await this.readPositionManagerV1_1.isValidCoin(coinAddress)) {
24840
24699
  return exports.FlaunchVersion.V1_1;
@@ -24857,12 +24716,12 @@ class ReadFlaunchSDK {
24857
24716
  return this.readPositionManager;
24858
24717
  case exports.FlaunchVersion.V1_1:
24859
24718
  return this.readPositionManagerV1_1;
24860
- case exports.FlaunchVersion.V1_1_1:
24861
- return this.readPositionManagerV1_1_1;
24719
+ case exports.FlaunchVersion.V1_2:
24720
+ return this.readPositionManagerV1_2;
24862
24721
  case exports.FlaunchVersion.ANY:
24863
24722
  return this.readAnyPositionManager;
24864
24723
  default:
24865
- return this.readPositionManagerV1_1_1;
24724
+ return this.readPositionManagerV1_2;
24866
24725
  }
24867
24726
  }
24868
24727
  /**
@@ -24875,7 +24734,7 @@ class ReadFlaunchSDK {
24875
24734
  return this.readFairLaunch;
24876
24735
  case exports.FlaunchVersion.V1_1:
24877
24736
  return this.readFairLaunchV1_1;
24878
- case exports.FlaunchVersion.V1_1_1:
24737
+ case exports.FlaunchVersion.V1_2:
24879
24738
  return this.readFairLaunchV1_1;
24880
24739
  case exports.FlaunchVersion.ANY:
24881
24740
  return this.readFairLaunchV1_1;
@@ -24893,7 +24752,7 @@ class ReadFlaunchSDK {
24893
24752
  return this.readBidWall;
24894
24753
  case exports.FlaunchVersion.V1_1:
24895
24754
  return this.readBidWallV1_1;
24896
- case exports.FlaunchVersion.V1_1_1:
24755
+ case exports.FlaunchVersion.V1_2:
24897
24756
  return this.readBidWallV1_1;
24898
24757
  case exports.FlaunchVersion.ANY:
24899
24758
  return this.readAnyBidWall;
@@ -24911,8 +24770,8 @@ class ReadFlaunchSDK {
24911
24770
  return this.readFlaunch.contract.address;
24912
24771
  case exports.FlaunchVersion.V1_1:
24913
24772
  return this.readFlaunchV1_1.contract.address;
24914
- case exports.FlaunchVersion.V1_1_1:
24915
- return this.readFlaunchV1_1_1.contract.address;
24773
+ case exports.FlaunchVersion.V1_2:
24774
+ return this.readFlaunchV1_2.contract.address;
24916
24775
  case exports.FlaunchVersion.ANY:
24917
24776
  return this.readFlaunchV1_1.contract.address;
24918
24777
  default:
@@ -25589,11 +25448,75 @@ class ReadFlaunchSDK {
25589
25448
  tokenImporterVerifyMemecoin(memecoin) {
25590
25449
  return this.readTokenImporter.verifyMemecoin(memecoin);
25591
25450
  }
25592
- async calculateAddLiquidityTicks({ coinAddress, liquidityMode, minMarketCap, maxMarketCap, }) {
25451
+ /**
25452
+ * Gets basic coin information (total supply and decimals)
25453
+ */
25454
+ async getCoinInfo(coinAddress) {
25593
25455
  const memecoin = new ReadMemecoin(coinAddress, this.drift);
25594
- const coinTotalSupply = await memecoin.totalSupply();
25595
- const coinDecimals = await memecoin.decimals();
25456
+ const [totalSupply, decimals] = await Promise.all([
25457
+ memecoin.totalSupply(),
25458
+ memecoin.decimals(),
25459
+ ]);
25460
+ return { totalSupply, decimals };
25461
+ }
25462
+ /**
25463
+ * Gets market context information needed for tick calculations
25464
+ */
25465
+ async getMarketContext(coinAddress, coinDecimals) {
25466
+ const ethUsdPrice = await this.getETHUSDCPrice();
25467
+ const isFlethZero = this.flETHIsCurrencyZero(coinAddress);
25468
+ const flETHDecimals = 18; // flETH has 18 decimals
25469
+ // Determine decimals based on token ordering
25470
+ const decimals0 = isFlethZero ? flETHDecimals : coinDecimals;
25471
+ const decimals1 = isFlethZero ? coinDecimals : flETHDecimals;
25472
+ return {
25473
+ ethUsdPrice,
25474
+ isFlethZero,
25475
+ decimals0,
25476
+ decimals1,
25477
+ };
25478
+ }
25479
+ /**
25480
+ * Converts market cap in USD to token price in ETH
25481
+ */
25482
+ marketCapToTokenPriceEth(marketCapUsd, totalSupplyDecimal, ethUsdPrice) {
25483
+ const tokenPriceUsd = marketCapUsd / totalSupplyDecimal;
25484
+ return tokenPriceUsd / ethUsdPrice;
25485
+ }
25486
+ /**
25487
+ * Converts token price in ETH to tick
25488
+ */
25489
+ convertPriceToTick(priceEth, isFlethZero, decimals0, decimals1) {
25490
+ return priceRatioToTick({
25491
+ priceInput: priceEth.toString(),
25492
+ isDirection1Per0: !isFlethZero,
25493
+ decimals0,
25494
+ decimals1,
25495
+ spacing: TICK_SPACING,
25496
+ });
25497
+ }
25498
+ /**
25499
+ * Calculates current tick from market cap if provided
25500
+ */
25501
+ calculateCurrentTickFromMarketCap(currentMarketCap, totalSupplyDecimal, marketContext) {
25502
+ if (!currentMarketCap) {
25503
+ return undefined;
25504
+ }
25505
+ const currentMarketCapNum = parseFloat(currentMarketCap);
25506
+ const currentTokenPriceEth = this.marketCapToTokenPriceEth(currentMarketCapNum, totalSupplyDecimal, marketContext.ethUsdPrice);
25507
+ return this.convertPriceToTick(currentTokenPriceEth, marketContext.isFlethZero, marketContext.decimals0, marketContext.decimals1);
25508
+ }
25509
+ async calculateAddLiquidityTicks({ coinAddress, liquidityMode, minMarketCap, maxMarketCap, currentMarketCap, }) {
25510
+ // Get coin information
25511
+ const { totalSupply: coinTotalSupply, decimals: coinDecimals } = await this.getCoinInfo(coinAddress);
25512
+ // Convert total supply to decimal format
25513
+ const totalSupplyDecimal = parseFloat(viem.formatEther(coinTotalSupply));
25596
25514
  if (liquidityMode === exports.LiquidityMode.FULL_RANGE) {
25515
+ let currentTick;
25516
+ if (currentMarketCap) {
25517
+ const marketContext = await this.getMarketContext(coinAddress, coinDecimals);
25518
+ currentTick = this.calculateCurrentTickFromMarketCap(currentMarketCap, totalSupplyDecimal, marketContext);
25519
+ }
25597
25520
  return {
25598
25521
  tickLower: getNearestUsableTick({
25599
25522
  tick: TickFinder.MIN_TICK,
@@ -25603,13 +25526,14 @@ class ReadFlaunchSDK {
25603
25526
  tick: TickFinder.MAX_TICK,
25604
25527
  tickSpacing: TICK_SPACING,
25605
25528
  }),
25529
+ currentTick,
25606
25530
  coinTotalSupply,
25607
25531
  coinDecimals,
25608
25532
  };
25609
25533
  }
25610
25534
  else {
25611
- const ethUsdPrice = await this.getETHUSDCPrice();
25612
- const isFlethZero = this.flETHIsCurrencyZero(coinAddress);
25535
+ // Get market context
25536
+ const marketContext = await this.getMarketContext(coinAddress, coinDecimals);
25613
25537
  const minMarketCapNum = parseFloat(minMarketCap);
25614
25538
  const maxMarketCapNum = parseFloat(maxMarketCap);
25615
25539
  if (minMarketCapNum <= 0 ||
@@ -25617,59 +25541,44 @@ class ReadFlaunchSDK {
25617
25541
  minMarketCapNum >= maxMarketCapNum) {
25618
25542
  throw new Error("[ReadFlaunchSDK.addLiquidityCalculateTicks]: Invalid market cap range");
25619
25543
  }
25620
- // Convert total supply to decimal format
25621
- const totalSupplyDecimal = parseFloat(viem.formatEther(coinTotalSupply));
25622
- // Calculate token price in USD at min and max market caps
25623
- const minTokenPriceUsd = minMarketCapNum / totalSupplyDecimal;
25624
- const maxTokenPriceUsd = maxMarketCapNum / totalSupplyDecimal;
25625
- // Convert to token price in ETH
25626
- const minTokenPriceEth = minTokenPriceUsd / ethUsdPrice;
25627
- const maxTokenPriceEth = maxTokenPriceUsd / ethUsdPrice;
25628
- const flETHDecimals = 18; // flETH has 18 decimals
25629
- // Determine decimals based on token ordering
25630
- const decimals0 = isFlethZero ? flETHDecimals : coinDecimals;
25631
- const decimals1 = isFlethZero ? coinDecimals : flETHDecimals;
25632
- // Convert to ticks using proper price direction handling
25633
- const minTick = priceRatioToTick({
25634
- priceInput: minTokenPriceEth.toString(),
25635
- isDirection1Per0: !isFlethZero,
25636
- decimals0,
25637
- decimals1,
25638
- spacing: TICK_SPACING,
25639
- });
25640
- const maxTick = priceRatioToTick({
25641
- priceInput: maxTokenPriceEth.toString(),
25642
- isDirection1Per0: !isFlethZero,
25643
- decimals0,
25644
- decimals1,
25645
- spacing: TICK_SPACING,
25646
- });
25544
+ // Convert market caps to token prices in ETH
25545
+ const minTokenPriceEth = this.marketCapToTokenPriceEth(minMarketCapNum, totalSupplyDecimal, marketContext.ethUsdPrice);
25546
+ const maxTokenPriceEth = this.marketCapToTokenPriceEth(maxMarketCapNum, totalSupplyDecimal, marketContext.ethUsdPrice);
25547
+ // Convert to ticks
25548
+ const minTick = this.convertPriceToTick(minTokenPriceEth, marketContext.isFlethZero, marketContext.decimals0, marketContext.decimals1);
25549
+ const maxTick = this.convertPriceToTick(maxTokenPriceEth, marketContext.isFlethZero, marketContext.decimals0, marketContext.decimals1);
25550
+ // Calculate current tick if provided
25551
+ const currentTick = this.calculateCurrentTickFromMarketCap(currentMarketCap, totalSupplyDecimal, marketContext);
25647
25552
  return {
25648
25553
  tickLower: Math.min(minTick, maxTick),
25649
25554
  tickUpper: Math.max(minTick, maxTick),
25555
+ currentTick,
25650
25556
  coinTotalSupply,
25651
25557
  coinDecimals,
25652
25558
  };
25653
25559
  }
25654
25560
  }
25655
- async calculateAddLiquidityAmounts({ coinAddress, liquidityMode, coinOrEthInputAmount, inputToken, minMarketCap, maxMarketCap, }) {
25656
- const { tickLower, tickUpper } = await this.calculateAddLiquidityTicks({
25561
+ async calculateAddLiquidityAmounts({ coinAddress, liquidityMode, coinOrEthInputAmount, inputToken, minMarketCap, maxMarketCap, currentMarketCap, }) {
25562
+ let { tickLower, tickUpper, currentTick } = await this.calculateAddLiquidityTicks({
25657
25563
  coinAddress,
25658
25564
  liquidityMode,
25659
25565
  minMarketCap,
25660
25566
  maxMarketCap,
25567
+ currentMarketCap,
25661
25568
  });
25662
- // get the current pool state for AnyPositionManager pool for the coin
25663
- const poolState = await this.readStateView.poolSlot0({
25664
- poolId: getPoolId(orderPoolKey({
25665
- currency0: coinAddress,
25666
- currency1: FLETHAddress[this.chainId],
25667
- fee: 0,
25668
- tickSpacing: TICK_SPACING,
25669
- hooks: AnyPositionManagerAddress[this.chainId],
25670
- })),
25671
- });
25672
- const currentTick = poolState.tick;
25569
+ if (!currentTick) {
25570
+ // get the current pool state for AnyPositionManager pool for the coin
25571
+ const poolState = await this.readStateView.poolSlot0({
25572
+ poolId: getPoolId(orderPoolKey({
25573
+ currency0: coinAddress,
25574
+ currency1: FLETHAddress[this.chainId],
25575
+ fee: 0,
25576
+ tickSpacing: TICK_SPACING,
25577
+ hooks: AnyPositionManagerAddress[this.chainId],
25578
+ })),
25579
+ });
25580
+ currentTick = poolState.tick;
25581
+ }
25673
25582
  // Determine currency ordering
25674
25583
  const isFlETHCurrency0 = this.flETHIsCurrencyZero(coinAddress);
25675
25584
  try {
@@ -25760,6 +25669,25 @@ class ReadFlaunchSDK {
25760
25669
  throw error;
25761
25670
  }
25762
25671
  }
25672
+ /**
25673
+ * Checks if an external memecoin has been imported to Flaunch
25674
+ * @param memecoin - The address of the memecoin to check
25675
+ * @returns Promise<boolean> - True if the memecoin has been imported
25676
+ */
25677
+ async isMemecoinImported(memecoin) {
25678
+ const poolKey = orderPoolKey({
25679
+ currency0: memecoin,
25680
+ currency1: FLETHAddress[this.chainId],
25681
+ fee: 0,
25682
+ tickSpacing: TICK_SPACING,
25683
+ hooks: AnyPositionManagerAddress[this.chainId],
25684
+ });
25685
+ // check if pool's sqrtPriceX96 is not 0
25686
+ const poolState = await this.readStateView.poolSlot0({
25687
+ poolId: getPoolId(poolKey),
25688
+ });
25689
+ return poolState.sqrtPriceX96 !== 0n;
25690
+ }
25763
25691
  /**
25764
25692
  * Checks if an operator is approved for all flaunch tokens of an owner
25765
25693
  * @param version - The flaunch version to determine the correct contract address
@@ -26130,7 +26058,7 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26130
26058
  }
26131
26059
  /**
26132
26060
  * Imports a memecoin into the TokenImporter
26133
- * @param params.memecoin - The address of the memecoin to import
26061
+ * @param params.coinAddress - The address of the memecoin to import
26134
26062
  * @param params.creatorFeeAllocationPercent - The creator fee allocation percentage
26135
26063
  * @param params.initialMarketCapUSD - The initial market cap in USD
26136
26064
  * @param params.verifier - Optional verifier to use for importing the memecoin
@@ -26139,6 +26067,11 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26139
26067
  importMemecoin(params) {
26140
26068
  return this.readWriteTokenImporter.initialize(params);
26141
26069
  }
26070
+ /**
26071
+ * Gets the calls needed to add liquidity to AnyPositionManager for external coins
26072
+ * @param params - Parameters for adding liquidity
26073
+ * @returns Array of calls with descriptions
26074
+ */
26142
26075
  async getAddLiquidityCalls(params) {
26143
26076
  const { coinAddress } = params;
26144
26077
  const flethAddress = FLETHAddress[this.chainId];
@@ -26161,10 +26094,15 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26161
26094
  flethAmount = params.flethAmount;
26162
26095
  tickLower = params.tickLower;
26163
26096
  tickUpper = params.tickUpper;
26164
- const poolState = await this.readStateView.poolSlot0({
26165
- poolId: getPoolId(poolKey),
26166
- });
26167
- currentTick = poolState.tick;
26097
+ if (params.currentTick) {
26098
+ currentTick = params.currentTick;
26099
+ }
26100
+ else {
26101
+ const poolState = await this.readStateView.poolSlot0({
26102
+ poolId: getPoolId(poolKey),
26103
+ });
26104
+ currentTick = poolState.tick;
26105
+ }
26168
26106
  }
26169
26107
  else {
26170
26108
  // Calculate the amounts
@@ -26175,6 +26113,9 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26175
26113
  inputToken: params.inputToken,
26176
26114
  minMarketCap: params.minMarketCap,
26177
26115
  maxMarketCap: params.maxMarketCap,
26116
+ currentMarketCap: params.initialMarketCapUSD
26117
+ ? params.initialMarketCapUSD.toString()
26118
+ : undefined,
26178
26119
  });
26179
26120
  coinAmount = calculated.coinAmount;
26180
26121
  flethAmount = calculated.ethAmount;
@@ -26380,8 +26321,8 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26380
26321
  finalAmount1 = constrainedAmounts.amount1;
26381
26322
  }
26382
26323
  // IMPORTANT: Add conservative buffer to account for contract rounding differences
26383
- // Reduce liquidity by 0.01% to ensure contract calculations stay within user bounds
26384
- const liquidityBuffer = finalLiquidity / 10000n; // 0.01%
26324
+ // Reduce liquidity by 0.05% to ensure contract calculations stay within user bounds
26325
+ const liquidityBuffer = finalLiquidity / 2000n; // 0.05%
26385
26326
  const conservativeLiquidity = finalLiquidity - (liquidityBuffer > 1n ? liquidityBuffer : 1n);
26386
26327
  // Use conservative liquidity but keep user's original amounts as maximums
26387
26328
  // The conservative liquidity ensures the contract won't need more than user provided
@@ -26476,6 +26417,28 @@ class ReadWriteFlaunchSDK extends ReadFlaunchSDK {
26476
26417
  });
26477
26418
  return calls;
26478
26419
  }
26420
+ /**
26421
+ * Gets the calls needed to import a memecoin to Flaunch and add liquidity to AnyPositionManager as a batch
26422
+ * @param params - Parameters for importing and adding liquidity
26423
+ * @returns Array of calls with descriptions
26424
+ */
26425
+ async getImportAndAddLiquidityCalls(params) {
26426
+ const importParams = await this.readWriteTokenImporter.getInitializeParams({
26427
+ memecoin: params.coinAddress,
26428
+ creatorFeeAllocationPercent: params.creatorFeeAllocationPercent,
26429
+ initialMarketCapUSD: params.initialMarketCapUSD,
26430
+ verifier: params.verifier,
26431
+ });
26432
+ const addLiquidityCalls = await this.getAddLiquidityCalls(params);
26433
+ return [
26434
+ {
26435
+ to: this.readWriteTokenImporter.contract.address,
26436
+ data: this.readWriteTokenImporter.contract.encodeFunctionData("initialize", importParams),
26437
+ description: "Import Memecoin to Flaunch",
26438
+ },
26439
+ ...addLiquidityCalls,
26440
+ ];
26441
+ }
26479
26442
  }
26480
26443
 
26481
26444
  /**
@@ -26549,11 +26512,11 @@ exports.FlaunchPositionManagerAbi = FlaunchPositionManagerAbi;
26549
26512
  exports.FlaunchPositionManagerAddress = FlaunchPositionManagerAddress;
26550
26513
  exports.FlaunchPositionManagerV1_1Abi = FlaunchPositionManagerV1_1Abi;
26551
26514
  exports.FlaunchPositionManagerV1_1Address = FlaunchPositionManagerV1_1Address;
26552
- exports.FlaunchPositionManagerV1_1_1Address = FlaunchPositionManagerV1_1_1Address;
26515
+ exports.FlaunchPositionManagerV1_2Address = FlaunchPositionManagerV1_2Address;
26553
26516
  exports.FlaunchSDK = FlaunchSDK;
26554
26517
  exports.FlaunchV1_1Abi = FlaunchV1_1Abi;
26555
26518
  exports.FlaunchV1_1Address = FlaunchV1_1Address;
26556
- exports.FlaunchV1_1_1Address = FlaunchV1_1_1Address;
26519
+ exports.FlaunchV1_2Address = FlaunchV1_2Address;
26557
26520
  exports.FlaunchZapAbi = FlaunchZapAbi;
26558
26521
  exports.FlaunchZapAddress = FlaunchZapAddress;
26559
26522
  exports.InitialPriceAbi = InitialPriceAbi;