@semaphore-protocol/cli 3.1.0 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +10 -10
- package/package.json +55 -55
- package/src/index.ts +9 -9
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @module @semaphore-protocol/cli
|
|
5
|
-
* @version 3.1
|
|
5
|
+
* @version 3.2.1
|
|
6
6
|
* @file A command line tool to set up your Semaphore project and get group data.
|
|
7
7
|
* @copyright Ethereum Foundation 2022
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/cli}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import {
|
|
12
|
+
import { SemaphoreSubgraph } from '@semaphore-protocol/data';
|
|
13
13
|
import chalk from 'chalk';
|
|
14
14
|
import { program } from 'commander';
|
|
15
15
|
import download from 'download';
|
|
16
16
|
import figlet from 'figlet';
|
|
17
17
|
import { readFileSync, existsSync, renameSync } from 'fs';
|
|
18
|
+
import inquirer from 'inquirer';
|
|
18
19
|
import logSymbols from 'log-symbols';
|
|
19
20
|
import { dirname } from 'path';
|
|
20
21
|
import { fileURLToPath } from 'url';
|
|
21
|
-
import inquirer from 'inquirer';
|
|
22
22
|
import axios from 'axios';
|
|
23
23
|
import boxen from 'boxen';
|
|
24
24
|
import { execSync } from 'child_process';
|
|
@@ -72,7 +72,7 @@ class Spinner {
|
|
|
72
72
|
|
|
73
73
|
const packagePath = `${dirname(fileURLToPath(import.meta.url))}/..`;
|
|
74
74
|
const { description, version } = JSON.parse(readFileSync(`${packagePath}/package.json`, "utf8"));
|
|
75
|
-
const supportedNetworks = ["goerli", "arbitrum"];
|
|
75
|
+
const supportedNetworks = ["goerli", "mumbai", "optimism-goerli", "arbitrum"];
|
|
76
76
|
program
|
|
77
77
|
.name("semaphore")
|
|
78
78
|
.description(description)
|
|
@@ -147,17 +147,17 @@ program
|
|
|
147
147
|
console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`);
|
|
148
148
|
return;
|
|
149
149
|
}
|
|
150
|
-
const subgraph = new
|
|
150
|
+
const subgraph = new SemaphoreSubgraph(network);
|
|
151
151
|
const spinner = new Spinner("Fetching groups");
|
|
152
152
|
spinner.start();
|
|
153
153
|
try {
|
|
154
|
-
const
|
|
154
|
+
const groupIds = await subgraph.getGroupIds();
|
|
155
155
|
spinner.stop();
|
|
156
|
-
if (
|
|
156
|
+
if (groupIds.length === 0) {
|
|
157
157
|
console.info(`\n ${logSymbols.info}`, "info: there are no groups in this network\n");
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
const content = `\n${
|
|
160
|
+
const content = `\n${groupIds.map((id) => ` - ${id}`).join("\n")}`;
|
|
161
161
|
console.info(`${content}\n`);
|
|
162
162
|
}
|
|
163
163
|
catch (error) {
|
|
@@ -185,7 +185,7 @@ program
|
|
|
185
185
|
network = selectedNetwork;
|
|
186
186
|
}
|
|
187
187
|
if (!groupId) {
|
|
188
|
-
const subgraphGroups = new
|
|
188
|
+
const subgraphGroups = new SemaphoreSubgraph(network);
|
|
189
189
|
const spinnerGroups = new Spinner("Fetching groups");
|
|
190
190
|
spinnerGroups.start();
|
|
191
191
|
try {
|
|
@@ -230,7 +230,7 @@ program
|
|
|
230
230
|
console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`);
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
|
-
const subgraph = new
|
|
233
|
+
const subgraph = new SemaphoreSubgraph(network);
|
|
234
234
|
const spinner = new Spinner(`Fetching group ${groupId}`);
|
|
235
235
|
spinner.start();
|
|
236
236
|
try {
|
package/package.json
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
2
|
+
"name": "@semaphore-protocol/cli",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "3.2.1",
|
|
5
|
+
"description": "A command line tool to set up your Semaphore project and get group data.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"semaphore": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"types": "dist/types/index.d.ts",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/",
|
|
13
|
+
"src/",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"repository": "https://github.com/semaphore-protocol/semaphore",
|
|
18
|
+
"homepage": "https://github.com/semaphore-protocol/semaphore/tree/main/packages/cli",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/semaphore-protocol/semaphore.git/issues"
|
|
21
|
+
},
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=14.16"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"start": "ts-node --esm src/index.ts",
|
|
27
|
+
"build:watch": "rollup -c rollup.config.ts -w --configPlugin typescript",
|
|
28
|
+
"build": "rimraf dist && rollup -c rollup.config.ts --configPlugin typescript",
|
|
29
|
+
"prepublishOnly": "yarn build"
|
|
30
|
+
},
|
|
31
|
+
"publishConfig": {
|
|
32
|
+
"access": "public"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/clear": "^0.1.2",
|
|
36
|
+
"@types/figlet": "^1.5.5",
|
|
37
|
+
"@types/semver": "^7.3.13",
|
|
38
|
+
"rollup-plugin-cleanup": "^3.2.1",
|
|
39
|
+
"rollup-plugin-typescript2": "^0.31.2",
|
|
40
|
+
"ts-node": "^10.9.1",
|
|
41
|
+
"typedoc": "^0.22.11"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@semaphore-protocol/data": "3.2.1",
|
|
45
|
+
"axios": "^1.3.2",
|
|
46
|
+
"boxen": "^7.0.1",
|
|
47
|
+
"chalk": "^5.1.2",
|
|
48
|
+
"commander": "^9.4.1",
|
|
49
|
+
"download": "^8.0.0",
|
|
50
|
+
"figlet": "^1.5.2",
|
|
51
|
+
"inquirer": "^9.1.4",
|
|
52
|
+
"log-symbols": "^5.1.0",
|
|
53
|
+
"ora": "^6.1.2",
|
|
54
|
+
"semver": "^7.3.8"
|
|
55
|
+
}
|
|
56
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SemaphoreSubgraph } from "@semaphore-protocol/data"
|
|
2
2
|
import chalk from "chalk"
|
|
3
3
|
import { program } from "commander"
|
|
4
4
|
import download from "download"
|
|
5
5
|
import figlet from "figlet"
|
|
6
6
|
import { existsSync, readFileSync, renameSync } from "fs"
|
|
7
|
+
import inquirer from "inquirer"
|
|
7
8
|
import logSymbols from "log-symbols"
|
|
8
9
|
import { dirname } from "path"
|
|
9
10
|
import { fileURLToPath } from "url"
|
|
10
|
-
import inquirer from "inquirer"
|
|
11
11
|
import checkLatestVersion from "./checkLatestVersion.js"
|
|
12
12
|
import Spinner from "./spinner.js"
|
|
13
13
|
|
|
14
14
|
const packagePath = `${dirname(fileURLToPath(import.meta.url))}/..`
|
|
15
15
|
const { description, version } = JSON.parse(readFileSync(`${packagePath}/package.json`, "utf8"))
|
|
16
16
|
|
|
17
|
-
const supportedNetworks = ["goerli", "arbitrum"]
|
|
17
|
+
const supportedNetworks = ["goerli", "mumbai", "optimism-goerli", "arbitrum"]
|
|
18
18
|
|
|
19
19
|
program
|
|
20
20
|
.name("semaphore")
|
|
@@ -108,22 +108,22 @@ program
|
|
|
108
108
|
return
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
const subgraph = new
|
|
111
|
+
const subgraph = new SemaphoreSubgraph(network)
|
|
112
112
|
const spinner = new Spinner("Fetching groups")
|
|
113
113
|
|
|
114
114
|
spinner.start()
|
|
115
115
|
|
|
116
116
|
try {
|
|
117
|
-
const
|
|
117
|
+
const groupIds = await subgraph.getGroupIds()
|
|
118
118
|
|
|
119
119
|
spinner.stop()
|
|
120
120
|
|
|
121
|
-
if (
|
|
121
|
+
if (groupIds.length === 0) {
|
|
122
122
|
console.info(`\n ${logSymbols.info}`, "info: there are no groups in this network\n")
|
|
123
123
|
return
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
const content = `\n${
|
|
126
|
+
const content = `\n${groupIds.map((id: any) => ` - ${id}`).join("\n")}`
|
|
127
127
|
|
|
128
128
|
console.info(`${content}\n`)
|
|
129
129
|
} catch (error) {
|
|
@@ -154,7 +154,7 @@ program
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
if (!groupId) {
|
|
157
|
-
const subgraphGroups = new
|
|
157
|
+
const subgraphGroups = new SemaphoreSubgraph(network)
|
|
158
158
|
const spinnerGroups = new Spinner("Fetching groups")
|
|
159
159
|
spinnerGroups.start()
|
|
160
160
|
try {
|
|
@@ -208,7 +208,7 @@ program
|
|
|
208
208
|
return
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
const subgraph = new
|
|
211
|
+
const subgraph = new SemaphoreSubgraph(network)
|
|
212
212
|
const spinner = new Spinner(`Fetching group ${groupId}`)
|
|
213
213
|
|
|
214
214
|
spinner.start()
|