diff --git a/src/utils.ts b/src/utils.ts index 1d7eed132..d963413b1 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -28,16 +28,16 @@ interface Strategy { } export const SNAPSHOT_SUBGRAPH_URL = delegationSubgraphs; +const ENS_RESOLVER_ABI = [ + 'function text(bytes32 node, string calldata key) external view returns (string memory)' +]; const SCORE_API_KEY = process?.env?.KEYCARD_SECRET || ''; -const SCORE_API_HEADERS = { + +const scoreApiHeaders = { Accept: 'application/json', 'Content-Type': 'application/json' }; -if (SCORE_API_KEY) SCORE_API_HEADERS['X-API-KEY'] = SCORE_API_KEY; - -const ENS_RESOLVER_ABI = [ - 'function text(bytes32 node, string calldata key) external view returns (string memory)' -]; +if (SCORE_API_KEY) scoreApiHeaders['X-API-KEY'] = SCORE_API_KEY; const ajv = new Ajv({ allErrors: true, allowUnionTypes: true, $data: true }); // @ts-ignore @@ -234,7 +234,7 @@ export async function getScores( }; const res = await fetch(scoreApiUrl, { method: 'POST', - headers: SCORE_API_HEADERS, + headers: scoreApiHeaders, body: JSON.stringify({ params }) }); const obj = await res.json(); @@ -257,7 +257,7 @@ export async function getVp( if (!options.url) options.url = 'https://score.snapshot.org'; const init = { method: 'POST', - headers: SCORE_API_HEADERS, + headers: scoreApiHeaders, body: JSON.stringify({ jsonrpc: '2.0', method: 'get_vp', @@ -290,7 +290,7 @@ export async function validate( if (!options.url) options.url = 'https://score.snapshot.org'; const init = { method: 'POST', - headers: SCORE_API_HEADERS, + headers: scoreApiHeaders, body: JSON.stringify({ jsonrpc: '2.0', method: 'validate',