dactyclaw 1.1.0 ā 1.2.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.
- package/bin/dacty-launch.js +75 -25
- package/package.json +4 -2
package/bin/dacty-launch.js
CHANGED
|
@@ -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 {
|
|
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')
|
|
@@ -25,20 +28,32 @@ program
|
|
|
25
28
|
devAddress = config.address;
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
const
|
|
29
|
-
if (!
|
|
31
|
+
const privateKeyStr = process.env.AGENT_PRIVATE_KEY;
|
|
32
|
+
if (!privateKeyStr) {
|
|
30
33
|
console.error('ā Error: AGENT_PRIVATE_KEY not found in .env file.');
|
|
31
34
|
process.exit(1);
|
|
32
35
|
}
|
|
33
36
|
|
|
37
|
+
// ensure private key has '0x' prefix for viem
|
|
38
|
+
const privateKey = privateKeyStr.startsWith('0x') ? privateKeyStr : '0x' + privateKeyStr;
|
|
39
|
+
|
|
34
40
|
console.log(`\nš Connecting to Base Mainnet...`);
|
|
35
41
|
try {
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
// Setup viem wallet client
|
|
43
|
+
const account = privateKeyToAccount(privateKey);
|
|
44
|
+
const publicClient = createPublicClient({
|
|
45
|
+
chain: base,
|
|
46
|
+
transport: http()
|
|
47
|
+
});
|
|
48
|
+
const wallet = createWalletClient({
|
|
49
|
+
account,
|
|
50
|
+
chain: base,
|
|
51
|
+
transport: http()
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
process.stdout.write(`š° Checking balance for ${account.address}... `);
|
|
55
|
+
const balanceWei = await publicClient.getBalance({ address: account.address });
|
|
56
|
+
const balanceEth = formatEther(balanceWei);
|
|
42
57
|
console.log(`${Number(balanceEth).toFixed(5)} ETH`);
|
|
43
58
|
|
|
44
59
|
const MIN_BALANCE = 0.0005;
|
|
@@ -47,34 +62,69 @@ program
|
|
|
47
62
|
console.error(`\nā Error: Insufficient funds for deployment.`);
|
|
48
63
|
console.error(` Required: ${MIN_BALANCE} ETH`);
|
|
49
64
|
console.error(` Current: ${balanceEth} ETH`);
|
|
50
|
-
console.error(`\nPlease send ETH (Base) to the agent wallet: ${
|
|
51
|
-
|
|
65
|
+
console.error(`\nPlease send ETH (Base) to the agent wallet: ${account.address}`);
|
|
66
|
+
return;
|
|
52
67
|
}
|
|
53
68
|
|
|
54
|
-
console.log(`\nā
Funds verified. Initiating on-chain deployment protocol...`);
|
|
69
|
+
console.log(`\nā
Funds verified. Agent DNA secure enclave connected. Initiating on-chain deployment protocol...`);
|
|
55
70
|
|
|
56
|
-
// Simulation of smart contract deployment transaction
|
|
57
71
|
console.log(`[1/3] Compiling token parameters for Clanker Factory...`);
|
|
58
|
-
await new Promise(r => setTimeout(r, 1500));
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
|
|
73
|
+
const clanker = new Clanker({
|
|
74
|
+
wallet,
|
|
75
|
+
publicClient,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const tokenConfig = {
|
|
79
|
+
name: config.name,
|
|
80
|
+
symbol: config.ticker,
|
|
81
|
+
image: "ipfs://bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi", // Placeholder Clanker/Agent image
|
|
82
|
+
metadata: {
|
|
83
|
+
description: `Autonomous agent token for ${config.name} created via Dactyclaw CLI. DNA: ${config.dna}`,
|
|
84
|
+
socialMediaUrls: [],
|
|
85
|
+
auditUrls: [],
|
|
86
|
+
},
|
|
87
|
+
context: {
|
|
88
|
+
interface: "Dactyclaw SDK",
|
|
89
|
+
platform: "Dactyclaw",
|
|
90
|
+
messageId: "Deploy",
|
|
91
|
+
id: config.ticker,
|
|
92
|
+
},
|
|
93
|
+
pool: {
|
|
94
|
+
quoteToken: "0x4200000000000000000000000000000000000006", // WETH
|
|
95
|
+
initialMarketCap: "0.2", // 0.2 ETH (Base) minimal initial
|
|
96
|
+
},
|
|
97
|
+
vault: { percentage: 0, durationInDays: 0 },
|
|
98
|
+
devBuy: { ethAmount: 0 },
|
|
99
|
+
rewardsConfig: {
|
|
100
|
+
creatorReward: 75,
|
|
101
|
+
creatorAdmin: account.address,
|
|
102
|
+
creatorRewardRecipient: account.address,
|
|
103
|
+
interfaceAdmin: "0x1eaf444ebDf6495C57aD52A04C61521bBf564ace", // Assuming default interface addr from docs
|
|
104
|
+
interfaceRewardRecipient: devAddress,
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Generate deploy transaction config
|
|
109
|
+
console.log(`[2/3] Calling SDK deployToken... (This will spend Base ETH gas)`);
|
|
110
|
+
|
|
111
|
+
// Execute the deployment using clanker-sdk
|
|
112
|
+
const tokenAddress = await clanker.deployToken(tokenConfig);
|
|
62
113
|
|
|
63
114
|
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
115
|
|
|
69
|
-
console.log(`\nš SUCCESS! Token deployed autonomously.`);
|
|
70
|
-
|
|
71
|
-
|
|
116
|
+
console.log(`\nš SUCCESS! Token deployed autonomously on-chain.`);
|
|
117
|
+
if (tokenAddress) {
|
|
118
|
+
console.log(`Token Contract: ${tokenAddress}`);
|
|
119
|
+
console.log(`Explorer: https://basescan.org/token/${tokenAddress}`);
|
|
120
|
+
}
|
|
72
121
|
console.log(`\nTrading will be live on Clanker shortly.`);
|
|
73
122
|
|
|
74
123
|
} catch (error) {
|
|
75
|
-
console.error(`\nā Network Error: Failed to interact with Base network.`);
|
|
124
|
+
console.error(`\nā Network Error: Failed to interact with Base network or Clanker SDK.`);
|
|
76
125
|
console.error(error.message);
|
|
77
|
-
|
|
126
|
+
// console.error(error); // uncomment for pure stack trace debug
|
|
127
|
+
return;
|
|
78
128
|
}
|
|
79
129
|
});
|
|
80
130
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dactyclaw",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "**Agent Monitor & Deployer for Clawn Ecosystem on Base**",
|
|
5
5
|
"main": "proxy.js",
|
|
6
6
|
"bin": {
|
|
@@ -25,8 +25,10 @@
|
|
|
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
|
+
"ethers": "^6.16.0",
|
|
32
|
+
"viem": "^2.46.3"
|
|
31
33
|
}
|
|
32
34
|
}
|