-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Historical pool rewards to Staking API, replace Subscan (#2376)
- Loading branch information
Showing
19 changed files
with
380 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2024 @polkadot-cloud/polkadot-staking-dashboard authors & contributors | ||
// SPDX-License-Identifier: GPL-3.0-only | ||
|
||
import { useApi } from 'contexts/Api' | ||
import type { NominatorReward } from 'plugin-staking-api/types' | ||
import { useErasToTimeLeft } from '../useErasToTimeLeft' | ||
|
||
export const useInjectBlockTimestamp = () => { | ||
const { activeEra } = useApi() | ||
const { erasToSeconds } = useErasToTimeLeft() | ||
|
||
// Inject timestamp for unclaimed payouts. We take the timestamp of the start of the | ||
// following payout era - this is the time payouts become available to claim by validators | ||
// NOTE: Not currently being used | ||
const injectBlockTimestamp = (entries: NominatorReward[]) => { | ||
entries.forEach((p) => { | ||
p.timestamp = activeEra.start | ||
.multipliedBy(0.001) | ||
.minus(erasToSeconds(activeEra.index.minus(p.era).minus(1))) | ||
.toNumber() | ||
}) | ||
return entries | ||
} | ||
return { | ||
injectBlockTimestamp, | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.