File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -42,10 +42,12 @@ const SubmitEvidenceModal: React.FC<{
4242 functionName : "submitEvidence" ,
4343 args : [ BigInt ( evidenceGroup ) , cid ] ,
4444 } ) ;
45- await wrapWithToast ( ( ) => walletClient . writeContract ( request ) , publicClient ) . then ( ( ) => {
46- setMessage ( "" ) ;
47- close ( ) ;
48- } ) ;
45+ await wrapWithToast ( async ( ) => await walletClient . writeContract ( request ) , publicClient ) . then (
46+ ( ) => {
47+ setMessage ( "" ) ;
48+ close ( ) ;
49+ }
50+ ) ;
4951 }
5052 } )
5153 . catch ( )
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ const Binary: React.FC<{ arbitrable: `0x${string}`; voteIDs: string[] }> = ({ ar
7070 ] ,
7171 } ) ;
7272 if ( walletClient ) {
73- wrapWithToast ( ( ) => walletClient . writeContract ( request ) , publicClient ) . finally ( ( ) => {
73+ wrapWithToast ( async ( ) => await walletClient . writeContract ( request ) , publicClient ) . finally ( ( ) => {
7474 setChosenOption ( - 1 ) ;
7575 setIsSending ( false ) ;
7676 } ) ;
Original file line number Diff line number Diff line change 11import { toast , ToastPosition , Theme } from "react-toastify" ;
2- import { WriteContractResult } from "wagmi/dist/actions" ;
32
43export const OPTIONS = {
54 position : "top-center" as ToastPosition ,
@@ -12,15 +11,19 @@ export const OPTIONS = {
1211 theme : "colored" as Theme ,
1312} ;
1413
15- export async function wrapWithToast ( contractWrite : ( ) => Promise < WriteContractResult > , publicClient : any ) {
14+ export async function wrapWithToast ( contractWrite : ( ) => Promise < `0x${ string } ` > , publicClient : any ) {
1615 toast . info ( "Transaction initiated" , OPTIONS ) ;
16+ console . log ( "1 before contractwrite" ) ;
1717 const { hash } = await contractWrite ( ) ;
18+ console . log ( "2 after contractwrite, hash:" , hash ) ;
1819 await publicClient
1920 . waitForTransactionReceipt ( { hash, confirmations : 2 } )
2021 . then ( ( ) => {
22+ console . log ( "3 inside waitfortransactionreceipt" ) ;
2123 toast . success ( "Transaction mined!" , OPTIONS ) ;
2224 } )
2325 . catch ( ( error ) => {
26+ console . log ( "4 inside waitfortransaction catch" , error ) ;
2427 toast . error ( error . message , OPTIONS ) ;
2528 } ) ;
2629}
You can’t perform that action at this time.
0 commit comments