This repository was archived by the owner on Aug 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,10 +37,6 @@ export async function connect(force = false) {
3737 } ,
3838 ] ,
3939 } ) ;
40- } else {
41- await metaMaskProvider . request ( {
42- method : 'eth_requestAccounts' ,
43- } ) ;
4440 }
4541
4642 return metaMaskProvider ;
Original file line number Diff line number Diff line change @@ -241,9 +241,17 @@ class TwitterHook {
241241 this . main . xlog ( 'info' , 'Detect status...' ) ;
242242 const settings = await getSettings ( ) ;
243243 // this.main.xlog('info', 'Settings is', settings);
244- const unidata = await this . main . getUnidata ( ) ;
245- // this.main.xlog('info', 'Now address is: '+ this.main.address);
246244 let newStatus = '' ;
245+ try {
246+ await this . main . getUnidata ( ) ;
247+ } catch ( e : any ) {
248+ newStatus = e . message ;
249+ this . main . xlog ( 'warn' , newStatus ) ;
250+ settings . syncing = newStatus ;
251+ await bucket . set ( settings ) ;
252+ return ;
253+ }
254+ // this.main.xlog('info', 'Now address is: '+ this.main.address);
247255 if ( settings . syncing !== false && settings . address && this . main . address ) {
248256 if ( settings . address . toLowerCase ( ) !== this . main . address ?. toLowerCase ( ) ) {
249257 newStatus = 'Address changed.' ;
Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ class CrossSyncContentScript {
5656 method : 'eth_accounts' ,
5757 } )
5858 ) ?. [ 0 ] ;
59+ if ( ! this . address ) {
60+ throw new Error ( 'No address found, MetaMask might be locked.' ) ;
61+ }
5962 // this.xlog('info', 'Init unidata with address: ', this.address);
6063 this . unidata = new Unidata ( {
6164 ethereumProvider : provider ,
@@ -65,6 +68,7 @@ class CrossSyncContentScript {
6568 }
6669 } catch ( e : any ) {
6770 this . xlog ( 'error' , 'Failed to initialize Unidata' , e ) ;
71+ throw e ;
6872 }
6973 }
7074 } ) ;
You can’t perform that action at this time.
0 commit comments