mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-26 06:42:15 +03:00
commit
a1bead7cde
@ -249,8 +249,6 @@ export const getAccount = (username) =>
|
||||
|
||||
export const getAccountHistory = (user, operations) =>
|
||||
new Promise((resolve, reject) => {
|
||||
//TOOD: list can be tweaked based on which coin is being visited
|
||||
const op = utils.operationOrders;
|
||||
let wallet_operations_bitmask = utils.makeBitMaskFilter(operations);
|
||||
try {
|
||||
const ah = client.call('condenser_api', 'get_account_history', [
|
||||
|
@ -2,7 +2,7 @@ import get from 'lodash/get';
|
||||
import parseDate from './parseDate';
|
||||
import parseToken from './parseToken';
|
||||
import { vestsToHp } from './conversions';
|
||||
import { getAccount, getAccountHistory, getConversionRequests, getOpenOrders, getSavingsWithdrawFrom } from '../providers/hive/dhive';
|
||||
import { getAccount, getAccountHistory, getConversionRequests, getFeedHistory, getOpenOrders, getSavingsWithdrawFrom } from '../providers/hive/dhive';
|
||||
import { getCurrencyTokenRate, getLatestQuotes } from '../providers/ecency/ecency';
|
||||
import { CoinActivitiesCollection, CoinActivity, CoinBase, CoinData, DataPair, QuoteItem } from '../redux/reducers/walletReducer';
|
||||
import { GlobalProps } from '../redux/reducers/accountReducer';
|
||||
@ -14,6 +14,7 @@ import { COIN_IDS } from '../constants/defaultCoins';
|
||||
import { operationOrders } from '@hiveio/dhive/lib/utils';
|
||||
import { ConversionRequest, OpenOrderItem, OrdersData, SavingsWithdrawRequest } from '../providers/hive/hive.types';
|
||||
import parseAsset from './parseAsset';
|
||||
import { utils } from '@hiveio/dhive';
|
||||
|
||||
|
||||
export const transferTypes = [
|
||||
@ -207,7 +208,6 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => {
|
||||
return walletData;
|
||||
}
|
||||
|
||||
//TODO: Use already available accoutn for frist wallet start
|
||||
const userdata = await getAccount(get(user, 'name'));
|
||||
|
||||
//const { accounts } = state;
|
||||
@ -215,7 +215,6 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => {
|
||||
// return walletData;
|
||||
//}
|
||||
|
||||
// TODO: move them to utils these so big for a lifecycle function
|
||||
walletData.rewardHiveBalance = parseToken(userdata.reward_hive_balance);
|
||||
walletData.rewardHbdBalance = parseToken(userdata.reward_hbd_balance);
|
||||
walletData.rewardVestingHive = parseToken(userdata.reward_vesting_hive);
|
||||
@ -234,9 +233,9 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => {
|
||||
walletData.savingBalanceHbd = parseToken(userdata.savings_hbd_balance);
|
||||
|
||||
//TOOD: use base and quote from account.globalProps redux
|
||||
// const feedHistory = await getFeedHistory();
|
||||
const base = 1.049; // parseToken(feedHistory.current_median_history.base);
|
||||
const quote = 1; // parseToken(feedHistory.current_median_history.quote);
|
||||
const feedHistory = await getFeedHistory();
|
||||
const base = parseToken(feedHistory.current_median_history.base);
|
||||
const quote = parseToken(feedHistory.current_median_history.quote);
|
||||
|
||||
walletData.hivePerMVests = globalProps.hivePerMVests;
|
||||
|
||||
@ -265,7 +264,25 @@ export const groomingWalletData = async (user, globalProps, userCurrency) => {
|
||||
walletData.nextVestingWithdrawal = Math.round(timeDiff / (1000 * 3600));
|
||||
|
||||
//TOOD: transfer history can be separated from here
|
||||
const history = await getAccountHistory(get(user, 'name'));
|
||||
const op = utils.operationOrders
|
||||
const ops = [
|
||||
op.transfer, //HIVE
|
||||
op.author_reward, //HBD, HP
|
||||
op.curation_reward, //HP
|
||||
op.transfer_to_vesting, //HIVE, HP
|
||||
op.withdraw_vesting, //HIVE, HP
|
||||
op.interest, //HP
|
||||
op.transfer_to_savings, //HIVE, HBD
|
||||
op.transfer_from_savings, //HIVE, HBD
|
||||
op.fill_convert_request, //HBD
|
||||
op.fill_order, //HIVE, HBD
|
||||
op.claim_reward_balance, //HP
|
||||
op.sps_fund, //HBD
|
||||
op.comment_benefactor_reward, //HP
|
||||
op.return_vesting_delegation, //HP
|
||||
]
|
||||
|
||||
const history = await getAccountHistory(get(user, 'name'), ops);
|
||||
|
||||
const transfers = history.filter((tx) => transferTypes.includes(get(tx[1], 'op[0]', false)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user