clanker-sdk 3.8.0 → 3.8.2
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/index.d.mts +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +12 -10
- package/dist/index.mjs +14 -11
- package/package.json +4 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicClient, WalletClient, Address } from 'viem';
|
|
2
2
|
|
|
3
3
|
interface TokenConfig {
|
|
4
4
|
name: string;
|
|
@@ -38,11 +38,11 @@ interface DeploymentConfig {
|
|
|
38
38
|
initialBuyConfig?: InitialBuyConfig;
|
|
39
39
|
rewardsConfig: RewardsConfig;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
wallet: WalletClient;
|
|
41
|
+
type ClankerConfig = {
|
|
43
42
|
publicClient: PublicClient;
|
|
43
|
+
wallet?: WalletClient;
|
|
44
44
|
factoryAddress?: Address;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
interface SimpleTokenConfig {
|
|
47
47
|
name: string;
|
|
48
48
|
symbol: string;
|
|
@@ -96,7 +96,12 @@ declare class Clanker {
|
|
|
96
96
|
private handleError;
|
|
97
97
|
deploy(config: DeploymentConfig): Promise<Address>;
|
|
98
98
|
private buildDeploymentConfig;
|
|
99
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Creates calldata (+ msg.value) **without** sending a transaction.
|
|
101
|
+
* This version no longer relies on viem's `simulateContract`, which
|
|
102
|
+
* was returning an object without `.data`. We now ABI-encode the
|
|
103
|
+
* call manually so `data` is always defined.
|
|
104
|
+
*/
|
|
100
105
|
prepareDeployToken(cfg: SimpleTokenConfig): Promise<PreparedDeployTx>;
|
|
101
106
|
deployToken(cfg: SimpleTokenConfig): Promise<Address>;
|
|
102
107
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PublicClient, WalletClient, Address } from 'viem';
|
|
2
2
|
|
|
3
3
|
interface TokenConfig {
|
|
4
4
|
name: string;
|
|
@@ -38,11 +38,11 @@ interface DeploymentConfig {
|
|
|
38
38
|
initialBuyConfig?: InitialBuyConfig;
|
|
39
39
|
rewardsConfig: RewardsConfig;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
wallet: WalletClient;
|
|
41
|
+
type ClankerConfig = {
|
|
43
42
|
publicClient: PublicClient;
|
|
43
|
+
wallet?: WalletClient;
|
|
44
44
|
factoryAddress?: Address;
|
|
45
|
-
}
|
|
45
|
+
};
|
|
46
46
|
interface SimpleTokenConfig {
|
|
47
47
|
name: string;
|
|
48
48
|
symbol: string;
|
|
@@ -96,7 +96,12 @@ declare class Clanker {
|
|
|
96
96
|
private handleError;
|
|
97
97
|
deploy(config: DeploymentConfig): Promise<Address>;
|
|
98
98
|
private buildDeploymentConfig;
|
|
99
|
-
/**
|
|
99
|
+
/**
|
|
100
|
+
* Creates calldata (+ msg.value) **without** sending a transaction.
|
|
101
|
+
* This version no longer relies on viem's `simulateContract`, which
|
|
102
|
+
* was returning an object without `.data`. We now ABI-encode the
|
|
103
|
+
* call manually so `data` is always defined.
|
|
104
|
+
*/
|
|
100
105
|
prepareDeployToken(cfg: SimpleTokenConfig): Promise<PreparedDeployTx>;
|
|
101
106
|
deployToken(cfg: SimpleTokenConfig): Promise<Address>;
|
|
102
107
|
}
|
package/dist/index.js
CHANGED
|
@@ -830,23 +830,25 @@ var Clanker = class {
|
|
|
830
830
|
}
|
|
831
831
|
};
|
|
832
832
|
}
|
|
833
|
-
/**
|
|
833
|
+
/**
|
|
834
|
+
* Creates calldata (+ msg.value) **without** sending a transaction.
|
|
835
|
+
* This version no longer relies on viem's `simulateContract`, which
|
|
836
|
+
* was returning an object without `.data`. We now ABI-encode the
|
|
837
|
+
* call manually so `data` is always defined.
|
|
838
|
+
*/
|
|
834
839
|
async prepareDeployToken(cfg) {
|
|
835
840
|
const deploymentConfig = await this.buildDeploymentConfig(cfg);
|
|
836
|
-
const
|
|
837
|
-
address: this.factoryAddress,
|
|
841
|
+
const data = (0, import_viem.encodeFunctionData)({
|
|
838
842
|
abi: Clanker_v3_1_abi,
|
|
839
843
|
functionName: "deployToken",
|
|
840
|
-
args: [deploymentConfig]
|
|
841
|
-
value: deploymentConfig.initialBuyConfig?.ethAmount ?? 0n,
|
|
842
|
-
chain: this.publicClient.chain,
|
|
843
|
-
// give Viem *some* account for simulation
|
|
844
|
-
account: this.wallet?.account ?? deploymentConfig.rewardsConfig.creatorAdmin
|
|
844
|
+
args: [deploymentConfig]
|
|
845
845
|
});
|
|
846
|
+
const value = deploymentConfig.initialBuyConfig?.ethAmount ?? 0n;
|
|
846
847
|
return {
|
|
847
848
|
to: this.factoryAddress,
|
|
848
|
-
data
|
|
849
|
-
|
|
849
|
+
data,
|
|
850
|
+
// 0x-prefixed hex string (non-empty)
|
|
851
|
+
value
|
|
850
852
|
};
|
|
851
853
|
}
|
|
852
854
|
async deployToken(cfg) {
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,8 @@ import {
|
|
|
3
3
|
parseEther,
|
|
4
4
|
parseUnits,
|
|
5
5
|
stringify,
|
|
6
|
-
parseEventLogs
|
|
6
|
+
parseEventLogs,
|
|
7
|
+
encodeFunctionData
|
|
7
8
|
} from "viem";
|
|
8
9
|
import { simulateContract, writeContract, readContract } from "viem/actions";
|
|
9
10
|
|
|
@@ -811,23 +812,25 @@ var Clanker = class {
|
|
|
811
812
|
}
|
|
812
813
|
};
|
|
813
814
|
}
|
|
814
|
-
/**
|
|
815
|
+
/**
|
|
816
|
+
* Creates calldata (+ msg.value) **without** sending a transaction.
|
|
817
|
+
* This version no longer relies on viem's `simulateContract`, which
|
|
818
|
+
* was returning an object without `.data`. We now ABI-encode the
|
|
819
|
+
* call manually so `data` is always defined.
|
|
820
|
+
*/
|
|
815
821
|
async prepareDeployToken(cfg) {
|
|
816
822
|
const deploymentConfig = await this.buildDeploymentConfig(cfg);
|
|
817
|
-
const
|
|
818
|
-
address: this.factoryAddress,
|
|
823
|
+
const data = encodeFunctionData({
|
|
819
824
|
abi: Clanker_v3_1_abi,
|
|
820
825
|
functionName: "deployToken",
|
|
821
|
-
args: [deploymentConfig]
|
|
822
|
-
value: deploymentConfig.initialBuyConfig?.ethAmount ?? 0n,
|
|
823
|
-
chain: this.publicClient.chain,
|
|
824
|
-
// give Viem *some* account for simulation
|
|
825
|
-
account: this.wallet?.account ?? deploymentConfig.rewardsConfig.creatorAdmin
|
|
826
|
+
args: [deploymentConfig]
|
|
826
827
|
});
|
|
828
|
+
const value = deploymentConfig.initialBuyConfig?.ethAmount ?? 0n;
|
|
827
829
|
return {
|
|
828
830
|
to: this.factoryAddress,
|
|
829
|
-
data
|
|
830
|
-
|
|
831
|
+
data,
|
|
832
|
+
// 0x-prefixed hex string (non-empty)
|
|
833
|
+
value
|
|
831
834
|
};
|
|
832
835
|
}
|
|
833
836
|
async deployToken(cfg) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clanker-sdk",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
4
|
"description": "SDK for deploying tokens using Clanker",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -18,7 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
21
|
-
"format": "prettier --write \"src/**/*.ts\""
|
|
21
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest"
|
|
22
24
|
},
|
|
23
25
|
"keywords": [
|
|
24
26
|
"clanker",
|