diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 503354c7b..47df3a64a 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -19,6 +19,7 @@ "outgoing_transfer_title": "Outgoing transfer", "checkin_extra": "Bonus", "delegation": "Delegation", + "delegations": "Delegations", "delegation_title": "Delegation reward", "delegation_desc": "Earn ESTM everyday for delegation", "post_title": "Points for post", diff --git a/src/containers/steemWalletContainer.js b/src/containers/steemWalletContainer.js index 5ae905e3e..f91158fe3 100644 --- a/src/containers/steemWalletContainer.js +++ b/src/containers/steemWalletContainer.js @@ -55,6 +55,7 @@ const WalletContainer = ({ const [estimatedSpValue, setEstimatedSpValue] = useState(0); const [unclaimedBalance, setUnclaimedBalance] = useState(''); const [estimatedAmount, setEstimatedAmount] = useState(0); + const [delegationsAmount, setDelegationsAmount] = useState(0); const [transferHistory, setTransferHistory] = useState([]); const intl = useIntl(); const dispatch = useDispatch(); @@ -143,6 +144,13 @@ const WalletContainer = ({ setEstimatedSbdValue && setEstimatedSbdValue(_walletData.estimatedSbdValue); setEstimatedSteemValue && setEstimatedSteemValue(_walletData.estimatedSteemValue); setEstimatedSpValue && setEstimatedSpValue(_walletData.estimatedSpValue); + setDelegationsAmount && + setDelegationsAmount( + vestsToSp( + _walletData.vestingSharesReceived - _walletData.vestingSharesDelegated, + steemPerMVests, + ).toFixed(3), + ); }, [globalProps, intl.formatNumber, setEstimatedWalletValue, steemPerMVests], ); @@ -282,6 +290,7 @@ const WalletContainer = ({ estimatedSteemValue, estimatedSbdValue, estimatedSpValue, + delegationsAmount, navigate: _navigate, steemDropdown: STEEM_DROPDOWN, sbdDropdown: SBD_DROPDOWN, diff --git a/src/screens/wallet/screen/spView.js b/src/screens/wallet/screen/spView.js index fb664ad6a..6d5398e74 100644 --- a/src/screens/wallet/screen/spView.js +++ b/src/screens/wallet/screen/spView.js @@ -1,5 +1,5 @@ import React from 'react'; -import { View } from 'react-native'; +import { View, Text } from 'react-native'; import { WalletHeader, FormattedCurrency } from '../../../components'; import { SteemWalletContainer, AccountContainer } from '../../../containers'; @@ -20,6 +20,7 @@ const SpView = ({ handleOnSelected, index, currentIndex, refreshing: reload }) = spBalance, isLoading, estimatedSpValue, + delegationsAmount, steemPowerDropdown, unclaimedBalance, navigate, @@ -45,6 +46,15 @@ const SpView = ({ handleOnSelected, index, currentIndex, refreshing: reload }) = currentIndex={currentIndex} showIconList={false} valueDescriptions={[ + { + textKey: 'delegations', + value: ( + + {delegationsAmount} + {' SP'} + + ), + }, { textKey: 'estimated_value', value: , diff --git a/src/utils/wallet.js b/src/utils/wallet.js index 19ec30712..087a1d141 100644 --- a/src/utils/wallet.js +++ b/src/utils/wallet.js @@ -187,7 +187,7 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => { walletData.vestingSharesReceived = parseToken(user.received_vesting_shares); walletData.vestingSharesTotal = walletData.vestingShares - walletData.vestingSharesDelegated + walletData.vestingSharesReceived; - + walletData.vestingSharesOwned = walletData.vestingShares - walletData.vestingSharesDelegated; walletData.sbdBalance = parseToken(user.sbd_balance); walletData.savingBalance = parseToken(user.savings_balance); walletData.savingBalanceSbd = parseToken(user.savings_sbd_balance); @@ -215,7 +215,7 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => { walletData.estimatedSteemValue = (walletData.balance + walletData.savingBalance) * ppSteem; walletData.estimatedSbdValue = totalSbd * ppSbd; walletData.estimatedSpValue = - vestsToSp(walletData.vestingSharesTotal, walletData.steemPerMVests) * ppSteem; + vestsToSp(walletData.vestingSharesOwned, walletData.steemPerMVests) * ppSteem; walletData.showPowerDown = user.next_vesting_withdrawal !== '1969-12-31T23:59:59'; const timeDiff = Math.abs(parseDate(user.next_vesting_withdrawal) - new Date());