clanker-sdk 4.0.20 → 4.0.22
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/README.md +39 -22
- package/dist/cli/cli.js +2983 -2794
- package/dist/cli/create-clanker.js +2983 -2806
- package/dist/index.d.ts +5580 -1099
- package/dist/index.js +3088 -2916
- package/package.json +13 -24
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Clanker SDK
|
|
2
2
|
|
|
3
|
-
The official TypeScript SDK for deploying tokens
|
|
3
|
+
The official TypeScript SDK for deploying tokens using Clanker.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -31,12 +31,13 @@ This will guide you through the token deployment process step by step.
|
|
|
31
31
|
|
|
32
32
|
1. Create a `.env` file with your configuration:
|
|
33
33
|
```env
|
|
34
|
-
PRIVATE_KEY
|
|
35
|
-
FACTORY_ADDRESS=factory_contract_address_here
|
|
34
|
+
PRIVATE_KEY=<your_private_key_here>
|
|
36
35
|
```
|
|
37
36
|
|
|
38
37
|
2. Create a deployment script:
|
|
39
38
|
```typescript
|
|
39
|
+
// deploy-script.ts
|
|
40
|
+
|
|
40
41
|
import { Clanker } from 'clanker-sdk';
|
|
41
42
|
import { createPublicClient, createWalletClient, http, PublicClient } from 'viem';
|
|
42
43
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
@@ -48,28 +49,23 @@ dotenv.config();
|
|
|
48
49
|
|
|
49
50
|
// Validate environment variables
|
|
50
51
|
const PRIVATE_KEY = process.env.PRIVATE_KEY as `0x${string}`;
|
|
51
|
-
const FACTORY_ADDRESS = process.env.FACTORY_ADDRESS as `0x${string}`;
|
|
52
|
-
const RPC_URL = process.env.RPC_URL;
|
|
53
52
|
|
|
54
|
-
if (!PRIVATE_KEY
|
|
55
|
-
throw new Error("Missing
|
|
53
|
+
if (!PRIVATE_KEY) {
|
|
54
|
+
throw new Error("Missing PRIVATE_KEY environment variable.");
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
// Initialize wallet with private key
|
|
59
58
|
const account = privateKeyToAccount(PRIVATE_KEY);
|
|
60
59
|
|
|
61
|
-
// Create transport with optional custom RPC
|
|
62
|
-
const transport = RPC_URL ? http(RPC_URL) : http();
|
|
63
|
-
|
|
64
60
|
const publicClient = createPublicClient({
|
|
65
61
|
chain: base,
|
|
66
|
-
transport,
|
|
62
|
+
transport: http(),
|
|
67
63
|
}) as PublicClient;
|
|
68
64
|
|
|
69
65
|
const wallet = createWalletClient({
|
|
70
66
|
account,
|
|
71
67
|
chain: base,
|
|
72
|
-
transport,
|
|
68
|
+
transport: http(),
|
|
73
69
|
});
|
|
74
70
|
|
|
75
71
|
// Initialize Clanker SDK
|
|
@@ -109,7 +105,7 @@ async function deployToken() {
|
|
|
109
105
|
durationInDays: 30, // 30-day vesting period
|
|
110
106
|
},
|
|
111
107
|
devBuy: {
|
|
112
|
-
ethAmount:
|
|
108
|
+
ethAmount: 0, // No initial buy
|
|
113
109
|
},
|
|
114
110
|
rewardsConfig: {
|
|
115
111
|
creatorReward: 75, // 75% creator reward
|
|
@@ -122,7 +118,7 @@ async function deployToken() {
|
|
|
122
118
|
|
|
123
119
|
try {
|
|
124
120
|
const tokenAddress = await clanker.deployToken(tokenConfig);
|
|
125
|
-
|
|
121
|
+
|
|
126
122
|
console.log("Token deployed successfully!");
|
|
127
123
|
console.log("Token address:", tokenAddress);
|
|
128
124
|
console.log("View on BaseScan:", `https://basescan.org/token/${tokenAddress}`);
|
|
@@ -141,7 +137,7 @@ deployToken().catch(console.error);
|
|
|
141
137
|
|
|
142
138
|
3. Run the deployment script:
|
|
143
139
|
```bash
|
|
144
|
-
|
|
140
|
+
bun deploy-script.ts
|
|
145
141
|
```
|
|
146
142
|
|
|
147
143
|
## Configuration Options
|
|
@@ -178,19 +174,40 @@ See the [examples](./examples) directory for more deployment scenarios:
|
|
|
178
174
|
- `deploy-token.ts`: Advanced token deployment with all options
|
|
179
175
|
- `deploy-full-sdk.ts`: Full SDK usage example
|
|
180
176
|
|
|
181
|
-
|
|
177
|
+
# SDK Development
|
|
178
|
+
|
|
179
|
+
## Setup
|
|
180
|
+
|
|
181
|
+
The SDK uses bun for development. Install bun following their instructions here: [https://bun.sh](https://bun.sh).
|
|
182
182
|
|
|
183
|
+
Once bun is installed, the project is ready for development
|
|
183
184
|
```bash
|
|
184
185
|
# Install dependencies
|
|
185
|
-
|
|
186
|
+
bun i
|
|
187
|
+
|
|
188
|
+
# Run Examples
|
|
189
|
+
# bun <path_to_example>
|
|
190
|
+
bun examples/v4/availableRewards.ts
|
|
191
|
+
|
|
192
|
+
# Run Tests
|
|
193
|
+
bun test
|
|
194
|
+
|
|
195
|
+
# Lint
|
|
196
|
+
bun lint
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Publishing the package
|
|
200
|
+
```bash
|
|
201
|
+
# Log into npm
|
|
202
|
+
bunx npm login
|
|
186
203
|
|
|
187
|
-
#
|
|
188
|
-
|
|
204
|
+
# Dry run publishing
|
|
205
|
+
bun publish-package --dry-run
|
|
189
206
|
|
|
190
|
-
#
|
|
191
|
-
|
|
207
|
+
# Publish
|
|
208
|
+
bun publish-package
|
|
192
209
|
```
|
|
193
210
|
|
|
194
211
|
## License
|
|
195
212
|
|
|
196
|
-
MIT
|
|
213
|
+
MIT
|