cometa-0.1.0.0: Idiomatic Haskell bindings to cardano-c
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cometa.Address.Reward

Description

Staking reward accounts, distinct from payment addresses.

import qualified Cometa.Address.Reward as Reward
import qualified Cometa.Credential as Credential
import qualified Cometa.NetworkId as Network

rewardAccount :: Credential.Credential Credential.Stake -> Reward.RewardAddress
rewardAccount = Reward.fromCredential Network.testnet
Synopsis

Documentation

data RewardAddress Source #

An immutable reward account. Equality and ordering compare network then credential (key before script, then hash bytes); Show is diagnostic.

fromCredential :: NetworkId -> Credential Stake -> RewardAddress Source #

Assemble a reward account from its network and staking authority.

networkId :: RewardAddress -> NetworkId Source #

Four-bit network tag carried by the header.

credential :: RewardAddress -> Credential Stake Source #

Staking authority controlling the rewards.

fromBytes :: ByteString -> Either Error RewardAddress Source #

Import exact reward-account bytes. Non-reward headers return UnsupportedAddressType; empty input or incorrect exact lengths return InvalidShelleyAddress. All four-bit network tags are retained.

toBytes :: RewardAddress -> ByteString Source #

Exact 29-byte header and credential encoding.

fromText :: Text -> Either Error RewardAddress Source #

Parse lowercase or all-uppercase Bech32. Mixed case, non-ASCII, empty, overlong (more than 120 characters), or mismatched network/form prefixes return InvalidShelleyAddressText. Malformed encoding or checksum returns InvalidShelleyAddressText; non-reward headers return UnsupportedAddressType; incorrect exact lengths return InvalidShelleyAddress.

toText :: RewardAddress -> Text Source #

Encode canonical lowercase Bech32, with stake for tag 1 and stake_test for other tags.