Use end + delay for activation
This commit is contained in:
parent
4f40a5bc5e
commit
8c13dad2a2
@ -35,7 +35,7 @@ export default function Overview ({ className }: Props): React.ReactElement<Prop
|
||||
const { api } = useApi();
|
||||
const bestNumber = trackStream<BlockNumber>(api.derive.chain.bestNumber, []);
|
||||
const _electionsInfo = trackStream<DerivedElectionsInfo>(api.derive.elections.info, []);
|
||||
const allVotes = trackStream<Record<string, AccountId[]>>(api.query.electionsPhragmen.votesOf, [], {
|
||||
const allVotes = trackStream<Record<string, AccountId[]>>(api.query.electionsPhragmen?.votesOf, [], {
|
||||
transform: ([voters, casted]: [AccountId[], AccountId[][]]): Record<string, AccountId[]> =>
|
||||
voters.reduce((result: Record<string, AccountId[]>, voter, index): Record<string, AccountId[]> => {
|
||||
casted[index].forEach((candidate): void => {
|
||||
|
||||
@ -21,7 +21,6 @@ interface Props extends I18nProps {
|
||||
idNumber: BN;
|
||||
chain_bestNumber?: BN;
|
||||
democracy_referendumVotesFor?: DerivedReferendumVote[];
|
||||
democracy_enactmentPeriod: BN;
|
||||
value: DerivedReferendum;
|
||||
}
|
||||
|
||||
@ -34,7 +33,7 @@ interface State {
|
||||
votedTotal: BN;
|
||||
}
|
||||
|
||||
function Referendum ({ chain_bestNumber, className, democracy_enactmentPeriod, democracy_referendumVotesFor, t, value }: Props): React.ReactElement<Props> | null {
|
||||
function Referendum ({ chain_bestNumber, className, democracy_referendumVotesFor, t, value }: Props): React.ReactElement<Props> | null {
|
||||
const [{ voteCountAye, voteCountNay, votedAye, votedNay }, setState] = useState<State>({
|
||||
voteCount: 0,
|
||||
voteCountAye: 0,
|
||||
@ -80,7 +79,7 @@ function Referendum ({ chain_bestNumber, className, democracy_enactmentPeriod, d
|
||||
return null;
|
||||
}
|
||||
|
||||
const enactBlock = (democracy_enactmentPeriod || new BN(0)).add(value.info.end);
|
||||
const enactBlock = value.info.end.add(value.info.delay);
|
||||
|
||||
return (
|
||||
<tr className={className}>
|
||||
@ -122,7 +121,6 @@ export default withMulti(
|
||||
translate,
|
||||
withCalls<Props>(
|
||||
'derive.chain.bestNumber',
|
||||
['derive.democracy.referendumVotesFor', { paramName: 'idNumber' }],
|
||||
['consts.democracy.enactmentPeriod', { fallbacks: ['query.democracy.publicDelay'] }]
|
||||
['derive.democracy.referendumVotesFor', { paramName: 'idNumber' }]
|
||||
)
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user