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

feat: CanisterStatus utility #572

Merged
merged 21 commits into from
May 19, 2022
Merged

feat: CanisterStatus utility #572

merged 21 commits into from
May 19, 2022

Conversation

krpeacock
Copy link
Contributor

@krpeacock krpeacock commented May 19, 2022

Description

The CanisterStatus utility is used to request structured data directly from the IC public API. This data can be accessed using agent.readState, but CanisterStatus provides a helpful abstraction with some known paths.

You can request a canisters Controllers, ModuleHash, Candid interface, Subnet, or Time, or provide a custom path {@link CanisterStatus.CustomPath} and pass arbitrary buffers for valid paths identified in https://smartcontracts.org/docs/current/references/ic-interface-spec/.

How Has This Been Tested?

Unit testing & local e2e testing

Checklist:

  • My changes follow the guidelines in CONTRIBUTING.md.
  • The title of this PR complies with Conventional Commits.
  • I have edited the CHANGELOG accordingly.
  • I have made corresponding changes to the documentation.

@krpeacock krpeacock requested review from a team and chenyan-dfinity May 19, 2022 19:23
@@ -0,0 +1,245 @@
/** @module CanisterStatus */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if canisterStatus is a good name. time and subnet are not tied to the canister. Maybe call it StateTree to match with the interface spec?

Copy link
Contributor Author

@krpeacock krpeacock May 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reasoning is that StateTree sounds overly generic - state tree of what? The entire IC? State tends to be an overloaded term in frontend

The feature was motivated by me wanting to discover the ModuleHash, Metadata, Controllers, and Subnet of a canister. I'd like the naming to reflect that motivation, which should make it more discoverable.

the fact that this involves a state tree in a certificate is more or less an implementation detail, from my POV as a developer

packages/agent/src/canisterStatus/index.ts Outdated Show resolved Hide resolved
packages/agent/src/canisterStatus/index.ts Outdated Show resolved Hide resolved
packages/agent/src/certificate.ts Outdated Show resolved Hide resolved
krpeacock and others added 4 commits May 19, 2022 13:16
Co-authored-by: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com>
Co-authored-by: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com>
packages/agent/src/canisterStatus/index.ts Outdated Show resolved Hide resolved
packages/agent/src/certificate.ts Outdated Show resolved Hide resolved
docs/generated/changelog.html Outdated Show resolved Hide resolved
krpeacock and others added 5 commits May 19, 2022 14:18
Co-authored-by: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com>
Co-authored-by: Yan Chen <48968912+chenyan-dfinity@users.noreply.github.com>
@krpeacock krpeacock merged commit faf850c into main May 19, 2022
@krpeacock krpeacock deleted the SDK-493-canister-state-api branch May 19, 2022 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants