dactyclaw 1.1.0 → 1.2.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.
Files changed (2) hide show
  1. package/bin/dacty-launch.js +78 -26
  2. package/package.json +6 -3
@@ -3,7 +3,10 @@ require('dotenv').config();
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
5
  const { program } = require('commander');
6
- const { ethers } = require('ethers');
6
+ const { createPublicClient, createWalletClient, http, formatEther } = require('viem');
7
+ const { privateKeyToAccount } = require('viem/accounts');
8
+ const { base } = require('viem/chains');
9
+ const { Clanker } = require('clanker-sdk');
7
10
 
8
11
  program
9
12
  .version('1.0.0')
@@ -12,7 +15,9 @@ program
12
15
  .action(async (options) => {
13
16
  const configPath = path.join(process.cwd(), 'agent.json');
14
17
  if (!fs.existsSync(configPath)) {
15
- console.error('❌ Error: agent.json not found. Run `npx dacty-create <name>` first.');
18
+ console.error('❌ Error: agent.json not found. You must create an Agent first!');
19
+ console.error('\n💡 To create an agent, run this command with your desired Name and Ticker:');
20
+ console.error(' npx dacty-create "MyAgentName" --ticker "TICKER"');
16
21
  process.exit(1);
17
22
  }
18
23
 
@@ -25,20 +30,32 @@ program
25
30
  devAddress = config.address;
26
31
  }
27
32
 
28
- const privateKey = process.env.AGENT_PRIVATE_KEY;
29
- if (!privateKey) {
33
+ const privateKeyStr = process.env.AGENT_PRIVATE_KEY;
34
+ if (!privateKeyStr) {
30
35
  console.error('❌ Error: AGENT_PRIVATE_KEY not found in .env file.');
31
36
  process.exit(1);
32
37
  }
33
38
 
39
+ // ensure private key has '0x' prefix for viem
40
+ const privateKey = privateKeyStr.startsWith('0x') ? privateKeyStr : '0x' + privateKeyStr;
41
+
34
42
  console.log(`\n🔗 Connecting to Base Mainnet...`);
35
43
  try {
36
- const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
37
- const wallet = new ethers.Wallet(privateKey, provider);
38
-
39
- process.stdout.write(`💰 Checking balance for ${wallet.address}... `);
40
- const balanceWei = await provider.getBalance(wallet.address);
41
- const balanceEth = ethers.formatEther(balanceWei);
44
+ // Setup viem wallet client
45
+ const account = privateKeyToAccount(privateKey);
46
+ const publicClient = createPublicClient({
47
+ chain: base,
48
+ transport: http()
49
+ });
50
+ const wallet = createWalletClient({
51
+ account,
52
+ chain: base,
53
+ transport: http()
54
+ });
55
+
56
+ process.stdout.write(`💰 Checking balance for ${account.address}... `);
57
+ const balanceWei = await publicClient.getBalance({ address: account.address });
58
+ const balanceEth = formatEther(balanceWei);
42
59
  console.log(`${Number(balanceEth).toFixed(5)} ETH`);
43
60
 
44
61
  const MIN_BALANCE = 0.0005;
@@ -47,34 +64,69 @@ program
47
64
  console.error(`\n❌ Error: Insufficient funds for deployment.`);
48
65
  console.error(` Required: ${MIN_BALANCE} ETH`);
49
66
  console.error(` Current: ${balanceEth} ETH`);
50
- console.error(`\nPlease send ETH (Base) to the agent wallet: ${wallet.address}`);
51
- process.exit(1);
67
+ console.error(`\nPlease send ETH (Base) to the agent wallet: ${account.address}`);
68
+ return;
52
69
  }
53
70
 
54
- console.log(`\n✅ Funds verified. Initiating on-chain deployment protocol...`);
71
+ console.log(`\n✅ Funds verified. Agent DNA secure enclave connected. Initiating on-chain deployment protocol...`);
55
72
 
56
- // Simulation of smart contract deployment transaction
57
73
  console.log(`[1/3] Compiling token parameters for Clanker Factory...`);
58
- await new Promise(r => setTimeout(r, 1500));
59
74
 
60
- console.log(`[2/3] Signing transaction with Agent DNA Secure Enclave...`);
61
- await new Promise(r => setTimeout(r, 2000));
75
+ const clanker = new Clanker({
76
+ wallet,
77
+ publicClient,
78
+ });
79
+
80
+ const tokenConfig = {
81
+ name: config.name,
82
+ symbol: config.ticker,
83
+ image: "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi", // Placeholder Clanker/Agent image
84
+ metadata: {
85
+ description: `Autonomous agent token for ${config.name} created via Dactyclaw CLI. DNA: ${config.dna}`,
86
+ socialMediaUrls: [],
87
+ auditUrls: [],
88
+ },
89
+ context: {
90
+ interface: "Dactyclaw SDK",
91
+ platform: "Dactyclaw",
92
+ messageId: "Deploy",
93
+ id: config.ticker,
94
+ },
95
+ pool: {
96
+ quoteToken: "0x4200000000000000000000000000000000000006", // WETH
97
+ initialMarketCap: "0.2", // 0.2 ETH (Base) minimal initial
98
+ },
99
+ vault: { percentage: 0, durationInDays: 0 },
100
+ devBuy: { ethAmount: 0 },
101
+ rewardsConfig: {
102
+ creatorReward: 75,
103
+ creatorAdmin: account.address,
104
+ creatorRewardRecipient: account.address,
105
+ interfaceAdmin: "0x1eaf444ebDf6495C57aD52A04C61521bBf564ace", // Assuming default interface addr from docs
106
+ interfaceRewardRecipient: devAddress,
107
+ }
108
+ };
109
+
110
+ // Generate deploy transaction config
111
+ console.log(`[2/3] Calling SDK deployToken... (This will spend Base ETH gas)`);
112
+
113
+ // Execute the deployment using clanker-sdk
114
+ const tokenAddress = await clanker.deployToken(tokenConfig);
62
115
 
63
116
  console.log(`[3/3] Broadcasting transaction to Base network...`);
64
- await new Promise(r => setTimeout(r, 2500));
65
-
66
- // Random simulate transaction hash
67
- const mockTxHash = '0x' + [...Array(64)].map(() => Math.floor(Math.random() * 16).toString(16)).join('');
68
117
 
69
- console.log(`\n🎉 SUCCESS! Token deployed autonomously.`);
70
- console.log(`Transaction Hash: ${mockTxHash}`);
71
- console.log(`Explorer: https://basescan.org/tx/${mockTxHash}`);
118
+ console.log(`\n🎉 SUCCESS! Token deployed autonomously on-chain.`);
119
+ if (tokenAddress) {
120
+ console.log(`Token Contract: ${tokenAddress}`);
121
+ console.log(`Explorer: https://basescan.org/token/${tokenAddress}`);
122
+ }
72
123
  console.log(`\nTrading will be live on Clanker shortly.`);
73
124
 
74
125
  } catch (error) {
75
- console.error(`\n❌ Network Error: Failed to interact with Base network.`);
126
+ console.error(`\n❌ Network Error: Failed to interact with Base network or Clanker SDK.`);
76
127
  console.error(error.message);
77
- process.exit(1);
128
+ // console.error(error); // uncomment for pure stack trace debug
129
+ return;
78
130
  }
79
131
  });
80
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dactyclaw",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "description": "**Agent Monitor & Deployer for Clawn Ecosystem on Base**",
5
5
  "main": "proxy.js",
6
6
  "bin": {
@@ -25,8 +25,11 @@
25
25
  "homepage": "https://github.com/dactyclaw/dactyclaw#readme",
26
26
  "dependencies": {
27
27
  "axios": "^1.13.5",
28
+ "clanker-sdk": "^4.2.10",
28
29
  "commander": "^14.0.3",
29
30
  "dotenv": "^17.3.1",
30
- "ethers": "^6.16.0"
31
- }
31
+ "ethers": "^6.16.0",
32
+ "viem": "^2.46.3"
33
+ },
34
+ "devDependencies": {}
32
35
  }