dacty-launch 1.2.0 → 1.3.1

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 CHANGED
@@ -40,10 +40,10 @@ npx dacty-launch
40
40
 
41
41
  The CLI will prompt you for:
42
42
 
43
- 1. **Agent DNA** - The DNA of your agent (from `npx dacty-create`)
44
- 2. **Token Name** - The name of your token
45
- 3. **Token Symbol** - The symbol (3-10 characters)
46
- 4. **Total Supply** - Initial token supply (e.g., 1000000000)
43
+ 1. **Token Name** - The name of your token
44
+ 2. **Token Symbol** - The symbol (3-10 characters)
45
+
46
+ Initial supply defaults to 1,000,000,000 tokens.
47
47
 
48
48
  ## Workflow
49
49
 
@@ -63,9 +63,9 @@ npx dacty-launch
63
63
 
64
64
  1. **Loads agent configuration** from `agent.config.json`
65
65
  2. **Reads private key** from `.env` file
66
- 3. **Signs transaction** with private key
67
- 4. **Calls Clanker API** to deploy token
68
- 5. **Configures fee distribution** (80/20 split)
66
+ 3. **Initializes Clanker SDK** with viem wallet
67
+ 4. **Calls deployToken()** with correct rewardsConfig structure
68
+ 5. **Configures fee distribution** (80% Agent, 20% Dactyclaw)
69
69
  6. **Returns token address** and deployment details
70
70
 
71
71
  ## Fee Distribution
@@ -25,15 +25,41 @@ function question(prompt) {
25
25
  });
26
26
  }
27
27
 
