| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Api.Tx.Address
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.
Constructors
| Addr Network (Credential 'Payment) StakeReference | |
| AddrBootstrap BootstrapAddress |
Instances
getNetwork ∷ Addr → Network Source #
Lookup a Network Id for an Address
newtype BootstrapAddress Source #
Constructors
| BootstrapAddress | |
Fields | |
Instances
| NFData BootstrapAddress | |||||
Defined in Cardano.Ledger.Address Methods rnf ∷ BootstrapAddress → () # | |||||
| Generic BootstrapAddress | |||||
Defined in Cardano.Ledger.Address Associated Types
Methods from ∷ BootstrapAddress → Rep BootstrapAddress x # to ∷ Rep BootstrapAddress x → BootstrapAddress # | |||||
| Show BootstrapAddress | |||||
Defined in Cardano.Ledger.Address Methods showsPrec ∷ Int → BootstrapAddress → ShowS # show ∷ BootstrapAddress → String # showList ∷ [BootstrapAddress] → ShowS # | |||||
| Eq BootstrapAddress | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| Ord BootstrapAddress | |||||
Defined in Cardano.Ledger.Address Methods compare ∷ BootstrapAddress → BootstrapAddress → Ordering # (<) ∷ BootstrapAddress → BootstrapAddress → Bool # (<=) ∷ BootstrapAddress → BootstrapAddress → Bool # (>) ∷ BootstrapAddress → BootstrapAddress → Bool # (>=) ∷ BootstrapAddress → BootstrapAddress → Bool # max ∷ BootstrapAddress → BootstrapAddress → BootstrapAddress # min ∷ BootstrapAddress → BootstrapAddress → BootstrapAddress # | |||||
| NoThunks BootstrapAddress | |||||
Defined in Cardano.Ledger.Address | |||||
| type Rep BootstrapAddress | |||||
Defined in Cardano.Ledger.Address type Rep BootstrapAddress = D1 ('MetaData "BootstrapAddress" "Cardano.Ledger.Address" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "BootstrapAddress" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBootstrapAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Address))) | |||||
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.
Constructors
| 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 |
Fields
| |
Instances
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
Constructors
| RewardAccount | |
Fields
| |
Instances
| FromJSON RewardAccount | |||||
Defined in Cardano.Ledger.Address Methods parseJSON ∷ Value → Parser RewardAccount Source # parseJSONList ∷ Value → Parser [RewardAccount] Source # | |||||
| FromJSONKey RewardAccount | |||||
Defined in Cardano.Ledger.Address | |||||
| ToJSON RewardAccount | |||||
Defined in Cardano.Ledger.Address Methods toJSON ∷ RewardAccount → Value Source # toEncoding ∷ RewardAccount → Encoding Source # toJSONList ∷ [RewardAccount] → Value Source # | |||||
| ToJSONKey RewardAccount | |||||
Defined in Cardano.Ledger.Address | |||||
| DecCBOR RewardAccount | |||||
Defined in Cardano.Ledger.Address | |||||
| EncCBOR RewardAccount | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| Default RewardAccount | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| NFData RewardAccount | |||||
Defined in Cardano.Ledger.Address Methods rnf ∷ RewardAccount → () # | |||||
| Generic RewardAccount | |||||
Defined in Cardano.Ledger.Address Associated Types
| |||||
| Show RewardAccount | |||||
Defined in Cardano.Ledger.Address Methods showsPrec ∷ Int → RewardAccount → ShowS # show ∷ RewardAccount → String # showList ∷ [RewardAccount] → ShowS # | |||||
| Eq RewardAccount | |||||
Defined in Cardano.Ledger.Address | |||||
| Ord RewardAccount | |||||
Defined in Cardano.Ledger.Address Methods compare ∷ RewardAccount → RewardAccount → Ordering # (<) ∷ RewardAccount → RewardAccount → Bool # (<=) ∷ RewardAccount → RewardAccount → Bool # (>) ∷ RewardAccount → RewardAccount → Bool # (>=) ∷ RewardAccount → RewardAccount → Bool # | |||||
| NoThunks RewardAccount | |||||
Defined in Cardano.Ledger.Address | |||||
| type Rep RewardAccount | |||||
Defined in Cardano.Ledger.Address type Rep RewardAccount = D1 ('MetaData "RewardAccount" "Cardano.Ledger.Address" "cardano-ledger-core-1.19.0.0-inplace" 'False) (C1 ('MetaCons "RewardAccount" 'PrefixI 'True) (S1 ('MetaSel ('Just "raNetwork") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Network) :*: S1 ('MetaSel ('Just "raCredential") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Credential 'Staking)))) | |||||
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).