clanker-sdk 4.0.3 → 4.0.4
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/cli/cli.js +45 -18
- package/dist/cli/create-clanker.js +45 -18
- package/dist/index.d.ts +16 -1
- package/dist/index.js +45 -18
- package/package.json +1 -1
package/dist/cli/cli.js
CHANGED
|
@@ -4819,32 +4819,27 @@ import {
|
|
|
4819
4819
|
encodeFunctionData as encodeFunctionData2,
|
|
4820
4820
|
parseEventLogs as parseEventLogs2
|
|
4821
4821
|
} from "viem";
|
|
4822
|
-
|
|
4823
|
-
const account = wallet?.account;
|
|
4824
|
-
const CHAIN_ID = publicClient.chain?.id;
|
|
4825
|
-
if (!account) {
|
|
4826
|
-
throw new Error("Wallet account required for deployToken");
|
|
4827
|
-
}
|
|
4822
|
+
function buildTokenV4(cfg, chainId) {
|
|
4828
4823
|
const feeConfig = cfg.feeConfig || { type: "static", fee: 500 };
|
|
4829
4824
|
const { hook, poolData } = encodeFeeConfig(feeConfig);
|
|
4830
4825
|
const deploymentConfig = {
|
|
4831
4826
|
tokenConfig: {
|
|
4832
|
-
tokenAdmin:
|
|
4827
|
+
tokenAdmin: cfg.tokenAdmin,
|
|
4833
4828
|
name: cfg.name,
|
|
4834
4829
|
symbol: cfg.symbol,
|
|
4835
4830
|
salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4836
4831
|
image: cfg.image || "",
|
|
4837
4832
|
metadata: cfg.metadata ? JSON.stringify(cfg.metadata) : "",
|
|
4838
4833
|
context: cfg.context ? JSON.stringify(cfg.context) : "",
|
|
4839
|
-
originatingChainId: BigInt(
|
|
4834
|
+
originatingChainId: BigInt(chainId)
|
|
4840
4835
|
},
|
|
4841
4836
|
lockerConfig: {
|
|
4842
4837
|
rewardAdmins: [
|
|
4843
|
-
cfg.rewardsConfig?.creatorAdmin ||
|
|
4838
|
+
cfg.rewardsConfig?.creatorAdmin || cfg.tokenAdmin,
|
|
4844
4839
|
...cfg.rewardsConfig?.additionalRewardAdmins || []
|
|
4845
4840
|
],
|
|
4846
4841
|
rewardRecipients: [
|
|
4847
|
-
cfg.rewardsConfig?.creatorRewardRecipient ||
|
|
4842
|
+
cfg.rewardsConfig?.creatorRewardRecipient || cfg.tokenAdmin,
|
|
4848
4843
|
...cfg.rewardsConfig?.additionalRewardRecipients || []
|
|
4849
4844
|
],
|
|
4850
4845
|
rewardBps: [
|
|
@@ -4876,7 +4871,7 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4876
4871
|
extensionData: encodeAbiParameters2(
|
|
4877
4872
|
[{ type: "address" }, { type: "uint256" }, { type: "uint256" }],
|
|
4878
4873
|
[
|
|
4879
|
-
|
|
4874
|
+
cfg.tokenAdmin,
|
|
4880
4875
|
BigInt(cfg.vault?.lockupDuration || 0),
|
|
4881
4876
|
BigInt(cfg.vault?.vestingDuration || 0)
|
|
4882
4877
|
]
|
|
@@ -4924,14 +4919,14 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4924
4919
|
{
|
|
4925
4920
|
currency0: "0x4200000000000000000000000000000000000006",
|
|
4926
4921
|
// WETH
|
|
4927
|
-
currency1:
|
|
4928
|
-
//
|
|
4922
|
+
currency1: "0x4200000000000000000000000000000000000006",
|
|
4923
|
+
// paired token address if not WETH
|
|
4929
4924
|
fee: 3e3,
|
|
4930
4925
|
tickSpacing: 60,
|
|
4931
4926
|
hooks: "0x0000000000000000000000000000000000000000"
|
|
4932
4927
|
},
|
|
4933
4928
|
BigInt(0),
|
|
4934
|
-
|
|
4929
|
+
cfg.tokenAdmin
|
|
4935
4930
|
]
|
|
4936
4931
|
)
|
|
4937
4932
|
}
|
|
@@ -4943,13 +4938,30 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4943
4938
|
functionName: "deployToken",
|
|
4944
4939
|
args: [deploymentConfig]
|
|
4945
4940
|
});
|
|
4946
|
-
|
|
4941
|
+
return {
|
|
4942
|
+
transaction: {
|
|
4943
|
+
to: CLANKER_FACTORY_V4,
|
|
4944
|
+
data: deployCalldata,
|
|
4945
|
+
value: cfg.devBuy && cfg.devBuy.ethAmount !== "0" ? BigInt(parseFloat(cfg.devBuy.ethAmount) * 1e18) : BigInt(0)
|
|
4946
|
+
},
|
|
4947
|
+
expectedAddress: "0x0000000000000000000000000000000000000000",
|
|
4948
|
+
// Placeholder for now
|
|
4949
|
+
chainId
|
|
4950
|
+
};
|
|
4951
|
+
}
|
|
4952
|
+
async function deployTokenV4(cfg, wallet, publicClient) {
|
|
4953
|
+
const account = wallet?.account;
|
|
4954
|
+
const CHAIN_ID = publicClient.chain?.id;
|
|
4955
|
+
if (!account) {
|
|
4956
|
+
throw new Error("Wallet account required for deployToken");
|
|
4957
|
+
}
|
|
4958
|
+
const { transaction } = buildTokenV4(cfg, CHAIN_ID || 84532);
|
|
4959
|
+
console.log("Deployment config:", JSON.stringify(transaction, bigIntReplacer, 2));
|
|
4947
4960
|
const tx = await wallet.sendTransaction({
|
|
4948
|
-
|
|
4949
|
-
data: deployCalldata,
|
|
4961
|
+
...transaction,
|
|
4950
4962
|
account,
|
|
4951
4963
|
chain: publicClient.chain,
|
|
4952
|
-
value:
|
|
4964
|
+
value: transaction.value
|
|
4953
4965
|
});
|
|
4954
4966
|
console.log("Transaction hash:", tx);
|
|
4955
4967
|
const receipt = await publicClient.waitForTransactionReceipt({
|
|
@@ -5122,6 +5134,21 @@ var init_index = __esm({
|
|
|
5122
5134
|
this.wallet = config2.wallet;
|
|
5123
5135
|
this.publicClient = config2.publicClient;
|
|
5124
5136
|
}
|
|
5137
|
+
/**
|
|
5138
|
+
* Build V4 token deployment data without deploying
|
|
5139
|
+
* @param cfg Token configuration for V4 deployment
|
|
5140
|
+
* @returns Object containing transaction data, target address, and network info
|
|
5141
|
+
*/
|
|
5142
|
+
buildV4(cfg) {
|
|
5143
|
+
if (!this.wallet?.account) {
|
|
5144
|
+
throw new Error("Wallet account required for building deployment data");
|
|
5145
|
+
}
|
|
5146
|
+
const result = buildTokenV4(
|
|
5147
|
+
cfg,
|
|
5148
|
+
this.publicClient.chain?.id || 84532
|
|
5149
|
+
);
|
|
5150
|
+
return result;
|
|
5151
|
+
}
|
|
5125
5152
|
/**
|
|
5126
5153
|
* Deploy a token using the V4 protocol
|
|
5127
5154
|
* @param cfg Token configuration for V4 deployment
|
|
@@ -4680,32 +4680,27 @@ var bigIntReplacer = (_key, value) => {
|
|
|
4680
4680
|
}
|
|
4681
4681
|
return value;
|
|
4682
4682
|
};
|
|
4683
|
-
|
|
4684
|
-
const account = wallet?.account;
|
|
4685
|
-
const CHAIN_ID = publicClient.chain?.id;
|
|
4686
|
-
if (!account) {
|
|
4687
|
-
throw new Error("Wallet account required for deployToken");
|
|
4688
|
-
}
|
|
4683
|
+
function buildTokenV4(cfg, chainId) {
|
|
4689
4684
|
const feeConfig = cfg.feeConfig || { type: "static", fee: 500 };
|
|
4690
4685
|
const { hook, poolData } = encodeFeeConfig(feeConfig);
|
|
4691
4686
|
const deploymentConfig = {
|
|
4692
4687
|
tokenConfig: {
|
|
4693
|
-
tokenAdmin:
|
|
4688
|
+
tokenAdmin: cfg.tokenAdmin,
|
|
4694
4689
|
name: cfg.name,
|
|
4695
4690
|
symbol: cfg.symbol,
|
|
4696
4691
|
salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4697
4692
|
image: cfg.image || "",
|
|
4698
4693
|
metadata: cfg.metadata ? JSON.stringify(cfg.metadata) : "",
|
|
4699
4694
|
context: cfg.context ? JSON.stringify(cfg.context) : "",
|
|
4700
|
-
originatingChainId: BigInt(
|
|
4695
|
+
originatingChainId: BigInt(chainId)
|
|
4701
4696
|
},
|
|
4702
4697
|
lockerConfig: {
|
|
4703
4698
|
rewardAdmins: [
|
|
4704
|
-
cfg.rewardsConfig?.creatorAdmin ||
|
|
4699
|
+
cfg.rewardsConfig?.creatorAdmin || cfg.tokenAdmin,
|
|
4705
4700
|
...cfg.rewardsConfig?.additionalRewardAdmins || []
|
|
4706
4701
|
],
|
|
4707
4702
|
rewardRecipients: [
|
|
4708
|
-
cfg.rewardsConfig?.creatorRewardRecipient ||
|
|
4703
|
+
cfg.rewardsConfig?.creatorRewardRecipient || cfg.tokenAdmin,
|
|
4709
4704
|
...cfg.rewardsConfig?.additionalRewardRecipients || []
|
|
4710
4705
|
],
|
|
4711
4706
|
rewardBps: [
|
|
@@ -4737,7 +4732,7 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4737
4732
|
extensionData: encodeAbiParameters2(
|
|
4738
4733
|
[{ type: "address" }, { type: "uint256" }, { type: "uint256" }],
|
|
4739
4734
|
[
|
|
4740
|
-
|
|
4735
|
+
cfg.tokenAdmin,
|
|
4741
4736
|
BigInt(cfg.vault?.lockupDuration || 0),
|
|
4742
4737
|
BigInt(cfg.vault?.vestingDuration || 0)
|
|
4743
4738
|
]
|
|
@@ -4785,14 +4780,14 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4785
4780
|
{
|
|
4786
4781
|
currency0: "0x4200000000000000000000000000000000000006",
|
|
4787
4782
|
// WETH
|
|
4788
|
-
currency1:
|
|
4789
|
-
//
|
|
4783
|
+
currency1: "0x4200000000000000000000000000000000000006",
|
|
4784
|
+
// paired token address if not WETH
|
|
4790
4785
|
fee: 3e3,
|
|
4791
4786
|
tickSpacing: 60,
|
|
4792
4787
|
hooks: "0x0000000000000000000000000000000000000000"
|
|
4793
4788
|
},
|
|
4794
4789
|
BigInt(0),
|
|
4795
|
-
|
|
4790
|
+
cfg.tokenAdmin
|
|
4796
4791
|
]
|
|
4797
4792
|
)
|
|
4798
4793
|
}
|
|
@@ -4804,13 +4799,30 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4804
4799
|
functionName: "deployToken",
|
|
4805
4800
|
args: [deploymentConfig]
|
|
4806
4801
|
});
|
|
4807
|
-
|
|
4802
|
+
return {
|
|
4803
|
+
transaction: {
|
|
4804
|
+
to: CLANKER_FACTORY_V4,
|
|
4805
|
+
data: deployCalldata,
|
|
4806
|
+
value: cfg.devBuy && cfg.devBuy.ethAmount !== "0" ? BigInt(parseFloat(cfg.devBuy.ethAmount) * 1e18) : BigInt(0)
|
|
4807
|
+
},
|
|
4808
|
+
expectedAddress: "0x0000000000000000000000000000000000000000",
|
|
4809
|
+
// Placeholder for now
|
|
4810
|
+
chainId
|
|
4811
|
+
};
|
|
4812
|
+
}
|
|
4813
|
+
async function deployTokenV4(cfg, wallet, publicClient) {
|
|
4814
|
+
const account = wallet?.account;
|
|
4815
|
+
const CHAIN_ID = publicClient.chain?.id;
|
|
4816
|
+
if (!account) {
|
|
4817
|
+
throw new Error("Wallet account required for deployToken");
|
|
4818
|
+
}
|
|
4819
|
+
const { transaction } = buildTokenV4(cfg, CHAIN_ID || 84532);
|
|
4820
|
+
console.log("Deployment config:", JSON.stringify(transaction, bigIntReplacer, 2));
|
|
4808
4821
|
const tx = await wallet.sendTransaction({
|
|
4809
|
-
|
|
4810
|
-
data: deployCalldata,
|
|
4822
|
+
...transaction,
|
|
4811
4823
|
account,
|
|
4812
4824
|
chain: publicClient.chain,
|
|
4813
|
-
value:
|
|
4825
|
+
value: transaction.value
|
|
4814
4826
|
});
|
|
4815
4827
|
console.log("Transaction hash:", tx);
|
|
4816
4828
|
const receipt = await publicClient.waitForTransactionReceipt({
|
|
@@ -4858,6 +4870,21 @@ var Clanker = class {
|
|
|
4858
4870
|
this.wallet = config2.wallet;
|
|
4859
4871
|
this.publicClient = config2.publicClient;
|
|
4860
4872
|
}
|
|
4873
|
+
/**
|
|
4874
|
+
* Build V4 token deployment data without deploying
|
|
4875
|
+
* @param cfg Token configuration for V4 deployment
|
|
4876
|
+
* @returns Object containing transaction data, target address, and network info
|
|
4877
|
+
*/
|
|
4878
|
+
buildV4(cfg) {
|
|
4879
|
+
if (!this.wallet?.account) {
|
|
4880
|
+
throw new Error("Wallet account required for building deployment data");
|
|
4881
|
+
}
|
|
4882
|
+
const result = buildTokenV4(
|
|
4883
|
+
cfg,
|
|
4884
|
+
this.publicClient.chain?.id || 84532
|
|
4885
|
+
);
|
|
4886
|
+
return result;
|
|
4887
|
+
}
|
|
4861
4888
|
/**
|
|
4862
4889
|
* Deploy a token using the V4 protocol
|
|
4863
4890
|
* @param cfg Token configuration for V4 deployment
|
package/dist/index.d.ts
CHANGED
|
@@ -785,6 +785,15 @@ interface DynamicFeeConfig {
|
|
|
785
785
|
}
|
|
786
786
|
type FeeConfig = StaticFeeConfig | DynamicFeeConfig;
|
|
787
787
|
|
|
788
|
+
interface BuildV4Result {
|
|
789
|
+
transaction: {
|
|
790
|
+
to: Address;
|
|
791
|
+
data: `0x${string}`;
|
|
792
|
+
value: bigint;
|
|
793
|
+
};
|
|
794
|
+
expectedAddress: `0x${string}`;
|
|
795
|
+
chainId: number;
|
|
796
|
+
}
|
|
788
797
|
interface TokenConfigV4$1 {
|
|
789
798
|
tokenAdmin: Address;
|
|
790
799
|
name: string;
|
|
@@ -1962,6 +1971,12 @@ declare class Clanker {
|
|
|
1962
1971
|
private readonly wallet?;
|
|
1963
1972
|
private readonly publicClient;
|
|
1964
1973
|
constructor(config: ClankerConfig);
|
|
1974
|
+
/**
|
|
1975
|
+
* Build V4 token deployment data without deploying
|
|
1976
|
+
* @param cfg Token configuration for V4 deployment
|
|
1977
|
+
* @returns Object containing transaction data, target address, and network info
|
|
1978
|
+
*/
|
|
1979
|
+
buildV4(cfg: TokenConfigV4): BuildV4Result;
|
|
1965
1980
|
/**
|
|
1966
1981
|
* Deploy a token using the V4 protocol
|
|
1967
1982
|
* @param cfg Token configuration for V4 deployment
|
|
@@ -1976,4 +1991,4 @@ declare class Clanker {
|
|
|
1976
1991
|
deployToken(cfg: TokenConfig): Promise<`0x${string}`>;
|
|
1977
1992
|
}
|
|
1978
1993
|
|
|
1979
|
-
export { type AirdropConfig, type AirdropEntry, AirdropExtension, Clanker, type ClankerConfig, type ClankerMetadata, type ClankerSocialContext, type DeployFormData, type DeploymentConfigV4, type DeploymentInfoV4, type DevBuyConfig, type DevBuyExtensionDataV4, type ExtensionConfigV4, type IClankerDeployConfig, type IPoolConfig, type ITokenData, type LockerConfigV4, type MevModuleConfigV4, type PoolConfig, type PoolConfigV4, type RewardsConfig, type RewardsConfigV4, type TokenConfig, type TokenConfigV4, TokenConfigV4Builder, type TokenPair, VALID_TOKEN_PAIRS, VALID_TOKEN_PAIR_ADDRESSES, type VaultConfig, type VaultConfigV4, type ZodClankerConfig, type ZodDeploymentConfig, type ZodInitialBuyConfig, type ZodPoolConfig, type ZodRewardsConfig, type ZodTokenConfig, type ZodVaultConfig, bpsToPercentage, clankerConfigSchema, createMerkleTree, deploymentConfigSchema, encodeAirdropData, findVanityAddress, getMerkleProof, initialBuyConfigSchema, isInRange, isValidBps, percentageToBps, poolConfigSchema, rewardsConfigSchema, tokenConfigSchema, validateBpsSum, validateConfig, vaultConfigSchema };
|
|
1994
|
+
export { type AirdropConfig, type AirdropEntry, AirdropExtension, type BuildV4Result, Clanker, type ClankerConfig, type ClankerMetadata, type ClankerSocialContext, type DeployFormData, type DeploymentConfigV4, type DeploymentInfoV4, type DevBuyConfig, type DevBuyExtensionDataV4, type ExtensionConfigV4, type IClankerDeployConfig, type IPoolConfig, type ITokenData, type LockerConfigV4, type MevModuleConfigV4, type PoolConfig, type PoolConfigV4, type RewardsConfig, type RewardsConfigV4, type TokenConfig, type TokenConfigV4, TokenConfigV4Builder, type TokenPair, VALID_TOKEN_PAIRS, VALID_TOKEN_PAIR_ADDRESSES, type VaultConfig, type VaultConfigV4, type ZodClankerConfig, type ZodDeploymentConfig, type ZodInitialBuyConfig, type ZodPoolConfig, type ZodRewardsConfig, type ZodTokenConfig, type ZodVaultConfig, bpsToPercentage, clankerConfigSchema, createMerkleTree, deploymentConfigSchema, encodeAirdropData, findVanityAddress, getMerkleProof, initialBuyConfigSchema, isInRange, isValidBps, percentageToBps, poolConfigSchema, rewardsConfigSchema, tokenConfigSchema, validateBpsSum, validateConfig, vaultConfigSchema };
|
package/dist/index.js
CHANGED
|
@@ -4678,32 +4678,27 @@ var bigIntReplacer = (_key, value) => {
|
|
|
4678
4678
|
}
|
|
4679
4679
|
return value;
|
|
4680
4680
|
};
|
|
4681
|
-
|
|
4682
|
-
const account = wallet?.account;
|
|
4683
|
-
const CHAIN_ID = publicClient.chain?.id;
|
|
4684
|
-
if (!account) {
|
|
4685
|
-
throw new Error("Wallet account required for deployToken");
|
|
4686
|
-
}
|
|
4681
|
+
function buildTokenV4(cfg, chainId) {
|
|
4687
4682
|
const feeConfig = cfg.feeConfig || { type: "static", fee: 500 };
|
|
4688
4683
|
const { hook, poolData } = encodeFeeConfig(feeConfig);
|
|
4689
4684
|
const deploymentConfig = {
|
|
4690
4685
|
tokenConfig: {
|
|
4691
|
-
tokenAdmin:
|
|
4686
|
+
tokenAdmin: cfg.tokenAdmin,
|
|
4692
4687
|
name: cfg.name,
|
|
4693
4688
|
symbol: cfg.symbol,
|
|
4694
4689
|
salt: "0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
4695
4690
|
image: cfg.image || "",
|
|
4696
4691
|
metadata: cfg.metadata ? JSON.stringify(cfg.metadata) : "",
|
|
4697
4692
|
context: cfg.context ? JSON.stringify(cfg.context) : "",
|
|
4698
|
-
originatingChainId: BigInt(
|
|
4693
|
+
originatingChainId: BigInt(chainId)
|
|
4699
4694
|
},
|
|
4700
4695
|
lockerConfig: {
|
|
4701
4696
|
rewardAdmins: [
|
|
4702
|
-
cfg.rewardsConfig?.creatorAdmin ||
|
|
4697
|
+
cfg.rewardsConfig?.creatorAdmin || cfg.tokenAdmin,
|
|
4703
4698
|
...cfg.rewardsConfig?.additionalRewardAdmins || []
|
|
4704
4699
|
],
|
|
4705
4700
|
rewardRecipients: [
|
|
4706
|
-
cfg.rewardsConfig?.creatorRewardRecipient ||
|
|
4701
|
+
cfg.rewardsConfig?.creatorRewardRecipient || cfg.tokenAdmin,
|
|
4707
4702
|
...cfg.rewardsConfig?.additionalRewardRecipients || []
|
|
4708
4703
|
],
|
|
4709
4704
|
rewardBps: [
|
|
@@ -4735,7 +4730,7 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4735
4730
|
extensionData: encodeAbiParameters2(
|
|
4736
4731
|
[{ type: "address" }, { type: "uint256" }, { type: "uint256" }],
|
|
4737
4732
|
[
|
|
4738
|
-
|
|
4733
|
+
cfg.tokenAdmin,
|
|
4739
4734
|
BigInt(cfg.vault?.lockupDuration || 0),
|
|
4740
4735
|
BigInt(cfg.vault?.vestingDuration || 0)
|
|
4741
4736
|
]
|
|
@@ -4783,14 +4778,14 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4783
4778
|
{
|
|
4784
4779
|
currency0: "0x4200000000000000000000000000000000000006",
|
|
4785
4780
|
// WETH
|
|
4786
|
-
currency1:
|
|
4787
|
-
//
|
|
4781
|
+
currency1: "0x4200000000000000000000000000000000000006",
|
|
4782
|
+
// paired token address if not WETH
|
|
4788
4783
|
fee: 3e3,
|
|
4789
4784
|
tickSpacing: 60,
|
|
4790
4785
|
hooks: "0x0000000000000000000000000000000000000000"
|
|
4791
4786
|
},
|
|
4792
4787
|
BigInt(0),
|
|
4793
|
-
|
|
4788
|
+
cfg.tokenAdmin
|
|
4794
4789
|
]
|
|
4795
4790
|
)
|
|
4796
4791
|
}
|
|
@@ -4802,13 +4797,30 @@ async function deployTokenV4(cfg, wallet, publicClient) {
|
|
|
4802
4797
|
functionName: "deployToken",
|
|
4803
4798
|
args: [deploymentConfig]
|
|
4804
4799
|
});
|
|
4805
|
-
|
|
4800
|
+
return {
|
|
4801
|
+
transaction: {
|
|
4802
|
+
to: CLANKER_FACTORY_V4,
|
|
4803
|
+
data: deployCalldata,
|
|
4804
|
+
value: cfg.devBuy && cfg.devBuy.ethAmount !== "0" ? BigInt(parseFloat(cfg.devBuy.ethAmount) * 1e18) : BigInt(0)
|
|
4805
|
+
},
|
|
4806
|
+
expectedAddress: "0x0000000000000000000000000000000000000000",
|
|
4807
|
+
// Placeholder for now
|
|
4808
|
+
chainId
|
|
4809
|
+
};
|
|
4810
|
+
}
|
|
4811
|
+
async function deployTokenV4(cfg, wallet, publicClient) {
|
|
4812
|
+
const account = wallet?.account;
|
|
4813
|
+
const CHAIN_ID = publicClient.chain?.id;
|
|
4814
|
+
if (!account) {
|
|
4815
|
+
throw new Error("Wallet account required for deployToken");
|
|
4816
|
+
}
|
|
4817
|
+
const { transaction } = buildTokenV4(cfg, CHAIN_ID || 84532);
|
|
4818
|
+
console.log("Deployment config:", JSON.stringify(transaction, bigIntReplacer, 2));
|
|
4806
4819
|
const tx = await wallet.sendTransaction({
|
|
4807
|
-
|
|
4808
|
-
data: deployCalldata,
|
|
4820
|
+
...transaction,
|
|
4809
4821
|
account,
|
|
4810
4822
|
chain: publicClient.chain,
|
|
4811
|
-
value:
|
|
4823
|
+
value: transaction.value
|
|
4812
4824
|
});
|
|
4813
4825
|
console.log("Transaction hash:", tx);
|
|
4814
4826
|
const receipt = await publicClient.waitForTransactionReceipt({
|
|
@@ -5036,6 +5048,21 @@ var Clanker = class {
|
|
|
5036
5048
|
this.wallet = config.wallet;
|
|
5037
5049
|
this.publicClient = config.publicClient;
|
|
5038
5050
|
}
|
|
5051
|
+
/**
|
|
5052
|
+
* Build V4 token deployment data without deploying
|
|
5053
|
+
* @param cfg Token configuration for V4 deployment
|
|
5054
|
+
* @returns Object containing transaction data, target address, and network info
|
|
5055
|
+
*/
|
|
5056
|
+
buildV4(cfg) {
|
|
5057
|
+
if (!this.wallet?.account) {
|
|
5058
|
+
throw new Error("Wallet account required for building deployment data");
|
|
5059
|
+
}
|
|
5060
|
+
const result = buildTokenV4(
|
|
5061
|
+
cfg,
|
|
5062
|
+
this.publicClient.chain?.id || 84532
|
|
5063
|
+
);
|
|
5064
|
+
return result;
|
|
5065
|
+
}
|
|
5039
5066
|
/**
|
|
5040
5067
|
* Deploy a token using the V4 protocol
|
|
5041
5068
|
* @param cfg Token configuration for V4 deployment
|