ledger-core
Public Member Functions | Static Public Member Functions | List of all members
ledger::core::BitcoinLikeAddress Class Reference
+ Inheritance diagram for ledger::core::BitcoinLikeAddress:
+ Collaboration diagram for ledger::core::BitcoinLikeAddress:

Public Member Functions

 BitcoinLikeAddress (const api::Currency &currency, const std::vector< uint8_t > &hash160, const std::string &keychainEngine, const Option< std::string > &derivationPath=Option< std::string >())
 
virtual std::vector< uint8_t > getVersion () override
 
std::vector< uint8_t > getVersionFromKeychainEngine (const std::string &keychainEngine, const api::BitcoinLikeNetworkParameters &params) const
 
virtual std::vector< uint8_t > getHash160 () override
 
virtual api::BitcoinLikeNetworkParameters getNetworkParameters () override
 
virtual std::string toBase58 () override
 
virtual std::string toBech32 () override
 
std::string toBase58 () const
 
std::string toBech32 () const
 
virtual bool isP2SH () override
 
virtual bool isP2PKH () override
 
virtual bool isP2WSH () override
 
virtual bool isP2WPKH () override
 
virtual optional< std::string > getDerivationPath () override
 
std::string toString () override
 
std::string getStringAddress () const
 
- Public Member Functions inherited from ledger::core::AbstractAddress
 AbstractAddress (const api::Currency &currency, const Option< std::string > &path)
 
api::Currency getCurrency () override
 
optional< std::string > getDerivationPath () override
 
std::shared_ptr< api::BitcoinLikeAddressasBitcoinLikeAddress () override
 
bool isInstanceOfBitcoinLikeAddress () override
 

Static Public Member Functions

static std::shared_ptr< AbstractAddressparse (const std::string &address, const api::Currency &currency, const Option< std::string > &derivationPath=Option< std::string >())
 
static std::shared_ptr< BitcoinLikeAddressfromBase58 (const std::string &address, const api::Currency &currency, const Option< std::string > &derivationPath=Option< std::string >())
 
static std::shared_ptr< BitcoinLikeAddressfromBech32 (const std::string &address, const api::Currency &currency, const Option< std::string > &derivationPath=Option< std::string >())
 
static std::string fromPublicKey (const std::shared_ptr< api::BitcoinLikeExtendedPublicKey > &pubKey, const api::Currency &currency, const std::string &derivationPath, const std::string &keychainEngine)
 
static std::vector< uint8_t > fromPublicKeyToHash160 (const std::vector< uint8_t > &pubKey, const std::vector< uint8_t > &pubKeyHash160, const api::Currency &currency, const std::string &keychainEngine)
 
static std::vector< uint8_t > fromPublicKeyToHash160 (const std::vector< uint8_t > &pubKey, const api::Currency &currency, const std::string &keychainEngine)
 
- Static Public Member Functions inherited from ledger::core::api::Address
static std::shared_ptr< Addressparse (const std::string &address, const Currency &currency)
 
static bool isValid (const std::string &address, const Currency &currency)
 

Member Function Documentation

◆ getDerivationPath()

std::experimental::optional< std::string > ledger::core::BitcoinLikeAddress::getDerivationPath ( )
overridevirtual

Gets an optional derivation path (if the address is owned by an account).

Returns
The derivation path of the address

Implements ledger::core::api::Address.

◆ getHash160()

std::vector< uint8_t > ledger::core::BitcoinLikeAddress::getHash160 ( )
overridevirtual

Gets the raw hash160 of the public key

Returns
The 20 bytes of the public key hash160

Implements ledger::core::api::BitcoinLikeAddress.

◆ getNetworkParameters()

ledger::core::api::BitcoinLikeNetworkParameters ledger::core::BitcoinLikeAddress::getNetworkParameters ( )
overridevirtual

Gets the network parameters used for serializing the address

Returns
The network parameters of the address

Implements ledger::core::api::BitcoinLikeAddress.

◆ getVersion()

std::vector< uint8_t > ledger::core::BitcoinLikeAddress::getVersion ( )
overridevirtual

Gets the version of the address (P2SH or P2PKH)

Returns
The version of the address

Implements ledger::core::api::BitcoinLikeAddress.

◆ isP2PKH()

bool ledger::core::BitcoinLikeAddress::isP2PKH ( )
overridevirtual

Checks if the given address is a P2PKH address

Returns
if the keychain engine is P2PKH

Implements ledger::core::api::BitcoinLikeAddress.

◆ isP2SH()

bool ledger::core::BitcoinLikeAddress::isP2SH ( )
overridevirtual

Serializes the hash160 to a payment uri (i.e bitcoin:16UwLL9Risc3QfPqBUvKofHmBQ7wMtjvM)

Returns
A payment uri to this address toPaymentUri(): string; Checks if the given address is a P2SH address
True if the keychain engine is P2SH

Implements ledger::core::api::BitcoinLikeAddress.

◆ isP2WPKH()

bool ledger::core::BitcoinLikeAddress::isP2WPKH ( )
overridevirtual

Checks if the given address is a P2WPKH address

Returns
True if the keychain engine is P2WPKH

Implements ledger::core::api::BitcoinLikeAddress.

◆ isP2WSH()

bool ledger::core::BitcoinLikeAddress::isP2WSH ( )
overridevirtual

Checks if the given address is a P2WSH address

Returns
True if the keychain engine is P2WSH

Implements ledger::core::api::BitcoinLikeAddress.

◆ toBase58()

std::string ledger::core::BitcoinLikeAddress::toBase58 ( )
overridevirtual

Serializes the hash160 into a Base58 encoded address (with checksum)

Returns
The Base58 serialization

Implements ledger::core::api::BitcoinLikeAddress.

◆ toBech32()

std::string ledger::core::BitcoinLikeAddress::toBech32 ( )
overridevirtual

Get the Bech32 encoded address (with respect to BIP173)

Returns
The Bech32 encoded address

Implements ledger::core::api::BitcoinLikeAddress.

◆ toString()

std::string ledger::core::BitcoinLikeAddress::toString ( )
overridevirtual

Serialize the address to a string. The serialization method depends of the underlying currency and format (Base58, Bech32, Ethereum...).

Implements ledger::core::api::Address.


The documentation for this class was generated from the following files: