Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(nns): Change Root interface crate to use ic-cdk #3306

Merged
merged 3 commits into from
Jan 6, 2025
Merged
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
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions rs/nns/handlers/root/interface/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ DEPENDENCIES = [
# Keep sorted.
"//rs/nervous_system/clients",
"//rs/nns/constants",
"//rs/rust_canisters/dfn_candid",
"//rs/rust_canisters/dfn_core",
"//rs/types/base_types",
"@crate_index//:candid",
"@crate_index//:ic-cdk",
Expand Down
2 changes: 0 additions & 2 deletions rs/nns/handlers/root/interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ edition = "2021"
[dependencies]
async-trait = { workspace = true }
candid = { workspace = true }
dfn_candid = { path = "../../../../rust_canisters/dfn_candid" }
dfn_core = { path = "../../../../rust_canisters/dfn_core" }
ic-base-types = { path = "../../../../types/base_types" }
ic-cdk = { workspace = true }
ic-nervous-system-clients = { path = "../../../../nervous_system/clients" }
Expand Down
17 changes: 9 additions & 8 deletions rs/nns/handlers/root/interface/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use crate::{
ChangeCanisterControllersResponse, ChangeCanisterControllersResult,
};
use async_trait::async_trait;
use dfn_candid::candid_one;
use dfn_core::call;
use ic_base_types::PrincipalId;
use ic_cdk::call;
use ic_nervous_system_clients::{
canister_id_record::CanisterIdRecord,
canister_status::{
Expand Down Expand Up @@ -44,25 +43,27 @@ impl NnsRootCanisterClient for NnsRootCanisterClientImpl {
change_canister_controllers_request: ChangeCanisterControllersRequest,
) -> Result<ChangeCanisterControllersResponse, (Option<i32>, String)> {
call(
ROOT_CANISTER_ID,
ROOT_CANISTER_ID.get().0,
"change_canister_controllers",
candid_one,
change_canister_controllers_request,
(change_canister_controllers_request,),
)
.await
.map(|(response,): (ChangeCanisterControllersResponse,)| response)
.map_err(|(code, message)| (Some(code as i32), message))
}

async fn canister_status(
&self,
canister_id_record: CanisterIdRecord,
) -> Result<CanisterStatusResult, (Option<i32>, String)> {
call(
ROOT_CANISTER_ID,
ROOT_CANISTER_ID.get().0,
"canister_status",
candid_one,
canister_id_record,
(canister_id_record,),
)
.await
.map(|(response,): (CanisterStatusResult,)| response)
.map_err(|(code, message)| (Some(code as i32), message))
}
}

Expand Down
Loading