forked from DA0-DA0/dao-dao-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreators.ts
49 lines (43 loc) · 1.45 KB
/
creators.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
import { ComponentType } from 'react'
import { FieldValues } from 'react-hook-form'
import { TFunction } from 'react-i18next'
import { CodeIdConfig, SupportedChainConfig } from './chain'
import { InstantiateMsg } from './contracts/DaoCore.v2'
import {
DaoCreationGovernanceConfigInputProps,
DaoCreationGovernanceConfigReviewProps,
DaoCreationVotingConfigItem,
NewDao,
} from './dao'
export type DaoCreatorMutate<Data extends FieldValues = any> = (
msg: InstantiateMsg,
// Used within voting and proposal module adapters, so the data generic passed
// in may not necessarily be the voting module adapter data. Must use `any`.
newDao: NewDao<any>,
data: Data,
t: TFunction,
codeIds: CodeIdConfig
) => InstantiateMsg
export type DaoCreator<Data extends FieldValues = any> = {
id: string
makeDefaultConfig: (chainConfig: SupportedChainConfig) => Data
displayInfo: {
Icon: ComponentType
nameI18nKey: string
descriptionI18nKey: string
suppliesI18nKey: string
membershipI18nKey: string
}
governanceConfig: {
Input: ComponentType<DaoCreationGovernanceConfigInputProps>
Review: ComponentType<DaoCreationGovernanceConfigReviewProps>
}
votingConfig: {
items: DaoCreationVotingConfigItem[]
advancedItems?: DaoCreationVotingConfigItem[]
advancedWarningI18nKeys?: string[]
}
// Modify `msg` to add any additional fields the creator needs to set based on
// its own config.
mutate: DaoCreatorMutate<Data>
}