clanker-sdk 4.2.4 → 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,
@@ -2060,7 +2060,12 @@ var POOL_POSITIONS = {
2060
2060
  };
2061
2061
 
2062
2062
  // src/services/vanityAddress.ts
2063
- import { encodeDeployData, keccak256 } from "viem";
2063
+ import {
2064
+ encodeAbiParameters,
2065
+ encodeDeployData,
2066
+ getContractAddress,
2067
+ keccak256
2068
+ } from "viem";
2064
2069
  import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
2065
2070
 
2066
2071
  // src/abi/v3.1/ClankerToken.ts
@@ -6607,6 +6612,30 @@ var findVanityAddressV4 = async (args, admin, suffix = "0x4b07", config) => {
6607
6612
  const { address, salt } = await response.json();
6608
6613
  return { token: address, salt };
6609
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
+ };
6610
6639
 
6611
6640
  // src/utils/zod-onchain.ts
6612
6641
  import { getAddress, isAddress, isHex } from "viem";
@@ -6663,6 +6692,8 @@ var clankerTokenV4 = z2.strictObject({
6663
6692
  image: z2.string().default(""),
6664
6693
  /** Id of the chain that the token will be deployed to. Defaults to base (8453). */
6665
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(),
6666
6697
  /** Admin for the token. They will be able to change fields like image, metadata, etc. */
6667
6698
  tokenAdmin: addressSchema.refine((v) => !isAddressEqual(v, zeroAddress), {
6668
6699
  error: "Admin cannot be zero address"
@@ -6866,23 +6897,24 @@ var clankerTokenV4Converter = async (config) => {
6866
6897
  if (cfg.presale && !clankerConfig?.related?.presale) {
6867
6898
  throw new Error(`Presales are not available on chain ${cfg.chainId}`);
6868
6899
  }
6869
- const { salt, token: expectedAddress } = cfg.vanity ? await findVanityAddressV4(
6870
- [
6871
- cfg.name,
6872
- cfg.symbol,
6873
- DEFAULT_SUPPLY,
6874
- cfg.tokenAdmin,
6875
- cfg.image,
6876
- metadata,
6877
- socialContext,
6878
- BigInt(cfg.chainId)
6879
- ],
6900
+ const tokenArgs = [
6901
+ cfg.name,
6902
+ cfg.symbol,
6903
+ DEFAULT_SUPPLY,
6880
6904
  cfg.tokenAdmin,
6881
- "0x4b07",
6882
- clankerConfig
6883
- ) : {
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
6884
6916
  salt: zeroHash,
6885
- token: void 0
6917
+ token: predictTokenAddressV4(tokenArgs, clankerConfig, zeroHash, cfg.tokenAdmin)
6886
6918
  };
6887
6919
  const airdropAmount = BigInt(cfg.airdrop?.amount || 0) * BigInt(1e18);
6888
6920
  const bpsAirdropped = airdropAmount * 10000n / DEFAULT_SUPPLY + (airdropAmount * 10000n % DEFAULT_SUPPLY ? 1n : 0n);
@@ -6918,7 +6950,7 @@ var clankerTokenV4Converter = async (config) => {
6918
6950
  },
6919
6951
  lockerConfig: {
6920
6952
  locker: cfg.locker.locker === "Locker" ? clankerConfig.related.locker : cfg.locker.locker,
6921
- lockerData: encodeAbiParameters(ClankerLpLocker_Instantiation_v4_abi, [
6953
+ lockerData: encodeAbiParameters2(ClankerLpLocker_Instantiation_v4_abi, [
6922
6954
  {
6923
6955
  feePreference: cfg.rewards.recipients.map(({ token }) => FeeInToInt[token])
6924
6956
  }
@@ -6939,7 +6971,7 @@ var clankerTokenV4Converter = async (config) => {
6939
6971
  },
6940
6972
  mevModuleConfig: {
6941
6973
  mevModule: clankerConfig.related?.mevModuleV2 || clankerConfig.related?.mevModule,
6942
- mevModuleData: clankerConfig.related?.mevModuleV2 ? encodeAbiParameters(Clanker_MevSniperAuction_InitData_v4_1_abi, [
6974
+ mevModuleData: clankerConfig.related?.mevModuleV2 ? encodeAbiParameters2(Clanker_MevSniperAuction_InitData_v4_1_abi, [
6943
6975
  {
6944
6976
  startingFee: cfg.sniperFees.startingFee,
6945
6977
  endingFee: cfg.sniperFees.endingFee,
@@ -6954,7 +6986,7 @@ var clankerTokenV4Converter = async (config) => {
6954
6986
  extension: clankerConfig.related.vault,
6955
6987
  msgValue: 0n,
6956
6988
  extensionBps: cfg.vault.percentage * 100,
6957
- extensionData: encodeAbiParameters(ClankerVault_Instantiation_v4_abi, [
6989
+ extensionData: encodeAbiParameters2(ClankerVault_Instantiation_v4_abi, [
6958
6990
  cfg.vault.recipient ?? cfg.tokenAdmin,
6959
6991
  BigInt(cfg.vault.lockupDuration),
6960
6992
  BigInt(cfg.vault.vestingDuration)
@@ -6967,7 +6999,7 @@ var clankerTokenV4Converter = async (config) => {
6967
6999
  extension: clankerConfig.related.airdrop,
6968
7000
  msgValue: 0n,
6969
7001
  extensionBps: Number(bpsAirdropped),
6970
- extensionData: encodeAbiParameters(ClankerAirdropV2_Instantiation_v4_abi, [
7002
+ extensionData: encodeAbiParameters2(ClankerAirdropV2_Instantiation_v4_abi, [
6971
7003
  cfg.airdrop.admin || cfg.tokenAdmin,
6972
7004
  cfg.airdrop.merkleRoot,
6973
7005
  BigInt(cfg.airdrop.lockupDuration),
@@ -6981,7 +7013,7 @@ var clankerTokenV4Converter = async (config) => {
6981
7013
  extension: clankerConfig.related.devbuy,
6982
7014
  msgValue: BigInt(cfg.devBuy.ethAmount * 1e18),
6983
7015
  extensionBps: 0,
6984
- extensionData: encodeAbiParameters(ClankerUniV4EthDevBuy_Instantiation_v4_abi, [
7016
+ extensionData: encodeAbiParameters2(ClankerUniV4EthDevBuy_Instantiation_v4_abi, [
6985
7017
  cfg.devBuy.poolKey,
6986
7018
  BigInt(cfg.devBuy.amountOutMin * 1e18),
6987
7019
  cfg.tokenAdmin
@@ -7009,7 +7041,7 @@ var clankerTokenV4Converter = async (config) => {
7009
7041
  function encodeFeeConfig(tokenConfig, clankerConfig) {
7010
7042
  const config = tokenConfig.fees;
7011
7043
  if (config.type === "static") {
7012
- const feeData = encodeAbiParameters(ClankerHook_StaticFee_Instantiation_v4_abi, [
7044
+ const feeData = encodeAbiParameters2(ClankerHook_StaticFee_Instantiation_v4_abi, [
7013
7045
  config.clankerFee * 100,
7014
7046
  // uniBps
7015
7047
  config.pairedFee * 100
@@ -7018,7 +7050,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7018
7050
  if (clankerConfig.related.feeStaticHookV2) {
7019
7051
  return {
7020
7052
  hook: clankerConfig.related.feeStaticHookV2,
7021
- poolData: encodeAbiParameters(Clanker_PoolInitializationData_v4_1_abi, [
7053
+ poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
7022
7054
  {
7023
7055
  extension: tokenConfig.poolExtension.address,
7024
7056
  extensionData: tokenConfig.poolExtension.initData,
@@ -7033,7 +7065,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7033
7065
  };
7034
7066
  }
7035
7067
  if (config.type === "dynamic") {
7036
- const feeData = encodeAbiParameters(ClankerHook_DynamicFee_Instantiation_v4_abi, [
7068
+ const feeData = encodeAbiParameters2(ClankerHook_DynamicFee_Instantiation_v4_abi, [
7037
7069
  config.baseFee * 100,
7038
7070
  // uniBps
7039
7071
  config.maxFee * 100,
@@ -7047,7 +7079,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7047
7079
  if (clankerConfig.related.feeDynamicHookV2) {
7048
7080
  return {
7049
7081
  hook: clankerConfig.related.feeDynamicHookV2,
7050
- poolData: encodeAbiParameters(Clanker_PoolInitializationData_v4_1_abi, [
7082
+ poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
7051
7083
  {
7052
7084
  extension: tokenConfig.poolExtension.address,
7053
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.4",
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",