Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions candid/registry.did
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ service : {
"add" : (trusted_source: opt principal, canister: add_canister_input) -> (operation_response);
"remove" : (trusted_source: opt principal, canister: principal) -> (operation_response);
"get_all" : () -> (vec canister_metadata) query;
"get_multiple": (vec principal) -> (vec opt canister_metadata) query;

"add_admin" : (admin: principal) -> (operation_response);
}
13 changes: 13 additions & 0 deletions registries/canister_registry/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ pub fn get(canister: Principal) -> Option<&'static CanisterMetadata> {
canister_db.get_info(canister)
}

#[query]
pub fn get_multiple(canister_ids: Vec<Principal>) -> Vec<Option<&'static CanisterMetadata>> {
let mut response = vec![];

for canister_id in canister_ids {
let canister_db = ic::get_mut::<CanisterDB>();
let canister = canister_db.get_info(canister_id);
response.push(canister);
}

return response;
}

#[update]
pub fn add(
trusted_source: Option<Principal>,
Expand Down