cardano-ledger-core-1.12.0.0: Core components of Cardano ledgers from the Shelley release on.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Address

Synopsis

Documentation

mkRwdAcntNetworkCredential 'Staking c → RewardAcnt c Source #

Deprecated: In favor of RewardAcnt

serialiseAddrAddr c → ByteString Source #

Serialise an address to the external format.

deserialiseAddrCrypto c ⇒ ByteStringMaybe (Addr c) Source #

Deprecated: In favor of decodeAddr or decodeAddrLenient. Please choose the appropriate variant carefully depending on your use case

Deserialise an address from the external format. This will fail if the input data is not in the right format (or if there is trailing data).

data Addr c Source #

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

Instances details
Crypto c ⇒ FromJSON (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ FromJSONKey (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

ToJSON (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

ToJSONKey (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Generic (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep (Addr c) ∷ TypeType Source #

Methods

fromAddr c → Rep (Addr c) x Source #

toRep (Addr c) x → Addr c Source #

Show (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

showsPrecIntAddr c → ShowS Source #

showAddr c → String Source #

showList ∷ [Addr c] → ShowS Source #

Crypto c ⇒ DecCBOR (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

decCBORDecoder s (Addr c) Source #

dropCBORProxy (Addr c) → Decoder s () Source #

labelProxy (Addr c) → Text Source #

Crypto c ⇒ EncCBOR (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

encCBORAddr c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Addr c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Addr c] → Size Source #

NFData (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfAddr c → () Source #

Eq (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

(==)Addr c → Addr c → Bool Source #

(/=)Addr c → Addr c → Bool Source #

Ord (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

compareAddr c → Addr c → Ordering Source #

(<)Addr c → Addr c → Bool Source #

(<=)Addr c → Addr c → Bool Source #

(>)Addr c → Addr c → Bool Source #

(>=)Addr c → Addr c → Bool Source #

maxAddr c → Addr c → Addr c Source #

minAddr c → Addr c → Addr c Source #

NoThunks (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (Addr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

addrPtrNormalizeAddr c → Addr c Source #

This function is implemented solely for the purpose of translating garbage pointers into knowingly invalid ones. Any pointer that contains a SlotNo, TxIx or CertIx that is too large to fit into Word32, Word16 and Word16 respectively, will have all of its values set to 0 using normalizePtr.

There are two reasons why we can safely do that at the Babbage/Conway era boundary:

  • Invalid pointers are no longer allowed in transactions starting with Babbage era
  • There are only a handful of Ptrs on mainnet that are invalid.

Once the transition is complete and we are officially in Conway era, this translation logic can be removed in favor of a fixed deserializer that does the same thing for all eras prior to Babbage.

newtype BootstrapAddress c Source #

Instances

Instances details
Generic (BootstrapAddress c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep (BootstrapAddress c) ∷ TypeType Source #

Show (BootstrapAddress c) Source # 
Instance details

Defined in Cardano.Ledger.Address

NFData (BootstrapAddress c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfBootstrapAddress c → () Source #

Eq (BootstrapAddress c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Ord (BootstrapAddress c) Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks (BootstrapAddress c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (BootstrapAddress c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (BootstrapAddress c) = D1 ('MetaData "BootstrapAddress" "Cardano.Ledger.Address" "cardano-ledger-core-1.12.0.0-inplace" 'True) (C1 ('MetaCons "BootstrapAddress" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBootstrapAddress") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Address)))

bootstrapAddressAttrsSizeBootstrapAddress c → Int Source #

The size of the extra attributes in a bootstrp (ie Byron) address. Used to help enforce that people do not post huge ones on the chain.

isBootstrapRedeemerBootstrapAddress c → Bool Source #

Return True if a given address is a redeemer address from the Byron Era

getNetworkAddr c → Network Source #

Lookup a Network Id for an Address

data RewardAccount c Source #

An account based address for rewards

Constructors

RewardAccount 

Bundled Patterns

pattern RewardAcntNetworkCredential 'Staking c → RewardAccount c

Deprecated: Use RewardAccount instead

Instances

Instances details
Crypto c ⇒ FromJSON (RewardAcnt c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ FromJSONKey (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ ToJSON (RewardAcnt c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ ToJSONKey (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Generic (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep (RewardAccount c) ∷ TypeType Source #

Show (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ DecCBOR (RewardAcnt c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ EncCBOR (RewardAcnt c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

encCBORRewardAcnt c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (RewardAcnt c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [RewardAcnt c] → Size Source #

Crypto c ⇒ Default (RewardAcnt c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

defRewardAcnt c Source #

NFData (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfRewardAccount c → () Source #

Eq (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Ord (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks (RewardAcnt c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (RewardAccount c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (RewardAccount c) = D1 ('MetaData "RewardAccount" "Cardano.Ledger.Address" "cardano-ledger-core-1.12.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 c))))

serialiseRewardAccountRewardAcnt c → ByteString Source #

Serialise a reward account to the external format.

deserialiseRewardAccountCrypto c ⇒ ByteStringMaybe (RewardAcnt 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).

putAddrAddr c → Put Source #

newtype Word7 Source #

Constructors

Word7 Word8 

Instances

Instances details
Show Word7 Source # 
Instance details

Defined in Cardano.Ledger.Address

Eq Word7 Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

(==)Word7Word7Bool Source #

(/=)Word7Word7Bool Source #

Compact Address

fromBoostrapCompactAddressCompactAddressCompactAddr c Source #

Convert Byron's comapct address into CompactAddr. This is just an efficient type cast.

data CompactAddr c Source #

Instances

Instances details
Generic (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep (CompactAddr c) ∷ TypeType Source #

Methods

fromCompactAddr c → Rep (CompactAddr c) x Source #

toRep (CompactAddr c) x → CompactAddr c Source #

Crypto c ⇒ Show (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ DecCBOR (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ EncCBOR (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

encCBORCompactAddr c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (CompactAddr c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [CompactAddr c] → Size Source #

NFData (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfCompactAddr c → () Source #

Eq (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Ord (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (CompactAddr c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (CompactAddr c) = D1 ('MetaData "CompactAddr" "Cardano.Ledger.Address" "cardano-ledger-core-1.12.0.0-inplace" 'True) (C1 ('MetaCons "UnsafeCompactAddr" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString)))

unCompactAddrCompactAddr c → ShortByteString Source #

Unwrap the compact address and get to the address' binary representation.

isPayCredScriptCompactAddrCompactAddr c → Bool Source #

Efficiently check whether compacted adddress is an address with a credential that is a payment script.

isBootstrapCompactAddrCompactAddr c → Bool Source #

Efficiently check whether compated adddress is a Byron address.

decodeAddr ∷ ∀ c m. (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 ∷ ∀ c. Crypto c ⇒ ByteStringEither String (Addr c) Source #

Same as decodeAddr, but produces an Either result

decodeAddrStateT ∷ (Crypto c, MonadFail m, AddressBuffer b) ⇒ b → StateT Int m (Addr c) Source #

Just like decodeAddrStateLenientT, but enforces the address to be well-formed.

decodeAddrStateLenientT Source #

Arguments

∷ (Crypto c, 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 c) 

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 @@@

fromCborAddr ∷ ∀ c s. Crypto c ⇒ Decoder s (Addr c) Source #

Decoder for an Addr. Works in all eras

fromCborBothAddr ∷ ∀ c s. Crypto c ⇒ Decoder s (Addr c, CompactAddr c) Source #

This is the decoder for an address that returns both the actual Addr and the bytes, that it was encoded as.

fromCborCompactAddr ∷ ∀ c s. Crypto c ⇒ Decoder s (CompactAddr c) 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.

fromCborBackwardsBothAddr ∷ ∀ c s. Crypto c ⇒ Decoder s (Addr c, CompactAddr c) 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 to 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.

decodeRewardAccount ∷ ∀ c b m. (Crypto c, AddressBuffer b, MonadFail m) ⇒ b → m (RewardAcnt c) Source #

newtype Withdrawals c Source #

This is called wdrl in the spec.

Constructors

Withdrawals 

Instances

Instances details
Generic (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep (Withdrawals c) ∷ TypeType Source #

Methods

fromWithdrawals c → Rep (Withdrawals c) x Source #

toRep (Withdrawals c) x → Withdrawals c Source #

Show (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ DecCBOR (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Crypto c ⇒ EncCBOR (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

encCBORWithdrawals c → Encoding Source #

encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy (Withdrawals c) → Size Source #

encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Withdrawals c] → Size Source #

NFData (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfWithdrawals c → () Source #

Eq (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (Withdrawals c) Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep (Withdrawals c) = D1 ('MetaData "Withdrawals" "Cardano.Ledger.Address" "cardano-ledger-core-1.12.0.0-inplace" 'True) (C1 ('MetaCons "Withdrawals" 'PrefixI 'True) (S1 ('MetaSel ('Just "unWithdrawals") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (RewardAcnt c) Coin))))

Deprecations

type RewardAcnt = RewardAccount Source #

Deprecated: Use RewardAccount instead

putRewardAcntRewardAcnt c → Put Source #

Deprecated: Use putRewardAccount instead

decodeRewardAcnt ∷ ∀ c b m. (Crypto c, AddressBuffer b, MonadFail m) ⇒ b → m (RewardAcnt c) Source #

Deprecated: Use decodeRewardAccount instead

fromCborRewardAcnt ∷ ∀ c s. Crypto c ⇒ Decoder s (RewardAcnt c) Source #

Deprecated: Use fromCborRewardAccount instead