@snapshot-labs/snapshot.js 0.5.2 → 0.5.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/dist/snapshot.cjs.js +3 -3
- package/dist/snapshot.esm.js +3 -3
- package/dist/snapshot.min.js +1 -1
- package/package.json +1 -1
- package/src/utils.ts +3 -2
package/package.json
CHANGED
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
|
|
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
|
}
|