cardano::BaseAddress class

A Cardano base address object.

Public static functions

static auto fromBech32(const std::string_view addr) →  BaseAddress
Create a new BaseAddress object from a bech32 address.
static auto fromKeys(NetworkID nid, const bip32_ed25519::PublicKey& pmt_key, const bip32_ed25519::PublicKey& stake_key) →  BaseAddress
Create a new BaseAddress object from the public keys.

Constructors, destructors, conversion operators

BaseAddress(NetworkID nid, std::array<uint8_t, KEY_HASH_LENGTH> pmt_key_hash, std::array<uint8_t, KEY_HASH_LENGTH> stake_key_hash)
Construct a new BaseAddress object.

Public functions

auto toBase16(bool with_header = false) const →  std::string
Encode the address as a base16 string.
auto toBech32(const std::string_view hrp) const →  std::string
Encode the address as a bech32 string.
auto toBytes(bool with_header = false) const →  std::vector<uint8_t>
Return the address as a byte array.

Function documentation

static BaseAddress cardano::BaseAddress::fromKeys(NetworkID nid, const bip32_ed25519::PublicKey& pmt_key, const bip32_ed25519::PublicKey& stake_key)

Create a new BaseAddress object from the public keys.

Parameters
nid The network ID.
pmt_key The payment key.
stake_key The stake key.
Returns The created BaseAddress object.

cardano::BaseAddress::BaseAddress(NetworkID nid, std::array<uint8_t, KEY_HASH_LENGTH> pmt_key_hash, std::array<uint8_t, KEY_HASH_LENGTH> stake_key_hash)

Construct a new BaseAddress object.

Parameters
nid The network ID.
pmt_key_hash The payment key hash.
stake_key_hash The stake key hash.

std::string cardano::BaseAddress::toBase16(bool with_header = false) const

Encode the address as a base16 string.

Parameters
with_header Whether to include the header byte in the output.
Returns The base16 encoded address.

std::string cardano::BaseAddress::toBech32(const std::string_view hrp) const

Encode the address as a bech32 string.

Parameters
hrp The human-readable part of the bech32 string.
Returns The bech32 encoded address.

std::vector<uint8_t> cardano::BaseAddress::toBytes(bool with_header = false) const

Return the address as a byte array.

Parameters
with_header Whether to include the header byte in the output.
Returns The address as a byte array.