From 4aa90b9a4eb5470d603a18fff01747e654c89269 Mon Sep 17 00:00:00 2001 From: zancas Date: Mon, 16 Feb 2026 20:50:26 -0800 Subject: [PATCH] add optional from zp impl on BlockHeight --- Cargo.lock | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 4 ++++ src/lib.rs | 7 +++++++ 3 files changed, 68 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 59f2127..156814a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,63 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "core2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239fa3ae9b63c2dc74bd3fa852d4792b8b305ae64eeede946265b6af62f1fff3" +dependencies = [ + "memchr", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "memuse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d97bbf43eb4f088f8ca469930cde17fa036207c9a5e02ccc5107c4e8b17c964" + +[[package]] +name = "zcash_protocol" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18b1a337bbc9a7d55ae35d31189f03507dbc7934e9a4bee5c1d5c47464860e48" +dependencies = [ + "core2", + "document-features", + "hex", + "memuse", +] + [[package]] name = "zcash_wallet_interface" version = "0.1.0" +dependencies = [ + "zcash_protocol", +] diff --git a/Cargo.toml b/Cargo.toml index b9fff87..9d6a9e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,7 @@ version = "0.1.0" edition = "2024" [dependencies] +zcash_protocol = { version = "0.7", optional = true } + +[features] +zcash_protocol = ["dep:zcash_protocol"] diff --git a/src/lib.rs b/src/lib.rs index 92eff75..cbf79e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,6 +18,13 @@ pub struct UserAgentId { #[derive(Debug)] // pub struct BlockHeight(pub u32); +#[cfg(feature = "zcash_protocol")] +impl From for BlockHeight { + fn from(h: zcash_protocol::consensus::BlockHeight) -> Self { + BlockHeight(h.into()) + } +} + /// A low-level request for a payment. /// see librustzcash components zip321/src/lib.rs pub struct Payment {