pub struct Address { /* private fields */ }Expand description
An Ark address
Used to address VTXO payments in an Ark.
Example usage:
let srv_pubkey = "03d2e3205d9fd8fb2d441e9c3aa5e28ac895f7aae68c209ae918e2750861e8ffc1".parse().unwrap();
let vtxo_pubkey = "035c4def84a9883afe60ef72b37aaf8038dd74ed3d0ab1a1f30610acccd68d1cdd".parse().unwrap();
let addr = ark::Address::builder()
.server_pubkey(srv_pubkey)
.pubkey_policy(vtxo_pubkey)
.into_address().unwrap();
assert_eq!(addr.to_string(),
"ark1pndckx4ezqqp4cn00sj5cswh7vrhh9vm647qr3ht5a57s4vdp7vrpptxv66x3ehgpqqnevf3z",
);Implementations§
Source§impl Address
impl Address
Sourcepub fn new(
testnet: bool,
ark_id: impl Into<ArkId>,
policy: VtxoPolicy,
delivery: Vec<VtxoDelivery>,
) -> Address
pub fn new( testnet: bool, ark_id: impl Into<ArkId>, policy: VtxoPolicy, delivery: Vec<VtxoDelivery>, ) -> Address
Create a new Address
Note that it might be more convenient to use Address::builder instead.
Sourcepub fn is_testnet(&self) -> bool
pub fn is_testnet(&self) -> bool
Whether or not this Address is intended to be used in a test network
Sourcepub fn is_for_server(&self, server_pubkey: PublicKey) -> bool
pub fn is_for_server(&self, server_pubkey: PublicKey) -> bool
Check whether this Address matches the given server pubkey
Sourcepub fn policy(&self) -> &VtxoPolicy
pub fn policy(&self) -> &VtxoPolicy
The VTXO policy the user wants to be paid in
Sourcepub fn delivery(&self) -> &[VtxoDelivery]
pub fn delivery(&self) -> &[VtxoDelivery]
The different VTXO delivery options provided by the user
Sourcepub fn encode_payload<W: Write + ?Sized>(
&self,
writer: &mut W,
) -> Result<(), Error>
pub fn encode_payload<W: Write + ?Sized>( &self, writer: &mut W, ) -> Result<(), Error>
Write the address payload to the writer
Sourcepub fn decode_payload(
testnet: bool,
bytes: impl Iterator<Item = u8>,
) -> Result<Address, ParseAddressError>
pub fn decode_payload( testnet: bool, bytes: impl Iterator<Item = u8>, ) -> Result<Address, ParseAddressError>
Read the address payload from the byte iterator
Returns an address straight away given the testnet indicator.
Trait Implementations§
Source§impl Ord for Address
impl Ord for Address
Source§impl PartialOrd for Address
impl PartialOrd for Address
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more