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

Cardano.Ledger.Address

Synopsis

Documentation

serialiseAddrAddrByteString Source #

Serialise an address to the external format.

data Addr 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
FromJSON Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

FromJSONKey Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

ToJSON Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

ToJSONKey Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

Generic Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep AddrTypeType Source #

Methods

fromAddrRep Addr x Source #

toRep Addr x → Addr Source #

Show Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

showsPrecIntAddrShowS Source #

showAddrString Source #

showList ∷ [Addr] → ShowS Source #

DecCBOR Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

EncCBOR Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

encCBORAddrEncoding Source #

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

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

NFData Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfAddr → () Source #

Eq Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

(==)AddrAddrBool Source #

(/=)AddrAddrBool Source #

Ord Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

compareAddrAddrOrdering Source #

(<)AddrAddrBool Source #

(<=)AddrAddrBool Source #

(>)AddrAddrBool Source #

(>=)AddrAddrBool Source #

maxAddrAddrAddr Source #

minAddrAddrAddr Source #

NoThunks Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep Addr Source # 
Instance details

Defined in Cardano.Ledger.Address

addrPtrNormalizeAddrAddr 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 Source #

Instances

Instances details
Generic BootstrapAddress Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep BootstrapAddressTypeType Source #

Show BootstrapAddress Source # 
Instance details

Defined in Cardano.Ledger.Address

NFData BootstrapAddress Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfBootstrapAddress → () Source #

Eq BootstrapAddress Source # 
Instance details

Defined in Cardano.Ledger.Address

Ord BootstrapAddress Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks BootstrapAddress Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep BootstrapAddress Source # 
Instance details

Defined in Cardano.Ledger.Address

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

bootstrapAddressAttrsSizeBootstrapAddressInt 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.

isBootstrapRedeemerBootstrapAddressBool Source #

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

getNetworkAddrNetwork Source #

Lookup a Network Id for an Address

data RewardAccount Source #

An account based address for rewards

Constructors

RewardAccount 

Instances

Instances details
FromJSON RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

FromJSONKey RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

ToJSON RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

ToJSONKey RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

Generic RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep RewardAccountTypeType Source #

Show RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

DecCBOR RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

EncCBOR RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

Default RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

NFData RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfRewardAccount → () Source #

Eq RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

Ord RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep RewardAccount Source # 
Instance details

Defined in Cardano.Ledger.Address

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

serialiseRewardAccountRewardAccountByteString Source #

Serialise a reward account to the external format.

deserialiseRewardAccountByteStringMaybe 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).

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 Source #

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

data CompactAddr Source #

Instances

Instances details
Generic CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep CompactAddrTypeType Source #

Show CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

DecCBOR CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

EncCBOR CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

encCBORCompactAddrEncoding Source #

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

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

NFData CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfCompactAddr → () Source #

Eq CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

Ord CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep CompactAddr Source # 
Instance details

Defined in Cardano.Ledger.Address

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

unCompactAddrCompactAddrShortByteString Source #

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

isPayCredScriptCompactAddrCompactAddrBool Source #

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

isBootstrapCompactAddrCompactAddrBool Source #

Efficiently check whether compated adddress is a Byron address.

decodeAddr ∷ ∀ m. 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.

decodeAddrEitherByteStringEither String Addr Source #

Same as decodeAddr, but produces an Either result

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

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

decodeAddrStateLenientT Source #

Arguments

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

fromCborAddrDecoder s Addr Source #

Decoder for an Addr. Works in all eras

fromCborBothAddrDecoder 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.

fromCborCompactAddrDecoder 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.

fromCborBackwardsBothAddrDecoder 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 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 ∷ ∀ b m. (AddressBuffer b, MonadFail m) ⇒ b → m RewardAccount Source #

newtype Withdrawals Source #

This is called wdrl in the spec.

Instances

Instances details
Generic Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

Associated Types

type Rep WithdrawalsTypeType Source #

Show Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

DecCBOR Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

EncCBOR Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

encCBORWithdrawalsEncoding Source #

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

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

NFData Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

Methods

rnfWithdrawals → () Source #

Eq Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

NoThunks Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

type Rep Withdrawals Source # 
Instance details

Defined in Cardano.Ledger.Address

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