repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources15d ago| #1 | #!/usr/bin/env python3 |
| #2 | """Launch a token on pump.fun with automatic metadata upload""" |
| #3 | |
| #4 | import sys |
| #5 | import argparse |
| #6 | |
| #7 | |
| #8 | def parse_args(): |
| #9 | parser = argparse.ArgumentParser( |
| #10 | description="Launch a token on pump.fun", |
| #11 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| #12 | epilog=""" |
| #13 | Examples: |
| #14 | # Launch a token with an image file |
| #15 | python launch_pumpfun.py --name "My Token" --symbol "MTK" --description "A cool token" --image ./logo.png |
| #16 | |
| #17 | # Launch with social links |
| #18 | python launch_pumpfun.py --name "My Token" --symbol "MTK" --description "A cool token" \\ |
| #19 | --image ./logo.png --twitter "https://twitter.com/mytoken" --website "https://mytoken.com" |
| #20 | |
| #21 | # Launch with initial buy (dev buy) |
| #22 | python launch_pumpfun.py --name "My Token" --symbol "MTK" --description "A cool token" \\ |
| #23 | --image ./logo.png --initial-buy 0.5 |
| #24 | |
| #25 | Environment Variables (in .env.local): |
| #26 | HELIUS_RPC_URL or SOLANA_RPC_URL - Solana RPC endpoint |
| #27 | MAWD_PRIVATE_KEY or SOLANA_PRIVATE_KEY - Wallet private key (base58) |
| #28 | """ |
| #29 | ) |
| #30 | |
| #31 | parser.add_argument("--name", "-n", required=True, help="Token name") |
| #32 | parser.add_argument("--symbol", "-s", required=True, help="Token symbol/ticker") |
| #33 | parser.add_argument("--description", "-d", required=True, help="Token description") |
| #34 | parser.add_argument("--image", "-i", help="Path to image file (PNG, JPG, GIF)") |
| #35 | parser.add_argument("--image-url", help="URL to image (alternative to --image)") |
| #36 | parser.add_argument("--twitter", help="Twitter URL") |
| #37 | parser.add_argument("--telegram", help="Telegram URL") |
| #38 | parser.add_argument("--website", help="Website URL") |
| #39 | parser.add_argument("--initial-buy", type=float, default=0.0, help="Initial buy amount in SOL (default: 0)") |
| #40 | parser.add_argument("--dry-run", action="store_true", help="Show what would be done without executing") |
| #41 | |
| #42 | return parser.parse_args() |
| #43 | |
| #44 | |
| #45 | args = parse_args() |
| #46 | |
| #47 | # Now import after parsing (to show help without loading heavy deps) |
| #48 | import asyncio |
| #49 | import os |
| #50 | from pathlib import Path |
| #51 | from dotenv import load_dotenv |
| #52 | |
| #53 | # Load env |
| #54 | for env_file in [".env.local", ".env"]: |
| #55 | if Path(env_file).exists(): |
| #56 | load_dotenv(env_file) |
| #57 | break |
| #58 | |
| #59 | |
| #60 | async def main(): |
| #61 | from clients.pumpfun_client import PumpFunClient |
| #62 | |
| #63 | # Get RPC URL |
| #64 | rpc_url = os.getenv("HELIUS_RPC_URL") or os.getenv("SOLANA_RPC_URL") |
| #65 | if not rpc_url: |
| #66 | print("❌ Error: HELIUS_RPC_URL or SOLANA_RPC_URL not set in .env.local") |
| #67 | return |
| #68 | |
| #69 | # Get private key |
| #70 | private_key = os.getenv("MAWD_PRIVATE_KEY") or os.getenv("SOLANA_PRIVATE_KEY") |
| #71 | if not private_key: |
| #72 | print("❌ Error: MAWD_PRIVATE_KEY or SOLANA_PRIVATE_KEY not set in .env.local") |
| #73 | return |
| #74 | |
| #75 | print("\n🚀 Pump.fun Token Launch") |
| #76 | print("=" * 50) |
| #77 | print(f" Name: {args.name}") |
| #78 | print(f" Symbol: {args.symbol}") |
| #79 | print(f" Description: {args.description[:50]}{'...' if len(args.description) > 50 else ''}") |
| #80 | if args.image: |
| #81 | print(f" Image: {args.image}") |
| #82 | if args.image_url: |
| #83 | print(f" Image URL: {args.image_url}") |
| #84 | if args.twitter: |
| #85 | print(f" Twitter: {args.twitter}") |
| #86 | if args.telegram: |
| #87 | print(f" Telegram: {args.telegram}") |
| #88 | if args.website: |
| #89 | print(f" Website: {args.website}") |
| #90 | if args.initial_buy > 0: |
| #91 | print(f" Initial Buy: {args.initial_buy} SOL") |
| #92 | print("=" * 50) |
| #93 | |
| #94 | if args.dry_run: |
| #95 | print("\n🔍 DRY RUN - No transaction will be sent") |
| #96 | return |
| #97 | |
| #98 | # Confirm |
| #99 | response = input("\n⚠️ Ready to launch? This will cost SOL. (y/n): ") |
| #100 | if response.lower() != 'y': |
| #101 | print("Cancelled.") |
| #102 | return |
| #103 | |
| #104 | # Initialize client |
| #105 | print("\n📡 Connecting to Solana...") |
| #106 | client = PumpFunClient(rpc_url=rpc_url, private_key=private_key) |
| #107 | |
| #108 | try: |
| #109 | print(f" Wallet: {client.wallet_pubkey}") |
| #110 | |
| #111 | # Check image |
| #112 | image_path = None |
| #113 | image_url = args.image_url |
| #114 | if args.image: |
| #115 | if not Path(args.image).exists(): |
| #116 | print(f"❌ Error: Image file not found: {args.image}") |
| #117 | return |
| #118 | image_path = args.image |
| #119 | |
| #120 | # Launch token |
| #121 | print("\n📤 Uploading metadata to IPFS...") |
| #122 | print("🔨 Building transaction...") |
| #123 | print("✍️ Signing and sending...") |
| #124 | |
| #125 | result = await client.create_token( |
| #126 | name=args.name, |
| #127 | symbol=args.symbol, |
| #128 | description=args.description, |
| #129 | image_url=image_url, |
| #130 | image_path=image_path, |
| #131 | twitter=args.twitter, |
| #132 | telegram=args.telegram, |
| #133 | website=args.website, |
| #134 | initial_buy_sol=args.initial_buy, |
| #135 | ) |
| #136 | |
| #137 | print("\n" + "=" * 50) |
| #138 | print("✅ TOKEN LAUNCHED SUCCESSFULLY!") |
| #139 | print("=" * 50) |
| #140 | print(f" Mint: {result.mint}") |
| #141 | print(f" Bonding Curve: {result.bonding_curve}") |
| #142 | print(f" Signature: {result.signature}") |
| #143 | print(f"\n 🔗 View on pump.fun: {result.token_url}") |
| #144 | print(f" 🔗 Solscan: https://solscan.io/tx/{result.signature}") |
| #145 | print("=" * 50) |
| #146 | |
| #147 | except Exception as e: |
| #148 | print(f"\n❌ Error: {e}") |
| #149 | import traceback |
| #150 | traceback.print_exc() |
| #151 | finally: |
| #152 | await client.close() |
| #153 | |
| #154 | |
| #155 | if __name__ == "__main__": |
| #156 | asyncio.run(main()) |
| #157 |