making use of updated getAccountHistory args

This commit is contained in:
Nouman Tahir 2022-04-09 02:07:00 +05:00
parent 30540ba91b
commit 3f72d67dbb

View File

@ -366,15 +366,30 @@ const fetchPendingRequests = async (username: string, coinSymbol: string): Promi
* @param globalProps * @param globalProps
* @returns {Promise<CoinActivitiesCollection>} * @returns {Promise<CoinActivitiesCollection>}
*/ */
export const fetchCoinActivities = async (username: string, coinId: string, coinSymbol: string, globalProps: GlobalProps): Promise<CoinActivitiesCollection> => { export const fetchCoinActivities = async (
username: string,
coinId: string,
coinSymbol: string,
globalProps: GlobalProps,
startIndex: number,
limit:number
): Promise<CoinActivitiesCollection> => {
const op = operationOrders; const op = operationOrders;
let history = []; let history = [];
switch (coinId) { switch (coinId) {
case COIN_IDS.ECENCY: { case COIN_IDS.ECENCY: {
//TODO: remove condition when we have a way to fetch paginated points data
if(startIndex !== -1){
return {
completed:[],
pending:[]
}
}
const pointActivities = await getUserPoints(username); const pointActivities = await getUserPoints(username);
console.log("Points Activities", pointActivities); console.log("Points Activities", pointActivities);
const completed = pointActivities && pointActivities.length ? const completed = pointActivities && pointActivities.length ?
@ -399,7 +414,7 @@ export const fetchCoinActivities = async (username: string, coinId: string, coin
op.transfer_to_savings, //HIVE, HBD op.transfer_to_savings, //HIVE, HBD
op.transfer_from_savings, //HIVE, HBD op.transfer_from_savings, //HIVE, HBD
op.fill_order, //HIVE, HBD op.fill_order, //HIVE, HBD
]); ], startIndex, limit);
break; break;
case COIN_IDS.HBD: case COIN_IDS.HBD:
history = await getAccountHistory(username, [ history = await getAccountHistory(username, [
@ -410,7 +425,7 @@ export const fetchCoinActivities = async (username: string, coinId: string, coin
op.fill_convert_request, //HBD op.fill_convert_request, //HBD
op.fill_order, //HIVE, HBD op.fill_order, //HIVE, HBD
op.sps_fund, //HBD op.sps_fund, //HBD
]); ], startIndex, limit);
break; break;
case COIN_IDS.HP: case COIN_IDS.HP:
history = await getAccountHistory(username, [ history = await getAccountHistory(username, [
@ -422,7 +437,7 @@ export const fetchCoinActivities = async (username: string, coinId: string, coin
op.claim_reward_balance, //HP op.claim_reward_balance, //HP
op.comment_benefactor_reward, //HP op.comment_benefactor_reward, //HP
op.return_vesting_delegation, //HP op.return_vesting_delegation, //HP
]); ], startIndex, limit);
break; break;
} }