(
agent: &Agent,
id: Principal,
sub_paths: &str,
)
| 284 | fetch_state_path_(agent, path).await |
| 285 | } |
| 286 | pub async fn fetch_metadata( |
| 287 | agent: &Agent, |
| 288 | id: Principal, |
| 289 | sub_paths: &str, |
| 290 | ) -> anyhow::Result<Vec<u8>> { |
| 291 | let mut path: Vec<ic_agent::hash_tree::Label<Vec<u8>>> = |
| 292 | vec!["canister".as_bytes().into(), id.as_slice().into()]; |
| 293 | path.extend(sub_paths.split('/').map(|s| s.as_bytes().into())); |
| 294 | let path = StatePath { |
| 295 | path, |
| 296 | effective_id: Some(id), |
| 297 | kind: StateKind::Canister, |
| 298 | result: StateType::Blob, |
| 299 | }; |
| 300 | match fetch_state_path_(agent, path).await? { |
| 301 | IDLValue::Blob(b) => Ok(b), |
| 302 | _ => unreachable!(), |
| 303 | } |
| 304 | } |
| 305 | async fn get_canister_id_from_subnet( |
| 306 | agent: &Agent, |
| 307 | subnet_id: ic_agent::hash_tree::Label<Vec<u8>>, |
no test coverage detected