pub fn governance_get_address(&self, governance_name: &str) -> Result<Pubkey, FarmClientError> {
        let dao_program = self.get_program_id(DAO_PROGRAM_NAME)?;
        let realm_address = get_realm_address(&dao_program, DAO_PROGRAM_NAME);
        match governance_name {
            DAO_MINT_NAME => {
                let dao_token = self.get_token(DAO_TOKEN_NAME)?;
                Ok(get_mint_governance_address(
                    &dao_program,
                    &realm_address,
                    &dao_token.mint,
                ))
            }
            DAO_CUSTODY_NAME => {
                let governed_account =
                    Pubkey::find_program_address(&[DAO_CUSTODY_NAME.as_bytes()], &dao_program).0;
                Ok(get_account_governance_address(
                    &dao_program,
                    &realm_address,
                    &governed_account,
                ))
            }
            _ => {
                let governed_program = self.get_program_id(governance_name)?;
                Ok(get_program_governance_address(
                    &dao_program,
                    &realm_address,
                    &governed_program,
                ))
            }
        }
    }
// Returns account address of the governance
Returns account address of the governance
Returns account address of the governance
pub fn governance_get_address(&self, governance_name: &str) -> Result<Pubkey, FarmClientError> {
        let dao_program = self.get_program_id(DAO_PROGRAM_NAME)?;
        let realm_address = get_realm_address(&dao_program, DAO_PROGRAM_NAME);
        match governance_name {
            DAO_MINT_NAME => {
                let dao_token = self.get_token(DAO_TOKEN_NAME)?;
                Ok(get_mint_governance_address(
                    &dao_program,
                    &realm_address,
                    &dao_token.mint,
                ))
            }
            DAO_CUSTODY_NAME => {
                let governed_account =
                    Pubkey::find_program_address(&[DAO_CUSTODY_NAME.as_bytes()], &dao_program).0;
                Ok(get_account_governance_address(
                    &dao_program,
                    &realm_address,
                    &governed_account,
                ))
            }
            _ => {
                let governed_program = self.get_program_id(governance_name)?;
                Ok(get_program_governance_address(
                    &dao_program,
                    &realm_address,
                    &governed_program,
                ))
            }
        }
    }
pub fn governance_get_address ( & self , governance_name : & str ) -> Result < Pubkey , FarmClientError > { let dao_program = self . get_program_id ( DAO_PROGRAM_NAME ) ? ; let realm_address = get_realm_address ( & dao_program , DAO_PROGRAM_NAME ) ; match governance_name { DAO_MINT_NAME => { let dao_token = self . get_token ( DAO_TOKEN_NAME ) ? ; Ok ( get_mint_governance_address ( & dao_program , & realm_address , & dao_token . mint , ) ) } DAO_CUSTODY_NAME => { let governed_account = Pubkey :: find_program_address ( & [ DAO_CUSTODY_NAME . as_bytes ( ) ] , & dao_program ) . 0 ; Ok ( get_account_governance_address ( & dao_program , & realm_address , & governed_account , ) ) } _ => { let governed_program = self . get_program_id ( governance_name ) ? ; Ok ( get_program_governance_address ( & dao_program , & realm_address , & governed_program , ) ) } } }
Returns account address of the governance
Returns account address of the governance
&self
governance_name
&str
&self
governance_name
&str