Преглед на файлове

minor fixes: api rewards

Joystream Stats преди 2 години
родител
ревизия
37b69a93ce
променени са 2 файла, в които са добавени 5 реда и са изтрити 3 реда
  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();