Skip to content

Commit 0a21868

Browse files
authored
Add score api endpoint as pathname (#884)
* Add score api endpoint as pathname * fix * v0.5.2
1 parent a0e15f7 commit 0a21868

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@snapshot-labs/snapshot.js",
3-
"version": "0.5.1",
3+
"version": "0.5.2",
44
"repository": "snapshot-labs/snapshot.js",
55
"license": "MIT",
66
"main": "dist/snapshot.cjs.js",

src/utils.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,14 @@ export async function getScores(
219219
network: string,
220220
addresses: string[],
221221
snapshot: number | string = 'latest',
222-
scoreApiUrl = 'https://score.snapshot.org/api/scores',
223-
options: any = { returnValue: 'scores' }
222+
scoreApiUrl = 'https://score.snapshot.org',
223+
options: any = {}
224224
) {
225+
if (!options.returnValue) options.returnValue = 'scores';
226+
const url = new URL(scoreApiUrl);
227+
url.pathname = '/api/scores';
228+
scoreApiUrl = url.toString();
229+
225230
try {
226231
const params = {
227232
space,

0 commit comments

Comments
 (0)