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

Poc microcrate account #972

Closed
wants to merge 7 commits into from
Closed
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
10 changes: 10 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ members = [
"zingo-testvectors",
"zingo-netutils",
"zingo-memo",
"zingo-account",
]
resolver = "2"

Expand Down
11 changes: 11 additions & 0 deletions zingo-account/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "zingo-account"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
zcash_keys.workspace = true
zcash_client_backend.workspace = true
zip32.workspace = true
28 changes: 28 additions & 0 deletions zingo-account/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! A micro crate to provide a wrapper around the zcash_client_backend account trait.
//! By constraining the wrapper to be independent of internal zingolib functionality
//! we expose a shareable component, and refine the definition of zingolib.

/// The a view-only abstraction that provides a management interface for
Copy link
Contributor

Choose a reason for hiding this comment

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

"The a view-only" is a typo? also comment seems to just ...end. I am ok to chalk that up to the TODO if you want

/// TODO: Explain more about our Account abstraction.
pub struct ZingoAccount(
pub zip32::AccountId,
pub zcash_keys::keys::UnifiedFullViewingKey,
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think we should make fields pub unless there is a really good reason? is there one?
the id and ufvk methods are private though which is surprising. Have you looked at how this Account trait is used in LRZ?

);

impl zcash_client_backend::data_api::Account<zip32::AccountId> for ZingoAccount {
fn id(&self) -> zip32::AccountId {
self.0
}

fn source(&self) -> zcash_client_backend::data_api::AccountSource {
unimplemented!()
}

fn ufvk(&self) -> Option<&zcash_keys::keys::UnifiedFullViewingKey> {
Some(&self.1)
}

fn uivk(&self) -> zcash_keys::keys::UnifiedIncomingViewingKey {
unimplemented!()
}
}
1 change: 1 addition & 0 deletions zingolib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ zingo-memo = { path = "../zingo-memo" }
zingo-status = { path = "../zingo-status" }
zingo-testvectors = { path = "../zingo-testvectors", optional = true }
zingo-netutils = { path = "../zingo-netutils" }
zingo-account = { path = "../zingo-account" }

http-body = { workspace = true }
hyper = { workspace = true }
Expand Down
Loading