@semaphore-protocol/cli 0.3.0 → 0.5.0

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 CHANGED
@@ -46,8 +46,8 @@
46
46
  </h4>
47
47
  </div>
48
48
 
49
- | Setting up a project, although not particularly complex, can be a lengthy process for some people. A command line to initialize a Semaphore project can reduce the set-up time from a few minutes to a few seconds. In addition, the Semaphore CLI can also be used to obtain on-chain group data. |
50
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
49
+ | Setting up a project, although not particularly complex, can be a lengthy process for some people. The Semaphore CLI reduces the set-up time from a few minutes to a few seconds. In addition, it can also be used to obtain on-chain group data. |
50
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
51
51
 
52
52
  ## 🛠 Install
53
53
 
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @module @semaphore-protocol/cli
5
- * @version 0.3.0
5
+ * @version 0.5.0
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
@@ -79,13 +79,18 @@ program
79
79
  console.info(`${Object.keys(scripts)
80
80
  .map((s) => ` ${chalk.cyan(`npm run ${s}`)}`)
81
81
  .join("\n")}\n`);
82
+ console.info(` See the README.md file to understand how to use them!\n`);
82
83
  }
83
84
  });
84
85
  program
85
86
  .command("get-groups")
86
- .description("Get the list of groups from a supported network (Goerli or Arbitrum).")
87
+ .description("Get the list of groups from a supported network (goerli or arbitrum).")
87
88
  .option("-n, --network <network-name>", "Supported Ethereum network.", "goerli")
88
89
  .action(async ({ network }) => {
90
+ if (!["goerli", "arbitrum"].includes(network)) {
91
+ console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`);
92
+ return;
93
+ }
89
94
  const subgraph = new Subgraph(network);
90
95
  const spinner = new Spinner("Fetching groups");
91
96
  spinner.start();
@@ -112,6 +117,10 @@ program
112
117
  .option("--members", "Show group members.")
113
118
  .option("--signals", "Show group signals.")
114
119
  .action(async (groupId, { network, members, signals }) => {
120
+ if (!["goerli", "arbitrum"].includes(network)) {
121
+ console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`);
122
+ return;
123
+ }
115
124
  const subgraph = new Subgraph(network);
116
125
  const spinner = new Spinner(`Fetching group ${groupId}`);
117
126
  spinner.start();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semaphore-protocol/cli",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.5.0",
5
5
  "description": "A command line tool to set up your Semaphore project and get group data.",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -32,6 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "devDependencies": {
35
+ "@types/clear": "^0.1.2",
35
36
  "@types/figlet": "^1.5.5",
36
37
  "rollup-plugin-cleanup": "^3.2.1",
37
38
  "rollup-plugin-typescript2": "^0.31.2",
@@ -40,7 +41,6 @@
40
41
  },
41
42
  "dependencies": {
42
43
  "@semaphore-protocol/subgraph": "2.6.1",
43
- "@types/clear": "^0.1.2",
44
44
  "chalk": "^5.1.2",
45
45
  "commander": "^9.4.1",
46
46
  "download": "^8.0.0",
package/src/index.ts CHANGED
@@ -64,14 +64,21 @@ program
64
64
  .map((s) => ` ${chalk.cyan(`npm run ${s}`)}`)
65
65
  .join("\n")}\n`
66
66
  )
67
+
68
+ console.info(` See the README.md file to understand how to use them!\n`)
67
69
  }
68
70
  })
69
71
 
70
72
  program
71
73
  .command("get-groups")
72
- .description("Get the list of groups from a supported network (Goerli or Arbitrum).")
74
+ .description("Get the list of groups from a supported network (goerli or arbitrum).")
73
75
  .option("-n, --network <network-name>", "Supported Ethereum network.", "goerli")
74
76
  .action(async ({ network }) => {
77
+ if (!["goerli", "arbitrum"].includes(network)) {
78
+ console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`)
79
+ return
80
+ }
81
+
75
82
  const subgraph = new Subgraph(network)
76
83
  const spinner = new Spinner("Fetching groups")
77
84
 
@@ -105,6 +112,11 @@ program
105
112
  .option("--members", "Show group members.")
106
113
  .option("--signals", "Show group signals.")
107
114
  .action(async (groupId, { network, members, signals }) => {
115
+ if (!["goerli", "arbitrum"].includes(network)) {
116
+ console.info(`\n ${logSymbols.error}`, `error: the network '${network}' is not supported\n`)
117
+ return
118
+ }
119
+
108
120
  const subgraph = new Subgraph(network)
109
121
  const spinner = new Spinner(`Fetching group ${groupId}`)
110
122