Browse Source

minor fixes: api rewards

Joystream Stats 2 years ago
parent
commit
37b69a93ce
2 changed files with 5 additions and 3 deletions
  1. 4 2
      api.ts
  2. 1 1
      rewards.ts

+ 4 - 2
api.ts

@@ -141,9 +141,11 @@ export const getCouncils = async (
 
 export const getCouncilRound = async (
   api: ApiPromise,
-  hash: Hash
+  hash?: Hash
 ): Promise<number> =>
-  ((await api.query.councilElection.round.at(hash)) as u32).toNumber();
+  hash
+    ? ((await api.query.councilElection.round.at(hash)) as u32).toNumber()
+    : ((await api.query.councilElection.round()) as u32).toNumber();
 
 export const getCouncilElectionStage = async (
   api: ApiPromise,

+ 1 - 1
rewards.ts

@@ -61,7 +61,7 @@ export const getWorkerRewards = async (
   for (let id = 0; id < nextWorkerId; ++id) {
     const worker: WorkerOf = await getWorker(api, group, hash, id);
 
-    const account = worker.role_account_id;
+    const account = worker.role_account_id as AccountId;
     const memberId = worker.member_id;
     const member: Membership = await getMember(api, memberId, hash);
     const handle = member ? String(member.handle) : account.toString();