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.
@@ -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 { Clanker } from 'clanker-sdk/v4';
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
- console.log(` Name: ${tokenName}`);
111
- console.log(` Symbol: ${tokenSymbol}`);
112
- console.log(` Supply: ${initialSupply}`);
113
- console.log(` Agent Wallet: ${agentConfig.wallet}`);
114
- console.log(` Fee Distribution: 80% Agent, 20% Clanker\n`);
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('šŸ”„ Initializing Clanker SDK...');
123
-
124
- // Setup viem clients with explicit fetch
125
- const account = privateKeyToAccount(privateKey);
126
- const publicClient = createPublicClient({
127
- chain: base,
128
- transport: http(undefined, { fetch: globalThis.fetch })
129
- });
130
- const walletClient = createWalletClient({
131
- account,
132
- chain: base,
133
- transport: http(undefined, { fetch: globalThis.fetch })
134
- });
135
-
136
- // Initialize Clanker SDK
137
- const clanker = new Clanker({
138
- publicClient,
139
- wallet: walletClient,
140
- fetch: globalThis.fetch,
141
- });
142
-
143
- console.log('āœ“ Clanker SDK initialized');
144
- console.log('āœ“ Connected to Base network');
145
- console.log('āœ“ Account:', account.address);
146
-
147
- console.log('\nšŸš€ Deploying token...');
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
- // Deploy token with 80/20 fee split
150
- // Using Clanker v4 deploy() method with correct token structure
151
- const { txHash, waitForTransaction } = await clanker.deploy({
152
- name: tokenName,
153
- symbol: tokenSymbol,
154
- tokenAdmin: agentConfig.wallet,
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
- vanity: true, // Try to get vanity address with "b07" suffix
156
+ body: JSON.stringify(deploymentPayload),
172
157
  });
173
158
 
174
- console.log(`āœ“ Transaction submitted: ${txHash}`);
175
- console.log('ā³ Waiting for confirmation...\n');
159
+ const result = await response.json();
176
160
 
177
- const result = await waitForTransaction();
178
-
179
- if (result.error) {
180
- console.error('āŒ Deployment error:', result.error);
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.address;
173
+ const tokenAddress = result.expectedAddress;
185
174
 
186
- console.log('āœ… Token deployed successfully!');
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 (typeof error === 'object' && Array.isArray(error)) {
245
- console.error(' Validation errors:');
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 { Clanker } from 'clanker-sdk/v4';
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
- console.log(` Name: ${tokenName}`);
111
- console.log(` Symbol: ${tokenSymbol}`);
112
- console.log(` Supply: ${initialSupply}`);
113
- console.log(` Agent Wallet: ${agentConfig.wallet}`);
114
- console.log(` Fee Distribution: 80% Agent, 20% Clanker\n`);
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('šŸ”„ Initializing Clanker SDK...');
123
-
124
- // Setup viem clients with explicit fetch
125
- const account = privateKeyToAccount(privateKey);
126
- const publicClient = createPublicClient({
127
- chain: base,
128
- transport: http(undefined, { fetch: globalThis.fetch })
129
- });
130
- const walletClient = createWalletClient({
131
- account,
132
- chain: base,
133
- transport: http(undefined, { fetch: globalThis.fetch })
134
- });
135
-
136
- // Initialize Clanker SDK
137
- const clanker = new Clanker({
138
- publicClient,
139
- wallet: walletClient,
140
- fetch: globalThis.fetch,
141
- });
142
-
143
- console.log('āœ“ Clanker SDK initialized');
144
- console.log('āœ“ Connected to Base network');
145
- console.log('āœ“ Account:', account.address);
146
-
147
- console.log('\nšŸš€ Deploying token...');
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
- // Deploy token with 80/20 fee split
150
- // Using Clanker v4 deploy() method with correct token structure
151
- const { txHash, waitForTransaction } = await clanker.deploy({
152
- name: tokenName,
153
- symbol: tokenSymbol,
154
- tokenAdmin: agentConfig.wallet,
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
- vanity: true, // Try to get vanity address with "b07" suffix
156
+ body: JSON.stringify(deploymentPayload),
172
157
  });
173
158
 
174
- console.log(`āœ“ Transaction submitted: ${txHash}`);
175
- console.log('ā³ Waiting for confirmation...\n');
159
+ const result = await response.json();
176
160
 
177
- const result = await waitForTransaction();
178
-
179
- if (result.error) {
180
- console.error('āŒ Deployment error:', result.error);
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.address;
173
+ const tokenAddress = result.expectedAddress;
185
174
 
186
- console.log('āœ… Token deployed successfully!');
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 (typeof error === 'object' && Array.isArray(error)) {
245
- console.error(' Validation errors:');
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dacty-launch",
3
- "version": "1.4.5",
3
+ "version": "1.5.0",
4
4
  "description": "Launch tokens for agents in the Dactyclaw ecosystem",
5
5
  "type": "module",
6
6
  "bin": {