| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Ledger.Address
Contents
Synopsis
- serialiseAddr ∷ Addr → ByteString
- data Addr
- newtype BootstrapAddress = BootstrapAddress {}
- bootstrapAddressAttrsSize ∷ BootstrapAddress → Int
- isBootstrapRedeemer ∷ BootstrapAddress → Bool
- getNetwork ∷ Addr → Network
- data AccountAddress = AccountAddress {}
- newtype AccountId = AccountId {}
- accountAddressAccountIdL ∷ Lens' AccountAddress AccountId
- accountAddressCredentialL ∷ Lens' AccountAddress (Credential 'Staking)
- accountAddressNetworkIdL ∷ Lens' AccountAddress Network
- serialiseAccountAddress ∷ AccountAddress → ByteString
- deserialiseAccountAddress ∷ ByteString → Maybe AccountAddress
- putAccountAddress ∷ AccountAddress → Put
- decodeAccountAddress ∷ (AddressBuffer b, MonadFail m) ⇒ b → m AccountAddress
- fromCborAccountAddress ∷ Decoder s AccountAddress
- pattern RewardAccount ∷ Network → Credential 'Staking → AccountAddress
- raNetwork ∷ AccountAddress → Network
- raCredential ∷ AccountAddress → Credential 'Staking
- rewardAccountCredentialL ∷ Lens' AccountAddress (Credential 'Staking)
- rewardAccountNetworkL ∷ Lens' AccountAddress Network
- serialiseRewardAccount ∷ AccountAddress → ByteString
- deserialiseRewardAccount ∷ ByteString → Maybe AccountAddress
- putRewardAccount ∷ AccountAddress → Put
- decodeRewardAccount ∷ (AddressBuffer b, MonadFail m) ⇒ b → m AccountAddress
- fromCborRewardAccount ∷ Decoder s AccountAddress
- bootstrapKeyHash ∷ BootstrapAddress → KeyHash 'Payment
- putAddr ∷ Addr → Put
- putCredential ∷ ∀ (kr ∷ KeyRole). Credential kr → Put
- putPtr ∷ Ptr → Put
- putVariableLengthWord64 ∷ Word64 → Put
- newtype Word7 = Word7 Word8
- toWord7 ∷ Word8 → Word7
- fromBoostrapCompactAddress ∷ CompactAddress → CompactAddr
- compactAddr ∷ Addr → CompactAddr
- decompactAddr ∷ HasCallStack ⇒ CompactAddr → Addr
- data CompactAddr
- unCompactAddr ∷ CompactAddr → ShortByteString
- isPayCredScriptCompactAddr ∷ CompactAddr → Bool
- isBootstrapCompactAddr ∷ CompactAddr → Bool
- decodeAddr ∷ MonadFail m ⇒ ByteString → m Addr
- decodeAddrEither ∷ ByteString → Either String Addr
- decodeAddrStateT ∷ ∀ (m ∷ Type → Type) b. (MonadFail m, AddressBuffer b) ⇒ b → StateT Int m Addr
- decodeAddrStateLenientT ∷ ∀ (m ∷ Type → Type) b. (MonadFail m, AddressBuffer b) ⇒ Bool → Bool → b → StateT Int m Addr
- fromCborAddr ∷ Decoder s Addr
- fromCborBothAddr ∷ Decoder s (Addr, CompactAddr)
- fromCborCompactAddr ∷ Decoder s CompactAddr
- fromCborRigorousBothAddr ∷ Bool → Decoder s (Addr, CompactAddr)
- fromCborBackwardsBothAddr ∷ Decoder s (Addr, CompactAddr)
- newtype Withdrawals = Withdrawals {}
- newtype DirectDeposits = DirectDeposits {}
Documentation
serialiseAddr ∷ Addr → ByteString Source #
Serialise an address to the external format.
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
newtype BootstrapAddress Source #
Constructors
| BootstrapAddress | |
Fields | |
Instances
| NFData BootstrapAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods rnf ∷ BootstrapAddress → () # | |||||
| Generic BootstrapAddress Source # | |||||
Defined in Cardano.Ledger.Address Associated Types
Methods from ∷ BootstrapAddress → Rep BootstrapAddress x # to ∷ Rep BootstrapAddress x → BootstrapAddress # | |||||
| Show BootstrapAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods showsPrec ∷ Int → BootstrapAddress → ShowS # show ∷ BootstrapAddress → String # showList ∷ [BootstrapAddress] → ShowS # | |||||
| Eq BootstrapAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| Ord BootstrapAddress Source # | |||||
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 Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| type Rep BootstrapAddress Source # | |||||
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))) | |||||
bootstrapAddressAttrsSize ∷ BootstrapAddress → Int Source #
The size of the extra attributes in a bootstrap (ie Byron) address. Used to help enforce that people do not post huge ones on the chain.
isBootstrapRedeemer ∷ BootstrapAddress → Bool Source #
Return True if a given address is a redeemer address from the Byron Era
getNetwork ∷ Addr → Network Source #
Lookup a Network Id for an Address
data AccountAddress Source #
An account based address for rewards
Constructors
| AccountAddress | |
Fields | |
Instances
| FromJSON AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods parseJSON ∷ Value → Parser AccountAddress Source # | |||||
| FromJSONKey AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| ToJSON AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods toJSON ∷ AccountAddress → Value Source # toEncoding ∷ AccountAddress → Encoding Source # toJSONList ∷ [AccountAddress] → Value Source # | |||||
| ToJSONKey AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| DecCBOR AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| EncCBOR AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| Default AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| NFData AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods rnf ∷ AccountAddress → () # | |||||
| Generic AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Associated Types
| |||||
| Show AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods showsPrec ∷ Int → AccountAddress → ShowS # show ∷ AccountAddress → String # showList ∷ [AccountAddress] → ShowS # | |||||
| Eq AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods (==) ∷ AccountAddress → AccountAddress → Bool # (/=) ∷ AccountAddress → AccountAddress → Bool # | |||||
| Ord AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address Methods compare ∷ AccountAddress → AccountAddress → Ordering # (<) ∷ AccountAddress → AccountAddress → Bool # (<=) ∷ AccountAddress → AccountAddress → Bool # (>) ∷ AccountAddress → AccountAddress → Bool # (>=) ∷ AccountAddress → AccountAddress → Bool # | |||||
| NoThunks AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| type Rep AccountAddress Source # | |||||
Defined in Cardano.Ledger.Address type Rep AccountAddress = D1 ('MetaData "AccountAddress" "Cardano.Ledger.Address" "cardano-ledger-core-1.19.0.0-inplace" 'False) (C1 ('MetaCons "AccountAddress" 'PrefixI 'True) (S1 ('MetaSel ('Just "aaNetworkId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Network) :*: S1 ('MetaSel ('Just "aaAccountId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 AccountId))) | |||||
Constructors
| AccountId | |
Fields | |
Instances
| FromJSON AccountId Source # | |||||
| ToJSON AccountId Source # | |||||
| DecCBOR AccountId Source # | |||||
| EncCBOR AccountId Source # | |||||
| NFData AccountId Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| Generic AccountId Source # | |||||
Defined in Cardano.Ledger.Address Associated Types
| |||||
| Show AccountId Source # | |||||
| Eq AccountId Source # | |||||
| Ord AccountId Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| NoThunks AccountId Source # | |||||
| type Rep AccountId Source # | |||||
Defined in Cardano.Ledger.Address type Rep AccountId = D1 ('MetaData "AccountId" "Cardano.Ledger.Address" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "AccountId" 'PrefixI 'True) (S1 ('MetaSel ('Just "unAccountId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Credential 'Staking)))) | |||||
serialiseAccountAddress ∷ AccountAddress → ByteString Source #
Serialise an account address to the external format.
deserialiseAccountAddress ∷ ByteString → Maybe AccountAddress Source #
Deserialise an account address from the external format. This will fail if the input data is not in the right format (or if there is trailing data).
decodeAccountAddress ∷ (AddressBuffer b, MonadFail m) ⇒ b → m AccountAddress Source #
pattern RewardAccount ∷ Network → Credential 'Staking → AccountAddress Source #
Deprecated: In favor of AccountAddress
Deprecated pattern synonym for backward compatibility
raNetwork ∷ AccountAddress → Network Source #
Deprecated: In favor of aaNetworkId
raCredential ∷ AccountAddress → Credential 'Staking Source #
Deprecated: In favor of aaAccountId
rewardAccountCredentialL ∷ Lens' AccountAddress (Credential 'Staking) Source #
Deprecated: In favor of accountAddressCredentialL
rewardAccountNetworkL ∷ Lens' AccountAddress Network Source #
Deprecated: In favor of accountAddressNetworkIdL
serialiseRewardAccount ∷ AccountAddress → ByteString Source #
Deprecated: In favor of serialiseAccountAddress
deserialiseRewardAccount ∷ ByteString → Maybe AccountAddress Source #
Deprecated: In favor of deserialiseAccountAddress
putRewardAccount ∷ AccountAddress → Put Source #
Deprecated: In favor of putAccountAddress
decodeRewardAccount ∷ (AddressBuffer b, MonadFail m) ⇒ b → m AccountAddress Source #
Deprecated: In favor of decodeAccountAddress
fromCborRewardAccount ∷ Decoder s AccountAddress Source #
Deprecated: In favor of fromCborAccountAddress
putCredential ∷ ∀ (kr ∷ KeyRole). Credential kr → Put Source #
Compact Address
fromBoostrapCompactAddress ∷ CompactAddress → CompactAddr Source #
Convert Byron's comapct address into CompactAddr. This is just an efficient type cast.
data CompactAddr Source #
Instances
| DecCBOR CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| EncCBOR CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| NFData CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address Methods rnf ∷ CompactAddr → () # | |||||
| Generic CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address Associated Types
| |||||
| Show CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address Methods showsPrec ∷ Int → CompactAddr → ShowS # show ∷ CompactAddr → String # showList ∷ [CompactAddr] → ShowS # | |||||
| Eq CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| Ord CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address Methods compare ∷ CompactAddr → CompactAddr → Ordering # (<) ∷ CompactAddr → CompactAddr → Bool # (<=) ∷ CompactAddr → CompactAddr → Bool # (>) ∷ CompactAddr → CompactAddr → Bool # (>=) ∷ CompactAddr → CompactAddr → Bool # max ∷ CompactAddr → CompactAddr → CompactAddr # min ∷ CompactAddr → CompactAddr → CompactAddr # | |||||
| MemPack CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| NoThunks CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| type Rep CompactAddr Source # | |||||
Defined in Cardano.Ledger.Address type Rep CompactAddr = D1 ('MetaData "CompactAddr" "Cardano.Ledger.Address" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "UnsafeCompactAddr" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString))) | |||||
unCompactAddr ∷ CompactAddr → ShortByteString Source #
Unwrap the compact address and get to the address' binary representation.
isPayCredScriptCompactAddr ∷ CompactAddr → Bool Source #
Efficiently check whether compacted adddress is an address with a credential that is a payment script.
isBootstrapCompactAddr ∷ CompactAddr → Bool Source #
Efficiently check whether compated adddress is a Byron address.
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
decodeAddrStateT ∷ ∀ (m ∷ Type → Type) b. (MonadFail m, AddressBuffer b) ⇒ b → StateT Int m Addr Source #
Just like decodeAddrStateLenientT, but enforces the address to be well-formed.
decodeAddrStateLenientT Source #
Arguments
| ∷ ∀ (m ∷ Type → Type) b. (MonadFail m, AddressBuffer b) | |
| ⇒ Bool | Enable lenient decoding for Ptrs, i.e. indicate whether junk can follow a Ptr. This is necessary for backwards compatibility only. Setting this argument to True is only needed for backwards compatibility. |
| → Bool | Indicate whether decoder should not enforce the full input to be consumed or not, i.e. allow garbage at the end or not. Setting this argument to True is only needed for backwards compatibility. |
| → b | |
| → StateT Int m Addr |
This is the most general decoder for a Cardano address. This function is not meant to
be used directly, but it is exported for convenice. decodeAddr and other should be
used instead.
While decoding an Addr the header (the first byte in the buffer) is expected to be in a certain format. Here are the meaning of all the bits:
@@@
┏━━━━━━━━━━━━━━━━┳━┯━┯━┯━┯━┯━┯━┯━┓ ┃ Byron Address ┃1┊0┊0┊0┊0┊0┊1┊0┃ ┣━━━━━━━━━━━━━━━━╋━┿━┿━┿━┿━┿━┿━┿━┫ ┃Shelley Address ┃0┊x┊x┊x┊0┊0┊0┊x┃ ┗━━━━━━━━━━━━━━━━╋━┿━┿━┿━┿━┿━┿━┿━╋━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃0┊0┊0┊0┊0┊0┊0┊0┃ Testnet PaymentKey StakingKey ┃ ┃0┊0┊0┊0┊0┊0┊0┊1┃ Mainnet PaymentKey StakingKey ┃ ┃0┊0┊0┊1┊0┊0┊0┊0┃ Testnet PaymentScript StakingKey ┃ ┃0┊0┊0┊1┊0┊0┊0┊1┃ Mainnet PaymentScript StakingKey ┃ ┃0┊0┊1┊0┊0┊0┊0┊0┃ Testnet PaymentKey StakingScript ┃ ┃0┊0┊1┊0┊0┊0┊0┊1┃ Mainnet PaymentKey StakingScript ┃ ┃0┊0┊1┊1┊0┊0┊0┊0┃ Testnet PaymentScript StakingScript ┃ ┃0┊0┊1┊1┊0┊0┊0┊1┃ Mainnet PaymentScript StakingScript ┃ ┃0┊1┊0┊0┊0┊0┊0┊0┃ Testnet PaymentKey StakingPtr ┃ ┃0┊1┊0┊0┊0┊0┊0┊1┃ Mainnet PaymentKey StakingPtr ┃ ┃0┊1┊0┊1┊0┊0┊0┊0┃ Testnet PaymentScript StakingPtr ┃ ┃0┊1┊0┊1┊0┊0┊0┊1┃ Mainnet PaymentScript StakingPtr ┃ ┃0┊1┊1┊0┊0┊0┊0┊0┃ Testnet PaymentKey StakingNull ┃ ┃0┊1┊1┊0┊0┊0┊0┊1┃ Mainnet PaymentKey StakingNull ┃ ┃0┊1┊1┊1┊0┊0┊0┊0┃ Testnet PaymentScript StakingNull ┃ ┃0┊1┊1┊1┊0┊0┊0┊1┃ Mainnet PaymentScript StakingNull ┃ ┗━┷━┷━┷━┷━┷━┷━┷━┻━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ `Is Mainnet Address `Payment Credential is a Script `Staking Credential is a Script / No Staking Credential `Not a Base Address @@@
fromCborBothAddr ∷ Decoder s (Addr, CompactAddr) Source #
This is the decoder for an address that returns both the actual Addr and the bytes,
that it was encoded as.
fromCborCompactAddr ∷ Decoder s CompactAddr Source #
Returns the actual bytes that represent an addres, while ensuring that they can
be decoded in any era as an Addr when need be.
fromCborRigorousBothAddr Source #
Arguments
| ∷ Bool | Should there be a hard failure for garbage pointers ( |
| → Decoder s (Addr, CompactAddr) |
Starting with Babbage we no longer allow addresses with garbage in them.
fromCborBackwardsBothAddr ∷ Decoder s (Addr, CompactAddr) Source #
Prior to Babbage era we did not check if a binary blob representing an address was fully consumed, so unfortunately we must preserve this behavior. However, we do not need to preserve the unconsumed bytes in memory, therefore we can drop the garbage after we successfully decoded the malformed address. We also need to allow bogus pointer address to be deserializeable prior to Babbage era.
newtype Withdrawals Source #
This is called wdrl in the spec.
Constructors
| Withdrawals | |
Fields | |
Instances
| DecCBOR Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| EncCBOR Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| NFData Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address Methods rnf ∷ Withdrawals → () # | |||||
| Monoid Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| Semigroup Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address Methods (<>) ∷ Withdrawals → Withdrawals → Withdrawals # sconcat ∷ NonEmpty Withdrawals → Withdrawals # stimes ∷ Integral b ⇒ b → Withdrawals → Withdrawals # | |||||
| Generic Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address Associated Types
| |||||
| Show Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address Methods showsPrec ∷ Int → Withdrawals → ShowS # show ∷ Withdrawals → String # showList ∷ [Withdrawals] → ShowS # | |||||
| Eq Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| NoThunks Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| type Rep Withdrawals Source # | |||||
Defined in Cardano.Ledger.Address type Rep Withdrawals = D1 ('MetaData "Withdrawals" "Cardano.Ledger.Address" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "Withdrawals" 'PrefixI 'True) (S1 ('MetaSel ('Just "unWithdrawals") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map AccountAddress Coin)))) | |||||
newtype DirectDeposits Source #
Direct deposits to account addresses.
Constructors
| DirectDeposits | |
Fields | |
Instances
| DecCBOR DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| EncCBOR DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address Methods | |||||
| NFData DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address Methods rnf ∷ DirectDeposits → () # | |||||
| Monoid DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address Methods mappend ∷ DirectDeposits → DirectDeposits → DirectDeposits # mconcat ∷ [DirectDeposits] → DirectDeposits # | |||||
| Semigroup DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address Methods (<>) ∷ DirectDeposits → DirectDeposits → DirectDeposits # sconcat ∷ NonEmpty DirectDeposits → DirectDeposits # stimes ∷ Integral b ⇒ b → DirectDeposits → DirectDeposits # | |||||
| Generic DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address Associated Types
| |||||
| Show DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address Methods showsPrec ∷ Int → DirectDeposits → ShowS # show ∷ DirectDeposits → String # showList ∷ [DirectDeposits] → ShowS # | |||||
| Eq DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address Methods (==) ∷ DirectDeposits → DirectDeposits → Bool # (/=) ∷ DirectDeposits → DirectDeposits → Bool # | |||||
| NoThunks DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address | |||||
| type Rep DirectDeposits Source # | |||||
Defined in Cardano.Ledger.Address type Rep DirectDeposits = D1 ('MetaData "DirectDeposits" "Cardano.Ledger.Address" "cardano-ledger-core-1.19.0.0-inplace" 'True) (C1 ('MetaCons "DirectDeposits" 'PrefixI 'True) (S1 ('MetaSel ('Just "unDirectDeposits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map AccountAddress Coin)))) | |||||