Skip to content

Commit

Permalink
NOVA_3665: switch <action>.multi to multiQuery (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Asmadek committed Feb 7, 2022
1 parent 70d9600 commit 28a7e75
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/mappings/Cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ export async function cachedRewardDestination(accountAddress: string, event: Sub
return await api.query.staking.payee(accountAddress)
}

const payees = await api.query.staking.payee.multi(allAccountsInBlock);
// TODO: Commented code doesn't work now, may be fixed later
// const payees = await api.query.staking.payee.multi(allAccountsInBlock);
const payees = await api.queryMulti(allAccountsInBlock.map(account => ([api.query.staking.payee, account])));

const rewardDestinations = payees.map(payee => { return payee as RewardDestination });

let destinationByAddress: {[address: string]: RewardDestination} = {}
Expand Down Expand Up @@ -94,7 +97,9 @@ export async function cachedController(accountAddress: string, event: SubstrateE
return accountId.toString()
}

const bonded = await api.query.staking.bonded.multi(controllerNeedAccounts);
// TODO: Commented code doesn't work now, may be fixed later
// const bonded = await api.query.staking.bonded.multi(controllerNeedAccounts);
const bonded = await api.queryMulti(controllerNeedAccounts.map(account => ([api.query.staking.bonded, account])));
const controllers = bonded.map(bonded => { return bonded.toString() });

let bondedByAddress: {[address: string]: string} = {}
Expand Down

0 comments on commit 28a7e75

Please sign in to comment.