@@ -40,7 +40,7 @@ const StakeWithdrawButton: React.FC<IActionButton> = ({ parsedAmount, action, se
4040 } ) ;
4141 const { data : jurorBalance } = useKlerosCoreGetJurorBalance ( {
4242 enabled : ! isUndefined ( address ) ,
43- args : [ address , id ] ,
43+ args : [ address ?? "0x" , BigInt ( id ?? 0 ) ] ,
4444 watch : true ,
4545 } ) ;
4646 const { data : allowance } = usePNKAllowance ( address ) ;
@@ -59,20 +59,23 @@ const StakeWithdrawButton: React.FC<IActionButton> = ({ parsedAmount, action, se
5959 return jurorBalance [ 0 ] - parsedAmount ;
6060 }
6161 }
62- } , [ action , jurorBalance , parsedAmount ] ) ;
62+ return 0n ;
63+ } , [ jurorBalance , parsedAmount , isAllowance , isStaking ] ) ;
6364
6465 const klerosCore = getKlerosCore ( { } ) ;
6566 const { config : increaseAllowanceConfig } = usePreparePnkIncreaseAllowance ( {
66- enabled : ! isUndefined ( klerosCore ) && ! isUndefined ( targetStake ) && ! isUndefined ( allowance ) ,
67+ enabled : isAllowance && ! isUndefined ( klerosCore ) && ! isUndefined ( targetStake ) && ! isUndefined ( allowance ) ,
6768 args : [ klerosCore ?. address , BigInt ( targetStake ?? 0 ) - BigInt ( allowance ?? 0 ) ] ,
6869 } ) ;
6970 const { writeAsync : increaseAllowance } = usePnkIncreaseAllowance ( increaseAllowanceConfig ) ;
7071 const handleAllowance = ( ) => {
7172 if ( ! isUndefined ( increaseAllowance ) ) {
7273 setIsSending ( true ) ;
73- wrapWithToast ( increaseAllowance , publicClient ) . finally ( ( ) => {
74- setIsSending ( false ) ;
75- } ) ;
74+ wrapWithToast ( async ( ) => await increaseAllowance ( ) . then ( ( response ) => response . hash ) , publicClient ) . finally (
75+ ( ) => {
76+ setIsSending ( false ) ;
77+ }
78+ ) ;
7679 }
7780 } ;
7881
@@ -84,7 +87,7 @@ const StakeWithdrawButton: React.FC<IActionButton> = ({ parsedAmount, action, se
8487 const handleStake = ( ) => {
8588 if ( typeof setStake !== "undefined" ) {
8689 setIsSending ( true ) ;
87- wrapWithToast ( setStake , publicClient )
90+ wrapWithToast ( async ( ) => await setStake ( ) . then ( ( response ) => response . hash ) , publicClient )
8891 . then ( ( ) => {
8992 setAmount ( "" ) ;
9093 } )
0 commit comments