Skip to content
This repository was archived by the owner on May 19, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import '@rsksmart/rif-ui/dist/index.css';
import Routes from './Routes';

const requiredNetworkId = 8545
const requiredNetworkId = 31

const App = () => {

Expand Down
18 changes: 14 additions & 4 deletions src/components/molecules/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ const Account: FC<AccountProps> = ({
const handleClose = (): void => setOpen(false)
const handleOpen = (): void => setOpen(true)

const accountText = (): string => {
if (!web3) return 'Connect wallet'

if (currentNetworkId !== requiredNetworkId) {
return 'Wrong Network'
}

if (account) {
return shortenString(account)
}
return 'Unlock your wallet'
}

return (
<React.Fragment>
<Button onClick={handleOpen} className={classes.button} variant="contained" color="primary" rounded>
Expand All @@ -71,10 +84,7 @@ const Account: FC<AccountProps> = ({
)
}
<Typography className={classes.accountText}>
{!web3 && 'Connect wallet'}
{web3 && networkName}
{web3 && !account && 'Wrong Network'}
{web3 && account && shortenString(account)}
{accountText()}
</Typography>
</Button>

Expand Down