dacty-launch 1.4.4 → 1.5.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.
@@ -4,22 +4,7 @@ import fs from 'fs';
4
4
  import path from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import readline from 'readline';
7
- import { Clanker } from 'clanker-sdk/v4';
8
- import { createWalletClient, createPublicClient, http } from 'viem';
9
- import { privateKeyToAccount } from 'viem/accounts';
10
- import { base } from 'viem/chains';
11
-
12
- // Polyfill fetch for Node.js if not available
13
- if (typeof globalThis.fetch === 'undefined') {
14
- try {
15
- const fetch = await import('node-fetch').then(m => m.default);
16
- globalThis.fetch = fetch;
17
- } catch (e) {
18
- // Fallback: use undici if node-fetch not available
19
- const { fetch: undiciFetch } = await import('undici');
20
- globalThis.fetch = undiciFetch;
21
- }
22
- }
7
+ import crypto from 'crypto';
23
8
 
24
9
  const __filename = fileURLToPath(import.meta.url);
25
10
  const __dirname = path.dirname(__filename);
@@ -113,80 +98,86 @@ async function main() {
113
98
  const initialSupply = '1000000000'; // Default supply
114
99
 
115
100
  console.log('\nšŸ“‹ Configuration:');
116
- console.log(` Name: ${tokenName}`);
117
- console.log(` Symbol: ${tokenSymbol}`);
118
- console.log(` Supply: ${initialSupply}`);
119
- console.log(` Agent Wallet: ${agentConfig.wallet}`);
120
- console.log(` Fee Distribution: 80% Agent, 20% Clanker\n`);
121
-
122
- // Clanker protocol addresses (for interface rewards)
123
- // Using Clanker's official fee recipient
124
- const CLANKER_INTERFACE_ADMIN = agentConfig.wallet; // Can be agent or clanker
125
- const CLANKER_INTERFACE_RECIPIENT = agentConfig.wallet; // Clanker fees go to agent for now
101
+ console.log(` Name: ${tokenName}`);
102
+ console.log(` Symbol: ${tokenSymbol}`);
103
+ console.log(` Supply: ${initialSupply}`);
104
+ console.log(` Agent Wallet: ${agentConfig.wallet}`);
105
+ console.log(` Fee Distribution: 80% Agent, 20% Clanker\n`);
126
106
 
127
107
  try {
128
- console.log('šŸ”„ Initializing Clanker SDK...');
129
-
130
- // Setup viem clients
131
- const account = privateKeyToAccount(privateKey);
132
- const publicClient = createPublicClient({ chain: base, transport: http() });
133
- const walletClient = createWalletClient({ account, chain: base, transport: http() });
134
-
135
- // Initialize Clanker SDK
136
- const clanker = new Clanker({
137
- publicClient,
138
- wallet: walletClient,
139
- });
140
-
141
- console.log('āœ“ Clanker SDK initialized');
142
- console.log('āœ“ Connected to Base network');
143
- console.log('āœ“ Account:', account.address);
144
-
145
- console.log('\nšŸš€ Deploying token...');
108
+ console.log('šŸš€ Deploying token via Clanker API...');
109
+
110
+ // Generate unique request key
111
+ const requestKey = crypto.randomBytes(16).toString('hex');
112
+
113
+ // Prepare deployment payload according to Clanker v4 API spec
114
+ const deploymentPayload = {
115
+ token: {
116
+ name: tokenName,
117
+ symbol: tokenSymbol,
118
+ tokenAdmin: agentConfig.wallet,
119
+ description: `${tokenName} - Created with DACTYCLAW`,
120
+ requestKey: requestKey,
121
+ },
122
+ rewards: [
123
+ {
124
+ admin: agentConfig.wallet,
125
+ recipient: agentConfig.wallet,
126
+ allocation: 80,
127
+ rewardsToken: 'Both',
128
+ },
129
+ {
130
+ admin: '0x0000000000000000000000000000000000000000',
131
+ recipient: '0x0000000000000000000000000000000000000000',
132
+ allocation: 20,
133
+ rewardsToken: 'Both',
134
+ },
135
+ ],
136
+ pool: {
137
+ type: 'standard',
138
+ pairedToken: '0x4200000000000000000000000000000000000006', // WETH on Base
139
+ initialMarketCap: 10,
140
+ },
141
+ fees: {
142
+ type: 'static',
143
+ clankerFee: 1,
144
+ pairedFee: 1,
145
+ },
146
+ chainId: 8453, // Base network
147
+ };
146
148
 
147
- // Deploy token with 80/20 fee split
148
- // Using Clanker v4 deploy() method with correct token structure
149
- const { txHash, waitForTransaction } = await clanker.deploy({
150
- name: tokenName,
151
- symbol: tokenSymbol,
152
- tokenAdmin: agentConfig.wallet,
153
- rewards: {
154
- recipients: [
155
- {
156
- recipient: agentConfig.wallet,
157
- admin: agentConfig.wallet,
158
- bps: 8000, // 80% to agent (basis points: 10000 = 100%)
159
- token: 'Both', // Receive fees in both tokens
160
- },
161
- {
162
- recipient: CLANKER_INTERFACE_RECIPIENT,
163
- admin: CLANKER_INTERFACE_ADMIN,
164
- bps: 2000, // 20% to clanker protocol
165
- token: 'Both',
166
- },
167
- ],
149
+ // Call Clanker API
150
+ const response = await fetch('https://www.clanker.world/api/tokens/deploy', {
151
+ method: 'POST',
152
+ headers: {
153
+ 'Content-Type': 'application/json',
154
+ 'x-api-key': 'public', // Public endpoint doesn't require API key
168
155
  },
169
- vanity: true, // Try to get vanity address with "b07" suffix
156
+ body: JSON.stringify(deploymentPayload),
170
157
  });
171
158
 
172
- console.log(`āœ“ Transaction submitted: ${txHash}`);
173
- console.log('ā³ Waiting for confirmation...\n');
159
+ const result = await response.json();
174
160
 
175
- const result = await waitForTransaction();
176
-
177
- if (result.error) {
178
- console.error('āŒ Deployment error:', result.error);
161
+ if (!response.ok || !result.success) {
162
+ console.error('āŒ Deployment error:');
163
+ if (result.data) {
164
+ result.data.forEach(err => {
165
+ console.error(` - ${err.path?.join('.')}: ${err.message}`);
166
+ });
167
+ } else {
168
+ console.error(` ${result.error || result.message || 'Unknown error'}`);
169
+ }
179
170
  process.exit(1);
180
171
  }
181
172
 
182
- const tokenAddress = result.address;
173
+ const tokenAddress = result.expectedAddress;
183
174
 
184
- console.log('āœ… Token deployed successfully!');
175
+ console.log('āœ… Token deployment enqueued!');
185
176
  console.log(`\nšŸ“Š Token Details:`);
186
- console.log(` Address: ${tokenAddress}`);
187
177
  console.log(` Name: ${tokenName}`);
188
178
  console.log(` Symbol: ${tokenSymbol}`);
189
179
  console.log(` Supply: ${initialSupply}`);
180
+ console.log(` Expected Address: ${tokenAddress}`);
190
181
  console.log(` Network: Base`);
191
182
  console.log(` Explorer: https://basescan.org/token/${tokenAddress}`);
192
183
 
@@ -208,6 +199,7 @@ async function main() {
208
199
  agent: 80,
209
200
  clanker: 20,
210
201
  },
202
+ requestKey: requestKey,
211
203
  };
212
204
 
213
205
  fs.writeFileSync(
@@ -239,11 +231,8 @@ async function main() {
239
231
  rl.close();
240
232
  } catch (error) {
241
233
  console.error('āŒ Error:', error.message);
242
- if (typeof error === 'object' && Array.isArray(error)) {
243
- console.error(' Validation errors:');
244
- error.forEach(e => console.error(` - ${e.path?.join('.')}: ${e.message}`));
245
- } else if (error.message.includes('invalid private key')) {
246
- console.error(' Hint: Check that AGENT_PRIVATE_KEY in .env is valid and properly formatted');
234
+ if (error.message.includes('fetch')) {
235
+ console.error(' Hint: Network error. Check your internet connection.');
247
236
  }
248
237
  rl.close();
249
238
  process.exit(1);
package/lib/index.mjs CHANGED
@@ -4,22 +4,7 @@ import fs from 'fs';
4
4
  import path from 'path';
5
5
  import { fileURLToPath } from 'url';
6
6
  import readline from 'readline';
7
- import { Clanker } from 'clanker-sdk/v4';
8
- import { createWalletClient, createPublicClient, http } from 'viem';
9
- import { privateKeyToAccount } from 'viem/accounts';
10
- import { base } from 'viem/chains';
11
-
12
- // Polyfill fetch for Node.js if not available
13
- if (typeof globalThis.fetch === 'undefined') {
14
- try {
15
- const fetch = await import('node-fetch').then(m => m.default);
16
- globalThis.fetch = fetch;
17
- } catch (e) {
18
- // Fallback: use undici if node-fetch not available
19
- const { fetch: undiciFetch } = await import('undici');
20
- globalThis.fetch = undiciFetch;
21
- }
22
- }
7
+ import crypto from 'crypto';
23
8
 
24
9
  const __filename = fileURLToPath(import.meta.url);
25
10
  const __dirname = path.dirname(__filename);
@@ -113,80 +98,86 @@ async function main() {
113
98
  const initialSupply = '1000000000'; // Default supply
114
99
 
115
100
  console.log('\nšŸ“‹ Configuration:');
116
- console.log(` Name: ${tokenName}`);
117
- console.log(` Symbol: ${tokenSymbol}`);
118
- console.log(` Supply: ${initialSupply}`);
119
- console.log(` Agent Wallet: ${agentConfig.wallet}`);
120
- console.log(` Fee Distribution: 80% Agent, 20% Clanker\n`);
121
-
122
- // Clanker protocol addresses (for interface rewards)
123
- // Using Clanker's official fee recipient
124
- const CLANKER_INTERFACE_ADMIN = agentConfig.wallet; // Can be agent or clanker
125
- const CLANKER_INTERFACE_RECIPIENT = agentConfig.wallet; // Clanker fees go to agent for now
101
+ console.log(` Name: ${tokenName}`);
102
+ console.log(` Symbol: ${tokenSymbol}`);
103
+ console.log(` Supply: ${initialSupply}`);
104
+ console.log(` Agent Wallet: ${agentConfig.wallet}`);
105
+ console.log(` Fee Distribution: 80% Agent, 20% Clanker\n`);
126
106
 
127
107
  try {
128
- console.log('šŸ”„ Initializing Clanker SDK...');
129
-
130
- // Setup viem clients
131
- const account = privateKeyToAccount(privateKey);
132
- const publicClient = createPublicClient({ chain: base, transport: http() });
133
- const walletClient = createWalletClient({ account, chain: base, transport: http() });
134
-
135
- // Initialize Clanker SDK
136
- const clanker = new Clanker({
137
- publicClient,
138
- wallet: walletClient,
139
- });
140
-
141
- console.log('āœ“ Clanker SDK initialized');
142
- console.log('āœ“ Connected to Base network');
143
- console.log('āœ“ Account:', account.address);
144
-
145
- console.log('\nšŸš€ Deploying token...');
108
+ console.log('šŸš€ Deploying token via Clanker API...');
109
+
110
+ // Generate unique request key
111
+ const requestKey = crypto.randomBytes(16).toString('hex');
112
+
113
+ // Prepare deployment payload according to Clanker v4 API spec
114
+ const deploymentPayload = {
115
+ token: {
116
+ name: tokenName,
117
+ symbol: tokenSymbol,
118
+ tokenAdmin: agentConfig.wallet,
119
+ description: `${tokenName} - Created with DACTYCLAW`,
120
+ requestKey: requestKey,
121
+ },
122
+ rewards: [
123
+ {
124
+ admin: agentConfig.wallet,
125
+ recipient: agentConfig.wallet,
126
+ allocation: 80,
127
+ rewardsToken: 'Both',
128
+ },
129
+ {
130
+ admin: '0x0000000000000000000000000000000000000000',
131
+ recipient: '0x0000000000000000000000000000000000000000',
132
+ allocation: 20,
133
+ rewardsToken: 'Both',
134
+ },
135
+ ],
136
+ pool: {
137
+ type: 'standard',
138
+ pairedToken: '0x4200000000000000000000000000000000000006', // WETH on Base
139
+ initialMarketCap: 10,
140
+ },
141
+ fees: {
142
+ type: 'static',
143
+ clankerFee: 1,
144
+ pairedFee: 1,
145
+ },
146
+ chainId: 8453, // Base network
147
+ };
146
148
 
147
- // Deploy token with 80/20 fee split
148
- // Using Clanker v4 deploy() method with correct token structure
149
- const { txHash, waitForTransaction } = await clanker.deploy({
150
- name: tokenName,
151
- symbol: tokenSymbol,
152
- tokenAdmin: agentConfig.wallet,
153
- rewards: {
154
- recipients: [
155
- {
156
- recipient: agentConfig.wallet,
157
- admin: agentConfig.wallet,
158
- bps: 8000, // 80% to agent (basis points: 10000 = 100%)
159
- token: 'Both', // Receive fees in both tokens
160
- },
161
- {
162
- recipient: CLANKER_INTERFACE_RECIPIENT,
163
- admin: CLANKER_INTERFACE_ADMIN,
164
- bps: 2000, // 20% to clanker protocol
165
- token: 'Both',
166
- },
167
- ],
149
+ // Call Clanker API
150
+ const response = await fetch('https://www.clanker.world/api/tokens/deploy', {
151
+ method: 'POST',
152
+ headers: {
153
+ 'Content-Type': 'application/json',
154
+ 'x-api-key': 'public', // Public endpoint doesn't require API key
168
155
  },
169
- vanity: true, // Try to get vanity address with "b07" suffix
156
+ body: JSON.stringify(deploymentPayload),
170
157
  });
171
158
 
172
- console.log(`āœ“ Transaction submitted: ${txHash}`);
173
- console.log('ā³ Waiting for confirmation...\n');
159
+ const result = await response.json();
174
160
 
175
- const result = await waitForTransaction();
176
-
177
- if (result.error) {
178
- console.error('āŒ Deployment error:', result.error);
161
+ if (!response.ok || !result.success) {
162
+ console.error('āŒ Deployment error:');
163
+ if (result.data) {
164
+ result.data.forEach(err => {
165
+ console.error(` - ${err.path?.join('.')}: ${err.message}`);
166
+ });
167
+ } else {
168
+ console.error(` ${result.error || result.message || 'Unknown error'}`);
169
+ }
179
170
  process.exit(1);
180
171
  }
181
172
 
182
- const tokenAddress = result.address;
173
+ const tokenAddress = result.expectedAddress;
183
174
 
184
- console.log('āœ… Token deployed successfully!');
175
+ console.log('āœ… Token deployment enqueued!');
185
176
  console.log(`\nšŸ“Š Token Details:`);
186
- console.log(` Address: ${tokenAddress}`);
187
177
  console.log(` Name: ${tokenName}`);
188
178
  console.log(` Symbol: ${tokenSymbol}`);
189
179
  console.log(` Supply: ${initialSupply}`);
180
+ console.log(` Expected Address: ${tokenAddress}`);
190
181
  console.log(` Network: Base`);
191
182
  console.log(` Explorer: https://basescan.org/token/${tokenAddress}`);
192
183
 
@@ -208,6 +199,7 @@ async function main() {
208
199
  agent: 80,
209
200
  clanker: 20,
210
201
  },
202
+ requestKey: requestKey,
211
203
  };
212
204
 
213
205
  fs.writeFileSync(
@@ -239,11 +231,8 @@ async function main() {
239
231
  rl.close();
240
232
  } catch (error) {
241
233
  console.error('āŒ Error:', error.message);
242
- if (typeof error === 'object' && Array.isArray(error)) {
243
- console.error(' Validation errors:');
244
- error.forEach(e => console.error(` - ${e.path?.join('.')}: ${e.message}`));
245
- } else if (error.message.includes('invalid private key')) {
246
- console.error(' Hint: Check that AGENT_PRIVATE_KEY in .env is valid and properly formatted');
234
+ if (error.message.includes('fetch')) {
235
+ console.error(' Hint: Network error. Check your internet connection.');
247
236
  }
248
237
  rl.close();
249
238
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dacty-launch",
3
- "version": "1.4.4",
3
+ "version": "1.5.0",
4
4
  "description": "Launch tokens for agents in the Dactyclaw ecosystem",
5
5
  "type": "module",
6
6
  "bin": {