Refactor update.sh to simplify usage by removing wallet address, private key, and RPC URL parameters; streamline script for improved clarity and maintainability.

This commit is contained in:
vvzvlad 2025-01-16 08:32:17 +03:00
parent 4c0268823b
commit 5d8a2cfdd6

View File

@ -1,31 +1,3 @@
#!/bin/bash
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <wallet_address> <private_key> <rpc_url>"
exit 1
fi
WALLET_ADDRESS=$1
PRIVATE_KEY=$2
RPC_URL=$3
# List of files
FILES=(
"./projects/hello-world/container/config.json"
"./projects/hello-world/contracts/Makefile"
"grist.json"
)
for FILE in "${FILES[@]}"; do
EXPANDED_FILE=$(eval echo "$FILE")
sed -i "s|###WALLET_ADDRESS###|$WALLET_ADDRESS|g" "$EXPANDED_FILE"
sed -i "s|###PRIVATE_KEY###|$PRIVATE_KEY|g" "$EXPANDED_FILE"
sed -i "s|###RPC_URL###|$RPC_URL|g" "$EXPANDED_FILE"
done
#!/usr/bin/env bash #!/usr/bin/env bash
if [ "$#" -ne 2 ]; then if [ "$#" -ne 2 ]; then