Vendor the two local Rust crates that build the lite backend artifact into third_party/silentdragonxlite/ (the qtlib C-ABI wrapper + the silentdragonxlitelib core, with proto/res and all the lite-send fixes), and point build-lite-backend-artifact.sh's default --backend-dir there, so the lite wallet builds without the upstream SilentDragonXLite repo. External build inputs are now only the Rust toolchain + git.dragonx.is + crates.io: - the 6 librustzcash git deps point at the git.dragonx.is/DragonX/librustzcash mirror (pinned rev acff1444), not git.hush.is; - the Sapling params are gitignored (not committed, no Git LFS) - the build fetches them from the git.dragonx.is/DragonX/zcash-params 'sapling-v1' release and verifies their SHA-256 before rust-embed bakes them in (ensure_sapling_params). For fully offline builds, cargo vendor into lib/vendor/ and add a vendored-sources redirect (vendor/ is gitignored; the script symlinks it into the prepared dir). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
47 lines
1.7 KiB
Rust
47 lines
1.7 KiB
Rust
//! Structs for handling supported address types.
|
|
|
|
use pairing::bls12_381::Bls12;
|
|
use zcash_primitives::primitives::PaymentAddress;
|
|
use zcash_client_backend::encoding::{decode_payment_address, decode_transparent_address};
|
|
use zcash_primitives::legacy::TransparentAddress;
|
|
|
|
/// An address that funds can be sent to.
|
|
pub enum RecipientAddress {
|
|
Shielded(PaymentAddress<Bls12>),
|
|
Transparent(TransparentAddress),
|
|
}
|
|
|
|
impl From<PaymentAddress<Bls12>> for RecipientAddress {
|
|
fn from(addr: PaymentAddress<Bls12>) -> Self {
|
|
RecipientAddress::Shielded(addr)
|
|
}
|
|
}
|
|
|
|
impl From<TransparentAddress> for RecipientAddress {
|
|
fn from(addr: TransparentAddress) -> Self {
|
|
RecipientAddress::Transparent(addr)
|
|
}
|
|
}
|
|
|
|
impl RecipientAddress {
|
|
pub fn from_str(s: &str, hrp_sapling_address: &str, b58_pubkey_address: [u8; 1], b58_script_address: [u8; 1]) -> Option<Self> {
|
|
// Try to match a sapling z address
|
|
if let Some(pa) = match decode_payment_address(hrp_sapling_address, s) {
|
|
Ok(ret) => ret,
|
|
Err(_) => None
|
|
}
|
|
{
|
|
Some(RecipientAddress::Shielded(pa)) // Matched a shielded address
|
|
} else if let Some(addr) = match decode_transparent_address(
|
|
&b58_pubkey_address, &b58_script_address, s) {
|
|
Ok(ret) => ret,
|
|
Err(_) => None
|
|
}
|
|
{
|
|
Some(RecipientAddress::Transparent(addr)) // Matched a transparent address
|
|
} else {
|
|
None // Didn't match anything
|
|
}
|
|
}
|
|
}
|