Fixed wallet issue after hf24

This commit is contained in:
Mustafa Buyukcelebi 2020-10-18 19:42:09 +03:00
parent 32dc25ae38
commit 5605c618e3
2 changed files with 31 additions and 34 deletions

View File

@ -12,7 +12,7 @@ import { getAccount, claimRewardBalance, getBtcAddress } from '../providers/stee
import { openPinCodeModal } from '../redux/actions/applicationActions';
// Utils
import { groomingWalletData, groomingTransactionData } from '../utils/wallet';
import { groomingWalletData, groomingTransactionData, transferTypes } from '../utils/wallet';
import parseToken from '../utils/parseToken';
import { vestsToSp } from '../utils/conversions';
import { navigate } from '../navigation/service';
@ -73,24 +73,8 @@ const WalletContainer = ({
}, [_getWalletData, selectedUser]);
useEffect(() => {
const _transferHistory = userActivities.filter(
(item) =>
get(item, 'textKey') === 'transfer' ||
get(item, 'textKey') === 'transfer_to_vesting' ||
get(item, 'textKey') === 'transfer_to_savings' ||
get(item, 'textKey') === 'withdraw_vesting' ||
get(item, 'textKey') === 'transfer_from_savings' ||
get(item, 'textKey') === 'convert' ||
get(item, 'textKey') === 'escrow_transfer' ||
get(item, 'textKey') === 'escrow_dispute' ||
get(item, 'textKey') === 'escrow_release' ||
get(item, 'textKey') === 'escrow_approve' ||
get(item, 'textKey') === 'cancel_transfer_from_savings' ||
get(item, 'textKey') === 'delegate_vesting_shares' ||
get(item, 'textKey') === 'fill_convert_request' ||
get(item, 'textKey') === 'fill_transfer_from_savings' ||
get(item, 'textKey') === 'fill_vesting_withdraw' ||
get(item, 'textKey') === 'fill_order',
const _transferHistory = userActivities.filter((item) =>
transferTypes.includes(get(item, 'textKey')),
);
setTransferHistory(_transferHistory);

View File

@ -2,9 +2,31 @@ import get from 'lodash/get';
import parseDate from './parseDate';
import parseToken from './parseToken';
import { vestsToSp } from './conversions';
import { getState, getFeedHistory, getAccount, getAccountHistory } from '../providers/steem/dsteem';
import { getFeedHistory, getAccount, getAccountHistory } from '../providers/steem/dsteem';
import { getCurrencyTokenRate } from '../providers/esteem/esteem';
export const transferTypes = [
'curation_reward',
'author_reward',
'comment_benefactor_reward',
'claim_reward_balance',
'transfer',
'transfer_to_savings',
'transfer_from_savings',
'transfer_to_vesting',
'withdraw_vesting',
'fill_order',
'escrow_transfer',
'escrow_dispute',
'escrow_release',
'escrow_approve',
'delegate_vesting_shares',
'cancel_transfer_from_savings',
'fill_convert_request',
'fill_transfer_from_savings',
'fill_vesting_withdraw',
];
export const groomingTransactionData = (transaction, steemPerMVests) => {
if (!transaction || !steemPerMVests) {
return [];
@ -224,22 +246,13 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => {
const timeDiff = Math.abs(parseDate(userdata.next_vesting_withdrawal) - new Date());
walletData.nextVestingWithdrawal = Math.round(timeDiff / (1000 * 3600));
/*const history = await getAccountHistory(get(user, 'name'));
const history = await getAccountHistory(get(user, 'name'));
const transfers = history.filter((tx) => {
return tx[1] && tx[1].op && tx[1].op[0] === 'claim_reward_balance'
});
const transfers = history.filter((tx) => transferTypes.includes(get(tx[1], 'op[0]', false)));
const actualTransfers = transfers.reduce((arr, tx) => {
console.log('tx', tx[1])
const transaction = tx[1].op[1];
const date = new Date(`${tx[1].timestamp}Z`);
transaction.date = date;
arr.push(transaction);
return arr;
}, []);
*/
walletData.transactions = [];
transfers.sort(compare);
walletData.transactions = transfers;
return walletData;
};