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

chore: Add view_account, view_code, view_block #82

Merged
merged 9 commits into from
Mar 4, 2022

Conversation

ChaoticTempest
Copy link
Member

This adds a couple convenience functions to Worker and Account types:

  • view_account: stuff like balance and storage usage
  • view_code
  • view_block: to grab latest block timestamps

Also addresses #76

workspaces/src/network/block.rs Show resolved Hide resolved
workspaces/src/worker/impls.rs Show resolved Hide resolved
workspaces/src/worker/impls.rs Show resolved Hide resolved
workspaces/src/worker/impls.rs Show resolved Hide resolved
workspaces/src/network/account.rs Outdated Show resolved Hide resolved
workspaces/src/network/account.rs Show resolved Hide resolved
workspaces/src/network/block.rs Outdated Show resolved Hide resolved
@@ -93,3 +96,15 @@ impl TryFrom<Vec<u8>> for CryptoHash {
<Self as TryFrom<&[u8]>>::try_from(v.as_ref())
}
}

impl fmt::Debug for CryptoHash {
Copy link
Contributor

Choose a reason for hiding this comment

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

impl std::hash::Hash seems like a reasonable addition.

Copy link
Contributor

Choose a reason for hiding this comment

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

So you can use it as keys to HashMap & HashSet

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, could derive it, probably worth adding

Copy link
Contributor

Choose a reason for hiding this comment

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

So you can use it as keys to HashMap & HashSet

oops had deleted my comment and updated it before I saw you responded. Sorry for my brain lapse :D

@ChaoticTempest ChaoticTempest merged commit fad4c97 into main Mar 4, 2022
@ChaoticTempest ChaoticTempest deleted the chore/convenient-functions branch March 4, 2022 19:36
@frol frol mentioned this pull request Oct 4, 2023
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.

4 participants