Skip to content

Commit b852e95

Browse files
alcercujaybuidl
authored andcommitted
feat: add deployment dependant subgraphs
1 parent 50de066 commit b852e95

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"packageManager": "yarn@3.3.1",
2525
"scripts": {
2626
"clear": "rm -fr ../.parcel-cache dist/bundle.js",
27-
"start": "parcel",
27+
"start": "yarn generate && parcel",
2828
"start-local": "REACT_APP_SUBGRAPH_ENDPOINT=http://localhost:8000/subgraphs/name/kleros/kleros-v2-core-local parcel",
2929
"build": "yarn generate && yarn parcel build",
3030
"check-style": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
import request from "graphql-request";
22
import { TypedDocumentNode } from "@graphql-typed-document-node/core";
33

4+
const DEPLOYMENT = process.env["REACT_APP_DEPLOYMENT"]?.toUpperCase() ?? "TESTNET";
5+
46
const CHAINID_TO_DISPUTETEMPLATE_SUBGRAPH = {
5-
421613: "https://api.thegraph.com/subgraphs/name/alcercu/disputetemplateregistryarbgrli",
7+
421613:
8+
process.env[`REACT_APP_DISPUTE_TEMPLATE_ARBGOERLI_SUBGRAPH_${DEPLOYMENT}`] ??
9+
"https://api.thegraph.com/subgraphs/name/alcercu/disputetemplateregistryarbgrli",
610
};
711

812
export const graphqlQueryFnHelper = async (
@@ -12,7 +16,8 @@ export const graphqlQueryFnHelper = async (
1216
chainId = 421613
1317
) => {
1418
const coreUrl =
15-
process.env.REACT_APP_SUBGRAPH_ENDPOINT ?? "https://api.thegraph.com/subgraphs/name/alcercu/kleroscoretest";
19+
process.env[`REACT_APP_KLEROS_CORE_SUBGRAPH_${DEPLOYMENT}`] ??
20+
"https://api.thegraph.com/subgraphs/name/alcercu/disputetemplateregistryarbgrli";
1621
const url = isDisputeTemplate ? CHAINID_TO_DISPUTETEMPLATE_SUBGRAPH[chainId] : coreUrl;
1722
return request(url, query, parametersObject);
1823
};

0 commit comments

Comments
 (0)