Skip to content

Commit

Permalink
feat: foxy claim handle 0-amount delegations (#5489)
Browse files Browse the repository at this point in the history
* feat: foxy claim handle 0-amount delegations

* feat: claim pending disabled too

* Revert "feat: claim pending disabled too"

This reverts commit 69aeb54.

* feat: pending undelegation too

* fix: derp
  • Loading branch information
gomesalexandre authored Oct 18, 2023
1 parent 5539558 commit b7c41f5
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,23 @@ export const FoxyOverview: React.FC<FoxyOverviewProps> = ({

const hasPendingUndelegation = Boolean(
undelegations &&
undelegations.some(undelegation =>
dayjs().isAfter(dayjs(undelegation.completionTime).unix()),
undelegations.some(
undelegation =>
dayjs().isAfter(dayjs(undelegation.completionTime).unix()) &&
bnOrZero(undelegation.undelegationAmountCryptoBaseUnit).gt(0),
),
)

const hasAvailableUndelegation = Boolean(
undelegations &&
undelegations.some(undelegation =>
dayjs().isBefore(dayjs(undelegation.completionTime).unix()),
undelegations.some(
undelegation =>
dayjs().isBefore(dayjs(undelegation.completionTime).unix()) &&
bnOrZero(undelegation.undelegationAmountCryptoBaseUnit).gt(0),
),
)

const claimDisabled = !canClaim && !hasAvailableUndelegation
const claimDisabled = !canClaim || !(hasAvailableUndelegation || hasPendingUndelegation)

const selectedLocale = useAppSelector(selectSelectedLocale)
const descriptionQuery = useGetAssetDescriptionQuery({ assetId: stakingAssetId, selectedLocale })
Expand Down

0 comments on commit b7c41f5

Please sign in to comment.