Ver Fonte

minor fixes: api rewards

Joystream Stats há 2 anos atrás
pai
commit
37b69a93ce
2 ficheiros alterados com 5 adições e 3 exclusões
  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();