Skip to content

Commit 05131d8

Browse files
authored
Merge pull request #16 from whichnode/fix-uninitialized-account-balances
Fix balance display for uninitialized accounts
2 parents 7e51f33 + 6333e02 commit 05131d8

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

web-app/src/modules/core/routes/Account/Account.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ const Account: FC<Props> = ({ accountAddress }) => {
9999
// Correct balance display for un-migrated V7 slow wallets:
100100
// If it's a slow wallet and not initialized then display unlocked as zero and balance as correct,
101101
// add a note that account is not initialized
102+
// Also all uninitialized accounts should be displayed as if they were slow wallets.
102103
!account.initialized && ( <div>Note: this account has not been initialized</div> )
103104
}
104105

@@ -107,7 +108,7 @@ const Account: FC<Props> = ({ accountAddress }) => {
107108
<div className="col-span-12 md:col-span-3 mt-5 gap-5">
108109
<div className="overflow-hidden rounded-lg bg-white px-4 py-5 shadow sm:p-6">
109110
<dt className="truncate text-sm font-medium text-gray-500">
110-
{account.slowWallet ? <>Unlocked Balance</> : <>Balance</>}
111+
{account.slowWallet || !account.initialized ? <>Unlocked Balance</> : <>Balance</>}
111112
</dt>
112113
<dd className="mt-1 md:text-2xl font-semibold tracking-tight text-gray-900">
113114
{account.slowWallet ? (
@@ -117,27 +118,30 @@ const Account: FC<Props> = ({ accountAddress }) => {
117118
<LibraAmount>{new Decimal(0)}</LibraAmount>
118119
)
119120
) : (
120-
<LibraAmount>{new Decimal(data.account.balance)}</LibraAmount>
121+
account.initialized ? (
122+
<LibraAmount>{new Decimal(data.account.balance)}</LibraAmount>
123+
) : (
124+
<LibraAmount>{new Decimal(0)}</LibraAmount>
125+
)
121126
)}
122127
</dd>
123128
</div>
124129
</div>
125130
)}
126-
{data.account.balance && account.slowWallet && (
131+
{data.account.balance && (account.slowWallet || !account.initialized) && (
127132
<div className="col-span-12 md:col-span-3 mt-5 gap-5">
128133
<div className="overflow-hidden rounded-lg bg-white px-4 py-5 shadow sm:p-6">
129134
<dt className="truncate text-sm font-medium text-gray-500">Locked</dt>
130135
<dd className="mt-1 text-3xl font-semibold tracking-tight text-gray-900">
131-
{account.initialized ? (
136+
{account.initialized && account.slowWallet ? (
132137
<LibraAmount>
133138
{new Decimal(data.account.balance).minus(
134139
new Decimal(account.slowWallet.unlocked),
135140
)}
136-
</LibraAmount>
141+
</LibraAmount>
137142
) : (
138143
<LibraAmount>{new Decimal(data.account.balance)}</LibraAmount>
139144
)
140-
141145
}
142146
</dd>
143147
</div>

0 commit comments

Comments
 (0)