mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 05:13:04 +03:00
Merge pull request #1377 from esteemapp/bugfix/wallet
fix vote value and add other_history transactions
This commit is contained in:
commit
13849031d9
@ -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 =
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user