shine-solana/shine/doc/sh/restart.sh

45 lines
1.2 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e # Завершаем при ошибке
set -o pipefail
PROGRAM_KEYPAIR="target/deploy/shine-keypair.json" # замени на свой путь
WALLET=$(solana address)
echo "🧹 Удаление старого ledger..."
rm -rf test-ledger
echo "🚀 Запуск solana-test-validator в фоне..."
solana-test-validator --ledger test-ledger --reset > validator.log 2>&1 &
VALIDATOR_PID=$!
# Убедимся, что validator запущен
echo "⏳ Ожидание запуска валидатора..."
until solana cluster-version &>/dev/null; do
sleep 1
done
sleep 2 # На всякий случай немного подождём
echo "💸 Airdrop 10 SOL на $WALLET..."
solana airdrop 10 HMww7YSVfwVm4i8sugqj7wyH26dqzHykzv3wzWwzEvPA
solana airdrop 5 $WALLET
echo "🔨 Сборка контракта..."
anchor build
echo "📦 Деплой контракта..."
anchor deploy
echo "✅ Готово!"
# Не убиваем валидатор, чтобы он оставался запущенным
echo " Валидатор всё ещё работает (PID $VALIDATOR_PID)"
echo " Запускаем логи"
solana logs