Retrieving canister_status or settings with PicJS

Hi,

How can I get the canister_status of a canister spun up with Pic-JS?

If that’s not available, is there a way to retrieve the settings of a deployed canister?

Context: I want to assert that my factory spins up canisters with the expected custom default settings.

Side note: I’m asking because I assume I can’t use an HTTP client to initialize an IC management actor in this context.

The only thing you can right now is make an updateCall() to the management canister.

The code for createCanister() can be used as an example starting point for implementing that.

When support for live mode has been added to pic-js, we’ll be able to use HTTP clients, agent-js and all of the existing libraries for handling stuff like this.

1 Like

EDIT: The following is not true. Leaving it here for reference (I don’t see how to strike through in this text editor).

One would have to set the target subnet ID manually though (otherwise the call can’t be routed by PocketIC). Adding a new API allowing to populate an effective canister ID (to match the actual application canister ID) would simplify such calls.

1 Like

Thanks, Nathan!! I had completely forgotten that I’d already used this workaround to implement chunked installation. I only realized it when I started re-implementing the same solution :sweat_smile:. I guess that’s what happens with a large codebase and too many tests :grinning_face_with_smiling_eyes:.

For anyone interested: I scoped this solution to a test-only PR, so you can check out the code there :backhand_index_pointing_right: https://github.com/junobuild/juno/pull/1778

I don’t know if PicJS does some magic under the hood, but in my case, setting the target subnet ID isn’t necessary for my test suite :man_shrugging:.

1 Like

You’re right. The PocketIC server actually derives the effective canister ID automatically (if it can).

2 Likes