Skip to content

Commit

Permalink
Pass score api url (#640)
Browse files Browse the repository at this point in the history
* Pass score-api URL to getVp

* Update .env.example
  • Loading branch information
ChaituVR authored Aug 11, 2023
1 parent ee406ff commit 8cca69f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ SEQUENCER_URL=https://testnet.seq.snapshot.org
KEYCARD_URL=https://keycard.snapshot.org
KEYCARD_SECRET=
SCORE_API_URL=https://score.snapshot.org
# If you need unlimited access to score-api, use `https://score.snapshot.org?apiKey=...`
SIDEKICK_URL=https://sh5.co
SENTRY_DSN=
SENTRY_TRACE_SAMPLE_RATE=
8 changes: 6 additions & 2 deletions src/graphql/operations/vp.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import snapshot from '@snapshot-labs/snapshot.js';
import db from '../../helpers/mysql';

const scoreAPIUrl = process.env.SCORE_API_URL || 'https://score.snapshot.org';

export default async function (_parent, { voter, space, proposal }) {
if (proposal) {
const query = `SELECT * FROM proposals WHERE id = ?`;
Expand All @@ -12,7 +14,8 @@ export default async function (_parent, { voter, space, proposal }) {
JSON.parse(p.strategies),
p.snapshot,
space,
p.delegation === 1
p.delegation === 1,
{ url: scoreAPIUrl }
);
} else if (space) {
const query = `SELECT settings FROM spaces WHERE id = ? AND deleted = 0 LIMIT 1`;
Expand All @@ -25,7 +28,8 @@ export default async function (_parent, { voter, space, proposal }) {
s.strategies,
'latest',
space,
s.delegation === 1
s.delegation === 1,
{ url: scoreAPIUrl }
);
}

Expand Down

0 comments on commit 8cca69f

Please sign in to comment.