dacty-launch 1.4.5 ā 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.
- package/bin/dacty-launch.mjs +69 -82
- package/lib/index.mjs +69 -82
- package/package.json +1 -1
package/bin/dacty-launch.mjs
CHANGED
|
@@ -4,16 +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
|
|
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 - use undici
|
|
13
|
-
if (typeof globalThis.fetch === 'undefined') {
|
|
14
|
-
const { fetch: undiciFetch } = await import('undici');
|
|
15
|
-
globalThis.fetch = undiciFetch;
|
|
16
|
-
}
|
|
7
|
+
import crypto from 'crypto';
|
|
17
8
|
|
|
18
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
19
10
|
const __dirname = path.dirname(__filename);
|
|
@@ -107,88 +98,86 @@ async function main() {
|
|
|
107
98
|
const initialSupply = '1000000000'; // Default supply
|
|
108
99
|
|
|
109
100
|
console.log('\nš Configuration:');
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// Clanker protocol addresses (for interface rewards)
|
|
117
|
-
// Using Clanker's official fee recipient
|
|
118
|
-
const CLANKER_INTERFACE_ADMIN = agentConfig.wallet; // Can be agent or clanker
|
|
119
|
-
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`);
|
|
120
106
|
|
|
121
107
|
try {
|
|
122
|
-
console.log('
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
+
};
|
|
148
148
|
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
rewards: {
|
|
156
|
-
recipients: [
|
|
157
|
-
{
|
|
158
|
-
recipient: agentConfig.wallet,
|
|
159
|
-
admin: agentConfig.wallet,
|
|
160
|
-
bps: 8000, // 80% to agent (basis points: 10000 = 100%)
|
|
161
|
-
token: 'Both', // Receive fees in both tokens
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
recipient: CLANKER_INTERFACE_RECIPIENT,
|
|
165
|
-
admin: CLANKER_INTERFACE_ADMIN,
|
|
166
|
-
bps: 2000, // 20% to clanker protocol
|
|
167
|
-
token: 'Both',
|
|
168
|
-
},
|
|
169
|
-
],
|
|
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
|
|
170
155
|
},
|
|
171
|
-
|
|
156
|
+
body: JSON.stringify(deploymentPayload),
|
|
172
157
|
});
|
|
173
158
|
|
|
174
|
-
|
|
175
|
-
console.log('ā³ Waiting for confirmation...\n');
|
|
159
|
+
const result = await response.json();
|
|
176
160
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
+
}
|
|
181
170
|
process.exit(1);
|
|
182
171
|
}
|
|
183
172
|
|
|
184
|
-
const tokenAddress = result.
|
|
173
|
+
const tokenAddress = result.expectedAddress;
|
|
185
174
|
|
|
186
|
-
console.log('ā
Token
|
|
175
|
+
console.log('ā
Token deployment enqueued!');
|
|
187
176
|
console.log(`\nš Token Details:`);
|
|
188
|
-
console.log(` Address: ${tokenAddress}`);
|
|
189
177
|
console.log(` Name: ${tokenName}`);
|
|
190
178
|
console.log(` Symbol: ${tokenSymbol}`);
|
|
191
179
|
console.log(` Supply: ${initialSupply}`);
|
|
180
|
+
console.log(` Expected Address: ${tokenAddress}`);
|
|
192
181
|
console.log(` Network: Base`);
|
|
193
182
|
console.log(` Explorer: https://basescan.org/token/${tokenAddress}`);
|
|
194
183
|
|
|
@@ -210,6 +199,7 @@ async function main() {
|
|
|
210
199
|
agent: 80,
|
|
211
200
|
clanker: 20,
|
|
212
201
|
},
|
|
202
|
+
requestKey: requestKey,
|
|
213
203
|
};
|
|
214
204
|
|
|
215
205
|
fs.writeFileSync(
|
|
@@ -241,11 +231,8 @@ async function main() {
|
|
|
241
231
|
rl.close();
|
|
242
232
|
} catch (error) {
|
|
243
233
|
console.error('ā Error:', error.message);
|
|
244
|
-
if (
|
|
245
|
-
console.error('
|
|
246
|
-
error.forEach(e => console.error(` - ${e.path?.join('.')}: ${e.message}`));
|
|
247
|
-
} else if (error.message.includes('invalid private key')) {
|
|
248
|
-
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.');
|
|
249
236
|
}
|
|
250
237
|
rl.close();
|
|
251
238
|
process.exit(1);
|
package/lib/index.mjs
CHANGED
|
@@ -4,16 +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
|
|
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 - use undici
|
|
13
|
-
if (typeof globalThis.fetch === 'undefined') {
|
|
14
|
-
const { fetch: undiciFetch } = await import('undici');
|
|
15
|
-
globalThis.fetch = undiciFetch;
|
|
16
|
-
}
|
|
7
|
+
import crypto from 'crypto';
|
|
17
8
|
|
|
18
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
19
10
|
const __dirname = path.dirname(__filename);
|
|
@@ -107,88 +98,86 @@ async function main() {
|
|
|
107
98
|
const initialSupply = '1000000000'; // Default supply
|
|
108
99
|
|
|
109
100
|
console.log('\nš Configuration:');
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
// Clanker protocol addresses (for interface rewards)
|
|
117
|
-
// Using Clanker's official fee recipient
|
|
118
|
-
const CLANKER_INTERFACE_ADMIN = agentConfig.wallet; // Can be agent or clanker
|
|
119
|
-
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`);
|
|
120
106
|
|
|
121
107
|
try {
|
|
122
|
-
console.log('
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
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
|
+
};
|
|
148
148
|
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
rewards: {
|
|
156
|
-
recipients: [
|
|
157
|
-
{
|
|
158
|
-
recipient: agentConfig.wallet,
|
|
159
|
-
admin: agentConfig.wallet,
|
|
160
|
-
bps: 8000, // 80% to agent (basis points: 10000 = 100%)
|
|
161
|
-
token: 'Both', // Receive fees in both tokens
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
recipient: CLANKER_INTERFACE_RECIPIENT,
|
|
165
|
-
admin: CLANKER_INTERFACE_ADMIN,
|
|
166
|
-
bps: 2000, // 20% to clanker protocol
|
|
167
|
-
token: 'Both',
|
|
168
|
-
},
|
|
169
|
-
],
|
|
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
|
|
170
155
|
},
|
|
171
|
-
|
|
156
|
+
body: JSON.stringify(deploymentPayload),
|
|
172
157
|
});
|
|
173
158
|
|
|
174
|
-
|
|
175
|
-
console.log('ā³ Waiting for confirmation...\n');
|
|
159
|
+
const result = await response.json();
|
|
176
160
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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
|
+
}
|
|
181
170
|
process.exit(1);
|
|
182
171
|
}
|
|
183
172
|
|
|
184
|
-
const tokenAddress = result.
|
|
173
|
+
const tokenAddress = result.expectedAddress;
|
|
185
174
|
|
|
186
|
-
console.log('ā
Token
|
|
175
|
+
console.log('ā
Token deployment enqueued!');
|
|
187
176
|
console.log(`\nš Token Details:`);
|
|
188
|
-
console.log(` Address: ${tokenAddress}`);
|
|
189
177
|
console.log(` Name: ${tokenName}`);
|
|
190
178
|
console.log(` Symbol: ${tokenSymbol}`);
|
|
191
179
|
console.log(` Supply: ${initialSupply}`);
|
|
180
|
+
console.log(` Expected Address: ${tokenAddress}`);
|
|
192
181
|
console.log(` Network: Base`);
|
|
193
182
|
console.log(` Explorer: https://basescan.org/token/${tokenAddress}`);
|
|
194
183
|
|
|
@@ -210,6 +199,7 @@ async function main() {
|
|
|
210
199
|
agent: 80,
|
|
211
200
|
clanker: 20,
|
|
212
201
|
},
|
|
202
|
+
requestKey: requestKey,
|
|
213
203
|
};
|
|
214
204
|
|
|
215
205
|
fs.writeFileSync(
|
|
@@ -241,11 +231,8 @@ async function main() {
|
|
|
241
231
|
rl.close();
|
|
242
232
|
} catch (error) {
|
|
243
233
|
console.error('ā Error:', error.message);
|
|
244
|
-
if (
|
|
245
|
-
console.error('
|
|
246
|
-
error.forEach(e => console.error(` - ${e.path?.join('.')}: ${e.message}`));
|
|
247
|
-
} else if (error.message.includes('invalid private key')) {
|
|
248
|
-
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.');
|
|
249
236
|
}
|
|
250
237
|
rl.close();
|
|
251
238
|
process.exit(1);
|