Skip to content
Merged
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
25 changes: 6 additions & 19 deletions src/app/dashboard/widgets/NativeAuth/NativeAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,16 @@ import { OutputContainer } from '@/components/OutputContainer';

import {
useGetLoginInfo,
useGetNetworkConfig,
MvxFormatAmount,
FormatAmountController,
DIGITS,
DECIMALS
useGetAccount,
FormatAmount
} from '@/lib';
import { useGetProfile } from './hooks';
import { Username } from '../Account/components';

export const NativeAuth = () => {
const { tokenLogin, isLoggedIn } = useGetLoginInfo();
const { balance } = useGetAccount();
const { isLoading, profile, getProfile } = useGetProfile();
const { network } = useGetNetworkConfig();

const { isValid, valueDecimal, valueInteger, label } =
FormatAmountController.getData({
digits: DIGITS,
decimals: DECIMALS,
egldLabel: network.egldLabel,
input: profile?.balance ?? '0'
});

useEffect(() => {
// On page refresh, tokenInfo is null which implies that we do not have access to loginInfo data
Expand Down Expand Up @@ -62,12 +51,10 @@ export const NativeAuth = () => {

<div className='flex gap-1'>
<Label>Balance:</Label>
<MvxFormatAmount
isValid={isValid}
valueDecimal={valueDecimal}
valueInteger={valueInteger}
label={label}
<FormatAmount
value={balance}
data-testid='balance'
showLabel
/>
</div>
</OutputContainer>
Expand Down