Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NOVA-3665: fix multi query #40

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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