How do I migrate use ic_cdk::api::management_canister::main::CanisterIdRecord; with the ic_cdk v0.18?
The new module api::management_canister does not seem to expose the record.
How do I migrate use ic_cdk::api::management_canister::main::CanisterIdRecord; with the ic_cdk v0.18?
The new module api::management_canister does not seem to expose the record.
Ah nvm, got it. Those are not needed anymore because each function is now typed with a related struct.
For example:
// Old
let result = delete_canister(CanisterIdRecord { canister_id }).await;
//
let result = delete_canister(&DeleteCanisterArgs { canister_id }).await;
Having trouble with ic_cdk::api::management_canister::http_request::HttpResponse;
cannot find where `HttpResponse` is exposed...
use of deprecated struct `ic_cdk::api::management_canister::http_request::HttpResponse`: The `api::management_canister::http_request` module is deprecated. Please use the `management_canister` module at the crate root
(nothing is here…)
and for some reason ic-cdk-bindgen(0.1.3) produces deprecated code as well ![]()
The deprecation message suggests using the ic_cdk::management_canister module.
In your case, the old HttpResponse struct you are looking for is now ic_cdk::management_canister::HttpRequestResult.
An HTTPS Outcall will then look like this:
use ic_cdk::management_canister::{HttpRequestArgs, HttpRequestResult};
async fn my_http_request(args: &HttpRequestArgs) -> HttpRequestResult {
ic_cdk::management_canister::http_request(args)
.await
.unwrap()
}
Any idea what is happening with ic-cdk-bindgen? My canister uses a lot of auto generated code(because it’s using a lot of other services for which I generated bindings from candid)…
And latest bindgen just generates code which is deprecated in the latest ic-cdk release
We’ll upgrade ic-cdk-bindgen to support v0.18 as soon as possible.
In the meantime, you can manually upgrade your generated bindings to use Bounded-wait calls. The ic-cdk’s V18 upgrading guide is a good reference on how to do that.
For a more practical example, the updates made to the example.rs test asset in this PR are also a good reference.
great write up, a reference from the main README.md could be useful maybe(I couldn’t find this guide right away)
I guess I have to wait for ic-cdk-bindgen updates, there’s just no way I’m updating all those bindings I use manually(way too many). Or I need to silence the warnings until ic-cdk-bindgen is updated
Anyway, thanks for your help!