Skip to content

Commit

Permalink
Display rewards in user history for dapp staking (#912)
Browse files Browse the repository at this point in the history
* Display rewards in user history for dapp staking

* Url  fix
  • Loading branch information
bobo-k2 authored Sep 1, 2023
1 parent aead9e1 commit c1f74f7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/modules/information/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export type RecentHistoryTxType =
| 'Transfer'
| 'BondAndStake'
| 'NominationTransfer'
| 'UnbondAndUnstake';
| 'UnbondAndUnstake'
| 'Reward';

export interface RecentHistory {
timestamp: string;
Expand Down
13 changes: 9 additions & 4 deletions src/modules/information/recent-history/stake/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export const castStakeTxType = (txType: RecentHistoryTxType): string => {
return 'Nomination Transfer';
case 'UnbondAndUnstake':
return 'Unstake';
case 'Reward':
return 'Reward';
default:
return txType;
}
Expand All @@ -47,14 +49,17 @@ export const getStakeTxHistories = async ({
(it) =>
it.transaction === 'BondAndStake' ||
it.transaction === 'NominationTransfer' ||
it.transaction === 'UnbondAndUnstake'
it.transaction === 'UnbondAndUnstake' ||
it.transaction === 'Reward'
)
.sort((a, b) => Number(b.timestamp) - Number(a.timestamp))
.slice(0, numberOfHistories)
.map((it) => {
const dapp = dapps.find(
(that) => that.contract.address.toLowerCase() === it.contractAddress.toLowerCase()
);
const dapp =
it.contractAddress &&
dapps.find(
(that) => that.contract.address.toLowerCase() === it.contractAddress.toLowerCase()
);
const note = dapp && dapp.dapp ? dapp.dapp.name : '';
const explorerUrl = subScan + '/extrinsic/' + it.transactionHash;
return {
Expand Down

0 comments on commit c1f74f7

Please sign in to comment.