/// Polls on the state of the proposal until a final state is reached and
/// returns the reached final state.
///
/// Requires that the proposal has been submitted and it's deadline has
/// elapsed.
Polls on the state of the proposal until a final state is reached and
returns the reached final state.

Requires that the proposal has been submitted and it's deadline has
elapsed.
Polls on the state of the proposal until a final state is reached and returns the reached final state . Requires that the proposal has been submitted and it ' s deadline has elapsed .
pub async fn wait_for_final_state(
    governance_canister: &Canister<'_>,
    id: ProposalId,
) -> ProposalInfo {
    let mut num_observed_accepted_state: usize = 0;
    while !is_proposal_executed_or_failed(governance_canister, id).await {
        // Without further instrumenting the IC, we can't guarantee that we will ever
        // see the `Accepted` state. So we just count how many times it happened for
        // information, without any assertion.
        num_observed_accepted_state += 1;
        std::thread::sleep(Duration::from_millis(500));
    }
    eprintln!(
        "Non-final states were seen {} times for {}.",
        num_observed_accepted_state, id
    );
    // Return the final state
    get_proposal_info(governance_canister, id).await.unwrap()
}
pub async fn wait_for_final_state ( governance_canister : & Canister < ' _ > , id : ProposalId , ) -> ProposalInfo { let mut num_observed_accepted_state : usize = 0 ; while ! is_proposal_executed_or_failed ( governance_canister , id ) . await { // Without further instrumenting the IC, we can't guarantee that we will ever // see the `Accepted` state. So we just count how many times it happened for // information, without any assertion. num_observed_accepted_state += 1 ; std :: thread :: sleep ( Duration :: from_millis ( 500 ) ) ; } eprintln ! ( " " num_observed_accepted_state id ) ; // Return the final state get_proposal_info ( governance_canister , id ) . await . unwrap ( ) }
Polls on the state of the proposal until a final state is reached and
returns the reached final state.
Polls on the state of the proposal until a final state is reached and returns the reached final state .
governance_canister
&Canister<'_>
id
ProposalId