@snapshot-labs/snapshot.js 0.5.2 → 0.5.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapshot-labs/snapshot.js",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "repository": "snapshot-labs/snapshot.js",
5
5
  "license": "MIT",
6
6
  "main": "dist/snapshot.cjs.js",
@@ -10,13 +10,14 @@
10
10
  "type": "string",
11
11
  "format": "long",
12
12
  "title": "About",
13
- "minLength": 1,
13
+ "minLength": 40,
14
14
  "maxLength": 140
15
15
  },
16
16
  "statement": {
17
17
  "type": "string",
18
18
  "format": "long",
19
- "title": "Statement"
19
+ "title": "Statement",
20
+ "maxLength": 10000
20
21
  }
21
22
  },
22
23
  "required": ["about"],
package/src/utils.ts CHANGED
@@ -222,7 +222,6 @@ export async function getScores(
222
222
  scoreApiUrl = 'https://score.snapshot.org',
223
223
  options: any = {}
224
224
  ) {
225
- if (!options.returnValue) options.returnValue = 'scores';
226
225
  const url = new URL(scoreApiUrl);
227
226
  url.pathname = '/api/scores';
228
227
  scoreApiUrl = url.toString();
@@ -241,7 +240,9 @@ export async function getScores(
241
240
  body: JSON.stringify({ params })
242
241
  });
243
242
  const obj = await res.json();
244
- return options.returnValue ? obj.result[options.returnValue] : obj.result;
243
+ return options.returnValue === 'all'
244
+ ? obj.result
245
+ : obj.result[options.returnValue || 'scores'];
245
246
  } catch (e) {
246
247
  return Promise.reject(e);
247
248
  }