@karma3labs/presale-cli
v1.0.1
Published
CLI for Karma Launcher Presale SDK
Readme
Karma Launcher Presale CLI
Command-line interface for interacting with Karma Launcher presale contracts.
Installation
# From the cli directory
npm install
# Build the CLI
npm run build
# Link globally (optional)
npm linkConfiguration
Create a .env file in the project root or cli directory:
# Required
PRIVATE_KEY=0x...your_private_key
# Optional - Network Configuration
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
BASE_RPC_URL=https://mainnet.base.org
# Optional - Contract Addresses (defaults provided for Base Sepolia)
PRESALE_ADDRESS=0x1f0FB2ac6a3a4C6162159eEe26d86E06aB23ee12
KARMA_FACTORY_ADDRESS=0x129183B7CC4F23e115064590dA970BB3Abc3C500
USDC_ADDRESS=0x72338D8859884B4CeeAE68651E8B8e49812f2fEeUsage
Global Options
All commands support the following options:
-n, --network <network>- Network to use (default:base-sepolia)--debug- Enable debug mode with detailed error output
Wallet Commands
# Show current wallet address
karma wallet address
# Check USDC balance and allowance
karma wallet balance
karma wallet balance --address 0x...
# Approve USDC for presale contract
karma wallet approve 1000 # Approve 1000 USDC
karma wallet approve max # Approve unlimitedPresale Commands
# Get presale information
karma presale info <presaleId>
# Get user info for a presale
karma presale user-info <presaleId>
karma presale user-info <presaleId> --address 0x...
# Contribute USDC to a presale
karma presale contribute <presaleId> <amount>
karma presale contribute 1 100 # Contribute 100 USDC to presale #1
karma presale contribute 1 100 --no-approve # Skip approval step
# Withdraw contribution from a presale
karma presale withdraw <presaleId> <amount>
karma presale withdraw 1 50 # Withdraw 50 USDC from presale #1
# Claim tokens and refund
karma presale claim <presaleId>
karma presale claim 1 # Claim from presale #1Token Commands
# Deploy token for a presale (presale must be ready)
karma token deploy <presaleId>
karma token deploy 1
# Get deployed token information
karma token info <presaleId>
karma token info 1Other Commands
# Show CLI information and quick start guide
karma info
# List supported networks
karma networks
# Show version
karma --version
# Show help
karma --help
karma presale --help
karma presale contribute --helpExamples
Complete Presale Flow
# 1. Check your wallet
karma wallet balance
# 2. View presale details
karma presale info 1
# 3. Approve USDC (if needed)
karma wallet approve 500
# 4. Contribute to presale
karma presale contribute 1 500
# 5. Check your contribution
karma presale user-info 1
# 6. After presale ends and token is deployed, claim your tokens
karma presale claim 1Using Different Networks
# Base Sepolia (testnet) - default
karma presale info 1 --network base-sepolia
# Base Mainnet
karma presale info 1 --network baseSupported Networks
| Network | Chain ID | Description |
|---------|----------|-------------|
| base-sepolia | 84532 | Base Sepolia Testnet (default) |
| base | 8453 | Base Mainnet |
Development
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Run directly without global install
npm start -- presale info 1
# or
node bin/karma.js presale info 1Troubleshooting
"PRIVATE_KEY environment variable is required"
Make sure you have a .env file with your private key:
PRIVATE_KEY=0x...your_private_key_here"Unknown network"
Use karma networks to see supported networks. Make sure you're using a valid network name.
Transaction Failures
- Check your USDC balance:
karma wallet balance - Check USDC allowance:
karma wallet balance - Enable debug mode for more details:
karma --debug presale contribute 1 100
Dependencies
@karma3labs/presale-sdk-evm- Karma Presale SDKcommander- CLI frameworkchalk- Terminal stylingora- Spinnersviem- Ethereum librarydotenv- Environment variables
License
MIT
