forked from DA0-DA0/dao-dao-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvoting-module-adapter.ts
67 lines (56 loc) · 1.62 KB
/
voting-module-adapter.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
import { ComponentType } from 'react'
import { ActionCategoryMaker } from './actions'
import { DaoInfoCard, StakingMode } from './components'
import { DaoTabWithComponent } from './dao'
import { GenericToken } from './token'
export interface BaseProfileCardMemberInfoProps {
maxGovernanceTokenDeposit: string | undefined
// True if wallet cannot vote on a proposal being shown.
cantVoteOnProposal?: boolean
}
export interface BaseStakingModalProps {
visible: boolean
onClose: () => void
initialMode?: StakingMode
maxDeposit?: string
}
export type VotingModuleRelevantAddress = {
label: string
address: string
}
export interface IVotingModuleAdapter {
// Hooks
hooks: {
useMainDaoInfoCards: () => DaoInfoCard[]
useVotingModuleRelevantAddresses: () => VotingModuleRelevantAddress[]
useCommonGovernanceTokenInfo?: () => GenericToken
}
// Components
components: {
extraTabs?: (Omit<DaoTabWithComponent, 'label'> & {
labelI18nKey: string
})[]
ProfileCardMemberInfo: ComponentType<BaseProfileCardMemberInfoProps>
MainDaoInfoCardsLoader: ComponentType<any>
StakingModal?: ComponentType<BaseStakingModalProps>
}
// Fields
fields: {
actionCategoryMakers: ActionCategoryMaker[]
}
}
export type VotingModuleAdapter = {
id: string
contractNames: string[]
load: (options: IVotingModuleAdapterOptions) => IVotingModuleAdapter
}
export interface IVotingModuleAdapterOptions {
chainId: string
coreAddress: string
votingModuleAddress: string
}
export interface IVotingModuleAdapterContext {
id: string
options: IVotingModuleAdapterOptions
adapter: IVotingModuleAdapter
}