Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Addr
- getNetwork ∷ Addr → Network
- newtype BootstrapAddress = BootstrapAddress {}
- serialiseAddr ∷ Addr → ByteString
- decodeAddr ∷ MonadFail m ⇒ ByteString → m Addr
- decodeAddrEither ∷ ByteString → Either String Addr
- decodeAddrShort ∷ MonadFail m ⇒ ShortByteString → m Addr
- decodeAddrShortEither ∷ ShortByteString → Either String Addr
- data DecAddr
- decodeAddrLenient ∷ MonadFail m ⇒ ByteString → m Addr
- decodeAddrLenientEither ∷ ByteString → Either String DecAddr
- data RewardAccount = RewardAccount {
- raNetwork ∷ !Network
- raCredential ∷ !(Credential 'Staking)
- serialiseRewardAccount ∷ RewardAccount → ByteString
- deserialiseRewardAccount ∷ ByteString → Maybe RewardAccount
Address
An address for UTxO.
Contents of Addr data type are intentionally left as lazy, otherwise operating on compact form of an address will result in redundant work.
Instances
FromJSON Addr | |
FromJSONKey Addr | |
ToJSON Addr | |
ToJSONKey Addr | |
Defined in Cardano.Ledger.Address | |
Generic Addr | |
Show Addr | |
DecCBOR Addr | |
EncCBOR Addr | |
NFData Addr | |
Defined in Cardano.Ledger.Address | |
Eq Addr | |
Ord Addr | |
NoThunks Addr | |
type Rep Addr | |
Defined in Cardano.Ledger.Address type Rep Addr = D1 ('MetaData "Addr" "Cardano.Ledger.Address" "cardano-ledger-core-1.17.0.0-inplace" 'False) (C1 ('MetaCons "Addr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Network) :*: (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 PaymentCredential) :*: S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 StakeReference))) :+: C1 ('MetaCons "AddrBootstrap" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BootstrapAddress))) |
getNetwork ∷ Addr → Network Source #
Lookup a Network Id for an Address
newtype BootstrapAddress Source #
Instances
serialiseAddr ∷ Addr → ByteString Source #
Serialise an address to the external format.
Strict decoders
Decoders below will only decode addresses that are allowed to be placed on chain
today. Historically there were a few bugs in the decoder which allowed a few
malformed addressed to be placed on chain. If you need backwards compatibility, reach
out for decodeAddrLenient
.
decodeAddr ∷ MonadFail m ⇒ ByteString → m Addr Source #
Strict decoder for an address from a ByteString
. This will not let you decode some
of the buggy addresses that have been placed on chain. This decoder is intended for
addresses that are to be placed on chian today.
decodeAddrEither ∷ ByteString → Either String Addr Source #
Same as decodeAddr
, but produces an Either
result
decodeAddrShort ∷ MonadFail m ⇒ ShortByteString → m Addr Source #
Same as decodeAddr
, but works on ShortByteString
decodeAddrShortEither ∷ ShortByteString → Either String Addr Source #
Same as decodeAddrShort
, but produces an Either
result
Lenient decoders
These lenient decoders do not fail for addresses with known bugs
Decoded Address.
DecAddr Addr | Address was decoded with no problems |
DecAddrBadPtr Addr | Address was decoded, but it contains an invalid |
DecAddrUnconsumed | Address was decoded, but not all of input was consumed |
|
decodeAddrLenient ∷ MonadFail m ⇒ ByteString → m Addr Source #
This is a lenient decoder that will disregard known bugs in the address
deserialization. This function is intended for clients that need to deal with
historical data that has already been placed on chain. If you also require information
on what exactly is bad in the address, or you would like to guard only against a
specific bug, you should use decodeAddrLenientEither
instead.
Since: 1.8.0
decodeAddrLenientEither ∷ ByteString → Either String DecAddr Source #
Decode an address and fail only for addresses that could have never been placed on
chain, while decoding addresses with information about potential problems in
them. Similar to decodeAddrLenient
, this function is not intended for addresses that
will be placed into a new transaction.
Since: 1.8.0
Reward Account
data RewardAccount Source #
An account based address for rewards
Instances
serialiseRewardAccount ∷ RewardAccount → ByteString Source #
Serialise a reward account to the external format.
deserialiseRewardAccount ∷ ByteString → Maybe RewardAccount Source #
Deserialise a reward account from the external format. This will fail if the input data is not in the right format (or if there is trailing data).