(id: &str, helper: &MyHelper)
| 147 | } |
| 148 | |
| 149 | pub fn str_to_principal(id: &str, helper: &MyHelper) -> Result<Principal> { |
| 150 | let try_id = Principal::from_text(id); |
| 151 | Ok(match try_id { |
| 152 | Ok(id) => id, |
| 153 | Err(_) => match helper.env.0.get(id) { |
| 154 | Some(IDLValue::Principal(id)) => *id, |
| 155 | Some(IDLValue::Service(id)) => *id, |
| 156 | Some(IDLValue::Func(id, _)) => *id, |
| 157 | _ => return Err(anyhow!("{} is not a canister id", id)), |
| 158 | }, |
| 159 | }) |
| 160 | } |
| 161 | |
| 162 | pub fn get_effective_canister_id( |
| 163 | canister_id: Principal, |
no test coverage detected