forked from DA0-DA0/dao-dao-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakeGetDaoStaticProps.ts
866 lines (791 loc) · 23.3 KB
/
makeGetDaoStaticProps.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
import { Chain } from '@chain-registry/types'
import type { GetStaticProps, Redirect } from 'next'
import { TFunction } from 'next-i18next'
import removeMarkdown from 'remove-markdown'
import { serverSideTranslationsWithServerT } from '@dao-dao/i18n/serverSideTranslations'
import {
DaoCoreV2QueryClient,
DaoVotingCw20StakedQueryClient,
PolytoneNoteQueryClient,
queryIndexer,
} from '@dao-dao/state'
import {
Account,
AccountType,
ActiveThreshold,
CommonProposalInfo,
ContractVersion,
ContractVersionInfo,
DaoPageMode,
DaoParentInfo,
Feature,
IndexerDumpState,
InfoResponse,
PolytoneProxies,
ProposalModule,
} from '@dao-dao/types'
import { ConfigResponse as ConfigV1Response } from '@dao-dao/types/contracts/CwCore.v1'
import {
Config,
ConfigResponse as ConfigV2Response,
ListItemsResponse,
ProposalModuleWithInfo,
} from '@dao-dao/types/contracts/DaoCore.v2'
import {
CI,
DAO_CORE_ACCENT_ITEM_KEY,
DAO_STATIC_PROPS_CACHE_SECONDS,
LEGACY_URL_PREFIX,
MAX_META_CHARS_PROPOSAL_DESCRIPTION,
addressIsModule,
cosmWasmClientRouter,
getChainForChainId,
getChainIdForAddress,
getDaoPath,
getDisplayNameForChainId,
getImageUrlForChainId,
getRpcForChainId,
getSupportedChainConfig,
getSupportedFeatures,
isFeatureSupportedByVersion,
isValidContractAddress,
parseContractVersion,
polytoneNoteProxyMapToChainIdMap,
processError,
} from '@dao-dao/utils'
import { cosmos } from '@dao-dao/utils/protobuf'
import { DaoPageWrapperProps } from '../components'
import {
ProposalModuleAdapterError,
matchAndLoadAdapter,
} from '../proposal-module-adapter'
import {
fetchProposalModules,
fetchProposalModulesWithInfoFromChain,
} from '../utils/fetchProposalModules'
interface GetDaoStaticPropsMakerProps {
leadingTitle?: string
followingTitle?: string
overrideTitle?: string
overrideDescription?: string
overrideImageUrl?: string
additionalProps?: Record<string, any> | null | undefined
url?: string
}
interface GetDaoStaticPropsMakerOptions {
appMode: DaoPageMode
coreAddress?: string
getProps?: (options: {
context: Parameters<GetStaticProps>[0]
t: TFunction
config: ConfigV1Response | ConfigV2Response
chain: Chain
coreAddress: string
coreVersion: ContractVersion
proposalModules: ProposalModule[]
}) =>
| GetDaoStaticPropsMakerProps
| undefined
| null
| Promise<GetDaoStaticPropsMakerProps | undefined | null>
}
type GetDaoStaticPropsMaker = (
options: GetDaoStaticPropsMakerOptions
) => GetStaticProps<DaoPageWrapperProps>
export class LegacyDaoError extends Error {
constructor() {
super()
this.name = 'LegacyDaoError'
}
}
// Computes DaoPageWrapperProps for the DAO with optional alterations.
export const makeGetDaoStaticProps: GetDaoStaticPropsMaker =
({ appMode, coreAddress: _coreAddress, getProps }) =>
async (context) => {
// Don't query chain if running in CI.
if (CI) {
return { notFound: true }
}
// Load server translations and get T function for use in getProps.
const { i18nProps, serverT } = await serverSideTranslationsWithServerT(
context.locale,
['translation']
)
const coreAddress = _coreAddress ?? context.params?.address
// Get chain ID for address based on prefix.
let chainId: string
try {
// If invalid address, display not found.
if (!coreAddress || typeof coreAddress !== 'string') {
throw new Error('Invalid address')
}
chainId = getChainIdForAddress(coreAddress)
// Validation throws error if address prefix not recognized. Display not
// found in this case.
} catch (err) {
console.error(err)
// Excluding `info` will render DAONotFound.
return {
props: {
...i18nProps,
title: serverT('title.daoNotFound'),
description: err instanceof Error ? err.message : `${err}`,
},
}
}
// If address is polytone proxy, redirect to DAO on native chain.
try {
const addressInfo = await queryIndexer<ContractVersionInfo>({
type: 'contract',
chainId,
address: coreAddress,
formula: 'info',
required: true,
})
if (addressInfo && addressInfo.contract === 'crates.io:polytone-proxy') {
// Get voice for this proxy on destination chain.
const voice = await queryIndexer({
type: 'contract',
chainId,
// proxy
address: coreAddress,
formula: 'polytone/proxy/instantiator',
required: true,
})
const dao = await queryIndexer({
type: 'contract',
chainId,
address: voice,
formula: 'polytone/voice/remoteController',
args: {
// proxy
address: coreAddress,
},
required: true,
})
return {
redirect: {
destination: getDaoPath(appMode, dao),
permanent: true,
},
}
}
} catch {
// If failed, ignore.
}
// Add to Sentry error tags if error occurs.
let coreVersion: ContractVersion | undefined
try {
const {
admin,
config,
version,
votingModule: { address: votingModuleAddress, info: votingModuleInfo },
activeProposalModules,
created,
isActive,
activeThreshold,
parentDao,
items: _items,
polytoneProxies,
} = await daoCoreDumpState(chainId, coreAddress, serverT)
coreVersion = version
// If no contract name, will display fallback voting module adapter.
const votingModuleContractName =
(votingModuleInfo &&
'contract' in votingModuleInfo &&
votingModuleInfo.contract) ||
'fallback'
// Get DAO proposal modules.
const proposalModules = await fetchProposalModules(
chainId,
coreAddress,
coreVersion,
activeProposalModules
)
// Convert items list into map.
const items = _items.reduce(
(acc, [key, value]) => ({
...acc,
[key]: value,
}),
{} as Record<string, string>
)
const accounts: Account[] = [
// Current chain.
{
chainId,
address: coreAddress,
type: AccountType.Native,
},
// Polytone.
...Object.entries(polytoneProxies).map(
([chainId, address]): Account => ({
chainId,
address,
type: AccountType.Polytone,
})
),
// The above accounts are the ones we already have. The rest of the
// accounts are loaded once the page loads (in `DaoPageWrapper`) since
// they are more complex and will probably expand over time.
]
// Must be called after server side translations has been awaited, because
// props may use the `t` function, and it won't be available until after.
const {
leadingTitle,
followingTitle,
overrideTitle,
overrideDescription,
overrideImageUrl,
additionalProps,
url,
} =
(await getProps?.({
context,
t: serverT,
config,
chain: getChainForChainId(chainId),
coreAddress,
coreVersion,
proposalModules,
})) ?? {}
const props: DaoPageWrapperProps = {
...i18nProps,
url: url ?? null,
title:
overrideTitle ??
[leadingTitle?.trim(), config.name.trim(), followingTitle?.trim()]
.filter(Boolean)
.join(' | '),
description: overrideDescription ?? config.description,
accentColor: items[DAO_CORE_ACCENT_ITEM_KEY] || null,
serializedInfo: {
chainId,
coreAddress,
coreVersion,
supportedFeatures: getSupportedFeatures(coreVersion),
votingModuleAddress,
votingModuleContractName,
proposalModules,
name: config.name,
description: config.description,
imageUrl: overrideImageUrl ?? config.image_url ?? null,
created: created?.toJSON() ?? null,
isActive,
activeThreshold,
items,
polytoneProxies,
accounts,
parentDao,
admin: admin ?? null,
},
...additionalProps,
}
return {
props,
// Regenerate the page at most once per `revalidate` seconds. Serves
// cached copy and refreshes in background.
revalidate: DAO_STATIC_PROPS_CACHE_SECONDS,
}
} catch (error) {
// Redirect.
if (error instanceof RedirectError) {
return {
redirect: error.redirect,
}
}
// Redirect legacy DAOs (legacy multisigs redirected in next.config.js
// redirects list).
if (
error instanceof LegacyDaoError ||
(error instanceof Error &&
error.message.includes(
'Query failed with (18): Error parsing into type cw3_dao::msg::QueryMsg: unknown variant `dump_state`'
))
) {
return {
redirect: {
destination:
LEGACY_URL_PREFIX + getDaoPath(DaoPageMode.Dapp, coreAddress),
permanent: false,
},
}
}
console.error(error)
if (
error instanceof Error &&
(error.message.includes('contract: not found') ||
error.message.includes('Error parsing into type') ||
error.message.includes('decoding bech32 failed') ||
error.message.includes('dumpState reason: Unexpected token'))
) {
// Excluding `info` will render DAONotFound.
return {
props: {
...i18nProps,
title: 'DAO not found',
description: '',
},
// Regenerate the page at most once per second. Serves cached copy and
// refreshes in background.
revalidate: 1,
}
}
// Return error in props to trigger client-side 500 error.
return {
props: {
...i18nProps,
title: serverT('title.500'),
description: '',
// Report to Sentry.
error: processError(error, {
forceCapture: true,
tags: {
coreAddress,
coreVersion: coreVersion ?? '<undefined>',
},
extra: { context },
}),
},
// Regenerate the page at most once per second. Serves cached copy and
// refreshes in background.
revalidate: 1,
}
}
}
interface GetDaoProposalStaticPropsMakerOptions
extends Omit<GetDaoStaticPropsMakerOptions, 'getProps'> {
getProposalUrlPrefix: (
params: Record<string, string | string[] | undefined>
) => string
proposalIdParamKey?: string
}
export const makeGetDaoProposalStaticProps = ({
getProposalUrlPrefix,
proposalIdParamKey = 'proposalId',
...options
}: GetDaoProposalStaticPropsMakerOptions) =>
makeGetDaoStaticProps({
...options,
getProps: async ({
context: { params = {} },
t,
chain,
coreAddress,
proposalModules,
}) => {
const proposalId = params[proposalIdParamKey]
// If invalid proposal ID, not found.
if (typeof proposalId !== 'string') {
return {
followingTitle: t('title.proposalNotFound'),
additionalProps: {
proposalInfo: null,
},
}
}
let proposalInfo: CommonProposalInfo | null = null
try {
const {
options: {
proposalModule: { prefix },
},
adapter: {
functions: { getProposalInfo },
},
} = await matchAndLoadAdapter(proposalModules, proposalId, {
chain,
coreAddress,
})
// If proposal is numeric, i.e. has no prefix, redirect to prefixed URL.
if (!isNaN(Number(proposalId))) {
throw new RedirectError({
destination: getProposalUrlPrefix(params) + prefix + proposalId,
permanent: true,
})
}
// undefined if proposal does not exist.
proposalInfo = (await getProposalInfo()) ?? null
} catch (error) {
// Rethrow.
if (error instanceof RedirectError) {
throw error
}
// If ProposalModuleAdapterError, treat as 404 below.
// Otherwise display 500.
if (!(error instanceof ProposalModuleAdapterError)) {
// Report to Sentry.
processError(error)
console.error(error)
// Throw error to trigger 500.
throw new Error(t('error.unexpectedError'))
}
}
return {
url: getProposalUrlPrefix(params) + proposalId,
followingTitle: proposalInfo
? proposalInfo.title
: t('title.proposalNotFound'),
overrideDescription: removeMarkdown(
proposalInfo?.description ?? ''
).slice(0, MAX_META_CHARS_PROPOSAL_DESCRIPTION),
additionalProps: {
// If proposal does not exist, null indicates 404.
proposalInfo,
},
}
},
})
export class RedirectError {
constructor(public redirect: Redirect) {}
}
const loadParentDaoInfo = async (
chainId: string,
subDaoAddress: string,
potentialParentAddress: string | null | undefined,
serverT: TFunction,
// Prevent cycles by ensuring admin has not already been seen.
previousParentAddresses: string[]
): Promise<Omit<DaoParentInfo, 'registeredSubDao'> | null> => {
// If no admin, or admin is set to itself, or admin is a wallet, no parent
// DAO.
if (
!potentialParentAddress ||
potentialParentAddress === subDaoAddress ||
previousParentAddresses?.includes(potentialParentAddress)
) {
return null
}
try {
// Check if address is chain module account.
const cosmosClient = (
await cosmos.ClientFactory.createRPCQueryClient({
rpcEndpoint: getRpcForChainId(chainId),
})
).cosmos
// If chain module account...
if (await addressIsModule(cosmosClient, potentialParentAddress)) {
const chainConfig = getSupportedChainConfig(chainId)
return chainConfig
? {
chainId,
coreAddress: chainConfig.name,
coreVersion: ContractVersion.Gov,
name: getDisplayNameForChainId(chainId),
imageUrl: getImageUrlForChainId(chainId),
parentDao: null,
admin: '',
}
: null
}
if (
!isValidContractAddress(
potentialParentAddress,
getChainForChainId(chainId).bech32_prefix
)
) {
return null
}
const {
admin,
version,
config: { name, image_url },
parentDao,
} = await daoCoreDumpState(chainId, potentialParentAddress, serverT, [
...(previousParentAddresses ?? []),
potentialParentAddress,
])
return {
chainId,
coreAddress: potentialParentAddress,
coreVersion: version,
name: name,
imageUrl: image_url ?? null,
parentDao,
admin: admin ?? null,
}
} catch (err) {
// If contract not found, ignore error. Otherwise, log it.
if (!(err instanceof Error) || !err.message.includes('not found')) {
console.error(err)
console.error(
`Error loading parent DAO (${potentialParentAddress}) of ${subDaoAddress}`,
processError(err)
)
}
// Don't prevent page render if failed to load parent DAO info.
return null
}
}
const LEGACY_DAO_CONTRACT_NAMES = ['crates.io:sg_dao', 'crates.io:cw3_dao']
const ITEM_LIST_LIMIT = 30
interface DaoCoreDumpState {
admin: string
config: Config
version: ContractVersion
votingModule: {
address: string
info: ContractVersionInfo
}
activeProposalModules: ProposalModuleWithInfo[]
created: Date | undefined
parentDao: DaoParentInfo | null
items: ListItemsResponse
polytoneProxies: PolytoneProxies
isActive: boolean
activeThreshold: ActiveThreshold | null
}
const daoCoreDumpState = async (
chainId: string,
coreAddress: string,
serverT: TFunction,
// Prevent cycles by ensuring admin has not already been seen.
previousParentAddresses?: string[]
): Promise<DaoCoreDumpState> => {
const cwClient = await cosmWasmClientRouter.connect(getRpcForChainId(chainId))
try {
const indexerDumpedState = await queryIndexer<IndexerDumpState>({
type: 'contract',
address: coreAddress,
formula: 'daoCore/dumpState',
chainId,
required: true,
})
// Use data from indexer if present.
if (indexerDumpedState) {
if (
LEGACY_DAO_CONTRACT_NAMES.includes(indexerDumpedState.version?.contract)
) {
throw new LegacyDaoError()
}
const coreVersion = parseContractVersion(
indexerDumpedState.version.version
)
if (!coreVersion) {
throw new Error(serverT('error.failedParsingCoreVersion'))
}
const items =
(await queryIndexer<ListItemsResponse>({
type: 'contract',
address: coreAddress,
formula: 'daoCore/listItems',
chainId,
required: true,
})) ?? []
const { admin } = indexerDumpedState
const parentDaoInfo = await loadParentDaoInfo(
chainId,
coreAddress,
admin,
serverT,
[...(previousParentAddresses ?? []), coreAddress]
)
// Convert to chainId -> proxy map.
const polytoneProxies = polytoneNoteProxyMapToChainIdMap(
chainId,
indexerDumpedState.polytoneProxies || {}
)
let isActive = true
let activeThreshold: ActiveThreshold | null = null
try {
// All voting modules use the same active queries, so it's safe to just
// use one here.
const client = new DaoVotingCw20StakedQueryClient(
cwClient,
indexerDumpedState.voting_module
)
isActive = (await client.isActive()).active
activeThreshold =
(await client.activeThreshold()).active_threshold || null
} catch {
// Some voting modules don't support the active queries, so if they
// fail, assume it's active.
}
return {
...indexerDumpedState,
version: coreVersion,
votingModule: {
address: indexerDumpedState.voting_module,
info: indexerDumpedState.votingModuleInfo,
},
activeProposalModules: indexerDumpedState.proposal_modules.filter(
({ status }) => status === 'enabled' || status === 'Enabled'
),
created: indexerDumpedState.createdAt
? new Date(indexerDumpedState.createdAt)
: undefined,
isActive,
activeThreshold,
items,
parentDao: parentDaoInfo
? {
...parentDaoInfo,
// Whether or not this parent has registered its child as a SubDAO.
registeredSubDao:
indexerDumpedState.adminInfo?.registeredSubDao ?? false,
}
: null,
polytoneProxies,
}
}
} catch (error) {
// Rethrow if legacy DAO.
if (error instanceof LegacyDaoError) {
throw error
}
// Ignore error. Fallback to querying chain below.
console.error(error, processError(error))
}
const daoCoreClient = new DaoCoreV2QueryClient(cwClient, coreAddress)
const dumpedState = await daoCoreClient.dumpState()
if (LEGACY_DAO_CONTRACT_NAMES.includes(dumpedState.version.contract)) {
throw new LegacyDaoError()
}
const [coreVersion, { info: votingModuleInfo }] = await Promise.all([
parseContractVersion(dumpedState.version.version),
(await cwClient.queryContractSmart(dumpedState.voting_module, {
info: {},
})) as InfoResponse,
])
if (!coreVersion) {
throw new Error(serverT('error.failedParsingCoreVersion'))
}
const proposalModules = await fetchProposalModulesWithInfoFromChain(
chainId,
coreAddress,
coreVersion
)
// Get all items.
const items: ListItemsResponse = []
while (true) {
const _items = await daoCoreClient.listItems({
startAfter: items[items.length - 1]?.[0],
limit: ITEM_LIST_LIMIT,
})
if (!_items.length) {
break
}
items.push(..._items)
// If we got less than the limit, we've reached the end.
if (_items.length < ITEM_LIST_LIMIT) {
break
}
}
let isActive = true
let activeThreshold: ActiveThreshold | null = null
try {
// All voting modules use the same active queries, so it's safe to just use
// one here.
const client = new DaoVotingCw20StakedQueryClient(
cwClient,
dumpedState.voting_module
)
isActive = (await client.isActive()).active
activeThreshold = (await client.activeThreshold()).active_threshold || null
} catch {
// Some voting modules don't support the active queries, so if they fail,
// assume it's active.
}
const { admin } = dumpedState
const parentDao = await loadParentDaoInfo(
chainId,
coreAddress,
admin,
serverT,
[...(previousParentAddresses ?? []), coreAddress]
)
let registeredSubDao = false
// If parent DAO exists, check if this DAO is a SubDAO of the parent.
if (
parentDao &&
isFeatureSupportedByVersion(Feature.SubDaos, parentDao.coreVersion)
) {
const parentDaoCoreClient = new DaoCoreV2QueryClient(cwClient, admin)
// Get all SubDAOs.
const subdaoAddrs: string[] = []
while (true) {
const response = await parentDaoCoreClient.listSubDaos({
startAfter: subdaoAddrs[subdaoAddrs.length - 1],
limit: SUBDAO_LIST_LIMIT,
})
if (!response?.length) break
subdaoAddrs.push(...response.map(({ addr }) => addr))
// If we have less than the limit of items, we've exhausted them.
if (response.length < SUBDAO_LIST_LIMIT) {
break
}
}
registeredSubDao = subdaoAddrs.includes(coreAddress)
}
// Get DAO polytone proxies.
const polytoneProxies = (
await Promise.all(
Object.entries(getSupportedChainConfig(chainId)?.polytone || {}).map(
async ([chainId, { note }]) => {
let proxy
try {
proxy = await queryIndexer<string>({
type: 'contract',
address: note,
formula: 'polytone/note/remoteAddress',
args: {
address: coreAddress,
},
chainId,
})
} catch {
// Ignore error.
}
if (!proxy) {
const polytoneNoteClient = new PolytoneNoteQueryClient(
cwClient,
note
)
proxy =
(await polytoneNoteClient.remoteAddress({
localAddress: coreAddress,
})) || undefined
}
return {
chainId,
proxy,
}
}
)
)
).reduce(
(acc, { chainId, proxy }) => ({
...acc,
...(proxy
? {
[chainId]: proxy,
}
: {}),
}),
{} as PolytoneProxies
)
return {
...dumpedState,
version: coreVersion,
votingModule: {
address: dumpedState.voting_module,
info: votingModuleInfo,
},
activeProposalModules: proposalModules.filter(
({ status }) => status === 'enabled' || status === 'Enabled'
),
created: undefined,
isActive,
activeThreshold,
items,
parentDao: parentDao
? {
...parentDao,
registeredSubDao,
}
: null,
polytoneProxies,
}
}
const SUBDAO_LIST_LIMIT = 30