Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Addr c
- = Addr Network (PaymentCredential c) (StakeReference c)
- | AddrBootstrap (BootstrapAddress c)
- getNetwork ∷ Addr c → Network
- newtype BootstrapAddress c = BootstrapAddress {}
- serialiseAddr ∷ Addr c → ByteString
- decodeAddr ∷ (Crypto c, MonadFail m) ⇒ ByteString → m (Addr c)
- decodeAddrEither ∷ Crypto c ⇒ ByteString → Either String (Addr c)
- decodeAddrShort ∷ (Crypto c, MonadFail m) ⇒ ShortByteString → m (Addr c)
- decodeAddrShortEither ∷ Crypto c ⇒ ShortByteString → Either String (Addr c)
- data DecAddr c
- = DecAddr (Addr c)
- | DecAddrBadPtr (Addr c)
- | DecAddrUnconsumed (Addr c) ByteString
- decodeAddrLenient ∷ (Crypto c, MonadFail m) ⇒ ByteString → m (Addr c)
- decodeAddrLenientEither ∷ Crypto c ⇒ ByteString → Either String (DecAddr c)
- data RewardAccount c = RewardAccount {
- raNetwork ∷ !Network
- raCredential ∷ !(Credential 'Staking c)
- serialiseRewardAccount ∷ RewardAccount c → ByteString
- deserialiseRewardAccount ∷ Crypto c ⇒ ByteString → Maybe (RewardAccount c)
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
getNetwork ∷ Addr c → Network Source #
Lookup a Network Id for an Address
newtype BootstrapAddress c Source #
Instances
serialiseAddr ∷ Addr c → 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 ∷ (Crypto c, MonadFail m) ⇒ ByteString → m (Addr c) 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 ∷ Crypto c ⇒ ByteString → Either String (Addr c) Source #
Same as decodeAddr
, but produces an Either
result
decodeAddrShort ∷ (Crypto c, MonadFail m) ⇒ ShortByteString → m (Addr c) Source #
Same as decodeAddr
, but works on ShortByteString
decodeAddrShortEither ∷ Crypto c ⇒ ShortByteString → Either String (Addr c) 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 c) | Address was decoded with no problems |
DecAddrBadPtr (Addr c) | Address was decoded, but it contains an invalid |
DecAddrUnconsumed | Address was decoded, but not all of input was consumed |
|
decodeAddrLenient ∷ (Crypto c, MonadFail m) ⇒ ByteString → m (Addr c) 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 ∷ Crypto c ⇒ ByteString → Either String (DecAddr c) 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 c Source #
An account based address for rewards
RewardAccount | |
|
Instances
serialiseRewardAccount ∷ RewardAccount c → ByteString Source #
Serialise a reward account to the external format.
deserialiseRewardAccount ∷ Crypto c ⇒ ByteString → Maybe (RewardAccount c) 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).