pub fn new_instruction_governance_vote_cast(
        &self,
        wallet_address: &Pubkey,
        governance_name: &str,
        proposal_index: u32,
        vote: u8,
    ) -> Result<Instruction, FarmClientError> {
        let (dao_program, realm_address, dao_token, governance, token_owner, proposal_address) =
            self.get_dao_accounts(wallet_address, governance_name, proposal_index)?;

        let voter_token_owner = get_token_owner_record_address(
            &dao_program,
            &realm_address,
            &dao_token.mint,
            wallet_address,
        );

        let inst = dao_instruction::cast_vote(
            &dao_program,
            &realm_address,
            &governance,
            &proposal_address,
            &token_owner,
            &voter_token_owner,
            wallet_address,
            &dao_token.mint,
            wallet_address,
            None,
            if vote > 0 {
                Vote::Approve(vec![VoteChoice {
                    rank: 0,
                    weight_percentage: 100,
                }])
            } else {
                Vote::Deny
            },
        );

        Ok(inst)
    }
/// Creates a new instruction for casting a vote on governance proposal
Creates a new instruction for casting a vote on governance proposal
Creates a new instruction for casting a vote on governance proposal
pub fn new_instruction_governance_vote_cast(
        &self,
        wallet_address: &Pubkey,
        governance_name: &str,
        proposal_index: u32,
        vote: u8,
    ) -> Result<Instruction, FarmClientError> {
        let (dao_program, realm_address, dao_token, governance, token_owner, proposal_address) =
            self.get_dao_accounts(wallet_address, governance_name, proposal_index)?;
        let voter_token_owner = get_token_owner_record_address(
            &dao_program,
            &realm_address,
            &dao_token.mint,
            wallet_address,
        );
        let inst = dao_instruction::cast_vote(
            &dao_program,
            &realm_address,
            &governance,
            &proposal_address,
            &token_owner,
            &voter_token_owner,
            wallet_address,
            &dao_token.mint,
            wallet_address,
            None,
            if vote > 0 {
                Vote::Approve(vec![VoteChoice {
                    rank: 0,
                    weight_percentage: 100,
                }])
            } else {
                Vote::Deny
            },
        );
        Ok(inst)
    }
pub fn new_instruction_governance_vote_cast ( & self , wallet_address : & Pubkey , governance_name : & str , proposal_index : u32 , vote : u8 , ) -> Result < Instruction , FarmClientError > { let ( dao_program , realm_address , dao_token , governance , token_owner , proposal_address ) = self . get_dao_accounts ( wallet_address , governance_name , proposal_index ) ? ; let voter_token_owner = get_token_owner_record_address ( & dao_program , & realm_address , & dao_token . mint , wallet_address , ) ; let inst = dao_instruction :: cast_vote ( & dao_program , & realm_address , & governance , & proposal_address , & token_owner , & voter_token_owner , wallet_address , & dao_token . mint , wallet_address , None , if vote > 0 { Vote :: Approve ( vec ! [ VoteChoice { rank 0 weight_percentage 100 } ] ) } else { Vote :: Deny } , ) ; Ok ( inst ) }
Creates a new instruction for casting a vote on governance proposal
Creates a new instruction for casting a vote on governance proposal
&self
wallet_address
&Pubkey
governance_name
&str
proposal_index
u32
vote
u8
&self
wallet_address
&Pubkey
governance_name
&str
proposal_index
u32
vote
u8