@semaphore-protocol/utils 4.0.0-beta.1 → 4.0.0-beta.3

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
@@ -70,10 +70,10 @@ yarn add @semaphore-protocol/utils
70
70
  For more information on the functions and modules provided by `@semaphore-protocol/utils`, please refer to the [TypeDoc documentation](https://js.semaphore.pse.dev/modules/_semaphore_protocol_utils).
71
71
 
72
72
  ```typescript
73
- // You can import modules from the main bundle.
74
- import { errors, types } from "@semaphore-protocol/utils"
73
+ // You can import functions/parameters from the main bundle.
74
+ import { supportedNetworks, decodeMessage } from "@semaphore-protocol/utils"
75
75
 
76
76
  // Or by using conditional exports.
77
- import { requireNumber } from "@semaphore-protocol/utils/errors"
78
- import { isNumber } from "@semaphore-protocol/utils/types"
77
+ import supportedNetworks from "@semaphore-protocol/utils/supported-networks"
78
+ import decodeMessage from "@semaphore-protocol/utils/decode-message"
79
79
  ```
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/utils
3
- * @version 4.0.0-beta.1
3
+ * @version 4.0.0-beta.3
4
4
  * @file A library to provide utility functions to the other Semaphore packages.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
@@ -8,252 +8,36 @@
8
8
  */
9
9
  'use strict';
10
10
 
11
- /**
12
- * @module Types
13
- * This module provides utility functions to check data types.
14
- * It defines a set of supported types and includes functions to check if
15
- * a value is defined and if it matches a supported type. These functions
16
- * are useful for type checking and validation in the other libraries,
17
- * enhancing code robustness and reliability.
18
- */
19
- // The list of types supported by this utility functions.
20
- var supportedTypes = ["number", "string", "function", "array", "uint8array", "object", "bigint"];
21
- /**
22
- * It returns true if the value is defined, false otherwise.
23
- * @param value The value to be checked.
24
- * @returns True or false.
25
- */
26
- function isDefined(value) {
27
- return typeof value !== "undefined";
28
- }
29
- /**
30
- * It returns true if the value is a number, false otherwise.
31
- * @param value The value to be checked.
32
- * @returns True or false.
33
- */
34
- function isNumber(value) {
35
- return typeof value === "number";
36
- }
37
- /**
38
- * It returns true if the value is a string, false otherwise.
39
- * @param value The value to be checked.
40
- * @returns True or false.
41
- */
42
- function isString(value) {
43
- return typeof value === "string";
44
- }
45
- /**
46
- * It returns true if the value is a function, false otherwise.
47
- * @param value The value to be checked.
48
- * @returns True or false.
49
- */
50
- function isFunction(value) {
51
- return typeof value === "function";
52
- }
53
- /**
54
- * It returns true if the value is an array, false otherwise.
55
- * @param value The value to be checked.
56
- * @returns True or false.
57
- */
58
- function isArray(value) {
59
- return typeof value === "object" && Array.isArray(value);
60
- }
61
- /**
62
- * It returns true if the value is a uint8array, false otherwise.
63
- * @param value The value to be checked.
64
- * @returns True or false.
65
- */
66
- function isUint8Array(value) {
67
- return value instanceof Uint8Array;
68
- }
69
- /**
70
- * It returns true if the value is an object, false otherwise.
71
- * @param value The value to be checked.
72
- * @returns True or false.
73
- */
74
- function isObject(value) {
75
- return typeof value === "object";
76
- }
77
- /**
78
- * It returns true if the value is a bigint, false otherwise.
79
- * @param value The value to be checked.
80
- * @returns True or false.
81
- */
82
- function isBigInt(value) {
83
- return typeof value === "bigint";
84
- }
85
- /**
86
- * It returns true if the value type is the same as the type passed
87
- * as the second parameter, false otherwise.
88
- * @param type The expected type.
89
- * @returns True or false.
90
- */
91
- function isType(value, type) {
92
- switch (type) {
93
- case "number":
94
- return isNumber(value);
95
- case "string":
96
- return isString(value);
97
- case "function":
98
- return isFunction(value);
99
- case "array":
100
- return isArray(value);
101
- case "uint8array":
102
- return isUint8Array(value);
103
- case "object":
104
- return isObject(value);
105
- case "bigint":
106
- return isBigInt(value);
107
- default:
108
- return false;
109
- }
110
- }
111
- /**
112
- * Return true if the type is being supported by this utility
113
- * functions, false otherwise.
114
- * @param type The type to be checked.
115
- * @returns True or false
116
- */
117
- function isSupportedType(type) {
118
- return supportedTypes.includes(type);
119
- }
11
+ var abi = require('ethers/abi');
12
+ var utils = require('ethers/utils');
13
+
14
+ // TODO: Support all tree depths after trusted-setup. MAX_DEPTH would be 32.
15
+ var MIN_DEPTH = 1;
16
+ var MAX_DEPTH = 12;
120
17
 
121
- var types = /*#__PURE__*/Object.freeze({
18
+ var constants = /*#__PURE__*/Object.freeze({
122
19
  __proto__: null,
123
- isArray: isArray,
124
- isBigInt: isBigInt,
125
- isDefined: isDefined,
126
- isFunction: isFunction,
127
- isNumber: isNumber,
128
- isObject: isObject,
129
- isString: isString,
130
- isSupportedType: isSupportedType,
131
- isType: isType,
132
- isUint8Array: isUint8Array
20
+ MAX_DEPTH: MAX_DEPTH,
21
+ MIN_DEPTH: MIN_DEPTH
133
22
  });
134
23
 
135
24
  /**
136
- * @module Errors
137
- * This module is designed to provide utility functions for validating
138
- * function parameters. It includes functions that throw type errors if
139
- * the parameters do not meet specified criteria, such as being defined,
140
- * a number, a string, a function, or an array. This module helps ensure
141
- * that functions receive the correct types of inputs, enhancing code
142
- * reliability and reducing runtime errors.
143
- */
144
- /**
145
- * It throws a type error if the parameter value has not been defined.
146
- * @param parameterValue The parameter value.
147
- * @param parameterName The parameter name.
148
- */
149
- function requireDefined(parameterValue, parameterName) {
150
- if (!isDefined(parameterValue)) {
151
- throw new TypeError("Parameter '".concat(parameterName, "' is not defined"));
152
- }
153
- }
154
- /**
155
- * It throws a type error if the parameter value is not a number.
156
- * @param parameterValue The parameter value.
157
- * @param parameterName The parameter name.
158
- */
159
- function requireNumber(parameterValue, parameterName) {
160
- if (!isNumber(parameterValue)) {
161
- throw new TypeError("Parameter '".concat(parameterName, "' is not a number"));
162
- }
163
- }
164
- /**
165
- * It throws a type error if the parameter value is not a string.
166
- * @param parameterValue The parameter value.
167
- * @param parameterName The parameter name.
168
- */
169
- function requireString(parameterValue, parameterName) {
170
- if (!isString(parameterValue)) {
171
- throw new TypeError("Parameter '".concat(parameterName, "' is not a string"));
172
- }
173
- }
174
- /**
175
- * It throws a type error if the parameter value is not a function.
176
- * @param parameterValue The parameter value.
177
- * @param parameterName The parameter name.
178
- */
179
- function requireFunction(parameterValue, parameterName) {
180
- if (!isFunction(parameterValue)) {
181
- throw new TypeError("Parameter '".concat(parameterName, "' is not a function"));
182
- }
183
- }
184
- /**
185
- * It throws a type error if the parameter value is not an array.
186
- * @param parameterValue The parameter value.
187
- * @param parameterName The parameter name.
188
- */
189
- function requireArray(parameterValue, parameterName) {
190
- if (!isArray(parameterValue)) {
191
- throw new TypeError("Parameter '".concat(parameterName, "' is not an array"));
192
- }
193
- }
194
- /**
195
- * It throws a type error if the parameter value is not a uint8array.
196
- * @param parameterValue The parameter value.
197
- * @param parameterName The parameter name.
25
+ * Typically used for decoding on-chain Semaphore messages.
26
+ * When Semaphore messages are text they are converted to bigints before
27
+ * the proof is generated (and eventually sent on-chain).
28
+ * This function help devs converting bigint messages to text again.
29
+ * If the original message was not text the output of this
30
+ * function won't probably be human-readable text.
31
+ * @param message The Semaphore message as a bigint.
32
+ * @returns The Semaphore message as a text.
198
33
  */
199
- function requireUint8Array(parameterValue, parameterName) {
200
- if (!isUint8Array(parameterValue)) {
201
- throw new TypeError("Parameter '".concat(parameterName, "' is not a Uint8Array"));
202
- }
203
- }
204
- /**
205
- * It throws a type error if the parameter value is not an object.
206
- * @param parameterValue The parameter value.
207
- * @param parameterName The parameter name.
208
- */
209
- function requireObject(parameterValue, parameterName) {
210
- if (!isObject(parameterValue)) {
211
- throw new TypeError("Parameter '".concat(parameterName, "' is not an object"));
212
- }
213
- }
214
- /**
215
- * It throws a type error if the parameter value is not a bigint.
216
- * @param parameterValue The parameter value.
217
- * @param parameterName The parameter name.
218
- */
219
- function requireBigInt(parameterValue, parameterName) {
220
- if (!isBigInt(parameterValue)) {
221
- throw new TypeError("Parameter '".concat(parameterName, "' is not a bigint"));
222
- }
223
- }
224
- /**
225
- * It throws a type error if the parameter value type is not part of the list of types.
226
- * @param parameterValue The parameter value.
227
- * @param parameterName The parameter name.
228
- */
229
- function requireTypes(parameterValue, parameterName, types) {
230
- for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {
231
- var type = types_1[_i];
232
- if (!isSupportedType(type)) {
233
- throw new Error("Type '".concat(type, "' is not supported"));
234
- }
235
- }
236
- for (var _a = 0, types_2 = types; _a < types_2.length; _a++) {
237
- var type = types_2[_a];
238
- if (isType(parameterValue, type)) {
239
- return;
240
- }
241
- }
242
- throw new TypeError("Parameter '".concat(parameterName, "' is none of the following types: ").concat(types.join(", ")));
34
+ function decodeMessage(message) {
35
+ return abi.decodeBytes32String(utils.toBeHex(message, 32));
243
36
  }
244
37
 
245
- var errors = /*#__PURE__*/Object.freeze({
246
- __proto__: null,
247
- requireArray: requireArray,
248
- requireBigInt: requireBigInt,
249
- requireDefined: requireDefined,
250
- requireFunction: requireFunction,
251
- requireNumber: requireNumber,
252
- requireObject: requireObject,
253
- requireString: requireString,
254
- requireTypes: requireTypes,
255
- requireUint8Array: requireUint8Array
256
- });
38
+ // List of Semaphore supported networks.
39
+ var supportedNetwork = ["sepolia", "mumbai", "optimism-sepolia", "arbitrum-sepolia", "arbitrum"];
257
40
 
258
- exports.errors = errors;
259
- exports.types = types;
41
+ exports.constants = constants;
42
+ exports.decodeMessage = decodeMessage;
43
+ exports.supportedNetworks = supportedNetwork;
package/dist/index.js CHANGED
@@ -1,256 +1,39 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/utils
3
- * @version 4.0.0-beta.1
3
+ * @version 4.0.0-beta.3
4
4
  * @file A library to provide utility functions to the other Semaphore packages.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
7
7
  * @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/utils}
8
8
  */
9
- /**
10
- * @module Types
11
- * This module provides utility functions to check data types.
12
- * It defines a set of supported types and includes functions to check if
13
- * a value is defined and if it matches a supported type. These functions
14
- * are useful for type checking and validation in the other libraries,
15
- * enhancing code robustness and reliability.
16
- */
17
- // The list of types supported by this utility functions.
18
- var supportedTypes = ["number", "string", "function", "array", "uint8array", "object", "bigint"];
19
- /**
20
- * It returns true if the value is defined, false otherwise.
21
- * @param value The value to be checked.
22
- * @returns True or false.
23
- */
24
- function isDefined(value) {
25
- return typeof value !== "undefined";
26
- }
27
- /**
28
- * It returns true if the value is a number, false otherwise.
29
- * @param value The value to be checked.
30
- * @returns True or false.
31
- */
32
- function isNumber(value) {
33
- return typeof value === "number";
34
- }
35
- /**
36
- * It returns true if the value is a string, false otherwise.
37
- * @param value The value to be checked.
38
- * @returns True or false.
39
- */
40
- function isString(value) {
41
- return typeof value === "string";
42
- }
43
- /**
44
- * It returns true if the value is a function, false otherwise.
45
- * @param value The value to be checked.
46
- * @returns True or false.
47
- */
48
- function isFunction(value) {
49
- return typeof value === "function";
50
- }
51
- /**
52
- * It returns true if the value is an array, false otherwise.
53
- * @param value The value to be checked.
54
- * @returns True or false.
55
- */
56
- function isArray(value) {
57
- return typeof value === "object" && Array.isArray(value);
58
- }
59
- /**
60
- * It returns true if the value is a uint8array, false otherwise.
61
- * @param value The value to be checked.
62
- * @returns True or false.
63
- */
64
- function isUint8Array(value) {
65
- return value instanceof Uint8Array;
66
- }
67
- /**
68
- * It returns true if the value is an object, false otherwise.
69
- * @param value The value to be checked.
70
- * @returns True or false.
71
- */
72
- function isObject(value) {
73
- return typeof value === "object";
74
- }
75
- /**
76
- * It returns true if the value is a bigint, false otherwise.
77
- * @param value The value to be checked.
78
- * @returns True or false.
79
- */
80
- function isBigInt(value) {
81
- return typeof value === "bigint";
82
- }
83
- /**
84
- * It returns true if the value type is the same as the type passed
85
- * as the second parameter, false otherwise.
86
- * @param type The expected type.
87
- * @returns True or false.
88
- */
89
- function isType(value, type) {
90
- switch (type) {
91
- case "number":
92
- return isNumber(value);
93
- case "string":
94
- return isString(value);
95
- case "function":
96
- return isFunction(value);
97
- case "array":
98
- return isArray(value);
99
- case "uint8array":
100
- return isUint8Array(value);
101
- case "object":
102
- return isObject(value);
103
- case "bigint":
104
- return isBigInt(value);
105
- default:
106
- return false;
107
- }
108
- }
109
- /**
110
- * Return true if the type is being supported by this utility
111
- * functions, false otherwise.
112
- * @param type The type to be checked.
113
- * @returns True or false
114
- */
115
- function isSupportedType(type) {
116
- return supportedTypes.includes(type);
117
- }
9
+ import { decodeBytes32String } from 'ethers/abi';
10
+ import { toBeHex } from 'ethers/utils';
11
+
12
+ // TODO: Support all tree depths after trusted-setup. MAX_DEPTH would be 32.
13
+ var MIN_DEPTH = 1;
14
+ var MAX_DEPTH = 12;
118
15
 
119
- var types = /*#__PURE__*/Object.freeze({
16
+ var constants = /*#__PURE__*/Object.freeze({
120
17
  __proto__: null,
121
- isArray: isArray,
122
- isBigInt: isBigInt,
123
- isDefined: isDefined,
124
- isFunction: isFunction,
125
- isNumber: isNumber,
126
- isObject: isObject,
127
- isString: isString,
128
- isSupportedType: isSupportedType,
129
- isType: isType,
130
- isUint8Array: isUint8Array
18
+ MAX_DEPTH: MAX_DEPTH,
19
+ MIN_DEPTH: MIN_DEPTH
131
20
  });
132
21
 
133
22
  /**
134
- * @module Errors
135
- * This module is designed to provide utility functions for validating
136
- * function parameters. It includes functions that throw type errors if
137
- * the parameters do not meet specified criteria, such as being defined,
138
- * a number, a string, a function, or an array. This module helps ensure
139
- * that functions receive the correct types of inputs, enhancing code
140
- * reliability and reducing runtime errors.
141
- */
142
- /**
143
- * It throws a type error if the parameter value has not been defined.
144
- * @param parameterValue The parameter value.
145
- * @param parameterName The parameter name.
146
- */
147
- function requireDefined(parameterValue, parameterName) {
148
- if (!isDefined(parameterValue)) {
149
- throw new TypeError("Parameter '".concat(parameterName, "' is not defined"));
150
- }
151
- }
152
- /**
153
- * It throws a type error if the parameter value is not a number.
154
- * @param parameterValue The parameter value.
155
- * @param parameterName The parameter name.
156
- */
157
- function requireNumber(parameterValue, parameterName) {
158
- if (!isNumber(parameterValue)) {
159
- throw new TypeError("Parameter '".concat(parameterName, "' is not a number"));
160
- }
161
- }
162
- /**
163
- * It throws a type error if the parameter value is not a string.
164
- * @param parameterValue The parameter value.
165
- * @param parameterName The parameter name.
166
- */
167
- function requireString(parameterValue, parameterName) {
168
- if (!isString(parameterValue)) {
169
- throw new TypeError("Parameter '".concat(parameterName, "' is not a string"));
170
- }
171
- }
172
- /**
173
- * It throws a type error if the parameter value is not a function.
174
- * @param parameterValue The parameter value.
175
- * @param parameterName The parameter name.
176
- */
177
- function requireFunction(parameterValue, parameterName) {
178
- if (!isFunction(parameterValue)) {
179
- throw new TypeError("Parameter '".concat(parameterName, "' is not a function"));
180
- }
181
- }
182
- /**
183
- * It throws a type error if the parameter value is not an array.
184
- * @param parameterValue The parameter value.
185
- * @param parameterName The parameter name.
186
- */
187
- function requireArray(parameterValue, parameterName) {
188
- if (!isArray(parameterValue)) {
189
- throw new TypeError("Parameter '".concat(parameterName, "' is not an array"));
190
- }
191
- }
192
- /**
193
- * It throws a type error if the parameter value is not a uint8array.
194
- * @param parameterValue The parameter value.
195
- * @param parameterName The parameter name.
23
+ * Typically used for decoding on-chain Semaphore messages.
24
+ * When Semaphore messages are text they are converted to bigints before
25
+ * the proof is generated (and eventually sent on-chain).
26
+ * This function help devs converting bigint messages to text again.
27
+ * If the original message was not text the output of this
28
+ * function won't probably be human-readable text.
29
+ * @param message The Semaphore message as a bigint.
30
+ * @returns The Semaphore message as a text.
196
31
  */
197
- function requireUint8Array(parameterValue, parameterName) {
198
- if (!isUint8Array(parameterValue)) {
199
- throw new TypeError("Parameter '".concat(parameterName, "' is not a Uint8Array"));
200
- }
201
- }
202
- /**
203
- * It throws a type error if the parameter value is not an object.
204
- * @param parameterValue The parameter value.
205
- * @param parameterName The parameter name.
206
- */
207
- function requireObject(parameterValue, parameterName) {
208
- if (!isObject(parameterValue)) {
209
- throw new TypeError("Parameter '".concat(parameterName, "' is not an object"));
210
- }
211
- }
212
- /**
213
- * It throws a type error if the parameter value is not a bigint.
214
- * @param parameterValue The parameter value.
215
- * @param parameterName The parameter name.
216
- */
217
- function requireBigInt(parameterValue, parameterName) {
218
- if (!isBigInt(parameterValue)) {
219
- throw new TypeError("Parameter '".concat(parameterName, "' is not a bigint"));
220
- }
221
- }
222
- /**
223
- * It throws a type error if the parameter value type is not part of the list of types.
224
- * @param parameterValue The parameter value.
225
- * @param parameterName The parameter name.
226
- */
227
- function requireTypes(parameterValue, parameterName, types) {
228
- for (var _i = 0, types_1 = types; _i < types_1.length; _i++) {
229
- var type = types_1[_i];
230
- if (!isSupportedType(type)) {
231
- throw new Error("Type '".concat(type, "' is not supported"));
232
- }
233
- }
234
- for (var _a = 0, types_2 = types; _a < types_2.length; _a++) {
235
- var type = types_2[_a];
236
- if (isType(parameterValue, type)) {
237
- return;
238
- }
239
- }
240
- throw new TypeError("Parameter '".concat(parameterName, "' is none of the following types: ").concat(types.join(", ")));
32
+ function decodeMessage(message) {
33
+ return decodeBytes32String(toBeHex(message, 32));
241
34
  }
242
35
 
243
- var errors = /*#__PURE__*/Object.freeze({
244
- __proto__: null,
245
- requireArray: requireArray,
246
- requireBigInt: requireBigInt,
247
- requireDefined: requireDefined,
248
- requireFunction: requireFunction,
249
- requireNumber: requireNumber,
250
- requireObject: requireObject,
251
- requireString: requireString,
252
- requireTypes: requireTypes,
253
- requireUint8Array: requireUint8Array
254
- });
36
+ // List of Semaphore supported networks.
37
+ var supportedNetwork = ["sepolia", "mumbai", "optimism-sepolia", "arbitrum-sepolia", "arbitrum"];
255
38
 
256
- export { errors, types };
39
+ export { constants, decodeMessage, supportedNetwork as supportedNetworks };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @module @semaphore-protocol/utils
3
+ * @version 4.0.0-beta.3
4
+ * @file A library to provide utility functions to the other Semaphore packages.
5
+ * @copyright Ethereum Foundation 2024
6
+ * @license MIT
7
+ * @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/utils}
8
+ */
9
+ 'use strict';
10
+
11
+ // TODO: Support all tree depths after trusted-setup. MAX_DEPTH would be 32.
12
+ var MIN_DEPTH = 1;
13
+ var MAX_DEPTH = 12;
14
+
15
+ exports.MAX_DEPTH = MAX_DEPTH;
16
+ exports.MIN_DEPTH = MIN_DEPTH;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @module @semaphore-protocol/utils
3
+ * @version 4.0.0-beta.3
4
+ * @file A library to provide utility functions to the other Semaphore packages.
5
+ * @copyright Ethereum Foundation 2024
6
+ * @license MIT
7
+ * @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/utils}
8
+ */
9
+ 'use strict';
10
+
11
+ var abi = require('ethers/abi');
12
+ var utils = require('ethers/utils');
13
+
14
+ /**
15
+ * Typically used for decoding on-chain Semaphore messages.
16
+ * When Semaphore messages are text they are converted to bigints before
17
+ * the proof is generated (and eventually sent on-chain).
18
+ * This function help devs converting bigint messages to text again.
19
+ * If the original message was not text the output of this
20
+ * function won't probably be human-readable text.
21
+ * @param message The Semaphore message as a bigint.
22
+ * @returns The Semaphore message as a text.
23
+ */
24
+ function decodeMessage(message) {
25
+ return abi.decodeBytes32String(utils.toBeHex(message, 32));
26
+ }
27
+
28
+ module.exports = decodeMessage;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @module @semaphore-protocol/utils
3
- * @version 4.0.0-beta.1
3
+ * @version 4.0.0-beta.3
4
4
  * @file A library to provide utility functions to the other Semaphore packages.
5
5
  * @copyright Ethereum Foundation 2024
6
6
  * @license MIT
@@ -8,10 +8,12 @@
8
8
  */
9
9
  'use strict';
10
10
 
11
- var errors = require('./errors.cjs');
12
- var types = require('./types.cjs');
11
+ var constants = require('./constants.cjs');
12
+ var decodeMessage = require('./decode-message.cjs');
13
+ var supportedNetworks = require('./supported-networks.cjs');
13
14
 
14
15
 
15
16
 
16
- exports.errors = errors;
17
- exports.types = types;
17
+ exports.constants = constants;
18
+ exports.decodeMessage = decodeMessage;
19
+ exports.supportedNetworks = supportedNetworks;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @module @semaphore-protocol/utils
3
+ * @version 4.0.0-beta.3
4
+ * @file A library to provide utility functions to the other Semaphore packages.
5
+ * @copyright Ethereum Foundation 2024
6
+ * @license MIT
7
+ * @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/utils}
8
+ */
9
+ 'use strict';
10
+
11
+ // List of Semaphore supported networks.
12
+ var supportedNetwork = ["sepolia", "mumbai", "optimism-sepolia", "arbitrum-sepolia", "arbitrum"];
13
+
14
+ module.exports = supportedNetwork;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @module @semaphore-protocol/utils
3
+ * @version 4.0.0-beta.3
4
+ * @file A library to provide utility functions to the other Semaphore packages.
5
+ * @copyright Ethereum Foundation 2024
6
+ * @license MIT
7
+ * @see [Github]{@link https://github.com/semaphore-protocol/semaphore/tree/main/packages/utils}
8
+ */
9
+ // TODO: Support all tree depths after trusted-setup. MAX_DEPTH would be 32.
10
+ var MIN_DEPTH = 1;
11
+ var MAX_DEPTH = 12;
12
+
13
+ export { MAX_DEPTH, MIN_DEPTH };