clanker-sdk 4.2.3 → 4.2.5-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/v4/index.js CHANGED
@@ -1401,7 +1401,7 @@ var ClankerVault_Instantiation_v4_abi = [
1401
1401
 
1402
1402
  // src/config/clankerTokenV4.ts
1403
1403
  import {
1404
- encodeAbiParameters,
1404
+ encodeAbiParameters as encodeAbiParameters2,
1405
1405
  isAddressEqual,
1406
1406
  stringify,
1407
1407
  zeroAddress,
@@ -2014,11 +2014,58 @@ var POOL_POSITIONS = {
2014
2014
  positionBps: 500
2015
2015
  // 5% of LP
2016
2016
  }
2017
+ ],
2018
+ TwentyETH: [
2019
+ {
2020
+ tickLower: -223400,
2021
+ // 20 ETH (starting tick)
2022
+ tickUpper: -212e3,
2023
+ // ~$180K
2024
+ positionBps: 1e3
2025
+ // 10% of LP
2026
+ },
2027
+ {
2028
+ tickLower: -212e3,
2029
+ // ~$180K
2030
+ tickUpper: -155e3,
2031
+ // ~$50M
2032
+ positionBps: 5e3
2033
+ // 50% of LP
2034
+ },
2035
+ {
2036
+ tickLower: -201e3,
2037
+ // ~$500K
2038
+ tickUpper: -155e3,
2039
+ // ~$50M
2040
+ positionBps: 1500
2041
+ // 15% of LP
2042
+ },
2043
+ {
2044
+ tickLower: -155e3,
2045
+ // ~$50M
2046
+ tickUpper: -12e4,
2047
+ // ~$1.5B
2048
+ positionBps: 2e3
2049
+ // 20% of LP
2050
+ },
2051
+ {
2052
+ tickLower: -141e3,
2053
+ // ~$200M
2054
+ tickUpper: -12e4,
2055
+ // ~$1.5B
2056
+ positionBps: 500
2057
+ // 5% of LP
2058
+ }
2017
2059
  ]
2018
2060
  };
2019
2061
 
2020
2062
  // src/services/vanityAddress.ts
2021
- import { encodeDeployData, keccak256 } from "viem";
2063
+ import {
2064
+ encodeAbiParameters,
2065
+ encodeDeployData,
2066
+ getContractAddress,
2067
+ keccak256
2068
+ } from "viem";
2022
2069
  import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
2023
2070
 
2024
2071
  // src/abi/v3.1/ClankerToken.ts
@@ -6565,6 +6612,30 @@ var findVanityAddressV4 = async (args, admin, suffix = "0x4b07", config) => {
6565
6612
  const { address, salt } = await response.json();
6566
6613
  return { token: address, salt };
6567
6614
  };
6615
+ var predictTokenAddressV4 = (args, config, salt, tokenAdmin) => {
6616
+ const deployData = encodeDeployData({
6617
+ abi: config.token.abi,
6618
+ bytecode: config.token.bytecode,
6619
+ args
6620
+ });
6621
+ const actualSalt = keccak256(
6622
+ encodeAbiParameters(
6623
+ [
6624
+ { type: "address", name: "tokenAdmin" },
6625
+ { type: "bytes32", name: "salt" }
6626
+ ],
6627
+ [tokenAdmin, salt]
6628
+ )
6629
+ );
6630
+ const predictedAddress = getContractAddress({
6631
+ from: config.address,
6632
+ // deployer (Clanker contract)
6633
+ salt: actualSalt,
6634
+ bytecode: deployData,
6635
+ opcode: "CREATE2"
6636
+ });
6637
+ return predictedAddress;
6638
+ };
6568
6639
 
6569
6640
  // src/utils/zod-onchain.ts
6570
6641
  import { getAddress, isAddress, isHex } from "viem";
