dacty-create 1.0.4 → 1.0.5

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.
@@ -8,6 +8,7 @@ import path from 'path';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { dirname } from 'path';
10
10
  import crypto from 'crypto';
11
+ import { privateKeyToAccount } from 'viem/accounts';
11
12
 
12
13
  const __filename = fileURLToPath(import.meta.url);
13
14
  const __dirname = dirname(__filename);
@@ -19,12 +20,12 @@ function generateDNA() {
19
20
 
20
21
  // Generate wallet (Ethereum-style)
21
22
  function generateWallet() {
22
- const privateKey = crypto.randomBytes(32).toString('hex');
23
+ const privateKey = '0x' + crypto.randomBytes(32).toString('hex');
24
+ // Derive address from private key using viem
25
+ const account = privateKeyToAccount(privateKey);
23
26
  return {
24
- privateKey: '0x' + privateKey,
25
- // Note: In production, derive address from private key using ethers.js
26
- // For now, generate a mock address
27
- address: '0x' + crypto.randomBytes(20).toString('hex')
27
+ privateKey: privateKey,
28
+ address: account.address
28
29
  };
29
30
  }
30
31
 
package/lib/index.mjs CHANGED
@@ -8,6 +8,7 @@ import path from 'path';
8
8
  import { fileURLToPath } from 'url';
9
9
  import { dirname } from 'path';
10
10
  import crypto from 'crypto';
11
+ import { privateKeyToAccount } from 'viem/accounts';
11
12
 
12
13
  const __filename = fileURLToPath(import.meta.url);
13
14
  const __dirname = dirname(__filename);
@@ -19,12 +20,12 @@ function generateDNA() {
19
20
 
20
21
  // Generate wallet (Ethereum-style)
21
22
  function generateWallet() {
22
- const privateKey = crypto.randomBytes(32).toString('hex');
23
+ const privateKey = '0x' + crypto.randomBytes(32).toString('hex');
24
+ // Derive address from private key using viem
25
+ const account = privateKeyToAccount(privateKey);
23
26
  return {
24
- privateKey: '0x' + privateKey,
25
- // Note: In production, derive address from private key using ethers.js
26
- // For now, generate a mock address
27
- address: '0x' + crypto.randomBytes(20).toString('hex')
27
+ privateKey: privateKey,
28
+ address: account.address
28
29
  };
29
30
  }
30
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dacty-create",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Create and deploy agents in the Dactyclaw ecosystem",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,11 +21,12 @@
21
21
  "author": "Dactyclaw",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
+ "axios": "^1.6.5",
24
25
  "chalk": "^5.3.0",
26
+ "dotenv": "^16.3.1",
25
27
  "inquirer": "^9.2.12",
26
28
  "ora": "^8.0.1",
27
- "axios": "^1.6.5",
28
- "dotenv": "^16.3.1"
29
+ "viem": "^2.46.3"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/node": "^20.10.5"