@moltlaunch/sdk 2.4.0 → 3.0.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/src/index.ts DELETED
@@ -1,68 +0,0 @@
1
- // MoltLaunch SDK - AI Agent Token Launches on Solana
2
- // Built on Meteora Dynamic Bonding Curve (DBC)
3
-
4
- export * from './types';
5
- export * from './verification';
6
- export * from './launcher';
7
-
8
- import { MoltLauncher, LaunchOptions, quickLaunch } from './launcher';
9
- import { AgentVerifier, verifier } from './verification';
10
- import {
11
- AgentProfile,
12
- LaunchConfig,
13
- VerificationResult,
14
- LaunchResult,
15
- MOLTLAUNCH_CONFIG,
16
- DBC_PROGRAM_ID,
17
- } from './types';
18
-
19
- /**
20
- * MoltLaunch SDK
21
- *
22
- * The first dedicated launchpad for AI agent token sales on Solana.
23
- * Built on Meteora's Dynamic Bonding Curve for fair, transparent launches.
24
- *
25
- * Features:
26
- * - Proof-of-Agent verification before launch
27
- * - Customizable bonding curves (linear, exponential, market cap)
28
- * - Automatic graduation to Meteora AMM
29
- * - Milestone-based team vesting
30
- * - 80/20 fee split (creator/platform)
31
- *
32
- * Quick Start:
33
- * ```typescript
34
- * import { MoltLauncher, AgentProfile } from '@moltlaunch/sdk';
35
- *
36
- * const agent: AgentProfile = {
37
- * name: 'TradingBot Pro',
38
- * symbol: 'TBP',
39
- * description: 'Autonomous trading agent with proven alpha generation',
40
- * capabilities: ['trading', 'analysis', 'automation'],
41
- * apiEndpoint: 'https://tradingbot.example.com/api',
42
- * githubRepo: 'https://github.com/example/tradingbot',
43
- * };
44
- *
45
- * const launcher = new MoltLauncher({
46
- * rpcUrl: 'https://api.devnet.solana.com',
47
- * payer: yourKeypair,
48
- * dryRun: true,
49
- * });
50
- *
51
- * const result = await launcher.launchAgent(agent, {
52
- * targetRaise: 500, // SOL
53
- * curveType: 'exponential',
54
- * });
55
- * ```
56
- */
57
-
58
- export default {
59
- MoltLauncher,
60
- AgentVerifier,
61
- quickLaunch,
62
- verifier,
63
- config: MOLTLAUNCH_CONFIG,
64
- programId: DBC_PROGRAM_ID,
65
- };
66
-
67
- // Version
68
- export const VERSION = '1.0.0';
package/src/launcher.ts DELETED
@@ -1,263 +0,0 @@
1
- // MoltLaunch - Token Launch on Meteora DBC
2
- import {
3
- Connection,
4
- Keypair,
5
- PublicKey,
6
- TransactionInstruction,
7
- VersionedTransaction,
8
- TransactionMessage,
9
- LAMPORTS_PER_SOL,
10
- } from '@solana/web3.js';
11
- import {
12
- AgentProfile,
13
- LaunchConfig,
14
- LaunchResult,
15
- SwapParams,
16
- SwapResult,
17
- DBC_PROGRAM_ID,
18
- MOLTLAUNCH_CONFIG,
19
- } from './types';
20
- import { AgentVerifier } from './verification';
21
-
22
- export interface LaunchOptions {
23
- rpcUrl: string;
24
- payer: Keypair;
25
- dryRun?: boolean;
26
- }
27
-
28
- export class MoltLauncher {
29
- private connection: Connection;
30
- private payer: Keypair;
31
- private dryRun: boolean;
32
- private verifier: AgentVerifier;
33
-
34
- constructor(options: LaunchOptions) {
35
- this.connection = new Connection(options.rpcUrl, 'confirmed');
36
- this.payer = options.payer;
37
- this.dryRun = options.dryRun ?? false;
38
- this.verifier = new AgentVerifier();
39
- }
40
-
41
- /**
42
- * Full launch flow: verify agent -> create DBC config -> create pool
43
- */
44
- async launchAgent(
45
- agent: AgentProfile,
46
- config: Partial<LaunchConfig> = {}
47
- ): Promise<LaunchResult> {
48
- console.log(`\n🚀 Starting launch for ${agent.name} ($${agent.symbol})\n`);
49
-
50
- // 1. Verify agent
51
- console.log('📋 Step 1: Verifying agent...');
52
- const verification = await this.verifier.verify(agent);
53
-
54
- if (!verification.passed) {
55
- return {
56
- success: false,
57
- error: `Verification failed with score ${verification.score}/100. Minimum required: ${MOLTLAUNCH_CONFIG.minVerificationScore}`,
58
- };
59
- }
60
- console.log(`✅ Verification passed! Score: ${verification.score}/100\n`);
61
-
62
- // 2. Merge with default config
63
- const launchConfig: LaunchConfig = {
64
- ...MOLTLAUNCH_CONFIG.defaultLaunchConfig,
65
- targetRaise: 100, // Default 100 SOL
66
- ...config,
67
- };
68
-
69
- // 3. Generate DBC configuration
70
- console.log('⚙️ Step 2: Generating DBC configuration...');
71
- const dbcConfig = this.generateDbcConfig(agent, launchConfig);
72
- console.log(` Curve Type: ${launchConfig.curveType}`);
73
- console.log(` Target Raise: ${launchConfig.targetRaise} SOL`);
74
- console.log(` Migration: ${launchConfig.migrationTarget}\n`);
75
-
76
- if (this.dryRun) {
77
- console.log('🔍 DRY RUN MODE - No transactions will be sent\n');
78
- console.log('Generated DBC Config:', JSON.stringify(dbcConfig, null, 2));
79
- return {
80
- success: true,
81
- transactionId: 'dry-run-no-tx',
82
- poolAddress: 'dry-run-pool-address',
83
- tokenMint: 'dry-run-token-mint',
84
- configKey: 'dry-run-config-key',
85
- };
86
- }
87
-
88
- // 4. Create DBC Config (on-chain)
89
- console.log('📝 Step 3: Creating DBC config on-chain...');
90
- // TODO: Implement actual DBC config creation using Meteora SDK
91
- // This would use the @mercurial-finance/dynamic-amm-sdk or similar
92
-
93
- // For now, we return a placeholder
94
- console.log('⚠️ Note: Full DBC integration requires Meteora SDK\n');
95
-
96
- return {
97
- success: true,
98
- transactionId: 'pending-integration',
99
- poolAddress: 'pending-integration',
100
- tokenMint: 'pending-integration',
101
- configKey: 'pending-integration',
102
- };
103
- }
104
-
105
- /**
106
- * Generate DBC-compatible configuration from MoltLaunch config
107
- */
108
- private generateDbcConfig(agent: AgentProfile, config: LaunchConfig) {
109
- // Map our config to Meteora DBC format
110
- const buildCurveMode = {
111
- linear: 0,
112
- exponential: 1,
113
- marketcap: 1,
114
- custom: 3,
115
- }[config.curveType];
116
-
117
- return {
118
- // Network
119
- rpcUrl: this.connection.rpcEndpoint,
120
- dryRun: this.dryRun,
121
- computeUnitPriceMicroLamports: 100000,
122
- quoteMint: config.quoteMint || 'So11111111111111111111111111111111111111112', // SOL
123
-
124
- // DBC Config
125
- dbcConfig: {
126
- buildCurveMode,
127
-
128
- // Supply & Migration
129
- totalTokenSupply: config.totalSupply,
130
- migrationQuoteThreshold: config.targetRaise,
131
- percentageSupplyOnMigration: 20,
132
-
133
- // For marketcap mode
134
- ...(config.curveType === 'marketcap' && {
135
- initialMarketCap: config.initialMarketCap || config.targetRaise * 0.1,
136
- migrationMarketCap: config.migrationMarketCap || config.targetRaise * 5,
137
- }),
138
-
139
- // Migration settings
140
- migrationOption: config.migrationTarget === 'damm-v2' ? 1 : 0,
141
- migrationFeeOption: config.migrationFeeOption,
142
-
143
- // Token settings
144
- tokenBaseDecimal: 6,
145
- tokenQuoteDecimal: 9,
146
- tokenType: 0, // SPL Token
147
- tokenUpdateAuthority: 1, // Immutable
148
-
149
- // Fee structure
150
- baseFeeParams: {
151
- baseFeeMode: 0,
152
- feeSchedulerParam: {
153
- startingFeeBps: config.tradingFeeBps,
154
- endingFeeBps: config.tradingFeeBps,
155
- numberOfPeriod: 0,
156
- totalDuration: 0,
157
- },
158
- },
159
- dynamicFeeEnabled: true,
160
- collectFeeMode: 0, // Quote token only
161
- activationType: 1, // Timestamp
162
-
163
- // LP Distribution
164
- partnerLiquidityPercentage: config.platformLpPercentage,
165
- creatorLiquidityPercentage: config.creatorLpPercentage,
166
- partnerPermanentLockedLiquidityPercentage: config.platformLockedLpPercentage,
167
- creatorPermanentLockedLiquidityPercentage: config.creatorLockedLpPercentage,
168
- creatorTradingFeePercentage: config.creatorFeeShare,
169
-
170
- // Vesting (if enabled)
171
- lockedVestingParams: config.vestingEnabled
172
- ? {
173
- totalLockedVestingAmount: 0,
174
- numberOfVestingPeriod: Math.ceil((config.vestingDurationDays || 30) / 7),
175
- cliffUnlockAmount: 0,
176
- totalVestingDuration: (config.vestingDurationDays || 30) * 24 * 60 * 60,
177
- cliffDurationFromMigrationTime: (config.cliffDays || 7) * 24 * 60 * 60,
178
- }
179
- : {
180
- totalLockedVestingAmount: 0,
181
- numberOfVestingPeriod: 0,
182
- cliffUnlockAmount: 0,
183
- totalVestingDuration: 0,
184
- cliffDurationFromMigrationTime: 0,
185
- },
186
-
187
- // Addresses
188
- leftover: 0,
189
- leftoverReceiver: MOLTLAUNCH_CONFIG.platformWallet,
190
- feeClaimer: MOLTLAUNCH_CONFIG.platformWallet,
191
-
192
- // Migration fee
193
- migrationFee: {
194
- feePercentage: 0,
195
- creatorFeePercentage: 0,
196
- },
197
- poolCreationFee: 0,
198
- },
199
-
200
- // Pool creation
201
- dbcPool: {
202
- creator: this.payer.publicKey.toBase58(),
203
- name: agent.name,
204
- symbol: agent.symbol,
205
- metadata: {
206
- description: agent.description,
207
- website: agent.website,
208
- twitter: agent.twitter,
209
- telegram: agent.telegram,
210
- image: agent.logo,
211
- },
212
- },
213
- };
214
- }
215
-
216
- /**
217
- * Get current pool status
218
- */
219
- async getPoolStatus(tokenMint: string): Promise<{
220
- exists: boolean;
221
- currentRaise: number;
222
- targetRaise: number;
223
- progress: number;
224
- currentPrice: number;
225
- graduated: boolean;
226
- } | null> {
227
- // TODO: Query DBC program for pool state
228
- return null;
229
- }
230
-
231
- /**
232
- * Buy/sell tokens on bonding curve
233
- */
234
- async swap(params: SwapParams): Promise<SwapResult> {
235
- // TODO: Implement swap via DBC program
236
- return {
237
- success: false,
238
- error: 'Swap not yet implemented - requires Meteora DBC SDK integration',
239
- amountIn: params.amountIn,
240
- amountOut: 0,
241
- priceImpact: 0,
242
- newPrice: 0,
243
- };
244
- }
245
- }
246
-
247
- /**
248
- * Quick launch helper function
249
- */
250
- export async function quickLaunch(
251
- agent: AgentProfile,
252
- payerSecretKey: Uint8Array,
253
- rpcUrl: string = 'https://api.devnet.solana.com',
254
- config: Partial<LaunchConfig> = {}
255
- ): Promise<LaunchResult> {
256
- const launcher = new MoltLauncher({
257
- rpcUrl,
258
- payer: Keypair.fromSecretKey(payerSecretKey),
259
- dryRun: true, // Default to dry run for safety
260
- });
261
-
262
- return launcher.launchAgent(agent, config);
263
- }
package/src/types.ts DELETED
@@ -1,122 +0,0 @@
1
- // MoltLaunch Types
2
-
3
- export interface AgentProfile {
4
- name: string;
5
- symbol: string;
6
- description: string;
7
- capabilities: string[];
8
- apiEndpoint: string;
9
- githubRepo?: string;
10
- website?: string;
11
- twitter?: string;
12
- telegram?: string;
13
- logo?: string; // URL or file path
14
- }
15
-
16
- export interface LaunchConfig {
17
- // Token Economics
18
- totalSupply: number;
19
- targetRaise: number; // in SOL
20
- quoteMint?: string; // default SOL
21
-
22
- // Bonding Curve
23
- curveType: 'linear' | 'exponential' | 'marketcap' | 'custom';
24
- initialMarketCap?: number;
25
- migrationMarketCap?: number;
26
-
27
- // Migration
28
- migrationTarget: 'damm-v1' | 'damm-v2';
29
- migrationFeeOption: 0 | 1 | 2 | 3 | 4 | 5; // 0.25% to 6%
30
-
31
- // LP Distribution (must total 100%)
32
- creatorLpPercentage: number;
33
- platformLpPercentage: number;
34
- creatorLockedLpPercentage: number;
35
- platformLockedLpPercentage: number;
36
-
37
- // Fees
38
- tradingFeeBps: number; // basis points
39
- creatorFeeShare: number; // 0-100, percentage of trading fees to creator
40
-
41
- // Anti-rug features
42
- vestingEnabled: boolean;
43
- vestingDurationDays?: number;
44
- cliffDays?: number;
45
- }
46
-
47
- export interface VerificationResult {
48
- passed: boolean;
49
- score: number; // 0-100
50
- checks: {
51
- apiLiveness: boolean;
52
- apiResponsive: boolean;
53
- githubExists: boolean;
54
- capabilitiesVerified: boolean;
55
- uniqueIdentity: boolean;
56
- };
57
- attestation?: string; // On-chain proof
58
- timestamp: string;
59
- }
60
-
61
- export interface LaunchApplication {
62
- id: string;
63
- agent: AgentProfile;
64
- config: LaunchConfig;
65
- verification: VerificationResult | null;
66
- status: 'pending' | 'verifying' | 'verified' | 'rejected' | 'live' | 'graduated';
67
- createdAt: string;
68
- updatedAt: string;
69
- launchAddress?: string;
70
- tokenMint?: string;
71
- }
72
-
73
- export interface LaunchResult {
74
- success: boolean;
75
- transactionId?: string;
76
- poolAddress?: string;
77
- tokenMint?: string;
78
- configKey?: string;
79
- error?: string;
80
- }
81
-
82
- export interface SwapParams {
83
- tokenMint: string;
84
- amountIn: number;
85
- isBuy: boolean; // true = buy tokens, false = sell tokens
86
- slippageBps: number;
87
- }
88
-
89
- export interface SwapResult {
90
- success: boolean;
91
- transactionId?: string;
92
- amountIn: number;
93
- amountOut: number;
94
- priceImpact: number;
95
- newPrice: number;
96
- error?: string;
97
- }
98
-
99
- // Meteora DBC Program ID
100
- export const DBC_PROGRAM_ID = 'dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN';
101
-
102
- // MoltLaunch Platform Config
103
- export const MOLTLAUNCH_CONFIG = {
104
- platformWallet: '82rh4CG9bMfVLFcpWwUXAscVkAgtDqCXgcQ4k2bjuoEx',
105
- platformFeePercentage: 20, // 20% of trading fees
106
- minVerificationScore: 60, // minimum score to launch
107
- defaultLaunchConfig: {
108
- totalSupply: 1_000_000_000,
109
- curveType: 'linear' as const,
110
- migrationTarget: 'damm-v2' as const,
111
- migrationFeeOption: 2 as const, // 1%
112
- creatorLpPercentage: 40,
113
- platformLpPercentage: 50,
114
- creatorLockedLpPercentage: 5,
115
- platformLockedLpPercentage: 5,
116
- tradingFeeBps: 100, // 1%
117
- creatorFeeShare: 80, // 80/20 split
118
- vestingEnabled: true,
119
- vestingDurationDays: 30,
120
- cliffDays: 7,
121
- }
122
- };
@@ -1,228 +0,0 @@
1
- // Agent Verification Service
2
- import axios from 'axios';
3
- import { AgentProfile, VerificationResult } from './types';
4
-
5
- export class AgentVerifier {
6
- private timeout: number;
7
-
8
- constructor(timeout: number = 10000) {
9
- this.timeout = timeout;
10
- }
11
-
12
- /**
13
- * Verify an agent's liveness and capabilities
14
- */
15
- async verify(agent: AgentProfile): Promise<VerificationResult> {
16
- const checks = {
17
- apiLiveness: false,
18
- apiResponsive: false,
19
- githubExists: false,
20
- capabilitiesVerified: false,
21
- uniqueIdentity: false,
22
- };
23
-
24
- // 1. API Liveness Check
25
- try {
26
- const livenessResult = await this.checkApiLiveness(agent.apiEndpoint);
27
- checks.apiLiveness = livenessResult.alive;
28
- checks.apiResponsive = livenessResult.responseTime < 5000;
29
- } catch (error) {
30
- console.log('API liveness check failed:', error);
31
- }
32
-
33
- // 2. GitHub Check
34
- if (agent.githubRepo) {
35
- try {
36
- checks.githubExists = await this.checkGithubRepo(agent.githubRepo);
37
- } catch (error) {
38
- console.log('GitHub check failed:', error);
39
- }
40
- }
41
-
42
- // 3. Capabilities Verification (via API prompt)
43
- if (checks.apiLiveness) {
44
- try {
45
- checks.capabilitiesVerified = await this.verifyCapabilities(
46
- agent.apiEndpoint,
47
- agent.capabilities
48
- );
49
- } catch (error) {
50
- console.log('Capability verification failed:', error);
51
- }
52
- }
53
-
54
- // 4. Unique Identity Check (placeholder for SAID/on-chain identity)
55
- checks.uniqueIdentity = true; // TODO: Integrate with SAID protocol
56
-
57
- // Calculate score
58
- const score = this.calculateScore(checks);
59
- const passed = score >= 60;
60
-
61
- return {
62
- passed,
63
- score,
64
- checks,
65
- attestation: passed ? this.generateAttestation(agent, score) : undefined,
66
- timestamp: new Date().toISOString(),
67
- };
68
- }
69
-
70
- /**
71
- * Check if agent API is alive and responsive
72
- */
73
- private async checkApiLiveness(
74
- endpoint: string
75
- ): Promise<{ alive: boolean; responseTime: number }> {
76
- const start = Date.now();
77
-
78
- try {
79
- // Try common health endpoints
80
- const healthEndpoints = [
81
- endpoint,
82
- `${endpoint}/health`,
83
- `${endpoint}/api/health`,
84
- `${endpoint}/ping`,
85
- ];
86
-
87
- for (const url of healthEndpoints) {
88
- try {
89
- const response = await axios.get(url, { timeout: this.timeout });
90
- if (response.status === 200) {
91
- return { alive: true, responseTime: Date.now() - start };
92
- }
93
- } catch {
94
- continue;
95
- }
96
- }
97
-
98
- // Try POST with verification prompt
99
- const response = await axios.post(
100
- endpoint,
101
- {
102
- message: 'MoltLaunch verification ping. Please respond with your agent name.',
103
- },
104
- { timeout: this.timeout }
105
- );
106
-
107
- return {
108
- alive: response.status === 200,
109
- responseTime: Date.now() - start,
110
- };
111
- } catch (error) {
112
- return { alive: false, responseTime: Date.now() - start };
113
- }
114
- }
115
-
116
- /**
117
- * Check if GitHub repository exists and has recent activity
118
- */
119
- private async checkGithubRepo(repoUrl: string): Promise<boolean> {
120
- try {
121
- // Extract owner/repo from URL
122
- const match = repoUrl.match(/github\.com\/([^\/]+)\/([^\/]+)/);
123
- if (!match) return false;
124
-
125
- const [, owner, repo] = match;
126
- const apiUrl = `https://api.github.com/repos/${owner}/${repo.replace('.git', '')}`;
127
-
128
- const response = await axios.get(apiUrl, {
129
- timeout: this.timeout,
130
- headers: { Accept: 'application/vnd.github.v3+json' },
131
- });
132
-
133
- // Check for recent activity (updated in last 30 days)
134
- const updatedAt = new Date(response.data.updated_at);
135
- const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
136
-
137
- return response.status === 200 && updatedAt > thirtyDaysAgo;
138
- } catch {
139
- return false;
140
- }
141
- }
142
-
143
- /**
144
- * Verify agent capabilities through API interaction
145
- */
146
- private async verifyCapabilities(
147
- endpoint: string,
148
- capabilities: string[]
149
- ): Promise<boolean> {
150
- const verificationPrompts: Record<string, string> = {
151
- trading: 'What trading pairs do you support? Respond with a list.',
152
- analysis: 'Provide a brief market analysis for SOL.',
153
- automation: 'Describe one automation task you can perform.',
154
- defi: 'What DeFi protocols do you integrate with?',
155
- social: 'What social platforms do you monitor?',
156
- nft: 'What NFT marketplaces do you support?',
157
- };
158
-
159
- let verifiedCount = 0;
160
-
161
- for (const capability of capabilities) {
162
- const prompt = verificationPrompts[capability.toLowerCase()];
163
- if (!prompt) continue;
164
-
165
- try {
166
- const response = await axios.post(
167
- endpoint,
168
- { message: prompt },
169
- { timeout: this.timeout }
170
- );
171
-
172
- // Basic check: response should be non-empty and relevant
173
- if (
174
- response.status === 200 &&
175
- response.data &&
176
- (typeof response.data === 'string' ? response.data.length > 20 : true)
177
- ) {
178
- verifiedCount++;
179
- }
180
- } catch {
181
- continue;
182
- }
183
- }
184
-
185
- // At least 50% of capabilities should be verified
186
- return capabilities.length > 0 && verifiedCount / capabilities.length >= 0.5;
187
- }
188
-
189
- /**
190
- * Calculate verification score (0-100)
191
- */
192
- private calculateScore(checks: VerificationResult['checks']): number {
193
- const weights = {
194
- apiLiveness: 30,
195
- apiResponsive: 20,
196
- githubExists: 15,
197
- capabilitiesVerified: 25,
198
- uniqueIdentity: 10,
199
- };
200
-
201
- let score = 0;
202
- for (const [key, passed] of Object.entries(checks)) {
203
- if (passed) {
204
- score += weights[key as keyof typeof weights] || 0;
205
- }
206
- }
207
-
208
- return score;
209
- }
210
-
211
- /**
212
- * Generate verification attestation (placeholder for on-chain)
213
- */
214
- private generateAttestation(agent: AgentProfile, score: number): string {
215
- const data = {
216
- agentName: agent.name,
217
- symbol: agent.symbol,
218
- score,
219
- verifiedAt: new Date().toISOString(),
220
- verifier: 'MoltLaunch',
221
- };
222
-
223
- // TODO: Create actual on-chain attestation
224
- return Buffer.from(JSON.stringify(data)).toString('base64');
225
- }
226
- }
227
-
228
- export const verifier = new AgentVerifier();