mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 04:41:43 +03:00
integrating powering down amounts
This commit is contained in:
parent
9753f06f65
commit
7f0dd8b017
@ -51,6 +51,7 @@
|
||||
"estimated_value": "Estimated value",
|
||||
"vote_value": "Vote value",
|
||||
"delegated_hive_power":"Delegated hive power",
|
||||
"powering_down_hive_power":"Powering down",
|
||||
"received_hive_power":"Received hive power",
|
||||
"total_hive_power":"Total hive power",
|
||||
"savings": "Savings",
|
||||
|
@ -572,6 +572,18 @@ export const fetchCoinsData = async ({
|
||||
`${_getBalanceStr(parseToken(userdata.reward_vesting_hive), ' HP', ' | ')}`
|
||||
).trim();
|
||||
|
||||
//calculate power down
|
||||
const isPoweringDown = userdata.next_vesting_withdrawal
|
||||
? parseDate(userdata.next_vesting_withdrawal) > new Date()
|
||||
: false;
|
||||
|
||||
const nextVestingSharesWithdrawal = isPoweringDown
|
||||
? Math.min(
|
||||
parseAsset(userdata.vesting_withdraw_rate).amount,
|
||||
(Number(userdata.to_withdraw) - Number(userdata.withdrawn)) / 1e6
|
||||
) : 0;
|
||||
const nextVestingSharesWithdrawalHive = isPoweringDown ? vestsToHp(nextVestingSharesWithdrawal, hivePerMVests) : 0;
|
||||
|
||||
//TODO: assess how we can make this value change live.
|
||||
const estimateVoteValueStr = '$ ' + getEstimatedAmount(userdata, globalProps);
|
||||
|
||||
@ -589,10 +601,13 @@ export const fetchCoinsData = async ({
|
||||
value: `- ${delegatedHP.toFixed(3)} HP`
|
||||
}, {
|
||||
labelId: 'received_hive_power',
|
||||
value: `${receivedHP.toFixed(3)} HP`
|
||||
value: `+ ${receivedHP.toFixed(3)} HP`
|
||||
}, {
|
||||
labelId: 'powering_down_hive_power',
|
||||
value: `- ${nextVestingSharesWithdrawalHive.toFixed(3)} HP`
|
||||
}, {
|
||||
labelId: 'total_hive_power',
|
||||
value: `${(balance - delegatedHP + receivedHP).toFixed(3)} HP`
|
||||
value: `${(balance - delegatedHP + receivedHP - nextVestingSharesWithdrawalHive).toFixed(3)} HP`
|
||||
}, {
|
||||
labelId: 'vote_value',
|
||||
value: estimateVoteValueStr
|
||||
|
Loading…
Reference in New Issue
Block a user