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.
@@ -1,7 +1,7 @@
1
- import { C as ClankerTransactionConfig, f as ClankerAirdrop_v4_abi, c as ClankerResult, g as Clanker_PresaleEthToCreator_v4_1_abi } from '../../write-clanker-contracts-B4LSHPv2.js';
1
+ import { C as ClankerTransactionConfig, f as ClankerAirdrop_v4_abi, c as ClankerResult, g as Clanker_PresaleEthToCreator_v4_1_abi, h as Clanker_PresaleAllowlist_v4_1_abi } from '../../write-clanker-contracts-CQTURFDk.js';
2
2
  import { MerkleTree } from '@openzeppelin/merkle-tree/dist/merkletree.js';
3
3
  import * as z from 'zod/v4';
4
- import { a as Chain, C as ClankerTokenV4 } from '../../clankerTokenV4-Btn0ZN4v.js';
4
+ import { a as Chain, C as ClankerTokenV4 } from '../../clankerTokenV4-xiAq6G4R.js';
5
5
  import { Clanker } from '../index.js';
6
6
  import { C as ClankerError } from '../../errors-5Gv28Tkr.js';
7
7
  import 'viem';
@@ -490,5 +490,195 @@ declare function withdrawFromPresale(data: {
490
490
  * @returns The allowlist contract address, or undefined if not available
491
491
  */
492
492
  declare function getAllowlistAddress(chainId: Chain): `0x${string}` | undefined;
493
+ /**
494
+ * Get a transaction to buy into a presale with allowlist proof
495
+ *
496
+ * Use this when buying into a presale that has an allowlist enabled.
497
+ * The proof must contain your allowlist proof data (merkle proof + allowed amount).
498
+ *
499
+ * @param presaleId The ID of the presale
500
+ * @param chainId The chain ID
501
+ * @param value The ETH amount to send (in wei)
502
+ * @param proof The encoded proof data from encodeAllowlistProofData
503
+ * @returns Transaction configuration for buying into a presale with proof
504
+ */
505
+ declare function getBuyIntoPresaleWithProofTransaction({ presaleId, chainId, value, proof, }: {
506
+ presaleId: bigint;
507
+ chainId: Chain;
508
+ value: bigint;
509
+ proof: `0x${string}`;
510
+ }): ClankerTransactionConfig<typeof Clanker_PresaleEthToCreator_v4_1_abi, 'buyIntoPresaleWithProof'>;
511
+ /**
512
+ * Buy into a presale with allowlist proof
513
+ *
514
+ * Use this when buying into a presale that has an allowlist enabled.
515
+ * You must provide proof that your address is on the allowlist.
516
+ *
517
+ * @param clanker Clanker object used for buying into presale
518
+ * @param presaleId The ID of the presale
519
+ * @param ethAmount The ETH amount to send (in ETH, will be converted to wei)
520
+ * @param proof The encoded proof data from encodeAllowlistProofData
521
+ * @returns Outcome of the transaction
522
+ *
523
+ * @example
524
+ * ```typescript
525
+ * import { createAllowlistMerkleTree, getAllowlistMerkleProof, encodeAllowlistProofData } from '../utils/presale-allowlist';
526
+ *
527
+ * // Get your proof from the allowlist
528
+ * const { tree, entries } = createAllowlistMerkleTree(allowlistEntries);
529
+ * const proof = getAllowlistMerkleProof(tree, entries, buyerAddress, 1.0);
530
+ * const proofData = encodeAllowlistProofData(1.0, proof);
531
+ *
532
+ * // Buy with proof
533
+ * await buyIntoPresaleWithProof({ clanker, presaleId: 1n, ethAmount: 0.5, proof: proofData });
534
+ * ```
535
+ */
536
+ declare function buyIntoPresaleWithProof(data: {
537
+ clanker: Clanker;
538
+ presaleId: bigint;
539
+ ethAmount: number;
540
+ proof: `0x${string}`;
541
+ }): ClankerResult<{
542
+ txHash: `0x${string}`;
543
+ }>;
544
+
545
+ /**
546
+ * Get a transaction to set the merkle root for a presale allowlist
547
+ *
548
+ * Only callable by the presale owner. This allows updating the allowlist
549
+ * after the presale has been created.
550
+ *
551
+ * @param presaleId The presale ID
552
+ * @param merkleRoot The new merkle root
553
+ * @param chainId The chain ID
554
+ * @returns Transaction configuration
555
+ */
556
+ declare function getSetMerkleRootTransaction({ presaleId, merkleRoot, chainId, }: {
557
+ presaleId: bigint;
558
+ merkleRoot: `0x${string}`;
559
+ chainId: Chain;
560
+ }): ClankerTransactionConfig<typeof Clanker_PresaleAllowlist_v4_1_abi, 'setMerkleRoot'>;
561
+ /**
562
+ * Set the merkle root for a presale allowlist
563
+ *
564
+ * Only callable by the presale owner. This allows updating the allowlist
565
+ * after the presale has been created.
566
+ *
567
+ * @param clanker Clanker object
568
+ * @param presaleId The presale ID
569
+ * @param merkleRoot The new merkle root
570
+ * @returns Outcome of the transaction
571
+ */
572
+ declare function setMerkleRoot(data: {
573
+ clanker: Clanker;
574
+ presaleId: bigint;
575
+ merkleRoot: `0x${string}`;
576
+ }): ClankerResult<{
577
+ txHash: `0x${string}`;
578
+ }>;
579
+ /**
580
+ * Get a transaction to set an address override for a presale allowlist
581
+ *
582
+ * Only callable by the presale owner. Address overrides take precedence
583
+ * over the merkle tree allowlist. Setting allowedAmount to 0 effectively
584
+ * removes the override.
585
+ *
586
+ * @param presaleId The presale ID
587
+ * @param buyer The buyer's address to override
588
+ * @param allowedAmount The allowed amount in wei (0 to remove override)
589
+ * @param chainId The chain ID
590
+ * @returns Transaction configuration
591
+ */
592
+ declare function getSetAddressOverrideTransaction({ presaleId, buyer, allowedAmount, chainId, }: {
593
+ presaleId: bigint;
594
+ buyer: `0x${string}`;
595
+ allowedAmount: bigint;
596
+ chainId: Chain;
597
+ }): ClankerTransactionConfig<typeof Clanker_PresaleAllowlist_v4_1_abi, 'setAddressOverride'>;
598
+ /**
599
+ * Set an address override for a presale allowlist
600
+ *
601
+ * Only callable by the presale owner. Address overrides take precedence
602
+ * over the merkle tree allowlist. This is useful for manually adding
603
+ * addresses without regenerating the entire merkle tree.
604
+ *
605
+ * @param clanker Clanker object
606
+ * @param presaleId The presale ID
607
+ * @param buyer The buyer's address to override
608
+ * @param allowedAmountEth The allowed amount in ETH (0 to remove override)
609
+ * @returns Outcome of the transaction
610
+ *
611
+ * @example
612
+ * ```typescript
613
+ * // Allow a specific address to buy up to 2 ETH
614
+ * await setAddressOverride({
615
+ * clanker,
616
+ * presaleId: 1n,
617
+ * buyer: '0x123...',
618
+ * allowedAmountEth: 2.0
619
+ * });
620
+ *
621
+ * // Remove the override (set to 0)
622
+ * await setAddressOverride({
623
+ * clanker,
624
+ * presaleId: 1n,
625
+ * buyer: '0x123...',
626
+ * allowedAmountEth: 0
627
+ * });
628
+ * ```
629
+ */
630
+ declare function setAddressOverride(data: {
631
+ clanker: Clanker;
632
+ presaleId: bigint;
633
+ buyer: `0x${string}`;
634
+ allowedAmountEth: number;
635
+ }): ClankerResult<{
636
+ txHash: `0x${string}`;
637
+ }>;
638
+ /**
639
+ * Get a transaction to enable or disable the allowlist for a presale
640
+ *
641
+ * Only callable by the presale owner. When disabled, anyone can buy
642
+ * into the presale without restrictions. When enabled, buyers must
643
+ * provide proof or have an address override.
644
+ *
645
+ * @param presaleId The presale ID
646
+ * @param enabled Whether to enable or disable the allowlist
647
+ * @param chainId The chain ID
648
+ * @returns Transaction configuration
649
+ */
650
+ declare function getSetAllowlistEnabledTransaction({ presaleId, enabled, chainId, }: {
651
+ presaleId: bigint;
652
+ enabled: boolean;
653
+ chainId: Chain;
654
+ }): ClankerTransactionConfig<typeof Clanker_PresaleAllowlist_v4_1_abi, 'setAllowlistEnabled'>;
655
+ /**
656
+ * Enable or disable the allowlist for a presale
657
+ *
658
+ * Only callable by the presale owner. When disabled, anyone can buy
659
+ * into the presale without restrictions. When enabled, buyers must
660
+ * provide proof or have an address override.
661
+ *
662
+ * @param clanker Clanker object
663
+ * @param presaleId The presale ID
664
+ * @param enabled Whether to enable or disable the allowlist
665
+ * @returns Outcome of the transaction
666
+ *
667
+ * @example
668
+ * ```typescript
669
+ * // Disable the allowlist to let anyone participate
670
+ * await setAllowlistEnabled({ clanker, presaleId: 1n, enabled: false });
671
+ *
672
+ * // Re-enable the allowlist
673
+ * await setAllowlistEnabled({ clanker, presaleId: 1n, enabled: true });
674
+ * ```
675
+ */
676
+ declare function setAllowlistEnabled(data: {
677
+ clanker: Clanker;
678
+ presaleId: bigint;
679
+ enabled: boolean;
680
+ }): ClankerResult<{
681
+ txHash: `0x${string}`;
682
+ }>;
493
683
 
494
- export { type AirdropRecipient, type PresaleConfig, PresaleStatus, buyIntoPresale, claimAirdrop, claimEth, claimTokens, createAirdrop, endPresale, fetchAirdropProofs, getAirdropProofs, getAllowlistAddress, getAmountAvailableToClaim, getBuyIntoPresaleTransaction, getClaimAirdropTransaction, getClaimEthTransaction, getClaimTokensTransaction, getEndPresaleTransaction, getPresale, getPresaleBuys, getPresaleClaimed, getPresaleState, getStartPresaleTransaction, getWithdrawFromPresaleTransaction, registerAirdrop, startPresale, withdrawFromPresale };
684
+ export { type AirdropRecipient, type PresaleConfig, PresaleStatus, buyIntoPresale, buyIntoPresaleWithProof, claimAirdrop, claimEth, claimTokens, createAirdrop, endPresale, fetchAirdropProofs, getAirdropProofs, getAllowlistAddress, getAmountAvailableToClaim, getBuyIntoPresaleTransaction, getBuyIntoPresaleWithProofTransaction, getClaimAirdropTransaction, getClaimEthTransaction, getClaimTokensTransaction, getEndPresaleTransaction, getPresale, getPresaleBuys, getPresaleClaimed, getPresaleState, getSetAddressOverrideTransaction, getSetAllowlistEnabledTransaction, getSetMerkleRootTransaction, getStartPresaleTransaction, getWithdrawFromPresaleTransaction, registerAirdrop, setAddressOverride, setAllowlistEnabled, setMerkleRoot, startPresale, withdrawFromPresale };
@@ -6861,7 +6861,7 @@ var Clanker_PresaleEthToCreator_v4_1_abi = [
6861
6861
 
6862
6862
  // src/config/clankerTokenV4.ts
6863
6863
  import {
6864
- encodeAbiParameters,
6864
+ encodeAbiParameters as encodeAbiParameters2,
6865
6865
  isAddressEqual as isAddressEqual2,
6866
6866
  stringify as stringify2,
6867
6867
  zeroAddress,
@@ -7069,7 +7069,12 @@ var POOL_POSITIONS = {
7069
7069
  };
7070
7070
 
7071
7071
  // src/services/vanityAddress.ts
7072
- import { encodeDeployData, keccak256 } from "viem";
7072
+ import {
7073
+ encodeAbiParameters,
7074
+ encodeDeployData,
7075
+ getContractAddress,
7076
+ keccak256
7077
+ } from "viem";
7073
7078
  import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
7074
7079
  var findVanityAddressV4 = async (args, admin, suffix = "0x4b07", config) => {
7075
7080
  const data = encodeDeployData({
@@ -7084,6 +7089,30 @@ var findVanityAddressV4 = async (args, admin, suffix = "0x4b07", config) => {
7084
7089
  const { address, salt } = await response.json();
7085
7090
  return { token: address, salt };
7086
7091
  };
7092
+ var predictTokenAddressV4 = (args, config, salt, tokenAdmin) => {
7093
+ const deployData = encodeDeployData({
7094
+ abi: config.token.abi,
7095
+ bytecode: config.token.bytecode,
7096
+ args
7097
+ });
7098
+ const actualSalt = keccak256(
7099
+ encodeAbiParameters(
7100
+ [
7101
+ { type: "address", name: "tokenAdmin" },
7102
+ { type: "bytes32", name: "salt" }
7103
+ ],
7104
+ [tokenAdmin, salt]
7105
+ )
7106
+ );
7107
+ const predictedAddress = getContractAddress({
7108
+ from: config.address,
7109
+ // deployer (Clanker contract)
7110
+ salt: actualSalt,
7111
+ bytecode: deployData,
7112
+ opcode: "CREATE2"
7113
+ });
7114
+ return predictedAddress;
7115
+ };
7087
7116
 
7088
7117
  // src/config/clankerTokenV4.ts
7089
7118
  var NULL_DEVBUY_POOL_CONFIG = {
@@ -7108,6 +7137,8 @@ var clankerTokenV4 = z3.strictObject({
7108
7137
  image: z3.string().default(""),
7109
7138
  /** Id of the chain that the token will be deployed to. Defaults to base (8453). */
7110
7139
  chainId: z3.literal(Chains).default(8453),
7140
+ /** Custom salt for CREATE2 deployment. If provided, this will be used instead of vanity address generation. Takes precedence over vanity. */
7141
+ salt: hexSchema.optional(),
7111
7142
  /** Admin for the token. They will be able to change fields like image, metadata, etc. */
7112
7143
  tokenAdmin: addressSchema.refine((v) => !isAddressEqual2(v, zeroAddress), {
7113
7144
  error: "Admin cannot be zero address"
@@ -7311,23 +7342,24 @@ var clankerTokenV4Converter = async (config) => {
7311
7342
  if (cfg.presale && !clankerConfig?.related?.presale) {
7312
7343
  throw new Error(`Presales are not available on chain ${cfg.chainId}`);
7313
7344
  }
7314
- const { salt, token: expectedAddress } = cfg.vanity ? await findVanityAddressV4(
7315
- [
7316
- cfg.name,
7317
- cfg.symbol,
7318
- DEFAULT_SUPPLY,
7319
- cfg.tokenAdmin,
7320
- cfg.image,
7321
- metadata,
7322
- socialContext,
7323
- BigInt(cfg.chainId)
7324
- ],
7345
+ const tokenArgs = [
7346
+ cfg.name,
7347
+ cfg.symbol,
7348
+ DEFAULT_SUPPLY,
7325
7349
  cfg.tokenAdmin,
7326
- "0x4b07",
7327
- clankerConfig
7328
- ) : {
7350
+ cfg.image,
7351
+ metadata,
7352
+ socialContext,
7353
+ BigInt(cfg.chainId)
7354
+ ];
7355
+ const { salt, token: expectedAddress } = cfg.salt ? {
7356
+ // Use custom salt if provided, predict the address using CREATE2
7357
+ salt: cfg.salt,
7358
+ token: predictTokenAddressV4(tokenArgs, clankerConfig, cfg.salt, cfg.tokenAdmin)
7359
+ } : cfg.vanity ? await findVanityAddressV4(tokenArgs, cfg.tokenAdmin, "0x4b07", clankerConfig) : {
7360
+ // Default case: use zeroHash and predict address
7329
7361
  salt: zeroHash,
7330
- token: void 0
7362
+ token: predictTokenAddressV4(tokenArgs, clankerConfig, zeroHash, cfg.tokenAdmin)
7331
7363
  };
7332
7364
  const airdropAmount = BigInt(cfg.airdrop?.amount || 0) * BigInt(1e18);
7333
7365
  const bpsAirdropped = airdropAmount * 10000n / DEFAULT_SUPPLY + (airdropAmount * 10000n % DEFAULT_SUPPLY ? 1n : 0n);
@@ -7363,7 +7395,7 @@ var clankerTokenV4Converter = async (config) => {
7363
7395
  },
7364
7396
  lockerConfig: {
7365
7397
  locker: cfg.locker.locker === "Locker" ? clankerConfig.related.locker : cfg.locker.locker,
7366
- lockerData: encodeAbiParameters(ClankerLpLocker_Instantiation_v4_abi, [
7398
+ lockerData: encodeAbiParameters2(ClankerLpLocker_Instantiation_v4_abi, [
7367
7399
  {
7368
7400
  feePreference: cfg.rewards.recipients.map(({ token }) => FeeInToInt[token])
7369
7401
  }
@@ -7384,7 +7416,7 @@ var clankerTokenV4Converter = async (config) => {
7384
7416
  },
7385
7417
  mevModuleConfig: {
7386
7418
  mevModule: clankerConfig.related?.mevModuleV2 || clankerConfig.related?.mevModule,
7387
- mevModuleData: clankerConfig.related?.mevModuleV2 ? encodeAbiParameters(Clanker_MevSniperAuction_InitData_v4_1_abi, [
7419
+ mevModuleData: clankerConfig.related?.mevModuleV2 ? encodeAbiParameters2(Clanker_MevSniperAuction_InitData_v4_1_abi, [
7388
7420
  {
7389
7421
  startingFee: cfg.sniperFees.startingFee,
7390
7422
  endingFee: cfg.sniperFees.endingFee,
@@ -7399,7 +7431,7 @@ var clankerTokenV4Converter = async (config) => {
7399
7431
  extension: clankerConfig.related.vault,
7400
7432
  msgValue: 0n,
7401
7433
  extensionBps: cfg.vault.percentage * 100,
7402
- extensionData: encodeAbiParameters(ClankerVault_Instantiation_v4_abi, [
7434
+ extensionData: encodeAbiParameters2(ClankerVault_Instantiation_v4_abi, [
7403
7435
  cfg.vault.recipient ?? cfg.tokenAdmin,
7404
7436
  BigInt(cfg.vault.lockupDuration),
7405
7437
  BigInt(cfg.vault.vestingDuration)
@@ -7412,7 +7444,7 @@ var clankerTokenV4Converter = async (config) => {
7412
7444
  extension: clankerConfig.related.airdrop,
7413
7445
  msgValue: 0n,
7414
7446
  extensionBps: Number(bpsAirdropped),
7415
- extensionData: encodeAbiParameters(ClankerAirdropV2_Instantiation_v4_abi, [
7447
+ extensionData: encodeAbiParameters2(ClankerAirdropV2_Instantiation_v4_abi, [
7416
7448
  cfg.airdrop.admin || cfg.tokenAdmin,
7417
7449
  cfg.airdrop.merkleRoot,
7418
7450
  BigInt(cfg.airdrop.lockupDuration),
@@ -7426,7 +7458,7 @@ var clankerTokenV4Converter = async (config) => {
7426
7458
  extension: clankerConfig.related.devbuy,
7427
7459
  msgValue: BigInt(cfg.devBuy.ethAmount * 1e18),
7428
7460
  extensionBps: 0,
7429
- extensionData: encodeAbiParameters(ClankerUniV4EthDevBuy_Instantiation_v4_abi, [
7461
+ extensionData: encodeAbiParameters2(ClankerUniV4EthDevBuy_Instantiation_v4_abi, [
7430
7462
  cfg.devBuy.poolKey,
7431
7463
  BigInt(cfg.devBuy.amountOutMin * 1e18),
7432
7464
  cfg.tokenAdmin
@@ -7454,7 +7486,7 @@ var clankerTokenV4Converter = async (config) => {
7454
7486
  function encodeFeeConfig(tokenConfig, clankerConfig) {
7455
7487
  const config = tokenConfig.fees;
7456
7488
  if (config.type === "static") {
7457
- const feeData = encodeAbiParameters(ClankerHook_StaticFee_Instantiation_v4_abi, [
7489
+ const feeData = encodeAbiParameters2(ClankerHook_StaticFee_Instantiation_v4_abi, [
7458
7490
  config.clankerFee * 100,
7459
7491
  // uniBps
7460
7492
  config.pairedFee * 100
@@ -7463,7 +7495,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7463
7495
  if (clankerConfig.related.feeStaticHookV2) {
7464
7496
  return {
7465
7497
  hook: clankerConfig.related.feeStaticHookV2,
7466
- poolData: encodeAbiParameters(Clanker_PoolInitializationData_v4_1_abi, [
7498
+ poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
7467
7499
  {
7468
7500
  extension: tokenConfig.poolExtension.address,
7469
7501
  extensionData: tokenConfig.poolExtension.initData,
@@ -7478,7 +7510,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7478
7510
  };
7479
7511
  }
7480
7512
  if (config.type === "dynamic") {
7481
- const feeData = encodeAbiParameters(ClankerHook_DynamicFee_Instantiation_v4_abi, [
7513
+ const feeData = encodeAbiParameters2(ClankerHook_DynamicFee_Instantiation_v4_abi, [
7482
7514
  config.baseFee * 100,
7483
7515
  // uniBps
7484
7516
  config.maxFee * 100,
@@ -7492,7 +7524,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
7492
7524
  if (clankerConfig.related.feeDynamicHookV2) {
7493
7525
  return {
7494
7526
  hook: clankerConfig.related.feeDynamicHookV2,
7495
- poolData: encodeAbiParameters(Clanker_PoolInitializationData_v4_1_abi, [
7527
+ poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
7496
7528
  {
7497
7529
  extension: tokenConfig.poolExtension.address,
7498
7530
  extensionData: tokenConfig.poolExtension.initData,
@@ -7812,9 +7844,248 @@ function getAllowlistAddress(chainId) {
7812
7844
  const config = clankerConfigFor(chainId, "clanker_v4");
7813
7845
  return config?.related?.presaleAllowlist;
7814
7846
  }
7847
+ function getBuyIntoPresaleWithProofTransaction({
7848
+ presaleId,
7849
+ chainId,
7850
+ value,
7851
+ proof
7852
+ }) {
7853
+ const config = clankerConfigFor(chainId, "clanker_v4");
7854
+ if (!config?.related?.presale) {
7855
+ throw new Error(`PresaleEthToCreator is not available on chain ${chainId}`);
7856
+ }
7857
+ return {
7858
+ chainId,
7859
+ address: config.related.presale,
7860
+ abi: Clanker_PresaleEthToCreator_v4_1_abi,
7861
+ functionName: "buyIntoPresaleWithProof",
7862
+ args: [presaleId, proof],
7863
+ value
7864
+ };
7865
+ }
7866
+ function buyIntoPresaleWithProof(data) {
7867
+ if (!data.clanker.publicClient) throw new Error("Public client required on clanker");
7868
+ if (!data.clanker.wallet) throw new Error("Wallet client required on clanker");
7869
+ const tx = getBuyIntoPresaleWithProofTransaction({
7870
+ presaleId: data.presaleId,
7871
+ chainId: data.clanker.wallet.chain.id,
7872
+ value: BigInt(data.ethAmount * 1e18),
7873
+ // Convert ETH to wei
7874
+ proof: data.proof
7875
+ });
7876
+ return writeClankerContract(data.clanker.publicClient, data.clanker.wallet, tx);
7877
+ }
7878
+
7879
+ // src/abi/v4.1/ClankerPresaleAllowlist.ts
7880
+ var Clanker_PresaleAllowlist_v4_1_abi = [
7881
+ {
7882
+ type: "constructor",
7883
+ inputs: [{ name: "presale_", type: "address", internalType: "address" }],
7884
+ stateMutability: "nonpayable"
7885
+ },
7886
+ {
7887
+ type: "function",
7888
+ name: "allowlists",
7889
+ inputs: [{ name: "presaleId", type: "uint256", internalType: "uint256" }],
7890
+ outputs: [
7891
+ { name: "presaleOwner", type: "address", internalType: "address" },
7892
+ { name: "merkleRoot", type: "bytes32", internalType: "bytes32" },
7893
+ { name: "enabled", type: "bool", internalType: "bool" }
7894
+ ],
7895
+ stateMutability: "view"
7896
+ },
7897
+ {
7898
+ type: "function",
7899
+ name: "getAllowedAmountForBuyer",
7900
+ inputs: [
7901
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
7902
+ { name: "buyer", type: "address", internalType: "address" },
7903
+ { name: "proof", type: "bytes", internalType: "bytes" }
7904
+ ],
7905
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
7906
+ stateMutability: "view"
7907
+ },
7908
+ {
7909
+ type: "function",
7910
+ name: "initialize",
7911
+ inputs: [
7912
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
7913
+ { name: "presaleOwner", type: "address", internalType: "address" },
7914
+ { name: "initializationData", type: "bytes", internalType: "bytes" }
7915
+ ],
7916
+ outputs: [],
7917
+ stateMutability: "nonpayable"
7918
+ },
7919
+ {
7920
+ type: "function",
7921
+ name: "presale",
7922
+ inputs: [],
7923
+ outputs: [{ name: "", type: "address", internalType: "address" }],
7924
+ stateMutability: "view"
7925
+ },
7926
+ {
7927
+ type: "function",
7928
+ name: "setAddressOverride",
7929
+ inputs: [
7930
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
7931
+ { name: "buyer", type: "address", internalType: "address" },
7932
+ { name: "allowedAmount", type: "uint256", internalType: "uint256" }
7933
+ ],
7934
+ outputs: [],
7935
+ stateMutability: "nonpayable"
7936
+ },
7937
+ {
7938
+ type: "function",
7939
+ name: "setAllowlistEnabled",
7940
+ inputs: [
7941
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
7942
+ { name: "enabled", type: "bool", internalType: "bool" }
7943
+ ],
7944
+ outputs: [],
7945
+ stateMutability: "nonpayable"
7946
+ },
7947
+ {
7948
+ type: "function",
7949
+ name: "setMerkleRoot",
7950
+ inputs: [
7951
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
7952
+ { name: "merkleRoot", type: "bytes32", internalType: "bytes32" }
7953
+ ],
7954
+ outputs: [],
7955
+ stateMutability: "nonpayable"
7956
+ },
7957
+ {
7958
+ type: "event",
7959
+ name: "Initialize",
7960
+ inputs: [
7961
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
7962
+ { name: "presaleOwner", type: "address", indexed: true, internalType: "address" },
7963
+ { name: "merkleRoot", type: "bytes32", indexed: false, internalType: "bytes32" }
7964
+ ],
7965
+ anonymous: false
7966
+ },
7967
+ {
7968
+ type: "event",
7969
+ name: "SetAddressOverride",
7970
+ inputs: [
7971
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
7972
+ { name: "buyer", type: "address", indexed: true, internalType: "address" },
7973
+ { name: "allowedAmount", type: "uint256", indexed: false, internalType: "uint256" }
7974
+ ],
7975
+ anonymous: false
7976
+ },
7977
+ {
7978
+ type: "event",
7979
+ name: "SetAllowlistEnabled",
7980
+ inputs: [
7981
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
7982
+ { name: "enabled", type: "bool", indexed: false, internalType: "bool" }
7983
+ ],
7984
+ anonymous: false
7985
+ },
7986
+ {
7987
+ type: "event",
7988
+ name: "SetMerkleRoot",
7989
+ inputs: [
7990
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
7991
+ { name: "merkleRoot", type: "bytes32", indexed: false, internalType: "bytes32" }
7992
+ ],
7993
+ anonymous: false
7994
+ },
7995
+ { type: "error", name: "InvalidProof", inputs: [] },
7996
+ { type: "error", name: "MerkleRootNotSet", inputs: [] },
7997
+ { type: "error", name: "Unauthorized", inputs: [] }
7998
+ ];
7999
+
8000
+ // src/v4/extensions/presale-allowlist-management.ts
8001
+ function getSetMerkleRootTransaction({
8002
+ presaleId,
8003
+ merkleRoot,
8004
+ chainId
8005
+ }) {
8006
+ const config = clankerConfigFor(chainId, "clanker_v4");
8007
+ if (!config?.related?.presaleAllowlist) {
8008
+ throw new Error(`Allowlist contract not available on chain ${chainId}`);
8009
+ }
8010
+ return {
8011
+ chainId,
8012
+ address: config.related.presaleAllowlist,
8013
+ abi: Clanker_PresaleAllowlist_v4_1_abi,
8014
+ functionName: "setMerkleRoot",
8015
+ args: [presaleId, merkleRoot]
8016
+ };
8017
+ }
8018
+ function setMerkleRoot(data) {
8019
+ if (!data.clanker.publicClient) throw new Error("Public client required on clanker");
8020
+ if (!data.clanker.wallet) throw new Error("Wallet client required on clanker");
8021
+ const tx = getSetMerkleRootTransaction({
8022
+ presaleId: data.presaleId,
8023
+ merkleRoot: data.merkleRoot,
8024
+ chainId: data.clanker.wallet.chain.id
8025
+ });
8026
+ return writeClankerContract(data.clanker.publicClient, data.clanker.wallet, tx);
8027
+ }
8028
+ function getSetAddressOverrideTransaction({
8029
+ presaleId,
8030
+ buyer,
8031
+ allowedAmount,
8032
+ chainId
8033
+ }) {
8034
+ const config = clankerConfigFor(chainId, "clanker_v4");
8035
+ if (!config?.related?.presaleAllowlist) {
8036
+ throw new Error(`Allowlist contract not available on chain ${chainId}`);
8037
+ }
8038
+ return {
8039
+ chainId,
8040
+ address: config.related.presaleAllowlist,
8041
+ abi: Clanker_PresaleAllowlist_v4_1_abi,
8042
+ functionName: "setAddressOverride",
8043
+ args: [presaleId, buyer, allowedAmount]
8044
+ };
8045
+ }
8046
+ function setAddressOverride(data) {
8047
+ if (!data.clanker.publicClient) throw new Error("Public client required on clanker");
8048
+ if (!data.clanker.wallet) throw new Error("Wallet client required on clanker");
8049
+ const tx = getSetAddressOverrideTransaction({
8050
+ presaleId: data.presaleId,
8051
+ buyer: data.buyer,
8052
+ allowedAmount: BigInt(data.allowedAmountEth * 1e18),
8053
+ // Convert ETH to wei
8054
+ chainId: data.clanker.wallet.chain.id
8055
+ });
8056
+ return writeClankerContract(data.clanker.publicClient, data.clanker.wallet, tx);
8057
+ }
8058
+ function getSetAllowlistEnabledTransaction({
8059
+ presaleId,
8060
+ enabled,
8061
+ chainId
8062
+ }) {
8063
+ const config = clankerConfigFor(chainId, "clanker_v4");
8064
+ if (!config?.related?.presaleAllowlist) {
8065
+ throw new Error(`Allowlist contract not available on chain ${chainId}`);
8066
+ }
8067
+ return {
8068
+ chainId,
8069
+ address: config.related.presaleAllowlist,
8070
+ abi: Clanker_PresaleAllowlist_v4_1_abi,
8071
+ functionName: "setAllowlistEnabled",
8072
+ args: [presaleId, enabled]
8073
+ };
8074
+ }
8075
+ function setAllowlistEnabled(data) {
8076
+ if (!data.clanker.publicClient) throw new Error("Public client required on clanker");
8077
+ if (!data.clanker.wallet) throw new Error("Wallet client required on clanker");
8078
+ const tx = getSetAllowlistEnabledTransaction({
8079
+ presaleId: data.presaleId,
8080
+ enabled: data.enabled,
8081
+ chainId: data.clanker.wallet.chain.id
8082
+ });
8083
+ return writeClankerContract(data.clanker.publicClient, data.clanker.wallet, tx);
8084
+ }
7815
8085
  export {
7816
8086
  PresaleStatus,
7817
8087
  buyIntoPresale,
8088
+ buyIntoPresaleWithProof,
7818
8089
  claimAirdrop,
7819
8090
  claimEth,
7820
8091
  claimTokens,
@@ -7825,6 +8096,7 @@ export {
7825
8096
  getAllowlistAddress,
7826
8097
  getAmountAvailableToClaim,
7827
8098
  getBuyIntoPresaleTransaction,
8099
+ getBuyIntoPresaleWithProofTransaction,
7828
8100
  getClaimAirdropTransaction,
7829
8101
  getClaimEthTransaction,
7830
8102
  getClaimTokensTransaction,
@@ -7833,9 +8105,15 @@ export {
7833
8105
  getPresaleBuys,
7834
8106
  getPresaleClaimed,
7835
8107
  getPresaleState,
8108
+ getSetAddressOverrideTransaction,
8109
+ getSetAllowlistEnabledTransaction,
8110
+ getSetMerkleRootTransaction,
7836
8111
  getStartPresaleTransaction,
7837
8112
  getWithdrawFromPresaleTransaction,
7838
8113
  registerAirdrop,
8114
+ setAddressOverride,
8115
+ setAllowlistEnabled,
8116
+ setMerkleRoot,
7839
8117
  startPresale,
7840
8118
  withdrawFromPresale
7841
8119
  };
@@ -1,9 +1,9 @@
1
- import { C as ClankerTransactionConfig, d as ClankerFeeLocker_abi, b as ClankerFactory, c as ClankerResult, e as ClankerLocker_v4_abi } from '../write-clanker-contracts-B4LSHPv2.js';
1
+ import { C as ClankerTransactionConfig, d as ClankerFeeLocker_abi, b as ClankerFactory, c as ClankerResult, e as ClankerLocker_v4_abi } from '../write-clanker-contracts-CQTURFDk.js';
2
2
  import * as viem from 'viem';
3
3
  import { WalletClient, Transport, Chain, Account, PublicClient } from 'viem';
4
4
  import { a as ClankerToken_v4_abi } from '../ClankerToken-Dra5lppJ.js';
5
- import { C as ClankerTokenV4 } from '../clankerTokenV4-Btn0ZN4v.js';
6
- export { e as encodeFeeConfig } from '../clankerTokenV4-Btn0ZN4v.js';
5
+ import { C as ClankerTokenV4 } from '../clankerTokenV4-xiAq6G4R.js';
6
+ export { e as encodeFeeConfig } from '../clankerTokenV4-xiAq6G4R.js';
7
7
  import { C as ClankerError } from '../errors-5Gv28Tkr.js';
8
8
  import 'zod/v4';
9
9