File tree Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Expand file tree Collapse file tree 1 file changed +16
-21
lines changed Original file line number Diff line number Diff line change @@ -108,39 +108,34 @@ program
108
108
return
109
109
}
110
110
111
- let queryData
111
+ let groupIds
112
112
113
113
const spinner = new Spinner ( "Fetching groups" )
114
-
115
- const getGroupIds = async ( ) => {
116
- const groupIds = await queryData . getGroupIds ( )
117
-
118
- spinner . stop ( )
119
-
120
- if ( groupIds . length === 0 ) {
121
- console . info ( `\n ${ logSymbols . info } ` , "info: there are no groups in this network\n" )
122
- return
123
- }
124
-
125
- const content = `\n${ groupIds . map ( ( id : any ) => ` - ${ id } ` ) . join ( "\n" ) } `
126
-
127
- console . info ( `${ content } \n` )
128
- }
129
-
130
114
spinner . start ( )
131
115
132
116
try {
133
- queryData = new SemaphoreSubgraph ( network )
134
- await getGroupIds ( )
117
+ const semaphoreSubgraph = new SemaphoreSubgraph ( network )
118
+ groupIds = await semaphoreSubgraph . getGroupIds ( )
119
+ spinner . stop ( )
135
120
} catch ( error ) {
136
121
try {
137
- queryData = new SemaphoreEthers ( network )
138
- await getGroupIds ( )
122
+ const semaphoreEthers = new SemaphoreEthers ( network )
123
+ groupIds = await semaphoreEthers . getGroupIds ( )
124
+ spinner . stop ( )
139
125
} catch {
140
126
spinner . stop ( )
141
127
console . info ( `\n ${ logSymbols . error } ` , "error: unexpected error with the SemaphoreEthers package" )
128
+ return
142
129
}
143
130
}
131
+ if ( groupIds . length === 0 ) {
132
+ console . info ( `\n ${ logSymbols . info } ` , "info: there are no groups in this network\n" )
133
+ return
134
+ }
135
+
136
+ const content = `\n${ groupIds . map ( ( id : any ) => ` - ${ id } ` ) . join ( "\n" ) } `
137
+
138
+ console . info ( `${ content } \n` )
144
139
} )
145
140
146
141
program
You can’t perform that action at this time.
0 commit comments