Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort by recoverable balance and show vesting total, claimable (#2807) #3953

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ export const AccountItem = ({ account }: AccountItemDataProps) => {
<TokenValue value={balance?.locked} isLoading={!isDefined(balance?.locked)} />
<AccountLocks locks={balance?.locks} />
</ValueAndLocks>
<TokenValue
value={balance?.recoverable?.add(balance?.vestedClaimable ?? BN_ZERO)}
isLoading={!isDefined(balance?.recoverable)}
/>
<TokenValue value={balance?.recoverable} isLoading={!isDefined(balance?.recoverable)} />
<TokenValue value={balance?.transferable} isLoading={!isDefined(balance?.transferable)} />
<AccountControls>
<TransferButton to={account} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
DetailsName,
LockWrapper,
TitleCell,
ValueCell,
VestingStyledDropDown,
} from '@/accounts/components/AccountItem/components/styles'
import { lockIcon } from '@/accounts/components/AccountLocks'
Expand Down Expand Up @@ -38,9 +37,11 @@ export const VestingLockListItem = ({
<DetailsName>Vesting</DetailsName>
</TitleCell>
{!isDropped && (
<ValueCell>
<>
<TokenValue value={locked.add(vested)} />
<TokenValue value={locked} />
</ValueCell>
<TokenValue value={vested} />
</>
Comment on lines +40 to +44
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current solution doesn't work:
Screenshot from 2022-12-21 17-23-31

This component is given the DeriveBalancesVesting which doesn't include vestedClaimable but:
Recoverable is vestedClaimable and what's actually locked is locked - vested + vestedClaimable (although there might be different way to get to these result) and finally the total should always be locked.

So one way to fix this is to pass vestedClaimable to the VestingLockListItem.

)}
<ButtonsCell>
<DropDownButton onClick={() => setDropped(!isDropped)} isDropped={isDropped} />
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/accounts/model/toBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const toBalances = (balances: DeriveBalancesAll): Balances => {
return {
locked,
locks,
recoverable,
recoverable: recoverable.add(vestedClaimable),
total,
transferable,
vesting,
Expand Down