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/{clankerTokenV4-Btn0ZN4v.d.ts → clankerTokenV4-xiAq6G4R.d.ts} +2 -0
- package/dist/cli/cli.js +8 -3
- package/dist/cli/create-clanker.js +7 -2
- package/dist/index.d.ts +164 -5
- package/dist/index.js +310 -4
- package/dist/v3/index.d.ts +1 -1
- package/dist/v3/index.js +6 -1
- package/dist/v4/extensions/index.d.ts +193 -3
- package/dist/v4/extensions/index.js +346 -26
- package/dist/v4/index.d.ts +3 -3
- package/dist/v4/index.js +100 -26
- package/dist/{write-clanker-contracts-B4LSHPv2.d.ts → write-clanker-contracts-CQTURFDk.d.ts} +212 -2
- package/package.json +1 -1
|
@@ -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,
|
|
@@ -7023,11 +7023,58 @@ var POOL_POSITIONS = {
|
|
|
7023
7023
|
positionBps: 500
|
|
7024
7024
|
// 5% of LP
|
|
7025
7025
|
}
|
|
7026
|
+
],
|
|
7027
|
+
TwentyETH: [
|
|
7028
|
+
{
|
|
7029
|
+
tickLower: -223400,
|
|
7030
|
+
// 20 ETH (starting tick)
|
|
7031
|
+
tickUpper: -212e3,
|
|
7032
|
+
// ~$180K
|
|
7033
|
+
positionBps: 1e3
|
|
7034
|
+
// 10% of LP
|
|
7035
|
+
},
|
|
7036
|
+
{
|
|
7037
|
+
tickLower: -212e3,
|
|
7038
|
+
// ~$180K
|
|
7039
|
+
tickUpper: -155e3,
|
|
7040
|
+
// ~$50M
|
|
7041
|
+
positionBps: 5e3
|
|
7042
|
+
// 50% of LP
|
|
7043
|
+
},
|
|
7044
|
+
{
|
|
7045
|
+
tickLower: -201e3,
|
|
7046
|
+
// ~$500K
|
|
7047
|
+
tickUpper: -155e3,
|
|
7048
|
+
// ~$50M
|
|
7049
|
+
positionBps: 1500
|
|
7050
|
+
// 15% of LP
|
|
7051
|
+
},
|
|
7052
|
+
{
|
|
7053
|
+
tickLower: -155e3,
|
|
7054
|
+
// ~$50M
|
|
7055
|
+
tickUpper: -12e4,
|
|
7056
|
+
// ~$1.5B
|
|
7057
|
+
positionBps: 2e3
|
|
7058
|
+
// 20% of LP
|
|
7059
|
+
},
|
|
7060
|
+
{
|
|
7061
|
+
tickLower: -141e3,
|
|
7062
|
+
// ~$200M
|
|
7063
|
+
tickUpper: -12e4,
|
|
7064
|
+
// ~$1.5B
|
|
7065
|
+
positionBps: 500
|
|
7066
|
+
// 5% of LP
|
|
7067
|
+
}
|
|
7026
7068
|
]
|
|
7027
7069
|
};
|
|
7028
7070
|
|
|
7029
7071
|
// src/services/vanityAddress.ts
|
|
7030
|
-
import {
|
|
7072
|
+
import {
|
|
7073
|
+
encodeAbiParameters,
|
|
7074
|
+
encodeDeployData,
|
|
7075
|
+
getContractAddress,
|
|
7076
|
+
keccak256
|
|
7077
|
+
} from "viem";
|
|
7031
7078
|
import { abstract as abstract3, monadTestnet as monadTestnet3 } from "viem/chains";
|
|
7032
7079
|
var findVanityAddressV4 = async (args, admin, suffix = "0x4b07", config) => {
|
|
7033
7080
|
const data = encodeDeployData({
|
|
@@ -7042,6 +7089,30 @@ var findVanityAddressV4 = async (args, admin, suffix = "0x4b07", config) => {
|
|
|
7042
7089
|
const { address, salt } = await response.json();
|
|
7043
7090
|
return { token: address, salt };
|
|
7044
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
|
+
};
|
|
7045
7116
|
|
|
7046
7117
|
// src/config/clankerTokenV4.ts
|
|
7047
7118
|
var NULL_DEVBUY_POOL_CONFIG = {
|
|
@@ -7066,6 +7137,8 @@ var clankerTokenV4 = z3.strictObject({
|
|
|
7066
7137
|
image: z3.string().default(""),
|
|
7067
7138
|
/** Id of the chain that the token will be deployed to. Defaults to base (8453). */
|
|
7068
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(),
|
|
7069
7142
|
/** Admin for the token. They will be able to change fields like image, metadata, etc. */
|
|
7070
7143
|
tokenAdmin: addressSchema.refine((v) => !isAddressEqual2(v, zeroAddress), {
|
|
7071
7144
|
error: "Admin cannot be zero address"
|
|
@@ -7269,23 +7342,24 @@ var clankerTokenV4Converter = async (config) => {
|
|
|
7269
7342
|
if (cfg.presale && !clankerConfig?.related?.presale) {
|
|
7270
7343
|
throw new Error(`Presales are not available on chain ${cfg.chainId}`);
|
|
7271
7344
|
}
|
|
7272
|
-
const
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
DEFAULT_SUPPLY,
|
|
7277
|
-
cfg.tokenAdmin,
|
|
7278
|
-
cfg.image,
|
|
7279
|
-
metadata,
|
|
7280
|
-
socialContext,
|
|
7281
|
-
BigInt(cfg.chainId)
|
|
7282
|
-
],
|
|
7345
|
+
const tokenArgs = [
|
|
7346
|
+
cfg.name,
|
|
7347
|
+
cfg.symbol,
|
|
7348
|
+
DEFAULT_SUPPLY,
|
|
7283
7349
|
cfg.tokenAdmin,
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
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
|
|
7287
7361
|
salt: zeroHash,
|
|
7288
|
-
token:
|
|
7362
|
+
token: predictTokenAddressV4(tokenArgs, clankerConfig, zeroHash, cfg.tokenAdmin)
|
|
7289
7363
|
};
|
|
7290
7364
|
const airdropAmount = BigInt(cfg.airdrop?.amount || 0) * BigInt(1e18);
|
|
7291
7365
|
const bpsAirdropped = airdropAmount * 10000n / DEFAULT_SUPPLY + (airdropAmount * 10000n % DEFAULT_SUPPLY ? 1n : 0n);
|
|
@@ -7321,7 +7395,7 @@ var clankerTokenV4Converter = async (config) => {
|
|
|
7321
7395
|
},
|
|
7322
7396
|
lockerConfig: {
|
|
7323
7397
|
locker: cfg.locker.locker === "Locker" ? clankerConfig.related.locker : cfg.locker.locker,
|
|
7324
|
-
lockerData:
|
|
7398
|
+
lockerData: encodeAbiParameters2(ClankerLpLocker_Instantiation_v4_abi, [
|
|
7325
7399
|
{
|
|
7326
7400
|
feePreference: cfg.rewards.recipients.map(({ token }) => FeeInToInt[token])
|
|
7327
7401
|
}
|
|
@@ -7342,7 +7416,7 @@ var clankerTokenV4Converter = async (config) => {
|
|
|
7342
7416
|
},
|
|
7343
7417
|
mevModuleConfig: {
|
|
7344
7418
|
mevModule: clankerConfig.related?.mevModuleV2 || clankerConfig.related?.mevModule,
|
|
7345
|
-
mevModuleData: clankerConfig.related?.mevModuleV2 ?
|
|
7419
|
+
mevModuleData: clankerConfig.related?.mevModuleV2 ? encodeAbiParameters2(Clanker_MevSniperAuction_InitData_v4_1_abi, [
|
|
7346
7420
|
{
|
|
7347
7421
|
startingFee: cfg.sniperFees.startingFee,
|
|
7348
7422
|
endingFee: cfg.sniperFees.endingFee,
|
|
@@ -7357,7 +7431,7 @@ var clankerTokenV4Converter = async (config) => {
|
|
|
7357
7431
|
extension: clankerConfig.related.vault,
|
|
7358
7432
|
msgValue: 0n,
|
|
7359
7433
|
extensionBps: cfg.vault.percentage * 100,
|
|
7360
|
-
extensionData:
|
|
7434
|
+
extensionData: encodeAbiParameters2(ClankerVault_Instantiation_v4_abi, [
|
|
7361
7435
|
cfg.vault.recipient ?? cfg.tokenAdmin,
|
|
7362
7436
|
BigInt(cfg.vault.lockupDuration),
|
|
7363
7437
|
BigInt(cfg.vault.vestingDuration)
|
|
@@ -7370,7 +7444,7 @@ var clankerTokenV4Converter = async (config) => {
|
|
|
7370
7444
|
extension: clankerConfig.related.airdrop,
|
|
7371
7445
|
msgValue: 0n,
|
|
7372
7446
|
extensionBps: Number(bpsAirdropped),
|
|
7373
|
-
extensionData:
|
|
7447
|
+
extensionData: encodeAbiParameters2(ClankerAirdropV2_Instantiation_v4_abi, [
|
|
7374
7448
|
cfg.airdrop.admin || cfg.tokenAdmin,
|
|
7375
7449
|
cfg.airdrop.merkleRoot,
|
|
7376
7450
|
BigInt(cfg.airdrop.lockupDuration),
|
|
@@ -7384,7 +7458,7 @@ var clankerTokenV4Converter = async (config) => {
|
|
|
7384
7458
|
extension: clankerConfig.related.devbuy,
|
|
7385
7459
|
msgValue: BigInt(cfg.devBuy.ethAmount * 1e18),
|
|
7386
7460
|
extensionBps: 0,
|
|
7387
|
-
extensionData:
|
|
7461
|
+
extensionData: encodeAbiParameters2(ClankerUniV4EthDevBuy_Instantiation_v4_abi, [
|
|
7388
7462
|
cfg.devBuy.poolKey,
|
|
7389
7463
|
BigInt(cfg.devBuy.amountOutMin * 1e18),
|
|
7390
7464
|
cfg.tokenAdmin
|
|
@@ -7412,7 +7486,7 @@ var clankerTokenV4Converter = async (config) => {
|
|
|
7412
7486
|
function encodeFeeConfig(tokenConfig, clankerConfig) {
|
|
7413
7487
|
const config = tokenConfig.fees;
|
|
7414
7488
|
if (config.type === "static") {
|
|
7415
|
-
const feeData =
|
|
7489
|
+
const feeData = encodeAbiParameters2(ClankerHook_StaticFee_Instantiation_v4_abi, [
|
|
7416
7490
|
config.clankerFee * 100,
|
|
7417
7491
|
// uniBps
|
|
7418
7492
|
config.pairedFee * 100
|
|
@@ -7421,7 +7495,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
|
|
|
7421
7495
|
if (clankerConfig.related.feeStaticHookV2) {
|
|
7422
7496
|
return {
|
|
7423
7497
|
hook: clankerConfig.related.feeStaticHookV2,
|
|
7424
|
-
poolData:
|
|
7498
|
+
poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
|
|
7425
7499
|
{
|
|
7426
7500
|
extension: tokenConfig.poolExtension.address,
|
|
7427
7501
|
extensionData: tokenConfig.poolExtension.initData,
|
|
@@ -7436,7 +7510,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
|
|
|
7436
7510
|
};
|
|
7437
7511
|
}
|
|
7438
7512
|
if (config.type === "dynamic") {
|
|
7439
|
-
const feeData =
|
|
7513
|
+
const feeData = encodeAbiParameters2(ClankerHook_DynamicFee_Instantiation_v4_abi, [
|
|
7440
7514
|
config.baseFee * 100,
|
|
7441
7515
|
// uniBps
|
|
7442
7516
|
config.maxFee * 100,
|
|
@@ -7450,7 +7524,7 @@ function encodeFeeConfig(tokenConfig, clankerConfig) {
|
|
|
7450
7524
|
if (clankerConfig.related.feeDynamicHookV2) {
|
|
7451
7525
|
return {
|
|
7452
7526
|
hook: clankerConfig.related.feeDynamicHookV2,
|
|
7453
|
-
poolData:
|
|
7527
|
+
poolData: encodeAbiParameters2(Clanker_PoolInitializationData_v4_1_abi, [
|
|
7454
7528
|
{
|
|
7455
7529
|
extension: tokenConfig.poolExtension.address,
|
|
7456
7530
|
extensionData: tokenConfig.poolExtension.initData,
|
|
@@ -7770,9 +7844,248 @@ function getAllowlistAddress(chainId) {
|
|
|
7770
7844
|
const config = clankerConfigFor(chainId, "clanker_v4");
|
|
7771
7845
|
return config?.related?.presaleAllowlist;
|
|
7772
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
|
+
}
|
|
7773
8085
|
export {
|
|
7774
8086
|
PresaleStatus,
|
|
7775
8087
|
buyIntoPresale,
|
|
8088
|
+
buyIntoPresaleWithProof,
|
|
7776
8089
|
claimAirdrop,
|
|
7777
8090
|
claimEth,
|
|
7778
8091
|
claimTokens,
|
|
@@ -7783,6 +8096,7 @@ export {
|
|
|
7783
8096
|
getAllowlistAddress,
|
|
7784
8097
|
getAmountAvailableToClaim,
|
|
7785
8098
|
getBuyIntoPresaleTransaction,
|
|
8099
|
+
getBuyIntoPresaleWithProofTransaction,
|
|
7786
8100
|
getClaimAirdropTransaction,
|
|
7787
8101
|
getClaimEthTransaction,
|
|
7788
8102
|
getClaimTokensTransaction,
|
|
@@ -7791,9 +8105,15 @@ export {
|
|
|
7791
8105
|
getPresaleBuys,
|
|
7792
8106
|
getPresaleClaimed,
|
|
7793
8107
|
getPresaleState,
|
|
8108
|
+
getSetAddressOverrideTransaction,
|
|
8109
|
+
getSetAllowlistEnabledTransaction,
|
|
8110
|
+
getSetMerkleRootTransaction,
|
|
7794
8111
|
getStartPresaleTransaction,
|
|
7795
8112
|
getWithdrawFromPresaleTransaction,
|
|
7796
8113
|
registerAirdrop,
|
|
8114
|
+
setAddressOverride,
|
|
8115
|
+
setAllowlistEnabled,
|
|
8116
|
+
setMerkleRoot,
|
|
7797
8117
|
startPresale,
|
|
7798
8118
|
withdrawFromPresale
|
|
7799
8119
|
};
|
package/dist/v4/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
6
|
-
export { e as encodeFeeConfig } from '../clankerTokenV4-
|
|
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
|
|