pub fn decode_payment_address(
hrp: &str,
s: &str,
) -> Result<PaymentAddress, Bech32DecodeError>
Expand description
Decodes a PaymentAddress
from a Bech32-encoded string.
ยงExamples
use group::Group;
use sapling::{Diversifier, PaymentAddress};
use zcash_keys::{
encoding::decode_payment_address,
};
use zcash_protocol::consensus::{TEST_NETWORK, NetworkConstants, Parameters};
let pa = PaymentAddress::from_bytes(&[
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x8e, 0x11,
0x9d, 0x72, 0x99, 0x2b, 0x56, 0x0d, 0x26, 0x50, 0xff, 0xe0, 0xbe, 0x7f, 0x35, 0x42,
0xfd, 0x97, 0x00, 0x3c, 0xb7, 0xcc, 0x3a, 0xbf, 0xf8, 0x1a, 0x7f, 0x90, 0x37, 0xf3,
0xea,
])
.unwrap();
assert_eq!(
decode_payment_address(
TEST_NETWORK.hrp_sapling_payment_address(),
"ztestsapling1qqqqqqqqqqqqqqqqqqcguyvaw2vjk4sdyeg0lc970u659lvhqq7t0np6hlup5lusxle75ss7jnk",
),
Ok(pa),
);