@@ -6621,6 +6692,8 @@ var clankerTokenV4 = z2.strictObject({
6621
6692
  image: z2.string().default(""),
6622
6693
  /** Id of the chain that the token will be deployed to. Defaults to base (8453). */
6623
6694
  chainId: z2.literal(Chains).default(8453),
6695
+ /** Custom salt for CREATE2 deployment. If provided, this will be used instead of vanity address generation. Takes precedence over vanity. */
6696
+ salt: hexSchema.optional(),
6624
6697
  /** Admin for the token. They will be able to change fields like image, metadata, etc. */
6625
6698
  tokenAdmin: addressSchema.refine((v) => !isAddressEqual(v, zeroAddress), {
6626
6699
  error: "Admin cannot be zero address"
@@ -6824,23 +6897,24 @@ var clankerTokenV4Converter = async (config) => {
6824
6897
  if (cfg.presale && !clankerConfig?.related?.presale) {
6825
6898
  throw new Error(`Presales are not available on chain ${cfg.chainId}`);
6826
6899
  }
6827
- const { salt, token: expectedAddress } = cfg.vanity ? await findVanityAddressV4(
6828
- [
6829
- cfg.name,
6830
- cfg.symbol,
6831
- DEFAULT_SUPPLY,
6832
- cfg.tokenAdmin,
6833
- cfg.image,
6834
- metadata,
6835
- socialContext,
6836
- BigInt(cfg.chainId)
6837
- ],
6900
+ const tokenArgs = [
6901
+ cfg.name,
6902
+ cfg.symbol,
6903
+ DEFAULT_SUPPLY,
6838
6904
  cfg.tokenAdmin,
6839
- "0x4b07",
6840
- clankerConfig
6841
- ) : {
6905
+ cfg.image,
6906
+ metadata,
6907
+ socialContext,
6908
+ BigInt(cfg.chainId)
6909
+ ];
6910
+ const { salt, token: expectedAddress } = cfg.salt ? {
6911
+ // Use custom salt if provided, predict the address using CREATE2
6912
+ salt: cfg.salt,
6913
+ token: predictTokenAddressV4(tokenArgs, clankerConfig, cfg.salt, cfg.tokenAdmin)
6914
+ } : cfg.vanity ? await findVanityAddressV4(tokenArgs, cfg.tokenAdmin, "0x4b07", clankerConfig) : {
6915
+ // Default case: use zeroHash and predict address
6842
6916
  salt: zeroHash,
6843
- token: void 0
6917
+ token: predictTokenAddressV4(tokenArgs, clankerConfig, zeroHash, cfg.tokenAdmin)
6844
6918
  };
6845
6919
  const airdropAmount = BigInt(cfg.airdrop?.amount || 0) * BigInt(1e18);
6846
6920
  const bpsAirdropped = airdropAmount * 10000n / DEFAULT_SUPPLY + (airdropAmount * 10000n % DEFAULT_SUPPLY ? 1n : 0n);
@@ -6876,7 +6950,7 @@ var clankerTokenV4Converter = async (config) => {
6876
6950
  },
6877
6951
  lockerConfig: {
6878
6952
  locker: cfg.locker.locker === "Locker" ? clankerConfig.related.locker : cfg.locker.locker,
6879
- lockerData: encodeAbiParameters(ClankerLpLocker_Instantiation_v4_abi, [
6953
+ lockerData: encodeAbiParameters2(ClankerLpLocker_Instantiation_v4_abi, [
6880
6954
  {
6881
6955
  feePreference: cfg.rewards.recipients.map(({ token }) => FeeInToInt[token])
6882
6956
  }
@@ -6897,7 +6971,7 @@ var clankerTokenV4Converter = async (config) => {
6897
6971
  },
6898
6972
  mevModuleConfig: {
6899
6973
  mevModule: clankerConfig.related?.mevModuleV2 || clankerConfig.related?.mevModule,
6900
- mevModuleData: clankerConfig.related?.mevModuleV2 ? encodeAbiParameters(Clanker_MevSniperAuction_InitData_v4_1_abi, [
6974
+ mevModuleData: clankerConfig.related?.mevModuleV2 ? encodeAbiParameters2(Clanker_MevSniperAuction_InitData_v4_1_abi, [
6901
6975
  {
6902
6976
  startingFee: cfg.sniperFees.startingFee,
6903
6977
  endingFee: cfg.sniperFees.endingFee,
@@ -6912,7 +6986,7 @@ var clankerTokenV4Converter = async (config) => {
6912
6986
  extension: clankerConfig.related.vault,
6913
6987
  msgValue: 0n,
6914
6988
  extensionBps: cfg.vault.percentage * 100,
6915
- extensionData: encodeAbiParameters(ClankerVault_Instantiation_v4_abi, [
6989
+ extensionData: encodeAbiParameters2(ClankerVault_Instantiation_v4_abi, [
6916
6990
  cfg.vault.recipient ?? cfg.tokenAdmin,
6917
6991
  BigInt(cfg.vault.lockupDuration),
6918
6992
  BigInt(cfg.vault.vestingDuration)
@@ -6925,7 +6999,7 @@ var clankerTokenV4Converter = async (config) => {
6925
6999
  extension: clankerConfig.related.airdrop,
6926
7000
  msgValue: 0n,
6927
7001
  extensionBps: Number(bpsAirdropped),
6928
- extensionData: encodeAbiParameters(ClankerAirdropV2_Instantiation_v4_abi, [
7002
+ extensionData: encodeAbiParameters2(ClankerAirdropV2_Instantiation_v4_abi, [
6929
7003
  cfg.airdrop.admin || cfg.tokenAdmin,
6930
7004
  cfg.airdrop.merkleRoot,
6931
7005
  BigInt(cfg.airdrop.lockupDuration),
@@ -6939,7 +7013,7 @@ var clankerTokenV4Converter = async (config) => {
6939
7013
  extension: clankerConfig.related.devbuy,
6940
7014
  msgValue: BigInt(cfg.devBuy.ethAmount * 1e18),
6941
7015
  extensionBps: 0,
6942
- extensionData: encodeAbiParameters(ClankerUniV4EthDevBuy_Instantiation_v4_abi, [
7016
+ extensionData: encodeAbiParameters2(ClankerUniV4EthDevBuy_Instantiation_v4_abi, [
6943
7017
  cfg.devBuy.poolKey,
6944
7018
  BigInt(cfg.devBuy.amountOutMin * 1e18),
6945
7019
  cfg.tokenAdmin
@@ -6967,7 +7041,7 @@ var clankerTokenV4Converter = async (config) => {
6967
7041
  function encodeFeeConfig(tokenConfig, clankerConfig) {
6968
7042
  const config = tokenConfig.fees;
6969
7043
  if (config.type === "static") {
6970
- const feeData = encodeAbiParameters(ClankerHook_StaticFee_Instantiation_v4_abi, [
7044
+ const feeData = encodeAbiParameters2(ClankerHook_StaticFee_Instantiation_v4_abi, [
6971
7045
  config.clankerFee * 100,
6972
7046
  // uniBps
6973
7047
  config.pairedFee * 100
@@ -6976,7 +7050,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
6976
7050
  if (clankerConfig.related.feeStaticHookV2) {
6977
7051
  return {
6978
7052
  hook: clankerConfig.related.feeStaticHookV2,
6979
- poolData: encodeAbiParameters(Clanker_PoolInitializationData_v4_1_abi, [
7053
+ poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
6980
7054
  {
6981
7055
  extension: tokenConfig.poolExtension.address,
6982
7056
  extensionData: tokenConfig.poolExtension.initData,
@@ -6991,7 +7065,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
6991
7065
  };
6992
7066
  }
6993
7067
  if (config.type === "dynamic") {
6994
- const feeData = encodeAbiParameters(ClankerHook_DynamicFee_Instantiation_v4_abi, [
7068
+ const feeData = encodeAbiParameters2(ClankerHook_DynamicFee_Instantiation_v4_abi, [
6995
7069
  config.baseFee * 100,
6996
7070
  // uniBps
6997
7071
  config.maxFee * 100,
@@ -7005,7 +7079,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7005
7079
  if (clankerConfig.related.feeDynamicHookV2) {
7006
7080
  return {
7007
7081
  hook: clankerConfig.related.feeDynamicHookV2,
7008
- poolData: encodeAbiParameters(Clanker_PoolInitializationData_v4_1_abi, [
7082
+ poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
7009
7083
  {
7010
7084
  extension: tokenConfig.poolExtension.address,
7011
7085
  extensionData: tokenConfig.poolExtension.initData,
@@ -7455,6 +7455,216 @@ declare const ClankerLocker_v4_abi: readonly [{
7455
7455
  readonly inputs: readonly [];
7456
7456
  }];
7457
7457
 
7458
+ declare const Clanker_PresaleAllowlist_v4_1_abi: readonly [{
7459
+ readonly type: "constructor";
7460
+ readonly inputs: readonly [{
7461
+ readonly name: "presale_";
7462
+ readonly type: "address";
7463
+ readonly internalType: "address";
7464
+ }];
7465
+ readonly stateMutability: "nonpayable";
7466
+ }, {
7467
+ readonly type: "function";
7468
+ readonly name: "allowlists";
7469
+ readonly inputs: readonly [{
7470
+ readonly name: "presaleId";
7471
+ readonly type: "uint256";
7472
+ readonly internalType: "uint256";
7473
+ }];
7474
+ readonly outputs: readonly [{
7475
+ readonly name: "presaleOwner";
7476
+ readonly type: "address";
7477
+ readonly internalType: "address";
7478
+ }, {
7479
+ readonly name: "merkleRoot";
7480
+ readonly type: "bytes32";
7481
+ readonly internalType: "bytes32";
7482
+ }, {
7483
+ readonly name: "enabled";
7484
+ readonly type: "bool";
7485
+ readonly internalType: "bool";
7486
+ }];
7487
+ readonly stateMutability: "view";
7488
+ }, {
7489
+ readonly type: "function";
7490
+ readonly name: "getAllowedAmountForBuyer";
7491
+ readonly inputs: readonly [{
7492
+ readonly name: "presaleId";
7493
+ readonly type: "uint256";
7494
+ readonly internalType: "uint256";
7495
+ }, {
7496
+ readonly name: "buyer";
7497
+ readonly type: "address";
7498
+ readonly internalType: "address";
7499
+ }, {
7500
+ readonly name: "proof";
7501
+ readonly type: "bytes";
7502
+ readonly internalType: "bytes";
7503
+ }];
7504
+ readonly outputs: readonly [{
7505
+ readonly name: "";
7506
+ readonly type: "uint256";
7507
+ readonly internalType: "uint256";
7508
+ }];
7509
+ readonly stateMutability: "view";
7510
+ }, {
7511
+ readonly type: "function";
7512
+ readonly name: "initialize";
7513
+ readonly inputs: readonly [{
7514
+ readonly name: "presaleId";
7515
+ readonly type: "uint256";
7516
+ readonly internalType: "uint256";
7517
+ }, {
7518
+ readonly name: "presaleOwner";
7519
+ readonly type: "address";
7520
+ readonly internalType: "address";
7521
+ }, {
7522
+ readonly name: "initializationData";
7523
+ readonly type: "bytes";
7524
+ readonly internalType: "bytes";
7525
+ }];
7526
+ readonly outputs: readonly [];
7527
+ readonly stateMutability: "nonpayable";
7528
+ }, {
7529
+ readonly type: "function";
7530
+ readonly name: "presale";
7531
+ readonly inputs: readonly [];
7532
+ readonly outputs: readonly [{
7533
+ readonly name: "";
7534
+ readonly type: "address";
7535
+ readonly internalType: "address";
7536
+ }];
7537
+ readonly stateMutability: "view";
7538
+ }, {
7539
+ readonly type: "function";
7540
+ readonly name: "setAddressOverride";
7541
+ readonly inputs: readonly [{
7542
+ readonly name: "presaleId";
7543
+ readonly type: "uint256";
7544
+ readonly internalType: "uint256";
7545
+ }, {
7546
+ readonly name: "buyer";
7547
+ readonly type: "address";
7548
+ readonly internalType: "address";
7549
+ }, {
7550
+ readonly name: "allowedAmount";
7551
+ readonly type: "uint256";
7552
+ readonly internalType: "uint256";
7553
+ }];
7554
+ readonly outputs: readonly [];
7555
+ readonly stateMutability: "nonpayable";
7556
+ }, {
7557
+ readonly type: "function";
7558
+ readonly name: "setAllowlistEnabled";
7559
+ readonly inputs: readonly [{
7560
+ readonly name: "presaleId";
7561
+ readonly type: "uint256";
7562
+ readonly internalType: "uint256";
7563
+ }, {
7564
+ readonly name: "enabled";
7565
+ readonly type: "bool";
7566
+ readonly internalType: "bool";
7567
+ }];
7568
+ readonly outputs: readonly [];
7569
+ readonly stateMutability: "nonpayable";
7570
+ }, {
7571
+ readonly type: "function";
7572
+ readonly name: "setMerkleRoot";
7573
+ readonly inputs: readonly [{
7574
+ readonly name: "presaleId";
7575
+ readonly type: "uint256";
7576
+ readonly internalType: "uint256";
7577
+ }, {
7578
+ readonly name: "merkleRoot";
7579
+ readonly type: "bytes32";
7580
+ readonly internalType: "bytes32";
7581
+ }];
7582
+ readonly outputs: readonly [];
7583
+ readonly stateMutability: "nonpayable";
7584
+ }, {
7585
+ readonly type: "event";
7586
+ readonly name: "Initialize";
7587
+ readonly inputs: readonly [{
7588
+ readonly name: "presaleId";
7589
+ readonly type: "uint256";
7590
+ readonly indexed: true;
7591
+ readonly internalType: "uint256";
7592
+ }, {
7593
+ readonly name: "presaleOwner";
7594
+ readonly type: "address";
7595
+ readonly indexed: true;
7596
+ readonly internalType: "address";
7597
+ }, {
7598
+ readonly name: "merkleRoot";
7599
+ readonly type: "bytes32";
7600
+ readonly indexed: false;
7601
+ readonly internalType: "bytes32";
7602
+ }];
7603
+ readonly anonymous: false;
7604
+ }, {
7605
+ readonly type: "event";
7606
+ readonly name: "SetAddressOverride";
7607
+ readonly inputs: readonly [{
7608
+ readonly name: "presaleId";
7609
+ readonly type: "uint256";
7610
+ readonly indexed: true;
7611
+ readonly internalType: "uint256";
7612
+ }, {
7613
+ readonly name: "buyer";
7614
+ readonly type: "address";
7615
+ readonly indexed: true;
7616
+ readonly internalType: "address";
7617
+ }, {
7618
+ readonly name: "allowedAmount";
7619
+ readonly type: "uint256";
7620
+ readonly indexed: false;
7621
+ readonly internalType: "uint256";
7622
+ }];
7623
+ readonly anonymous: false;
7624
+ }, {
7625
+ readonly type: "event";
7626
+ readonly name: "SetAllowlistEnabled";
7627
+ readonly inputs: readonly [{
7628
+ readonly name: "presaleId";
7629
+ readonly type: "uint256";
7630
+ readonly indexed: true;
7631
+ readonly internalType: "uint256";
7632
+ }, {
7633
+ readonly name: "enabled";
7634
+ readonly type: "bool";
7635
+ readonly indexed: false;
7636
+ readonly internalType: "bool";
7637
+ }];
7638
+ readonly anonymous: false;
7639
+ }, {
7640
+ readonly type: "event";
7641
+ readonly name: "SetMerkleRoot";
7642
+ readonly inputs: readonly [{
7643
+ readonly name: "presaleId";
7644
+ readonly type: "uint256";
7645
+ readonly indexed: true;
7646
+ readonly internalType: "uint256";
7647
+ }, {
7648
+ readonly name: "merkleRoot";
7649
+ readonly type: "bytes32";
7650
+ readonly indexed: false;
7651
+ readonly internalType: "bytes32";
7652
+ }];
7653
+ readonly anonymous: false;
7654
+ }, {
7655
+ readonly type: "error";
7656
+ readonly name: "InvalidProof";
7657
+ readonly inputs: readonly [];
7658
+ }, {
7659
+ readonly type: "error";
7660
+ readonly name: "MerkleRootNotSet";
7661
+ readonly inputs: readonly [];
7662
+ }, {
7663
+ readonly type: "error";
7664
+ readonly name: "Unauthorized";
7665
+ readonly inputs: readonly [];
7666
+ }];
7667
+
7458
7668
  declare const Clanker_PresaleEthToCreator_v4_1_abi: readonly [{
7459
7669
  readonly type: "constructor";
7460
7670
  readonly inputs: readonly [{
@@ -9186,7 +9396,7 @@ declare const Clanker_PresaleEthToCreator_v4_1_abi: readonly [{
9186
9396
  type ClankerToken = typeof ClankerToken_v3_1_abi | typeof ClankerToken_v4_abi;
9187
9397
  type ClankerFactory = typeof Clanker_v3_1_abi | typeof Clanker_v4_abi;
9188
9398
  type ClankerHooks = typeof ClankerHook_DynamicFee_v4_abi | typeof ClankerHook_StaticFee_v4_abi;
9189
- type ClankerContract = typeof ClankerFeeLocker_abi | ClankerFactory | ClankerToken | ClankerHooks | typeof ClankerAirdrop_v4_abi | typeof ClankerAirdropv2_v4_abi | typeof LpLockerv2_abi | typeof ClankerLocker_v4_abi | typeof Clanker_PresaleEthToCreator_v4_1_abi | typeof Clanker_v0_abi;
9399
+ type ClankerContract = typeof ClankerFeeLocker_abi | ClankerFactory | ClankerToken | ClankerHooks | typeof ClankerAirdrop_v4_abi | typeof ClankerAirdropv2_v4_abi | typeof LpLockerv2_abi | typeof ClankerLocker_v4_abi | typeof Clanker_PresaleAllowlist_v4_1_abi | typeof Clanker_PresaleEthToCreator_v4_1_abi | typeof Clanker_v0_abi;
9190
9400
 
9191
9401
  type UndefinedValues<T> = {
9192
9402
  [P in keyof T]?: undefined;
@@ -9207,4 +9417,4 @@ type ClankerTransactionConfig<abi extends ClankerContract = ClankerContract, fun
9207
9417
  chainId?: number;
9208
9418
  };
9209
9419
 
9210
- export { type ClankerTransactionConfig as C, Clanker_v3_1_abi as a, type ClankerFactory as b, type ClankerResult as c, ClankerFeeLocker_abi as d, ClankerLocker_v4_abi as e, ClankerAirdrop_v4_abi as f, Clanker_PresaleEthToCreator_v4_1_abi as g };
9420
+ export { type ClankerTransactionConfig as C, Clanker_v3_1_abi as a, type ClankerFactory as b, type ClankerResult as c, ClankerFeeLocker_abi as d, ClankerLocker_v4_abi as e, ClankerAirdrop_v4_abi as f, Clanker_PresaleEthToCreator_v4_1_abi as g, Clanker_PresaleAllowlist_v4_1_abi as h };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clanker-sdk",
3
- "version": "4.2.3",
3
+ "version": "4.2.5-canary.0",
4
4
  "description": "SDK for deploying tokens using Clanker",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",