pub fn canister_can_manage_other_canister(handle: IcHandle, ctx: &ic_fondue::pot::Context) {
    let mut rng = ctx.rng.clone();
    let rt = tokio::runtime::Runtime::new().expect("Could not create tokio runtime.");
    rt.block_on({
        async move {
            let endpoint = get_random_nns_node_endpoint(&handle, &mut rng);
            endpoint.assert_ready(ctx).await;
            let agent = assert_create_agent(endpoint.url.as_str()).await;

            let canister_a = UniversalCanister::new(&agent).await;

            let canister_b = canister_a
                .update(wasm().call(management::create_canister(2_000_000_000_000)))
                .await
                .map(|res| {
                    Decode!(res.as_slice(), CreateCanisterResult)
                        .unwrap()
                        .canister_id
                })
                .unwrap();

            canister_a
                .update(wasm().call(management::install_code(
                    canister_b,
                    UNIVERSAL_CANISTER_WASM.to_vec(),
                )))
                .await
                .unwrap();

            let arbitrary_bytes = b";ioapusdvzn,x";
            assert_eq!(
                canister_a
                    .update(wasm().inter_update(
                        canister_b,
                        call_args().other_side(wasm().reply_data(arbitrary_bytes)),
                    ))
                    .await
                    .unwrap(),
                arbitrary_bytes
            );
        }
    })
}
/// Canister A creates canister B; installs wasm on it; and then executes some
/// code on it; Each of the above operations are done in distinct steps i.e. the
/// "user" initiates each step separately.
Canister A creates canister B; installs wasm on it; and then executes some
code on it; Each of the above operations are done in distinct steps i.e. the
"user" initiates each step separately.
Canister A creates canister B ; installs wasm on it ; and then executes some code on it ; Each of the above operations are done in distinct steps i . e . the " user " initiates each step separately .
pub fn canister_can_manage_other_canister(handle: IcHandle, ctx: &ic_fondue::pot::Context) {
    let mut rng = ctx.rng.clone();
    let rt = tokio::runtime::Runtime::new().expect("Could not create tokio runtime.");
    rt.block_on({
        async move {
            let endpoint = get_random_nns_node_endpoint(&handle, &mut rng);
            endpoint.assert_ready(ctx).await;
            let agent = assert_create_agent(endpoint.url.as_str()).await;
            let canister_a = UniversalCanister::new(&agent).await;
            let canister_b = canister_a
                .update(wasm().call(management::create_canister(2_000_000_000_000)))
                .await
                .map(|res| {
                    Decode!(res.as_slice(), CreateCanisterResult)
                        .unwrap()
                        .canister_id
                })
                .unwrap();
            canister_a
                .update(wasm().call(management::install_code(
                    canister_b,
                    UNIVERSAL_CANISTER_WASM.to_vec(),
                )))
                .await
                .unwrap();
            let arbitrary_bytes = b";ioapusdvzn,x";
            assert_eq!(
                canister_a
                    .update(wasm().inter_update(
                        canister_b,
                        call_args().other_side(wasm().reply_data(arbitrary_bytes)),
                    ))
                    .await
                    .unwrap(),
                arbitrary_bytes
            );
        }
    })
}
pub fn canister_can_manage_other_canister ( handle : IcHandle , ctx : & ic_fondue :: pot :: Context ) { let mut rng = ctx . rng . clone ( ) ; let rt = tokio :: runtime :: Runtime :: new ( ) . expect ( " " ) ; rt . block_on ( { async move { let endpoint = get_random_nns_node_endpoint ( & handle , & mut rng ) ; endpoint . assert_ready ( ctx ) . await ; let agent = assert_create_agent ( endpoint . url . as_str ( ) ) . await ; let canister_a = UniversalCanister :: new ( & agent ) . await ; let canister_b = canister_a . update ( wasm ( ) . call ( management :: create_canister ( 2_000_000_000_000 ) ) ) . await . map ( | res | { Decode ! ( res as_slice ( ) CreateCanisterResult ) . unwrap ( ) . canister_id } ) . unwrap ( ) ; canister_a . update ( wasm ( ) . call ( management :: install_code ( canister_b , UNIVERSAL_CANISTER_WASM . to_vec ( ) , ) ) ) . await . unwrap ( ) ; let arbitrary_bytes = b" " ; assert_eq ! ( canister_a update ( wasm ( ) inter_update ( canister_b call_args ( ) other_side ( wasm ( ) reply_data ( arbitrary_bytes ) ) ) ) await unwrap ( ) arbitrary_bytes ) ; } } ) }
Canister A creates canister B; installs wasm on it; and then executes some
code on it; Each of the above operations are done in distinct steps i.e.
Canister A creates canister B ; installs wasm on it ; and then executes some code on it ; Each of the above operations are done in distinct steps i . e .
handle
IcHandle
ctx
&ic_fondue::pot::Context
handle
IcHandle
ctx
&ic_fondue::pot::Context