@@ -5,6 +5,7 @@ import { DisputeKitClassic } from "@kleros/kleros-v2-contracts/typechain-types/s
55import { Button , Textarea } from "@kleros/ui-components-library" ;
66import { useConnectedContract } from "hooks/useConnectedContract" ;
77import { useGetMetaEvidence } from "queries/useGetMetaEvidence" ;
8+ import { wrapWithToast } from "utils/wrapWithToast" ;
89
910const Binary : React . FC < { arbitrable ?: string ; voteIDs : string [ ] } > = ( {
1011 arbitrable,
@@ -40,16 +41,15 @@ const Binary: React.FC<{ arbitrable?: string; voteIDs: string[] }> = ({
4041 text = { answer }
4142 disabled = { isSending }
4243 isLoading = { chosenOption === i + 1 }
43- onClick = { async ( ) => {
44+ onClick = { ( ) => {
4445 setIsSending ( true ) ;
4546 setChosenOption ( i + 1 ) ;
46- await disputeKit
47- . castVote ( id , voteIDs , i + 1 , 0 , justification )
48- . then ( async ( tx ) => await tx . wait ( 2 ) )
49- . finally ( ( ) => {
50- setChosenOption ( - 1 ) ;
51- setIsSending ( false ) ;
52- } ) ;
47+ wrapWithToast (
48+ disputeKit . castVote ( id , voteIDs , i + 1 , 0 , justification )
49+ ) . finally ( ( ) => {
50+ setChosenOption ( - 1 ) ;
51+ setIsSending ( false ) ;
52+ } ) ;
5353 } }
5454 />
5555 )
@@ -62,16 +62,15 @@ const Binary: React.FC<{ arbitrable?: string; voteIDs: string[] }> = ({
6262 text = "Refuse to Arbitrate"
6363 disabled = { isSending }
6464 isLoading = { chosenOption === 0 }
65- onClick = { async ( ) => {
65+ onClick = { ( ) => {
6666 setIsSending ( true ) ;
6767 setChosenOption ( 0 ) ;
68- await disputeKit
69- . castVote ( id , voteIDs , 0 , 0 , justification )
70- . then ( async ( tx ) => await tx . wait ( 2 ) )
71- . finally ( ( ) => {
72- setChosenOption ( - 1 ) ;
73- setIsSending ( false ) ;
74- } ) ;
68+ wrapWithToast (
69+ disputeKit . castVote ( id , voteIDs , 0 , 0 , justification )
70+ ) . finally ( ( ) => {
71+ setChosenOption ( - 1 ) ;
72+ setIsSending ( false ) ;
73+ } ) ;
7574 } }
7675 />
7776 </ RefuseToArbitrateContainer >
0 commit comments