Skip to content

Commit

Permalink
Merge pull request #31 from kleros/fix/subgraph-migration
Browse files Browse the repository at this point in the history
fix: read stakeSet from kleros-display subgraphs.
  • Loading branch information
salgozino authored Jun 3, 2024
2 parents 185db46 + bbdcd5f commit c9c1195
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 c9c1195

Please sign in to comment.