|
@@ -64,7 +64,8 @@ export const getWorkerRewards = async (
|
|
|
const member: Membership = await getMember(api, memberId, hash);
|
|
|
const handle = member ? String(member.handle) : account.toString();
|
|
|
const status = worker.is_active ? `active` : `inactive`;
|
|
|
- let stake: Stake, reward: RewardRelationship;
|
|
|
+ let stake: Stake | undefined = undefined
|
|
|
+ let reward: RewardRelationship | undefined = undefined
|
|
|
|
|
|
if (worker.role_stake_profile.isSome) {
|
|
|
const roleStakeProfile = worker.role_stake_profile.unwrap();
|
|
@@ -77,7 +78,9 @@ export const getWorkerRewards = async (
|
|
|
worker.reward_relationship.unwrap();
|
|
|
reward = await getWorkerReward(api, hash, rewardId);
|
|
|
}
|
|
|
- workers.push({ id, stake, reward, status, handle, account, memberId });
|
|
|
+ if (stake && reward) {
|
|
|
+ workers.push({ id, stake, reward, status, handle, account, memberId });
|
|
|
+ }
|
|
|
}
|
|
|
return workers;
|
|
|
};
|
|
@@ -167,7 +170,7 @@ export const getActiveValidators = async (
|
|
|
): Promise<AccountId[]> => {
|
|
|
const block = await getBlock(api, hash);
|
|
|
let currentBlockNr = block.block.header.number.toNumber();
|
|
|
- let activeValidators: AccountId[];
|
|
|
+ let activeValidators: AccountId[] | undefined = undefined;
|
|
|
do {
|
|
|
const hash: Hash = await getBlockHash(api, currentBlockNr);
|
|
|
const validators: AccountId[] = await getValidators(api, hash);
|