cardano::RewardsAddress class

A Cardano rewards address object.

Public static functions

static auto fromBech32(const std::string_view addr) →  RewardsAddress
Factory method to create a RewardsAddress object from a bech32 address.
static auto fromKey(NetworkID nid, const bip32_ed25519::PublicKey& stake_key) →  RewardsAddress
Factory method to create a RewardsAddress object from a key.

Constructors, destructors, conversion operators

RewardsAddress(NetworkID nid, std::array<uint8_t, KEY_HASH_LENGTH> key_hash)
Construct a new RewardsAddress 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 RewardsAddress cardano::RewardsAddress::fromBech32(const std::string_view addr)

Factory method to create a RewardsAddress object from a bech32 address.

Parameters
addr The bech32 address.
Returns The created RewardsAddress object.

static RewardsAddress cardano::RewardsAddress::fromKey(NetworkID nid, const bip32_ed25519::PublicKey& stake_key)

Factory method to create a RewardsAddress object from a key.

Parameters
nid The network ID enum.
stake_key The stake key.
Returns The created RewardsAddress object.

cardano::RewardsAddress::RewardsAddress(NetworkID nid, std::array<uint8_t, KEY_HASH_LENGTH> key_hash)

Construct a new RewardsAddress object.

Parameters
nid The network ID enum.
key_hash The key hash.

std::string cardano::RewardsAddress::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::RewardsAddress::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::RewardsAddress::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.