Skip to content

Commit 5ee00e2

Browse files
committed
fix: hardcoded block number for filter queries
1 parent 8f1a11f commit 5ee00e2

File tree

8 files changed

+25
-9
lines changed

8 files changed

+25
-9
lines changed

contracts/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,8 @@ tags
179179
# .pnp.*
180180

181181
# End of https://www.toptal.com/developers/gitignore/api/vim,node,visualstudiocode,yarn
182+
183+
.env*
184+
.flaskenv*
185+
!.env.project
186+
!.env.vault

contracts/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@
99
# Except this
1010
/deployments/localhost/
1111
**/.DS_Store
12+
13+
.env*
14+
.flaskenv*
15+
!.env.project
16+
!.env.vault

web/.env.devnet.public

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
export REACT_APP_DEPLOYMENT=devnet
33
export REACT_APP_CORE_SUBGRAPH=https://api.studio.thegraph.com/query/61738/kleros-v2-core-devnet/v0.0.1
44
export REACT_APP_DRT_ARBSEPOLIA_SUBGRAPH=https://api.studio.thegraph.com/query/61738/kleros-v2-drt-arbisep-devnet/v0.0.1
5-
export REACT_APP_STATUS_URL=https://kleros-v2-devnet.betteruptime.com/badge
5+
export REACT_APP_STATUS_URL=https://kleros-v2-devnet.betteruptime.com/badge
6+
export REACT_APP_GENESIS_BLOCK_ARBSEPOLIA=3084598

web/src/consts/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ export const TELEGRAM_REGEX = /^@\w{5,32}$/;
1818
export const ETH_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/;
1919
export const ETH_SIGNATURE_REGEX = /^0x[a-fA-F0-9]{130}$/;
2020

21+
export const GENESIS_BLOCK_ARBSEPOLIA = BigInt(process.env.REACT_APP_GENESIS_BLOCK_ARBSEPOLIA ?? 0);
22+
2123
export const isProductionDeployment = () => process.env.REACT_APP_DEPLOYMENT !== "mainnet";

web/src/hooks/queries/useDisputeTemplate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { graphql } from "src/graphql";
33
import { PublicClient } from "viem";
44
import { usePublicClient } from "wagmi";
55
import { getIArbitrableV2 } from "hooks/contracts/generated";
6-
import { DisputeTemplateQuery } from "src/graphql/graphql";
76
import { isUndefined } from "utils/index";
8-
import { graphqlQueryFnHelper } from "utils/graphqlQueryFnHelper";
7+
import { graphqlQueryFnHelper, graphqlUrl } from "utils/graphqlQueryFnHelper";
98
import { useIsCrossChainDispute } from "../useIsCrossChainDispute";
9+
import { GENESIS_BLOCK_ARBSEPOLIA } from "consts/index";
1010

1111
const disputeTemplateQuery = graphql(`
1212
query DisputeTemplate($id: ID!) {
@@ -62,7 +62,7 @@ const getTemplateId = async (
6262
_arbitrableDisputeID: BigInt(disputeID),
6363
},
6464
{
65-
fromBlock: 27808516n,
65+
fromBlock: GENESIS_BLOCK_ARBSEPOLIA,
6666
toBlock: "latest",
6767
}
6868
);

web/src/hooks/queries/useEvidenceGroup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
22
import { getIArbitrableV2 } from "hooks/contracts/generated";
33
import { usePublicClient } from "wagmi";
44
import { isUndefined } from "utils/index";
5+
import { GENESIS_BLOCK_ARBSEPOLIA } from "consts/index";
56

67
export const useEvidenceGroup = (disputeID?: string, arbitrableAddress?: `0x${string}`) => {
78
const isEnabled = !isUndefined(arbitrableAddress);
@@ -20,7 +21,7 @@ export const useEvidenceGroup = (disputeID?: string, arbitrableAddress?: `0x${st
2021
_arbitrableDisputeID: BigInt(disputeID),
2122
},
2223
{
23-
fromBlock: 27808516n,
24+
fromBlock: GENESIS_BLOCK_ARBSEPOLIA,
2425
toBlock: "latest",
2526
}
2627
);

web/src/hooks/useIsCrossChainDispute.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useQuery } from "@tanstack/react-query";
22
import { usePublicClient } from "wagmi";
33
import { getIHomeGateway } from "hooks/contracts/generated";
44
import { isUndefined } from "utils/index";
5+
import { GENESIS_BLOCK_ARBSEPOLIA } from "consts";
56

67
interface IIsCrossChainDispute {
78
isCrossChainDispute: boolean;
@@ -27,7 +28,7 @@ export const useIsCrossChainDispute = (disputeID?: string, arbitrableAddress?: `
2728
_arbitratorDisputeID: BigInt(disputeID),
2829
},
2930
{
30-
fromBlock: 27808516n,
31+
fromBlock: GENESIS_BLOCK_ARBSEPOLIA,
3132
toBlock: "latest",
3233
}
3334
);

web/src/utils/graphqlQueryFnHelper.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import request from "graphql-request";
2+
import { arbitrumSepolia } from "wagmi/chains";
23
import { TypedDocumentNode } from "@graphql-typed-document-node/core";
34

45
const CHAINID_TO_DISPUTE_TEMPLATE_SUBGRAPH = {
5-
421614:
6+
[arbitrumSepolia.id]:
67
process.env.REACT_APP_DRT_ARBSEPOLIA_SUBGRAPH ?? "Wrong Subgraph URL. Please check the environment variables.",
78
};
89

9-
export const graphqlUrl = (isDisputeTemplate = false, chainId = 421614) => {
10+
export const graphqlUrl = (isDisputeTemplate = false, chainId = arbitrumSepolia.id) => {
1011
const coreUrl = process.env.REACT_APP_CORE_SUBGRAPH ?? "Wrong Subgraph URL. Please check the environment variables.";
1112
return isDisputeTemplate ? CHAINID_TO_DISPUTE_TEMPLATE_SUBGRAPH[chainId] : coreUrl;
1213
};
@@ -15,7 +16,7 @@ export const graphqlQueryFnHelper = async (
1516
query: TypedDocumentNode<any, any>,
1617
parametersObject: Record<string, any>,
1718
isDisputeTemplate = false,
18-
chainId = 421614
19+
chainId = arbitrumSepolia.id
1920
) => {
2021
const url = graphqlUrl(isDisputeTemplate, chainId);
2122
return request(url, query, parametersObject);

0 commit comments

Comments
 (0)