This repository was archived by the owner on May 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {
1515import '@rsksmart/rif-ui/dist/index.css' ;
1616import Routes from './Routes' ;
1717
18- const requiredNetworkId = 8545
18+ const requiredNetworkId = 31
1919
2020const App = ( ) => {
2121
Original file line number Diff line number Diff line change @@ -55,6 +55,19 @@ const Account: FC<AccountProps> = ({
5555 const handleClose = ( ) : void => setOpen ( false )
5656 const handleOpen = ( ) : void => setOpen ( true )
5757
58+ const accountText = ( ) : string => {
59+ if ( ! web3 ) return 'Connect wallet'
60+
61+ if ( currentNetworkId !== requiredNetworkId ) {
62+ return 'Wrong Network'
63+ }
64+
65+ if ( account ) {
66+ return shortenString ( account )
67+ }
68+ return 'Unlock your wallet'
69+ }
70+
5871 return (
5972 < React . Fragment >
6073 < Button onClick = { handleOpen } className = { classes . button } variant = "contained" color = "primary" rounded >
@@ -71,10 +84,7 @@ const Account: FC<AccountProps> = ({
7184 )
7285 }
7386 < Typography className = { classes . accountText } >
74- { ! web3 && 'Connect wallet' }
75- { web3 && networkName }
76- { web3 && ! account && 'Wrong Network' }
77- { web3 && account && shortenString ( account ) }
87+ { accountText ( ) }
7888 </ Typography >
7989 </ Button >
8090
You can’t perform that action at this time.
0 commit comments