pub fn new_instruction_governance_instruction_execute(
        &self,
        wallet_address: &Pubkey,
        governance_name: &str,
        proposal_index: u32,
        instruction_index: u16,
    ) -> 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 instruction_address = get_proposal_instruction_address(
            &dao_program,
            &proposal_address,
            &0u16.to_le_bytes(),
            &instruction_index.to_le_bytes(),
        );

        let data = self.rpc_client.get_account_data(&instruction_address)?;
        let ins_data: InstructionData =
            try_from_slice_unchecked::<ProposalInstructionV2>(data.as_slice())
                .map_err(|e| FarmClientError::IOError(e.to_string()))?
                .instruction;
        let mut instruction: Instruction = (&ins_data).into();

        for account in &mut instruction.accounts {
            if account.pubkey == governance {
                account.is_signer = false;
            }
        }

        let inst = dao_instruction::execute_instruction(
            &dao_program,
            &governance,
            &proposal_address,
            &instruction_address,
            &instruction.program_id,
            instruction.accounts.as_slice(),
        );

        Ok(inst)
    }
/// Creates a new instruction for executing the instruction in governance proposal
Creates a new instruction for executing the instruction in governance proposal
Creates a new instruction for executing the instruction in governance proposal
pub fn new_instruction_governance_instruction_execute(
        &self,
        wallet_address: &Pubkey,
        governance_name: &str,
        proposal_index: u32,
        instruction_index: u16,
    ) -> 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 instruction_address = get_proposal_instruction_address(
            &dao_program,
            &proposal_address,
            &0u16.to_le_bytes(),
            &instruction_index.to_le_bytes(),
        );
        let data = self.rpc_client.get_account_data(&instruction_address)?;
        let ins_data: InstructionData =
            try_from_slice_unchecked::<ProposalInstructionV2>(data.as_slice())
                .map_err(|e| FarmClientError::IOError(e.to_string()))?
                .instruction;
        let mut instruction: Instruction = (&ins_data).into();
        for account in &mut instruction.accounts {
            if account.pubkey == governance {
                account.is_signer = false;
            }
        }
        let inst = dao_instruction::execute_instruction(
            &dao_program,
            &governance,
            &proposal_address,
            &instruction_address,
            &instruction.program_id,
            instruction.accounts.as_slice(),
        );
        Ok(inst)
    }
pub fn new_instruction_governance_instruction_execute ( & self , wallet_address : & Pubkey , governance_name : & str , proposal_index : u32 , instruction_index : u16 , ) -> 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 instruction_address = get_proposal_instruction_address ( & dao_program , & proposal_address , & 0u16 . to_le_bytes ( ) , & instruction_index . to_le_bytes ( ) , ) ; let data = self . rpc_client . get_account_data ( & instruction_address ) ? ; let ins_data : InstructionData = try_from_slice_unchecked :: < ProposalInstructionV2 > ( data . as_slice ( ) ) . map_err ( | e | FarmClientError :: IOError ( e . to_string ( ) ) ) ? . instruction ; let mut instruction : Instruction = ( & ins_data ) . into ( ) ; for account in & mut instruction . accounts { if account . pubkey == governance { account . is_signer = false ; } } let inst = dao_instruction :: execute_instruction ( & dao_program , & governance , & proposal_address , & instruction_address , & instruction . program_id , instruction . accounts . as_slice ( ) , ) ; Ok ( inst ) }
Creates a new instruction for executing the instruction in governance proposal
Creates a new instruction for executing the instruction in governance proposal
&self
wallet_address
&Pubkey
governance_name
&str
proposal_index
u32
instruction_index
u16
&self
wallet_address
&Pubkey
governance_name
&str
proposal_index
u32
instruction_index
u16