Skip to content

Commit

Permalink
Added proposal count to daos/memberOf wallet query.
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahSaso committed Nov 30, 2023
1 parent 7416f0c commit 46a5da6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/data/formulas/wallet/daos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import { Op } from 'sequelize'
import { WalletFormula } from '@/core'

import { config } from '../contract/daoCore/base'
import { proposalCount } from '../contract/daoCore/proposals'

export const memberOf: WalletFormula<
{
dao: string
config: any
proposalCount: number
}[]
> = {
compute: async (env) => {
Expand Down Expand Up @@ -129,12 +131,18 @@ export const memberOf: WalletFormula<
config.compute({ ...env, contractAddress: daoAddress })
)
)
const proposalCounts = await Promise.all(
daos.map((daoAddress) =>
proposalCount.compute({ ...env, contractAddress: daoAddress })
)
)

return configs.flatMap((config, index) =>
config
? {
dao: daos[index],
config,
proposalCount: proposalCounts[index] || 0,
}
: []
)
Expand Down

0 comments on commit 46a5da6

Please sign in to comment.