zcash_keys: Add `Address::to_transparent_address`
This commit is contained in:
parent
e4dac19eb6
commit
c278405a63
|
@ -10,6 +10,7 @@ and this library adheres to Rust's notion of
|
|||
- `no-std` compatibility (`alloc` is required). A default-enabled `std` feature
|
||||
flag has been added gating the `std::error::Error` usage.
|
||||
- `zcash_keys::keys::ReceiverRequirement`
|
||||
- `zcash_keys::Address::to_transparent_address`
|
||||
|
||||
### Changed
|
||||
- Migrated to `nonempty 0.11`
|
||||
|
|
|
@ -424,6 +424,18 @@ impl Address {
|
|||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the transparent address corresponding to this address, if it is a transparent
|
||||
/// address, a Unified address with a transparent receiver, or ZIP 320 (TEX) address.
|
||||
pub fn to_transparent_address(&self) -> Option<TransparentAddress> {
|
||||
match self {
|
||||
#[cfg(feature = "sapling")]
|
||||
Address::Sapling(_) => None,
|
||||
Address::Transparent(addr) => Some(*addr),
|
||||
Address::Unified(ua) => ua.transparent().copied(),
|
||||
Address::Tex(addr_bytes) => Some(TransparentAddress::PublicKeyHash(*addr_bytes)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
|
|
Loading…
Reference in New Issue