28
+ // Find agent.config.json in current directory or subdirectories
29
+ function findAgentConfig(startPath = process.cwd()) {
30
+ // Check current directory first
31
+ const currentPath = path.join(startPath, 'agent.config.json');
32
+ if (fs.existsSync(currentPath)) {
33
+ return currentPath;
34
+ }
35
+
36
+ // Check subdirectories (one level deep)
37
+ try {
38
+ const entries = fs.readdirSync(startPath, { withFileTypes: true });
39
+ for (const entry of entries) {
40
+ if (entry.isDirectory() && !entry.name.startsWith('.')) {
41
+ const subPath = path.join(startPath, entry.name, 'agent.config.json');
42
+ if (fs.existsSync(subPath)) {
43
+ return subPath;
44
+ }
45
+ }
46
+ }
47
+ } catch (error) {
48
+ // Ignore read errors
49
+ }
50
+
51
+ return null;
52
+ }
53
+
28
54
  async function main() {
29
55
  console.log('\n╔═══════════════════════════════════════╗');
30
56
  console.log('║ DACTYCLAW - Token Launch ║');
31
57
  console.log('║ Powered by Clanker v4.0.0 ║');
32
58
  console.log('╚═══════════════════════════════════════╝\n');
33
59
 
34
- // Check if agent.config.json exists
35
- const agentConfigPath = path.join(process.cwd(), 'agent.config.json');
36
- if (!fs.existsSync(agentConfigPath)) {
60
+ // Find agent.config.json (current dir or subdirectories)
61
+ const agentConfigPath = findAgentConfig();
62
+ if (!agentConfigPath) {
37
63
  console.error('❌ Error: agent.config.json not found!');
38
64
  console.error(' Please run `npx dacty-create` first to create an agent.');
39
65
  process.exit(1);
@@ -44,8 +70,9 @@ async function main() {
44
70
  console.log(`✓ Agent loaded: ${agentConfig.name} (DNA: ${agentConfig.dna})`);
45
71
  console.log(`✓ Wallet: ${agentConfig.wallet}\n`);
46
72
 
47
- // Check if .env exists with private key
48
- const envPath = path.join(process.cwd(), '.env');
73
+ // Check if .env exists with private key (same directory as agent.config.json)
74
+ const agentDir = path.dirname(agentConfigPath);
75
+ const envPath = path.join(agentDir, '.env');
49
76
  if (!fs.existsSync(envPath)) {
50
77
  console.error('❌ Error: .env file not found!');
51
78
  console.error(' Private key should be in .env file.');
@@ -53,13 +80,17 @@ async function main() {
53
80
  }
54
81
 
55
82
  const envContent = fs.readFileSync(envPath, 'utf-8');
83
+ process.chdir(agentDir); // Change to agent directory for token config save
56
84
  const privateKeyMatch = envContent.match(/PRIVATE_KEY=(.+)/);
57
85
  if (!privateKeyMatch) {
58
86
  console.error('❌ Error: PRIVATE_KEY not found in .env file!');
59
87
  process.exit(1);
60
88
  }
61
89
 
62
- const privateKey = privateKeyMatch[1].trim();
90
+ // Parse private key: remove quotes, trim whitespace
91
+ let privateKey = privateKeyMatch[1].trim();
92
+ privateKey = privateKey.replace(/^["']|["']$/g, ''); // Remove surrounding quotes
93
+ privateKey = privateKey.trim(); // Trim again after removing quotes
63
94
  console.log('✓ Private key loaded from .env\n');
64
95
 
65
96
  // Get token details from user
@@ -81,7 +112,7 @@ async function main() {
81
112
  console.log('🔄 Initializing Clanker SDK...');
82
113
 
83
114
  // Setup viem clients
84
- const account = privateKeyToAccount(`0x${privateKey.replace(/^0x/, '')}`);
115
+ const account = privateKeyToAccount(privateKey);
85
116
  const publicClient = createPublicClient({ chain: base, transport: http() });
86
117
  const walletClient = createWalletClient({ account, chain: base, transport: http() });
87
118
 
@@ -155,7 +186,7 @@ async function main() {
155
186
  };
156
187
 
157
188
  fs.writeFileSync(
158
- path.join(process.cwd(), 'token.config.json'),
189
+ path.join(agentDir, 'token.config.json'),
159
190
  JSON.stringify(tokenConfig, null, 2)
160
191
  );
161
192
 
@@ -183,7 +214,9 @@ async function main() {
183
214
  rl.close();
184
215
  } catch (error) {
185
216
  console.error('❌ Error:', error.message);
186
- console.error('Stack:', error.stack);
217
+ if (error.message.includes('invalid private key')) {
218
+ console.error(' Hint: Check that AGENT_PRIVATE_KEY in .env is valid and properly formatted');
219
+ }
187
220
  rl.close();
188
221
  process.exit(1);
189
222
  }
package/lib/index.mjs CHANGED
@@ -25,15 +25,41 @@ function question(prompt) {
25
25
  });
26
26
  }
27
27
 
28
+ // Find agent.config.json in current directory or subdirectories
29
+ function findAgentConfig(startPath = process.cwd()) {
30
+ // Check current directory first
31
+ const currentPath = path.join(startPath, 'agent.config.json');
32
+ if (fs.existsSync(currentPath)) {
33
+ return currentPath;
34
+ }
35
+
36
+ // Check subdirectories (one level deep)
37
+ try {
38
+ const entries = fs.readdirSync(startPath, { withFileTypes: true });
39
+ for (const entry of entries) {
40
+ if (entry.isDirectory() && !entry.name.startsWith('.')) {
41
+ const subPath = path.join(startPath, entry.name, 'agent.config.json');
42
+ if (fs.existsSync(subPath)) {
43
+ return subPath;
44
+ }
45
+ }
46
+ }
47
+ } catch (error) {
48
+ // Ignore read errors
49
+ }
50
+
51
+ return null;
52
+ }
53
+
28
54
  async function main() {
29
55
  console.log('\n╔═══════════════════════════════════════╗');
30
56
  console.log('║ DACTYCLAW - Token Launch ║');
31
57
  console.log('║ Powered by Clanker v4.0.0 ║');
32
58
  console.log('╚═══════════════════════════════════════╝\n');
33
59
 
34
- // Check if agent.config.json exists
35
- const agentConfigPath = path.join(process.cwd(), 'agent.config.json');
36
- if (!fs.existsSync(agentConfigPath)) {
60
+ // Find agent.config.json (current dir or subdirectories)
61
+ const agentConfigPath = findAgentConfig();
62
+ if (!agentConfigPath) {
37
63
  console.error('❌ Error: agent.config.json not found!');
38
64
  console.error(' Please run `npx dacty-create` first to create an agent.');
39
65
  process.exit(1);
@@ -44,8 +70,9 @@ async function main() {
44
70
  console.log(`✓ Agent loaded: ${agentConfig.name} (DNA: ${agentConfig.dna})`);
45
71
  console.log(`✓ Wallet: ${agentConfig.wallet}\n`);
46
72
 
47
- // Check if .env exists with private key
48
- const envPath = path.join(process.cwd(), '.env');
73
+ // Check if .env exists with private key (same directory as agent.config.json)
74
+ const agentDir = path.dirname(agentConfigPath);
75
+ const envPath = path.join(agentDir, '.env');
49
76
  if (!fs.existsSync(envPath)) {
50
77
  console.error('❌ Error: .env file not found!');
51
78
  console.error(' Private key should be in .env file.');
@@ -53,13 +80,17 @@ async function main() {
53
80
  }
54
81
 
55
82
  const envContent = fs.readFileSync(envPath, 'utf-8');
83
+ process.chdir(agentDir); // Change to agent directory for token config save
56
84
  const privateKeyMatch = envContent.match(/PRIVATE_KEY=(.+)/);
57
85
  if (!privateKeyMatch) {
58
86
  console.error('❌ Error: PRIVATE_KEY not found in .env file!');
59
87
  process.exit(1);
60
88
  }
61
89
 
62
- const privateKey = privateKeyMatch[1].trim();
90
+ // Parse private key: remove quotes, trim whitespace
91
+ let privateKey = privateKeyMatch[1].trim();
92
+ privateKey = privateKey.replace(/^["']|["']$/g, ''); // Remove surrounding quotes
93
+ privateKey = privateKey.trim(); // Trim again after removing quotes
63
94
  console.log('✓ Private key loaded from .env\n');
64
95
 
65
96
  // Get token details from user
@@ -81,7 +112,7 @@ async function main() {
81
112
  console.log('🔄 Initializing Clanker SDK...');
82
113
 
83
114
  // Setup viem clients
84
- const account = privateKeyToAccount(`0x${privateKey.replace(/^0x/, '')}`);
115
+ const account = privateKeyToAccount(privateKey);
85
116
  const publicClient = createPublicClient({ chain: base, transport: http() });
86
117
  const walletClient = createWalletClient({ account, chain: base, transport: http() });
87
118
 
@@ -155,7 +186,7 @@ async function main() {
155
186
  };
156
187
 
157
188
  fs.writeFileSync(
158
- path.join(process.cwd(), 'token.config.json'),
189
+ path.join(agentDir, 'token.config.json'),
159
190
  JSON.stringify(tokenConfig, null, 2)
160
191
  );
161
192
 
@@ -183,7 +214,9 @@ async function main() {
183
214
  rl.close();
184
215
  } catch (error) {
185
216
  console.error('❌ Error:', error.message);
186
- console.error('Stack:', error.stack);
217
+ if (error.message.includes('invalid private key')) {
218
+ console.error(' Hint: Check that AGENT_PRIVATE_KEY in .env is valid and properly formatted');
219
+ }
187
220
  rl.close();
188
221
  process.exit(1);
189
222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dacty-launch",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Launch tokens for agents in the Dactyclaw ecosystem",
5
5
  "type": "module",
6
6
  "bin": {