Struct walletd_bitcoin::BitcoinAddress
source · pub struct BitcoinAddress { /* private fields */ }
Expand description
Represents a Bitcoin address. Contains the address details and network The private key and public key are optional fields.
Implementations§
source§impl BitcoinAddress
impl BitcoinAddress
sourcepub fn from_hd_key(
hd_key: &HDKey,
address_format: AddressType
) -> Result<Self, Error>
pub fn from_hd_key( hd_key: &HDKey, address_format: AddressType ) -> Result<Self, Error>
Creates a new BitcoinAddress struct from an HD Key with a specified address format.
sourcepub async fn balance(
&self,
blockchain_client: &Blockstream
) -> Result<BitcoinAmount, Error>
pub async fn balance( &self, blockchain_client: &Blockstream ) -> Result<BitcoinAmount, Error>
Returns the balance of this particular BitcoinAddress as a BitcoinAmount struct.
source§impl BitcoinAddress
impl BitcoinAddress
sourcepub fn from_public_address(
public_address: &str,
network: Network
) -> Result<Self, Error>
pub fn from_public_address( public_address: &str, network: Network ) -> Result<Self, Error>
Creates a new BitcoinAddress struct from a public address string and a specified network. The created BitcoinAddress will not have info related to its private key or public key
sourcepub fn public_key(&self) -> Result<BitcoinPublicKey, Error>
pub fn public_key(&self) -> Result<BitcoinPublicKey, Error>
Returns the public key related to this BitcoinAddress. Returns an error if the public key is not present.
This method should be used in cases where either it is expected that the public key is present or the Error is handled in the case that the public key is not present.
sourcepub fn private_key(&self) -> Result<BitcoinPrivateKey, Error>
pub fn private_key(&self) -> Result<BitcoinPrivateKey, Error>
Returns the private key related to this BitcoinAddress. Returs an error if the private key is not present.
This method should be used in cases where either it is expected that the private key is present or the Error is handled in the case that the private key is not present.
sourcepub fn estimate_fee_with_default_sizes(
is_segwit: bool,
num_inputs: usize,
num_outputs: usize,
byte_fee: f64
) -> Result<u64, Error>
pub fn estimate_fee_with_default_sizes( is_segwit: bool, num_inputs: usize, num_outputs: usize, byte_fee: f64 ) -> Result<u64, Error>
Estimates the fee for a transaction with the given number of inputs and outputs given the fee per byte, makes use of default sizes to estimate the size of the transaction and the corresponding fee.
sourcepub fn address_info(&self) -> &AddressInfo
pub fn address_info(&self) -> &AddressInfo
Returns a reference to the address info related to this BitcoinAddress.
Trait Implementations§
source§impl Clone for BitcoinAddress
impl Clone for BitcoinAddress
source§fn clone(&self) -> BitcoinAddress
fn clone(&self) -> BitcoinAddress
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl CryptoAddress for BitcoinAddress
impl CryptoAddress for BitcoinAddress
source§fn public_address(&self) -> String
fn public_address(&self) -> String
source§impl Debug for BitcoinAddress
impl Debug for BitcoinAddress
source§impl PartialEq<BitcoinAddress> for BitcoinAddress
impl PartialEq<BitcoinAddress> for BitcoinAddress
source§fn eq(&self, other: &BitcoinAddress) -> bool
fn eq(&self, other: &BitcoinAddress) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for BitcoinAddress
impl StructuralEq for BitcoinAddress
impl StructuralPartialEq for BitcoinAddress
Auto Trait Implementations§
impl RefUnwindSafe for BitcoinAddress
impl Send for BitcoinAddress
impl Sync for BitcoinAddress
impl Unpin for BitcoinAddress
impl UnwindSafe for BitcoinAddress
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.