File tree 2 files changed +45
-1
lines changed 2 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 8
8
"start" : " next start" ,
9
9
"lint" : " next lint" ,
10
10
"test" : " jest" ,
11
- "postinstall" : " graz generate -g "
11
+ "postinstall" : " bash scripts/fetchGrazChains.sh "
12
12
},
13
13
"dependencies" : {
14
14
"@amplitude/analytics-browser" : " ^2.8.1" ,
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ MAX_RETRIES=10
3
+ command_exists () {
4
+ command -v " $1 " > /dev/null 2>&1
5
+ }
6
+ if ! command_exists graz; then
7
+ echo " graz is not installed."
8
+ if command_exists npm; then
9
+ npm install -g graz
10
+ else
11
+ echo " Error: npm is not installed. Please install npm and try again."
12
+ exit 1
13
+ fi
14
+ fi
15
+
16
+ fetch_graz_chains () {
17
+ local retry_count=0
18
+
19
+ while [ $retry_count -lt $MAX_RETRIES ]; do
20
+ echo " Attempt $(( retry_count + 1 )) to fetch cosmos chains..."
21
+
22
+ if graz generate -g; then
23
+ echo " Successfully fetched cosmos chains!"
24
+ return 0
25
+ else
26
+ retry_count=$(( retry_count + 1 ))
27
+ if [ $retry_count -lt $MAX_RETRIES ]; then
28
+ echo " Fetch failed. Retrying in 5 seconds..."
29
+ sleep 5
30
+ else
31
+ echo " Max retries reached. Unable to fetch cosmos chains."
32
+ fi
33
+ fi
34
+ done
35
+
36
+ return 1
37
+ }
38
+
39
+ if fetch_graz_chains; then
40
+ echo " Cosmos chains have been successfully fetched and stored in $OUTPUT_DIR "
41
+ else
42
+ echo " Failed to fetch cosmos chains after $MAX_RETRIES attempts."
43
+ exit 1
44
+ fi
You can’t perform that action at this time.
0 commit comments