File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1093,7 +1093,12 @@ export class ContractService {
10931093 throw new Error ( 'Raw provider or request method not available' ) ;
10941094 }
10951095
1096- const txHash = await rawProvider . request ( {
1096+ // Add timeout to handle user interaction in MetaMask
1097+ const timeoutPromise = new Promise < never > ( ( _ , reject ) => {
1098+ setTimeout ( ( ) => reject ( new Error ( 'Transaction request timeout after 60 seconds - user may have cancelled or MetaMask is not responding' ) ) , 60000 ) ;
1099+ } ) ;
1100+
1101+ const transactionPromise = rawProvider . request ( {
10971102 method : 'eth_sendTransaction' ,
10981103 params : [ {
10991104 from : await this . signer . getAddress ( ) ,
@@ -1103,6 +1108,9 @@ export class ContractService {
11031108 } ] ,
11041109 } ) ;
11051110
1111+ console . log ( '⏰ claimRewardsForPeer: Waiting for user to approve transaction in MetaMask...' ) ;
1112+ const txHash = await Promise . race ( [ transactionPromise , timeoutPromise ] ) ;
1113+
11061114 console . log ( '✅ claimRewardsForPeer: Transaction sent successfully!' , { txHash } ) ;
11071115
11081116 // Wait for transaction confirmation
You can’t perform that action at this time.
0 commit comments