Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"start": "next start",
"lint": "next lint",
"test": "jest",
"postinstall": "graz generate -g"
"postinstall": "bash scripts/fetchGrazChains.sh"
},
"dependencies": {
"@amplitude/analytics-browser": "^2.8.1",
Expand Down
44 changes: 44 additions & 0 deletions scripts/fetchGrazChains.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
MAX_RETRIES=10
command_exists() {
command -v "$1" >/dev/null 2>&1
}
if ! command_exists graz; then
echo "graz is not installed."
if command_exists npm; then
npm install -g graz
else
echo "Error: npm is not installed. Please install npm and try again."
exit 1
fi
fi

fetch_graz_chains() {
local retry_count=0

while [ $retry_count -lt $MAX_RETRIES ]; do
echo "Attempt $((retry_count + 1)) to fetch cosmos chains..."

if graz generate -g; then
echo "Successfully fetched cosmos chains!"
return 0
else
retry_count=$((retry_count + 1))
if [ $retry_count -lt $MAX_RETRIES ]; then
echo "Fetch failed. Retrying in 5 seconds..."
sleep 5
else
echo "Max retries reached. Unable to fetch cosmos chains."
fi
fi
done

return 1
}

if fetch_graz_chains; then
echo "Cosmos chains have been successfully fetched and stored in $OUTPUT_DIR"
else
echo "Failed to fetch cosmos chains after $MAX_RETRIES attempts."
exit 1
fi
Loading