File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed
Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change 11import useSWRImmutable from "swr/immutable" ;
22import { getIArbitrableV2 } from "hooks/contracts/generated" ;
33import { usePublicClient } from "wagmi" ;
4+ import { isUndefined } from "utils/index" ;
45
5- export const useEvidenceGroup = ( disputeID ?: string , arbitrableAddress ?: string ) => {
6- // const formattedAddress = arbitrableAddress
7- // ? utils.getAddress(arbitrableAddress)
8- // : undefined;
6+ export const useEvidenceGroup = ( disputeID ?: string , arbitrableAddress ?: `0x${string } `) => {
97 const publicClient = usePublicClient ( ) ;
10-
11- const arbitrable = getIArbitrableV2 ( {
12- address : "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b" ,
13- } ) ;
14-
158 return useSWRImmutable (
16- ( ) => ( arbitrable ? `EvidenceGroup${ disputeID } ${ arbitrableAddress } ` : false ) ,
9+ ( ) => ( arbitrableAddress ? `EvidenceGroup${ disputeID } ${ arbitrableAddress } ` : false ) ,
1710 async ( ) => {
18- if ( arbitrable ) {
19- const disputeFilter = await arbitrable . createEventFilter . DisputeTemplate ( {
20- _templateId : BigInt ( parseInt ( disputeID ! ) + 1 ) ,
11+ if ( arbitrableAddress && ! isUndefined ( disputeID ) ) {
12+ const arbitrable = getIArbitrableV2 ( {
13+ address : arbitrableAddress ,
2114 } ) ;
15+ const disputeFilter = await arbitrable . createEventFilter . DisputeTemplate (
16+ {
17+ _templateId : BigInt ( disputeID ) ,
18+ } ,
19+ {
20+ fromBlock : 27808516n ,
21+ toBlock : "latest" ,
22+ }
23+ ) ;
2224
2325 const disputeEvents = await publicClient . getFilterLogs ( {
2426 filter : disputeFilter ,
You can’t perform that action at this time.
0 commit comments