You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

57 lines
1.4 KiB

#!/bin/bash
# Simple script to switch from devnet to mainnet
set -e
echo "🔄 Switching to Mainnet Configuration..."
echo "⚠ WARNING: You'll need to deploy the program to mainnet first!"
echo
# Get current config
if [[ ! -f "config.json" ]]; then
echo "❌ config.json not found"
exit 1
fi
# Show current config
echo "📋 Current config:"
cat config.json
echo
# Get user inputs
read -p "🔑 Enter MAINNET program ID: " PROGRAM_ID
read -p "🪙 Enter MAINNET mint address: " MINT_ADDRESS
read -p "💰 Enter MAINNET dev wallet (or press enter for current): " DEV_WALLET
# Use current dev wallet if none provided
if [[ -z "$DEV_WALLET" ]]; then
DEV_WALLET=$(cat config.json | grep devWallet | cut -d'"' -f4)
fi
# Create mainnet config
cat > config-mainnet.json << EOF
{
"cluster": "https://api.mainnet-beta.solana.com",
"programId": "$PROGRAM_ID",
"mint": "$MINT_ADDRESS",
"devWallet": "$DEV_WALLET"
}
EOF
# Backup current config
cp config.json config-devnet-backup.json
# Switch to mainnet
cp config-mainnet.json config.json
echo "✅ Switched to mainnet!"
echo "📁 Devnet config backed up to: config-devnet-backup.json"
echo "📁 Mainnet config saved to: config-mainnet.json"
echo
echo "📝 To deploy frontend with mainnet config:"
echo " ./deploy.sh"
echo
echo "📝 To switch back to devnet:"
echo " cp config-devnet-backup.json config.json"