import { initializeProvider } from '@metamask/inpage-provider' ; import { WindowPostMessageStream } from '@metamask/post-message-stream' ; import { injectMobile } from './inpage-metamask-mobile' ; ( ( ) => { if ( window . ethereum || window . web3 ) { return ; } if ( navigator . userAgent . includes ( 'Firefox' ) ) { const metamaskStream = new WindowPostMessageStream ( { name : 'metamask-inpage' , target : 'metamask-contentscript' } ) ; initializeProvider ( { connectionStream : metamaskStream , shouldShimWeb3 : true } ) ; } else if ( navigator . userAgent . includes ( 'iPhone' ) ) { injectMobile ( ) ; } } ) ( ) ;