@@ -4,10 +4,9 @@ import { useParams } from "react-router-dom";
44import { Button , Textarea } from "@kleros/ui-components-library" ;
55import { useGetMetaEvidence } from "queries/useGetMetaEvidence" ;
66import { wrapWithToast } from "utils/wrapWithToast" ;
7- import { useWalletClient , useNetwork } from "wagmi" ;
7+ import { useWalletClient } from "wagmi" ;
8+ import { EnsureChain } from "components/EnsureChain" ;
89import { prepareWriteDisputeKitClassic } from "hooks/contracts/generated" ;
9- import { DEFAULT_CHAIN } from "consts/chains" ;
10- import ConnectButton from "components/ConnectButton" ;
1110
1211const Binary : React . FC < { arbitrable ?: string ; voteIDs : string [ ] } > = ( { arbitrable, voteIDs } ) => {
1312 const { id } = useParams ( ) ;
@@ -18,7 +17,6 @@ const Binary: React.FC<{ arbitrable?: string; voteIDs: string[] }> = ({ arbitrab
1817 const [ isSending , setIsSending ] = useState ( false ) ;
1918 const [ justification , setJustification ] = useState ( "" ) ;
2019 const { data : walletClient } = useWalletClient ( ) ;
21- const { chain } = useNetwork ( ) ;
2220
2321 const handleVote = async ( voteOption : number ) => {
2422 setIsSending ( true ) ;
@@ -50,32 +48,28 @@ const Binary: React.FC<{ arbitrable?: string; voteIDs: string[] }> = ({ arbitrab
5048 />
5149 < OptionsContainer >
5250 { metaEvidence ?. rulingOptions ?. titles ?. map ( ( answer : string , i : number ) => {
53- return chain && chain . id === DEFAULT_CHAIN ? (
51+ < EnsureChain >
5452 < Button
5553 key = { i }
5654 text = { answer }
5755 disabled = { isSending }
5856 isLoading = { chosenOption === i + 1 }
5957 onClick = { ( ) => handleVote ( i + 1 ) }
6058 />
61- ) : (
62- < ConnectButton />
63- ) ;
59+ </ EnsureChain > ;
6460 } ) }
6561 </ OptionsContainer >
6662 </ MainContainer >
6763 < RefuseToArbitrateContainer >
68- { chain && chain . id === DEFAULT_CHAIN ? (
64+ < EnsureChain >
6965 < Button
7066 variant = "secondary"
7167 text = "Refuse to Arbitrate"
7268 disabled = { isSending }
7369 isLoading = { chosenOption === 0 }
7470 onClick = { ( ) => handleVote ( 0 ) }
7571 />
76- ) : (
77- < ConnectButton />
78- ) }
72+ </ EnsureChain >
7973 </ RefuseToArbitrateContainer >
8074 </ Container >
8175 ) : (
0 commit comments