pub struct PaymentCode {
pub version: PaymentCodeVersion,
pub features: u8,
pub public_key: PublicKey,
pub chain_code: [u8; 32],
pub network: Network,
}Expand description
BIP 47 payment code
A payment code is a shareable identifier that allows others to send payments to you without requiring you to share new addresses for each transaction.
Fields§
§version: PaymentCodeVersionVersion of the payment code
features: u8Feature bits (reserved for future use)
public_key: PublicKeyPublic key for ECDH
chain_code: [u8; 32]Chain code for key derivation
network: NetworkNetwork (mainnet, testnet, etc.)
Implementations§
Source§impl PaymentCode
impl PaymentCode
Sourcepub fn new(
version: PaymentCodeVersion,
public_key: PublicKey,
chain_code: [u8; 32],
network: Network,
) -> Self
pub fn new( version: PaymentCodeVersion, public_key: PublicKey, chain_code: [u8; 32], network: Network, ) -> Self
Create a new payment code
Sourcepub fn to_base58(&self) -> String
pub fn to_base58(&self) -> String
Convert to base58 string format
Format: PM8T[version][features][pubkey][chaincode]
Sourcepub fn from_base58(s: &str) -> Result<Self, BitcoinError>
pub fn from_base58(s: &str) -> Result<Self, BitcoinError>
Parse from base58 string
Trait Implementations§
Source§impl Clone for PaymentCode
impl Clone for PaymentCode
Source§fn clone(&self) -> PaymentCode
fn clone(&self) -> PaymentCode
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PaymentCode
impl Debug for PaymentCode
Source§impl<'de> Deserialize<'de> for PaymentCode
impl<'de> Deserialize<'de> for PaymentCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PaymentCode
impl PartialEq for PaymentCode
Source§impl Serialize for PaymentCode
impl Serialize for PaymentCode
impl Eq for PaymentCode
impl StructuralPartialEq for PaymentCode
Auto Trait Implementations§
impl Freeze for PaymentCode
impl RefUnwindSafe for PaymentCode
impl Send for PaymentCode
impl Sync for PaymentCode
impl Unpin for PaymentCode
impl UnwindSafe for PaymentCode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.