99 injected ,
1010 isChainIdSupported ,
1111 web3ContextNames ,
12+ walletconnect
1213} from 'provider/connectors' ;
1314import Identicon from '../Identicon' ;
1415import { useStores } from '../../contexts/storesContext' ;
@@ -84,24 +85,20 @@ const Web3ConnectStatus = observer((props) => {
8485 const {
8586 chainId,
8687 active,
88+ account,
8789 connector,
8890 error,
8991 } = providerStore . getActiveWeb3React ( ) ;
90- const { account, chainId : injectedChainId } = providerStore . getWeb3React (
91- web3ContextNames . injected
92- ) ;
93-
94- const contextNetwork = providerStore . getWeb3React ( web3ContextNames . backup ) ;
9592
9693 if ( ! chainId ) {
9794 throw new Error ( 'No chain ID specified' ) ;
9895 }
99-
96+
10097 let pending = undefined ;
10198 let confirmed = undefined ;
10299 let hasPendingTransactions = false ;
103100
104- if ( account && isChainIdSupported ( injectedChainId ) ) {
101+ if ( account && isChainIdSupported ( chainId ) ) {
105102 pending = transactionStore . getPendingTransactions ( account ) ;
106103 confirmed = transactionStore . getConfirmedTransactions ( account ) ;
107104 hasPendingTransactions = ! ! pending . length ;
@@ -115,17 +112,19 @@ const Web3ConnectStatus = observer((props) => {
115112 function getStatusIcon ( ) {
116113 if ( connector === injected ) {
117114 return < Identicon /> ;
115+ } else if ( connector === walletconnect ) {
116+ return < img src = "walletConnectIcon.svg" /> ;
118117 }
119118 }
120119
121120 function getWeb3Status ( ) {
122121 console . log ( '[GetWeb3Status]' , {
123122 account,
124- injectedChainId : injectedChainId ,
123+ chainId : chainId ,
125124 error,
126125 } ) ;
127126 // Wrong network
128- if ( account && ! isChainIdSupported ( injectedChainId ) ) {
127+ if ( account && ! isChainIdSupported ( chainId ) ) {
129128 return (
130129 < WrongNetworkButton onClick = { toggleWalletModal } >
131130 Wrong Network
@@ -157,10 +156,6 @@ const Web3ConnectStatus = observer((props) => {
157156 }
158157 }
159158
160- if ( ! contextNetwork . active && ! active ) {
161- return null ;
162- }
163-
164159 return (
165160 < >
166161 { getWeb3Status ( ) }
0 commit comments