@@ -224,7 +224,7 @@ const startWeb3 = (/* tcall */) => {
224224 tinyCrypto . isUnlocked = ( ) => window . ethereum && window . ethereum . _isUnlocked ;
225225
226226 // Emitter
227- class MyEmitter extends EventEmitter { }
227+ class MyEmitter extends EventEmitter { }
228228 const myEmitter = new MyEmitter ( ) ;
229229 myEmitter . setMaxListeners ( Infinity ) ;
230230
@@ -267,7 +267,7 @@ const startWeb3 = (/* tcall */) => {
267267 } )
268268 . catch ( reject ) ;
269269 } )
270- . catch ( reject ) ;
270+ . catch ( err => { console . error ( err ) ; resolve ( null ) ; } ) ;
271271 } else {
272272 reject ( tinyCrypto . errors . noProvider ( ) ) ;
273273 }
@@ -281,7 +281,7 @@ const startWeb3 = (/* tcall */) => {
281281 tinyCrypto
282282 . checkConnection ( )
283283 . then ( ( cryptoData ) => {
284- if ( tinyCrypto . validateMatrixAddress ( ) ) {
284+ if ( cryptoData && tinyCrypto . validateMatrixAddress ( ) ) {
285285 // Address
286286 const tinyAddress = address . toLowerCase ( ) ;
287287
@@ -440,16 +440,18 @@ const startWeb3 = (/* tcall */) => {
440440
441441 tinyCrypto
442442 . checkConnection ( true )
443- . then ( ( ) => {
444- web3
445- . getNetwork ( )
446- . then ( ( network ) => {
447- tinyCrypto . chainId = network . chainId ;
448- tinyCrypto . connected = true ;
449- // tcall();
450- myEmitter . emit ( 'readyProvider' ) ;
451- } )
452- . catch ( tinyConnectionError ) ;
443+ . then ( ( data ) => {
444+ if ( data ) {
445+ web3
446+ . getNetwork ( )
447+ . then ( ( network ) => {
448+ tinyCrypto . chainId = network . chainId ;
449+ tinyCrypto . connected = true ;
450+ // tcall();
451+ myEmitter . emit ( 'readyProvider' ) ;
452+ } )
453+ . catch ( tinyConnectionError ) ;
454+ }
453455 } )
454456 . catch ( tinyConnectionError ) ;
455457 }
0 commit comments