From 46a5da6d2e1abfd961ffe2fe83193f5fb4b2501d Mon Sep 17 00:00:00 2001 From: Noah Saso Date: Thu, 30 Nov 2023 10:46:19 -0800 Subject: [PATCH] Added proposal count to daos/memberOf wallet query. --- src/data/formulas/wallet/daos.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/data/formulas/wallet/daos.ts b/src/data/formulas/wallet/daos.ts index 8c6388bc..03f120bb 100644 --- a/src/data/formulas/wallet/daos.ts +++ b/src/data/formulas/wallet/daos.ts @@ -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) => { @@ -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, } : [] )