Merge pull request #1377 from esteemapp/bugfix/wallet

fix vote value and add other_history transactions
This commit is contained in:
Feruz M 2019-12-10 13:32:03 +02:00 committed by GitHub
commit 13849031d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import get from 'lodash/get';
import parseToken from './parseToken';
import { vestsToRshares } from './conversions';
export const getEstimatedAmount = (account, globalProps, value = 100) => {
export const getEstimatedAmount = (account, globalProps, value = 1) => {
const { fundRecentClaims, fundRewardBalance, base, quote } = globalProps;
const votingPower = account.voting_power;
const totalVests =

View File

@ -221,14 +221,32 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => {
const timeDiff = Math.abs(parseDate(user.next_vesting_withdrawal) - new Date());
walletData.nextVestingWithdrawal = Math.round(timeDiff / (1000 * 3600));
const { transfer_history: transferHistory } = get(accounts, user.name, []);
walletData.transactions = transferHistory
? transferHistory.slice(Math.max(transferHistory.length - 20, 0)).reverse()
const { transfer_history: transferHistory, other_history: virtualHistory } = get(
accounts,
user.name,
[],
);
const realHistory = transferHistory
? transferHistory.slice(Math.max(transferHistory.length - 50, 0))
: [];
realHistory.push(...virtualHistory); //concat
realHistory.sort(compare); //sort desc
walletData.transactions = realHistory;
return walletData;
};
function compare(a, b) {
if (a[1].block < b[1].block) {
return 1;
}
if (a[1].block > b[1].block) {
return -1;
}
return 0;
}
export const groomingPointsTransactionData = transaction => {
if (!transaction) {
return null;