diff --git a/Cargo.lock b/Cargo.lock index 7468bbef0..5c012779d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4160,6 +4160,15 @@ dependencies = [ "syn 2.0.59", ] +[[package]] +name = "zingo-account" +version = "0.1.0" +dependencies = [ + "zcash_client_backend", + "zcash_keys", + "zip32", +] + [[package]] name = "zingo-cli" version = "0.2.0" @@ -4331,6 +4340,7 @@ dependencies = [ "zcash_note_encryption", "zcash_primitives", "zcash_proofs", + "zingo-account", "zingo-memo", "zingo-netutils", "zingo-status", diff --git a/Cargo.toml b/Cargo.toml index 6ae991e29..d24c32425 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,7 @@ members = [ "zingo-testvectors", "zingo-netutils", "zingo-memo", + "zingo-account", ] resolver = "2" diff --git a/zingo-account/Cargo.toml b/zingo-account/Cargo.toml new file mode 100644 index 000000000..e12fc829d --- /dev/null +++ b/zingo-account/Cargo.toml @@ -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 diff --git a/zingo-account/src/lib.rs b/zingo-account/src/lib.rs new file mode 100644 index 000000000..e832271d2 --- /dev/null +++ b/zingo-account/src/lib.rs @@ -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 +/// TODO: Explain more about our Account abstraction. +pub struct ZingoAccount( + pub zip32::AccountId, + pub zcash_keys::keys::UnifiedFullViewingKey, +); + +impl zcash_client_backend::data_api::Account 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!() + } +} diff --git a/zingolib/Cargo.toml b/zingolib/Cargo.toml index 0042cbf5b..0f8227a8d 100644 --- a/zingolib/Cargo.toml +++ b/zingolib/Cargo.toml @@ -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 }