Skip to content

Commit

Permalink
fix: read stakeSet from kleros-display subgraphs.
Browse files Browse the repository at this point in the history
Migration to studio do the hosted-service deprecation
  • Loading branch information
salgozino committed May 27, 2024
1 parent 185db46 commit bbdcd5f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions snapshots/src/helpers/subgraph-events.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const fetchStakeSets = async (blockStart, blockEnd, subgraphEndpoint, lastId) =>
id_gt: "${lastId}"
},
orderBy: id,
orderDir: asc,
orderDirection: asc,
first: 1000) {
id
address
Expand All @@ -26,9 +26,11 @@ const fetchStakeSets = async (blockStart, blockEnd, subgraphEndpoint, lastId) =>
};
const response = await fetch(subgraphEndpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(subgraphQuery),
});

const { data } = await response.json();
const stakeSets = data.stakeSets;

Expand Down Expand Up @@ -67,9 +69,9 @@ const parseStakeSetsIntoEvents = (subgraphStakeSets) => {
export const getStakeSets = async (blockStart, blockEnd, chainId) => {
let endpoint;
if (chainId === 1) {
endpoint = "https://api.thegraph.com/subgraphs/name/greenlucid/kleros-display-mainnet";
endpoint = "https://api.studio.thegraph.com/query/61738/kleros-display-mainnet/version/latest";
} else if (chainId === 100) {
endpoint = "https://api.thegraph.com/subgraphs/name/greenlucid/kleros-display";
endpoint = "https://api.studio.thegraph.com/query/61738/kleros-display-gnosis/version/latest";
} else {
throw new Error("Unsupported Chain, nor mainnet nor gnosis");
}
Expand Down

0 comments on commit bbdcd5f

Please sign in to comment.