Skip to content

Commit

Permalink
fix inactive staking principal + reward bug (#20428)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
Jibz-Mysten authored Dec 4, 2024
1 parent b0f8b12 commit 8b3076d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/wallet/src/ui/app/staking/home/StakedCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { IconTooltip } from '_src/ui/app/shared/tooltip';
import { useFormatCoin, useGetTimeBeforeEpochNumber } from '@mysten/core';
import { type StakeObject } from '@mysten/sui/client';
import { SUI_TYPE_ARG } from '@mysten/sui/utils';
import BigNumber from 'bignumber.js';
import { cva, cx, type VariantProps } from 'class-variance-authority';
import type { ReactNode } from 'react';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -127,7 +128,7 @@ export function StakeCard({

// For inactive validator, show principal + rewards
const [principalStaked, symbol] = useFormatCoin(
inactiveValidator ? principal + rewards : principal,
inactiveValidator ? new BigNumber(principal).plus(rewards.toString()).toString() : principal,
SUI_TYPE_ARG,
);
const [rewardsStaked] = useFormatCoin(rewards, SUI_TYPE_ARG);
Expand Down

0 comments on commit 8b3076d

Please sign in to comment.