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.
@@ -18015,6 +18015,8 @@ declare const clankerTokenV4: z.ZodObject<{
18015
18015
  image: z.ZodDefault<z.ZodString>;
18016
18016
  /** Id of the chain that the token will be deployed to. Defaults to base (8453). */
18017
18017
  chainId: z.ZodDefault<z.ZodLiteral<1 | 143 | 8453 | 10143 | 2741 | 84532 | 42161 | 130>>;
18018
+ /** Custom salt for CREATE2 deployment. If provided, this will be used instead of vanity address generation. Takes precedence over vanity. */
18019
+ salt: z.ZodOptional<z.ZodCustom<`0x${string}`, `0x${string}`>>;
18018
18020
  /** Admin for the token. They will be able to change fields like image, metadata, etc. */
18019
18021
  tokenAdmin: z.ZodCustom<`0x${string}`, `0x${string}`>;
18020
18022
  /** Metadata for the token. */
package/dist/cli/cli.js CHANGED
@@ -9,12 +9,12 @@ var __export = (target, all) => {
9
9
  __defProp(target, name, { get: all[name], enumerable: true });
10
10
  };
11
11
 
12
- // node_modules/.pnpm/tsup@8.4.0_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js
12
+ // node_modules/tsup/assets/esm_shims.js
13
13
  import { fileURLToPath } from "url";
14
14
  import path from "path";
15
15
  var getFilename, getDirname, __dirname;
16
16
  var init_esm_shims = __esm({
17
- "node_modules/.pnpm/tsup@8.4.0_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js"() {
17
+ "node_modules/tsup/assets/esm_shims.js"() {
18
18
  "use strict";
19
19
  getFilename = () => fileURLToPath(import.meta.url);
20
20
  getDirname = () => path.dirname(getFilename());
@@ -6282,7 +6282,12 @@ var init_clankers = __esm({
6282
6282
  });
6283
6283
 
6284
6284
  // src/services/vanityAddress.ts
6285
- import { encodeDeployData, keccak256 } from "viem";
6285
+ import {
6286
+ encodeAbiParameters,
6287
+ encodeDeployData,
6288
+ getContractAddress,
6289
+ keccak256
6290
+ } from "viem";
6286
6291
  import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
6287
6292
  var findVanityAddress;
6288
6293
  var init_vanityAddress = __esm({
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // node_modules/.pnpm/tsup@8.4.0_typescript@5.8.3/node_modules/tsup/assets/esm_shims.js
3
+ // node_modules/tsup/assets/esm_shims.js
4
4
  import { fileURLToPath } from "url";
5
5
  import path from "path";
6
6
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -3137,7 +3137,12 @@ var WETH_ADDRESSES = {
3137
3137
  var DEFAULT_SUPPLY = 100000000000000000000000000000n;
3138
3138
 
3139
3139
  // src/services/vanityAddress.ts
3140
- import { encodeDeployData, keccak256 } from "viem";
3140
+ import {
3141
+ encodeAbiParameters,
3142
+ encodeDeployData,
3143
+ getContractAddress,
3144
+ keccak256
3145
+ } from "viem";
3141
3146
  import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
3142
3147
 
3143
3148
  // src/utils/clankers.ts
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { C as ClankerTokenV3 } from './clankerTokenV3-BqHTF9QY.js';
2
- import { a as Chain, C as ClankerTokenV4, b as ClankerDeployment } from './clankerTokenV4-Btn0ZN4v.js';
3
- export { d as CLANKERS, g as Chains, h as ClankerDeployments, f as Clankers, R as RelatedV3_1, c as RelatedV4, T as Type, i as clankerConfigFor } from './clankerTokenV4-Btn0ZN4v.js';
4
- import { ContractConstructorArgs } from 'viem';
2
+ import { a as Chain, C as ClankerTokenV4, b as ClankerDeployment } from './clankerTokenV4-xiAq6G4R.js';
3
+ export { d as CLANKERS, g as Chains, h as ClankerDeployments, f as Clankers, R as RelatedV3_1, c as RelatedV4, T as Type, i as clankerConfigFor } from './clankerTokenV4-xiAq6G4R.js';
4
+ import { ContractConstructorArgs, Hex, PublicClient } from 'viem';
5
5
  import { C as ClankerToken_v3_1_abi, a as ClankerToken_v4_abi } from './ClankerToken-Dra5lppJ.js';
6
6
  import { StandardMerkleTree } from '@openzeppelin/merkle-tree';
7
7
  import 'zod/v4';
@@ -43,6 +43,19 @@ declare const findVanityAddressV4: (args: ContractConstructorArgs<typeof Clanker
43
43
  salt: `0x${string}`;
44
44
  token: `0x${string}`;
45
45
  }>;
46
+ /**
47
+ * Predict the token address for a V4 deployment with a custom salt using CREATE2.
48
+ *
49
+ * The Clanker contract uses: keccak256(abi.encode(tokenAdmin, salt))
50
+ * as the actual CREATE2 salt.
51
+ *
52
+ * @param args Constructor arguments for the token
53
+ * @param config Clanker deployment configuration
54
+ * @param salt Custom salt for CREATE2 deployment
55
+ * @param tokenAdmin Token admin address (used to derive the actual CREATE2 salt)
56
+ * @returns The predicted token address
57
+ */
58
+ declare const predictTokenAddressV4: (args: ContractConstructorArgs<typeof ClankerToken_v4_abi>, config: ClankerDeployment, salt: Hex, tokenAdmin: `0x${string}`) => `0x${string}`;
46
59
 
47
60
  /**
48
61
  * Calculate starting tick and spacing for a token pooled against ETH.
@@ -82,4 +95,135 @@ declare function createMerkleTree(entries: AirdropEntry[]): {
82
95
  declare function getMerkleProof(tree: StandardMerkleTree<[string, string]>, entries: [string, string][], account: `0x${string}`, amount: number): `0x${string}`[];
83
96
  declare function encodeAirdropData(merkleRoot: `0x${string}`, lockupDuration: number, vestingDuration: number): `0x${string}`;
84
97
 
85
- export { A0X_ADDRESS, ANON_ADDRESS, type AirdropEntry, CB_BTC_ADDRESS, CLANKER_ADDRESS, Chain, ClankerDeployment, ClankerTokenV4, DEFAULT_SUPPLY, DEGEN_ADDRESS, FEE_CONFIGS, FeeConfigs, HIGHER_ADDRESS, NATIVE_ADDRESS, POOL_POSITIONS, PoolPositions, WETH_ADDRESSES, createMerkleTree, encodeAirdropData, findVanityAddress, findVanityAddressV4, getMerkleProof, getTickFromMarketCap, getTickFromMarketCapUSDC };
98
+ /**
99
+ * Represents an allowlist entry with an address and allowed ETH amount
100
+ */
101
+ interface AllowlistEntry {
102
+ /** The wallet address that is allowed to participate */
103
+ address: `0x${string}`;
104
+ /** The maximum amount of ETH this address is allowed to contribute (in ETH, not wei) */
105
+ allowedAmount: number;
106
+ }
107
+ /**
108
+ * Allowlist proof structure for contract calls
109
+ */
110
+ interface AllowlistProof {
111
+ /** The maximum amount of ETH the buyer is allowed to contribute */
112
+ allowedAmount: bigint;
113
+ /** Merkle proof bytes32 array */
114
+ proof: `0x${string}`[];
115
+ }
116
+ /**
117
+ * Create a Merkle tree from allowlist entries
118
+ *
119
+ * @param entries Array of allowlist entries with addresses and allowed amounts
120
+ * @returns Object containing the Merkle tree, root, and formatted entries
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * const entries = [
125
+ * { address: '0x123...', allowedAmount: 1.0 }, // 1 ETH max
126
+ * { address: '0x456...', allowedAmount: 0.5 }, // 0.5 ETH max
127
+ * ];
128
+ * const { root, tree } = createAllowlistMerkleTree(entries);
129
+ * ```
130
+ */
131
+ declare function createAllowlistMerkleTree(entries: AllowlistEntry[]): {
132
+ tree: StandardMerkleTree<[string, string]>;
133
+ root: `0x${string}`;
134
+ entries: [string, string][];
135
+ };
136
+ /**
137
+ * Get a Merkle proof for a specific address in the allowlist
138
+ *
139
+ * @param tree The Merkle tree created from allowlist entries
140
+ * @param entries The formatted entries array from createAllowlistMerkleTree
141
+ * @param address The address to get a proof for
142
+ * @param allowedAmount The allowed amount for this address (in ETH)
143
+ * @returns Array of proof hashes
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * const { tree, entries } = createAllowlistMerkleTree(allowlistEntries);
148
+ * const proof = getAllowlistMerkleProof(tree, entries, '0x123...', 1.0);
149
+ * ```
150
+ */
151
+ declare function getAllowlistMerkleProof(tree: StandardMerkleTree<[string, string]>, entries: [string, string][], address: `0x${string}`, allowedAmount: number): `0x${string}`[];
152
+ /**
153
+ * Encode allowlist initialization data for starting a presale with a merkle root
154
+ *
155
+ * @param merkleRoot The merkle root for the allowlist
156
+ * @returns Encoded bytes for the allowlistInitializationData parameter
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * const { root } = createAllowlistMerkleTree(entries);
161
+ * const initData = encodeAllowlistInitializationData(root);
162
+ * // Use initData in presaleConfig.allowlistInitializationData
163
+ * ```
164
+ */
165
+ declare function encodeAllowlistInitializationData(merkleRoot: `0x${string}`): `0x${string}`;
166
+ /**
167
+ * Encode allowlist proof data for buying into a presale with proof
168
+ *
169
+ * @param allowedAmount The maximum allowed ETH amount for the buyer (in ETH)
170
+ * @param proof The merkle proof array
171
+ * @returns Encoded bytes for the proof parameter
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * const proof = getAllowlistMerkleProof(tree, entries, buyerAddress, 1.0);
176
+ * const proofData = encodeAllowlistProofData(1.0, proof);
177
+ * // Use proofData when calling buyIntoPresaleWithProof
178
+ * ```
179
+ */
180
+ declare function encodeAllowlistProofData(allowedAmount: number, proof: `0x${string}`[]): `0x${string}`;
181
+ /**
182
+ * Get the allowlist contract address for a specific chain
183
+ *
184
+ * @param chainId The chain ID
185
+ * @returns The allowlist contract address, or undefined if not available on this chain
186
+ */
187
+ declare function getAllowlistAddress(chainId: Chain): `0x${string}` | undefined;
188
+ /**
189
+ * Get allowlist information for a presale
190
+ *
191
+ * @param publicClient The viem public client
192
+ * @param presaleId The presale ID
193
+ * @param chainId The chain ID
194
+ * @returns Allowlist data including presale owner, merkle root, and enabled status
195
+ */
196
+ declare function getAllowlistInfo(publicClient: PublicClient, presaleId: bigint, chainId: Chain): Promise<{
197
+ presaleOwner: `0x${string}`;
198
+ merkleRoot: `0x${string}`;
199
+ enabled: boolean;
200
+ }>;
201
+ /**
202
+ * Get the allowed amount for a specific buyer in a presale
203
+ *
204
+ * @param publicClient The viem public client
205
+ * @param presaleId The presale ID
206
+ * @param buyer The buyer's address
207
+ * @param proof The encoded proof data (use encodeAllowlistProofData or pass '0x' for no proof)
208
+ * @param chainId The chain ID
209
+ * @returns The allowed amount in wei (returns max uint256 if allowlist is disabled)
210
+ */
211
+ declare function getAllowedAmountForBuyer(publicClient: PublicClient, presaleId: bigint, buyer: `0x${string}`, proof: `0x${string}`, chainId: Chain): Promise<bigint>;
212
+ /**
213
+ * Helper to verify if a buyer is allowed to purchase a specific amount
214
+ *
215
+ * @param publicClient The viem public client
216
+ * @param presaleId The presale ID
217
+ * @param buyer The buyer's address
218
+ * @param desiredAmount The amount the buyer wants to purchase (in ETH)
219
+ * @param proof The encoded proof data
220
+ * @param chainId The chain ID
221
+ * @returns Object with isAllowed boolean and allowedAmount in ETH
222
+ */
223
+ declare function verifyBuyerAllowance(publicClient: PublicClient, presaleId: bigint, buyer: `0x${string}`, desiredAmount: number, proof: `0x${string}`, chainId: Chain): Promise<{
224
+ isAllowed: boolean;
225
+ allowedAmountEth: number;
226
+ allowedAmountWei: bigint;
227
+ }>;
228
+
229
+ export { A0X_ADDRESS, ANON_ADDRESS, type AirdropEntry, type AllowlistEntry, type AllowlistProof, CB_BTC_ADDRESS, CLANKER_ADDRESS, Chain, ClankerDeployment, ClankerTokenV4, DEFAULT_SUPPLY, DEGEN_ADDRESS, FEE_CONFIGS, FeeConfigs, HIGHER_ADDRESS, NATIVE_ADDRESS, POOL_POSITIONS, PoolPositions, WETH_ADDRESSES, createAllowlistMerkleTree, createMerkleTree, encodeAirdropData, encodeAllowlistInitializationData, encodeAllowlistProofData, findVanityAddress, findVanityAddressV4, getAllowedAmountForBuyer, getAllowlistAddress, getAllowlistInfo, getAllowlistMerkleProof, getMerkleProof, getTickFromMarketCap, getTickFromMarketCapUSDC, predictTokenAddressV4, verifyBuyerAllowance };
package/dist/index.js CHANGED
@@ -206,7 +206,12 @@ var FEE_CONFIGS = {
206
206
  };
207
207
 
208
208
  // src/services/vanityAddress.ts
209
- import { encodeDeployData, keccak256 } from "viem";
209
+ import {
210
+ encodeAbiParameters,
211
+ encodeDeployData,
212
+ getContractAddress,
213
+ keccak256
214
+ } from "viem";
210
215
  import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
211
216
 
212
217
  // src/abi/v3.1/ClankerToken.ts
@@ -5759,6 +5764,30 @@ var findVanityAddressV4 = async (args, admin, suffix = "0x4b07", config) => {
5759
5764
  const { address, salt } = await response.json();
5760
5765
  return { token: address, salt };
5761
5766
  };
5767
+ var predictTokenAddressV4 = (args, config, salt, tokenAdmin) => {
5768
+ const deployData = encodeDeployData({
5769
+ abi: config.token.abi,
5770
+ bytecode: config.token.bytecode,
5771
+ args
5772
+ });
5773
+ const actualSalt = keccak256(
5774
+ encodeAbiParameters(
5775
+ [
5776
+ { type: "address", name: "tokenAdmin" },
5777
+ { type: "bytes32", name: "salt" }
5778
+ ],
5779
+ [tokenAdmin, salt]
5780
+ )
5781
+ );
5782
+ const predictedAddress = getContractAddress({
5783
+ from: config.address,
5784
+ // deployer (Clanker contract)
5785
+ salt: actualSalt,
5786
+ bytecode: deployData,
5787
+ opcode: "CREATE2"
5788
+ });
5789
+ return predictedAddress;
5790
+ };
5762
5791
 
5763
5792
  // src/utils/market-cap.ts
5764
5793
  var getTickFromMarketCap = (marketCap) => {
@@ -5781,7 +5810,7 @@ function getTickFromMarketCapUSDC(marketCapUSDC, tickSpacing = 200) {
5781
5810
 
5782
5811
  // src/utils/merkleTree.ts
5783
5812
  import { StandardMerkleTree } from "@openzeppelin/merkle-tree";
5784
- import { encodeAbiParameters } from "viem";
5813
+ import { encodeAbiParameters as encodeAbiParameters2 } from "viem";
5785
5814
  var TOKEN_DECIMALS = 18n;
5786
5815
  function toTokenDecimals(amount) {
5787
5816
  return BigInt(amount) * 10n ** TOKEN_DECIMALS;
@@ -5806,11 +5835,230 @@ function getMerkleProof(tree, entries, account, amount) {
5806
5835
  return proof.map((p) => p);
5807
5836
  }
5808
5837
  function encodeAirdropData(merkleRoot, lockupDuration, vestingDuration) {
5809
- return encodeAbiParameters(
5838
+ return encodeAbiParameters2(
5810
5839
  [{ type: "bytes32" }, { type: "uint256" }, { type: "uint256" }],
5811
5840
  [merkleRoot, BigInt(lockupDuration), BigInt(vestingDuration)]
5812
5841
  );
5813
5842
  }
5843
+
5844
+ // src/utils/presale-allowlist.ts
5845
+ import { StandardMerkleTree as StandardMerkleTree2 } from "@openzeppelin/merkle-tree";
5846
+ import { encodeAbiParameters as encodeAbiParameters3 } from "viem";
5847
+
5848
+ // src/abi/v4.1/ClankerPresaleAllowlist.ts
5849
+ var Clanker_PresaleAllowlist_v4_1_abi = [
5850
+ {
5851
+ type: "constructor",
5852
+ inputs: [{ name: "presale_", type: "address", internalType: "address" }],
5853
+ stateMutability: "nonpayable"
5854
+ },
5855
+ {
5856
+ type: "function",
5857
+ name: "allowlists",
5858
+ inputs: [{ name: "presaleId", type: "uint256", internalType: "uint256" }],
5859
+ outputs: [
5860
+ { name: "presaleOwner", type: "address", internalType: "address" },
5861
+ { name: "merkleRoot", type: "bytes32", internalType: "bytes32" },
5862
+ { name: "enabled", type: "bool", internalType: "bool" }
5863
+ ],
5864
+ stateMutability: "view"
5865
+ },
5866
+ {
5867
+ type: "function",
5868
+ name: "getAllowedAmountForBuyer",
5869
+ inputs: [
5870
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
5871
+ { name: "buyer", type: "address", internalType: "address" },
5872
+ { name: "proof", type: "bytes", internalType: "bytes" }
5873
+ ],
5874
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
5875
+ stateMutability: "view"
5876
+ },
5877
+ {
5878
+ type: "function",
5879
+ name: "initialize",
5880
+ inputs: [
5881
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
5882
+ { name: "presaleOwner", type: "address", internalType: "address" },
5883
+ { name: "initializationData", type: "bytes", internalType: "bytes" }
5884
+ ],
5885
+ outputs: [],
5886
+ stateMutability: "nonpayable"
5887
+ },
5888
+ {
5889
+ type: "function",
5890
+ name: "presale",
5891
+ inputs: [],
5892
+ outputs: [{ name: "", type: "address", internalType: "address" }],
5893
+ stateMutability: "view"
5894
+ },
5895
+ {
5896
+ type: "function",
5897
+ name: "setAddressOverride",
5898
+ inputs: [
5899
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
5900
+ { name: "buyer", type: "address", internalType: "address" },
5901
+ { name: "allowedAmount", type: "uint256", internalType: "uint256" }
5902
+ ],
5903
+ outputs: [],
5904
+ stateMutability: "nonpayable"
5905
+ },
5906
+ {
5907
+ type: "function",
5908
+ name: "setAllowlistEnabled",
5909
+ inputs: [
5910
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
5911
+ { name: "enabled", type: "bool", internalType: "bool" }
5912
+ ],
5913
+ outputs: [],
5914
+ stateMutability: "nonpayable"
5915
+ },
5916
+ {
5917
+ type: "function",
5918
+ name: "setMerkleRoot",
5919
+ inputs: [
5920
+ { name: "presaleId", type: "uint256", internalType: "uint256" },
5921
+ { name: "merkleRoot", type: "bytes32", internalType: "bytes32" }
5922
+ ],
5923
+ outputs: [],
5924
+ stateMutability: "nonpayable"
5925
+ },
5926
+ {
5927
+ type: "event",
5928
+ name: "Initialize",
5929
+ inputs: [
5930
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
5931
+ { name: "presaleOwner", type: "address", indexed: true, internalType: "address" },
5932
+ { name: "merkleRoot", type: "bytes32", indexed: false, internalType: "bytes32" }
5933
+ ],
5934
+ anonymous: false
5935
+ },
5936
+ {
5937
+ type: "event",
5938
+ name: "SetAddressOverride",
5939
+ inputs: [
5940
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
5941
+ { name: "buyer", type: "address", indexed: true, internalType: "address" },
5942
+ { name: "allowedAmount", type: "uint256", indexed: false, internalType: "uint256" }
5943
+ ],
5944
+ anonymous: false
5945
+ },
5946
+ {
5947
+ type: "event",
5948
+ name: "SetAllowlistEnabled",
5949
+ inputs: [
5950
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
5951
+ { name: "enabled", type: "bool", indexed: false, internalType: "bool" }
5952
+ ],
5953
+ anonymous: false
5954
+ },
5955
+ {
5956
+ type: "event",
5957
+ name: "SetMerkleRoot",
5958
+ inputs: [
5959
+ { name: "presaleId", type: "uint256", indexed: true, internalType: "uint256" },
5960
+ { name: "merkleRoot", type: "bytes32", indexed: false, internalType: "bytes32" }
5961
+ ],
5962
+ anonymous: false
5963
+ },
5964
+ { type: "error", name: "InvalidProof", inputs: [] },
5965
+ { type: "error", name: "MerkleRootNotSet", inputs: [] },
5966
+ { type: "error", name: "Unauthorized", inputs: [] }
5967
+ ];
5968
+
5969
+ // src/utils/presale-allowlist.ts
5970
+ function createAllowlistMerkleTree(entries) {
5971
+ const values = entries.map((entry) => [
5972
+ entry.address.toLowerCase(),
5973
+ BigInt(entry.allowedAmount * 1e18).toString()
5974
+ // Convert ETH to wei
5975
+ ]);
5976
+ const tree = StandardMerkleTree2.of(values, ["address", "uint256"]);
5977
+ const root = tree.root;
5978
+ return { tree, root, entries: values };
5979
+ }
5980
+ function getAllowlistMerkleProof(tree, entries, address, allowedAmount) {
5981
+ const allowedAmountInWei = BigInt(allowedAmount * 1e18);
5982
+ const leaf = [address.toLowerCase(), allowedAmountInWei.toString()];
5983
+ const index = entries.findIndex(([addr, amt]) => addr === leaf[0] && amt === leaf[1]);
5984
+ if (index === -1) {
5985
+ throw new Error(`Entry not found in allowlist Merkle tree for address ${address}`);
5986
+ }
5987
+ const proof = tree.getProof(index);
5988
+ return proof.map((p) => p);
5989
+ }
5990
+ function encodeAllowlistInitializationData(merkleRoot) {
5991
+ return encodeAbiParameters3([{ type: "bytes32", name: "merkleRoot" }], [merkleRoot]);
5992
+ }
5993
+ function encodeAllowlistProofData(allowedAmount, proof) {
5994
+ const allowedAmountInWei = BigInt(allowedAmount * 1e18);
5995
+ return encodeAbiParameters3(
5996
+ [
5997
+ {
5998
+ type: "tuple",
5999
+ components: [
6000
+ { name: "allowedAmount", type: "uint256" },
6001
+ { name: "proof", type: "bytes32[]" }
6002
+ ]
6003
+ }
6004
+ ],
6005
+ [
6006
+ {
6007
+ allowedAmount: allowedAmountInWei,
6008
+ proof
6009
+ }
6010
+ ]
6011
+ );
6012
+ }
6013
+ function getAllowlistAddress(chainId) {
6014
+ const config = clankerConfigFor(chainId, "clanker_v4");
6015
+ return config?.related?.presaleAllowlist;
6016
+ }
6017
+ async function getAllowlistInfo(publicClient, presaleId, chainId) {
6018
+ const allowlistAddress = getAllowlistAddress(chainId);
6019
+ if (!allowlistAddress) {
6020
+ throw new Error(`Allowlist contract not available on chain ${chainId}`);
6021
+ }
6022
+ const result = await publicClient.readContract({
6023
+ address: allowlistAddress,
6024
+ abi: Clanker_PresaleAllowlist_v4_1_abi,
6025
+ functionName: "allowlists",
6026
+ args: [presaleId]
6027
+ });
6028
+ return {
6029
+ presaleOwner: result[0],
6030
+ merkleRoot: result[1],
6031
+ enabled: result[2]
6032
+ };
6033
+ }
6034
+ async function getAllowedAmountForBuyer(publicClient, presaleId, buyer, proof, chainId) {
6035
+ const allowlistAddress = getAllowlistAddress(chainId);
6036
+ if (!allowlistAddress) {
6037
+ throw new Error(`Allowlist contract not available on chain ${chainId}`);
6038
+ }
6039
+ return publicClient.readContract({
6040
+ address: allowlistAddress,
6041
+ abi: Clanker_PresaleAllowlist_v4_1_abi,
6042
+ functionName: "getAllowedAmountForBuyer",
6043
+ args: [presaleId, buyer, proof]
6044
+ });
6045
+ }
6046
+ async function verifyBuyerAllowance(publicClient, presaleId, buyer, desiredAmount, proof, chainId) {
6047
+ const allowedAmountWei = await getAllowedAmountForBuyer(
6048
+ publicClient,
6049
+ presaleId,
6050
+ buyer,
6051
+ proof,
6052
+ chainId
6053
+ );
6054
+ const allowedAmountEth = Number(allowedAmountWei) / 1e18;
6055
+ const isAllowed = desiredAmount <= allowedAmountEth;
6056
+ return {
6057
+ isAllowed,
6058
+ allowedAmountEth,
6059
+ allowedAmountWei
6060
+ };
6061
+ }
5814
6062
  export {
5815
6063
  A0X_ADDRESS,
5816
6064
  ANON_ADDRESS,
@@ -5829,11 +6077,20 @@ export {
5829
6077
  PoolPositions,
5830
6078
  WETH_ADDRESSES,
5831
6079
  clankerConfigFor,
6080
+ createAllowlistMerkleTree,
5832
6081
  createMerkleTree,
5833
6082
  encodeAirdropData,
6083
+ encodeAllowlistInitializationData,
6084
+ encodeAllowlistProofData,
5834
6085
  findVanityAddress,
5835
6086
  findVanityAddressV4,
6087
+ getAllowedAmountForBuyer,
6088
+ getAllowlistAddress,
6089
+ getAllowlistInfo,
6090
+ getAllowlistMerkleProof,
5836
6091
  getMerkleProof,
5837
6092
  getTickFromMarketCap,
5838
- getTickFromMarketCapUSDC
6093
+ getTickFromMarketCapUSDC,
6094
+ predictTokenAddressV4,
6095
+ verifyBuyerAllowance
5839
6096
  };
@@ -1,4 +1,4 @@
1
- import { C as ClankerTransactionConfig, a as Clanker_v3_1_abi, b as ClankerFactory, c as ClankerResult } from '../write-clanker-contracts-B4LSHPv2.js';
1
+ import { C as ClankerTransactionConfig, a as Clanker_v3_1_abi, b as ClankerFactory, c as ClankerResult } 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 { C as ClankerToken_v3_1_abi } from '../ClankerToken-Dra5lppJ.js';
package/dist/v3/index.js CHANGED
@@ -3119,7 +3119,12 @@ var WETH_ADDRESSES = {
3119
3119
  var DEFAULT_SUPPLY = 100000000000000000000000000000n;
3120
3120
 
3121
3121
  // src/services/vanityAddress.ts
3122
- import { encodeDeployData, keccak256 } from "viem";
3122
+ import {
3123
+ encodeAbiParameters,
3124
+ encodeDeployData,
3125
+ getContractAddress,
3126
+ keccak256
3127
+ } from "viem";
3123
3128
  import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
3124
3129
 
3125
3130
  // src/utils/clankers.ts