laconicd-stack/scripts/generate-lps-lock.sh
shreerang 44ab959af5 Update playbooks to sign txs on a separate machine from the one running laconicd node (#5)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Reviewed-on: #5
Co-authored-by: shreerang <shreerang@noreply.git.vdb.to>
Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
2025-06-09 12:37:50 +00:00

55 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
# Default values
INPUT=""
OUTPUT_FILE="./distribution.json"
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-i|--input)
INPUT="$2"
shift 2
;;
-o|--output)
OUTPUT_FILE="$2"
shift 2
;;
*)
echo "Unknown option: $1"
echo "Usage: $0 -i|--input <input_url_or_path> [-o|--output <output_file_path>]"
exit 1
;;
esac
done
# Check if input is provided
if [ -z "$INPUT" ]; then
echo "Error: Input URL or path is required"
echo "Usage: $0 -i|--input <input_url_or_path> [-o|--output <output_file_path>]"
exit 1
fi
venv_dir="$PWD/venv-lps-lock"
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Create venv if it doesn't exist
if [ ! -d "$venv_dir" ]; then
python3 -m venv "$venv_dir"
fi
# Activate venv and install dependencies
"$venv_dir/bin/pip" install --upgrade pip
"$venv_dir/bin/pip" install requests pandas openpyxl bech32
echo "Running LPS lock generation script..."
"$venv_dir/bin/python" "$script_dir/generate-lps-distribution-json.py" \
--input "$INPUT" \
--output "$OUTPUT_FILE"
# Clean up venv
echo "Cleaning up..."
rm -rf "$venv_dir"