modules.ts
1 import { Module, ModuleParameter, Role, WriteFunction } from '@hatsprotocol/modules-sdk'; 2 import { ReactNode } from 'react'; 3 import { Hex } from 'viem'; 4 5 import { SupportedChains } from './chains'; 6 import { CouncilMember, LabeledModules } from './councils'; 7 import { AppHat } from './hat'; 8 9 export type DeploymentType = 'onlyModule' | 'moduleAndClaimsHatter' | 'onlyClaimsHatter'; 10 11 export type ModuleCreationArg = { 12 name: string; 13 description: string; 14 type: string; 15 example: unknown; 16 displayType: string; 17 optional?: boolean; 18 }; 19 20 export type ModuleCreationArgs = { 21 immutable: ModuleCreationArg[]; 22 mutable: ModuleCreationArg[]; 23 }; 24 25 export interface ModuleDetails extends Module { 26 // id: Hex; // was added to registry and SDK migrate module address to `instanceAddress` 27 liveParameters: ModuleParameter[] | undefined; 28 instanceAddress?: Hex; 29 } 30 31 export type ModuleDetailsComponent = (m: ModuleDetails, chainId: SupportedChains) => ReactNode | undefined; 32 33 export interface ModuleDetailRole { 34 param: string; 35 label: string; 36 tooltip: string; 37 } 38 39 export interface ModuleRole extends Role { 40 label: string; 41 } 42 43 export interface ModuleFunction extends WriteFunction { 44 isCustom?: boolean; 45 onClick: (args?: unknown) => void; 46 icon?: ReactNode; 47 } 48 49 export interface EligibilityRule { 50 module: Module; 51 address: `0x${string}`; 52 liveParams?: ModuleParameter[] | undefined; 53 } 54 55 export interface CurrentEligibility { 56 [key: Hex]: { 57 eligible: boolean; 58 goodStanding: boolean; 59 }; 60 } 61 62 export interface StatusManagerProps { 63 rule: EligibilityRule; 64 user: CouncilMember | undefined; 65 selectedHat: AppHat | undefined; 66 chainId: number; 67 labeledModules: LabeledModules | undefined; 68 currentEligibility: CurrentEligibility | undefined; 69 isFirstInChain?: boolean; 70 }