Skip to content

Commit

Permalink
fix: adjust wallet address shortening
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Sep 27, 2022
1 parent 50e2915 commit d12d4a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/widget/src/components/Header/WalletHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import { Box, IconButton, Typography } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { useLocation, useNavigate } from 'react-router-dom';
import { useWallet, useWidgetConfig } from '../../providers';
import { navigationRoutes } from '../../utils';
import { navigationRoutes, shortenWalletAddress } from '../../utils';
import { HeaderAppBar } from './Header.style';

export const WalletHeader: React.FC = () => {
const { t } = useTranslation();
const { account, disconnect } = useWallet();
const walletAddress = account.address
? `${account.address.substring(0, 7)}...${account.address.substring(
account.address.length - 7,
)}`
: null;
const walletAddress = shortenWalletAddress(account.address);

return (
<HeaderAppBar elevation={0}>
Expand Down
4 changes: 4 additions & 0 deletions packages/widget/src/utils/wallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const shortenWalletAddress = (address?: string) =>
address
? `${address.substring(0, 5)}...${address.substring(address.length - 4)}`
: null;

0 comments on commit d12d4a7

Please sign in to comment.