cardano-ledger-0.1.0.0: The blockchain layer of Cardano
Safe HaskellNone
LanguageHaskell2010

Cardano.Chain.Common

Synopsis

Documentation

data TxSizeLinear Source #

A linear equation on the transaction size. Represents the s -> a + b*s function where s is the transaction size in bytes, a and b are constant coefficients.

Instances

Instances details
Eq TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Ord TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Show TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Generic TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Associated Types

type Rep TxSizeLinear :: Type -> Type #

NFData TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Methods

rnf :: TxSizeLinear -> () #

ToJSON TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

ToCBOR TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

FromCBOR TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

Buildable TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

NoThunks TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

type Rep TxSizeLinear Source # 
Instance details

Defined in Cardano.Chain.Common.TxSizeLinear

type Rep TxSizeLinear = D1 ('MetaData "TxSizeLinear" "Cardano.Chain.Common.TxSizeLinear" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "TxSizeLinear" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Lovelace) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Rational)))

data TxFeePolicy Source #

Transaction fee policy represents a formula to compute the minimal allowed Fee for a transaction. Transactions with lesser fees won't be accepted. The Minimal fee may depend on the properties of a transaction (for example, its Size in bytes), so the policy can't be represented simply as a number.

Recall that a transaction fee is the difference between the sum of its Inputs and the sum of its outputs. The transaction is accepted when minimal_fee(tx) <= fee(tx), where minimal_fee is the function defined By the policy.

The policy can change during the lifetime of the blockchain (using the Update mechanism). At the moment we have just one policy type (a linear Equation on the transaction size), but in the future other policies may Be added. To make this future-proof, we also have an "unknown" policy used By older node versions (the ones that haven't updated yet).

Instances

Instances details
Eq TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Ord TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Show TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Generic TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Associated Types

type Rep TxFeePolicy :: Type -> Type #

NFData TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Methods

rnf :: TxFeePolicy -> () #

ToJSON TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

ToCBOR TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

FromCBOR TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Buildable TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

NoThunks TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

Monad m => ToJSON m TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

MonadError SchemaError m => FromJSON m TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

type Rep TxFeePolicy Source # 
Instance details

Defined in Cardano.Chain.Common.TxFeePolicy

type Rep TxFeePolicy = D1 ('MetaData "TxFeePolicy" "Cardano.Chain.Common.TxFeePolicy" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "TxFeePolicyTxSizeLinear" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 TxSizeLinear)))

newtype KeyHash Source #

A KeyHash refers to a VerificationKey

Instances

Instances details
Eq KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

Methods

(==) :: KeyHash -> KeyHash -> Bool #

(/=) :: KeyHash -> KeyHash -> Bool #

Ord KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

Show KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

NFData KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

Methods

rnf :: KeyHash -> () #

ToCBOR KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

Methods

toCBOR :: KeyHash -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy KeyHash -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [KeyHash] -> Size Source #

FromCBOR KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

HeapWords KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

Buildable KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

NoThunks KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

Monad m => ToObjectKey m KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

MonadError SchemaError m => FromObjectKey m KeyHash Source # 
Instance details

Defined in Cardano.Chain.Common.KeyHash

data NetworkMagic Source #

Instances

Instances details
Eq NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Ord NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Show NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Generic NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Associated Types

type Rep NetworkMagic :: Type -> Type #

NFData NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Methods

rnf :: NetworkMagic -> () #

ToJSON NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

ToCBOR NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

FromCBOR NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

HeapWords NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

Buildable NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

NoThunks NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

type Rep NetworkMagic Source # 
Instance details

Defined in Cardano.Chain.Common.NetworkMagic

type Rep NetworkMagic = D1 ('MetaData "NetworkMagic" "Cardano.Chain.Common.NetworkMagic" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "NetworkMainOrStage" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NetworkTestnet" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32)))

MerkleRoot

newtype MerkleRoot a Source #

Data type for root of Merkle tree

Constructors

MerkleRoot 

Fields

Instances

Instances details
Eq (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

(==) :: MerkleRoot a -> MerkleRoot a -> Bool #

(/=) :: MerkleRoot a -> MerkleRoot a -> Bool #

Ord (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Show (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Generic (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Associated Types

type Rep (MerkleRoot a) :: Type -> Type #

Methods

from :: MerkleRoot a -> Rep (MerkleRoot a) x #

to :: Rep (MerkleRoot a) x -> MerkleRoot a #

NFData (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

rnf :: MerkleRoot a -> () #

ToJSON a => ToJSON (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

ToCBOR a => ToCBOR (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

toCBOR :: MerkleRoot a -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (MerkleRoot a) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [MerkleRoot a] -> Size Source #

FromCBOR a => FromCBOR (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Buildable (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

NoThunks (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep (MerkleRoot a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep (MerkleRoot a) = D1 ('MetaData "MerkleRoot" "Cardano.Chain.Common.Merkle" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "MerkleRoot" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMerkleRoot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Hash Raw))))

MerkleTree

data MerkleTree a Source #

Instances

Instances details
Foldable MerkleTree Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

fold :: Monoid m => MerkleTree m -> m #

foldMap :: Monoid m => (a -> m) -> MerkleTree a -> m #

foldMap' :: Monoid m => (a -> m) -> MerkleTree a -> m #

foldr :: (a -> b -> b) -> b -> MerkleTree a -> b #

foldr' :: (a -> b -> b) -> b -> MerkleTree a -> b #

foldl :: (b -> a -> b) -> b -> MerkleTree a -> b #

foldl' :: (b -> a -> b) -> b -> MerkleTree a -> b #

foldr1 :: (a -> a -> a) -> MerkleTree a -> a #

foldl1 :: (a -> a -> a) -> MerkleTree a -> a #

toList :: MerkleTree a -> [a] #

null :: MerkleTree a -> Bool #

length :: MerkleTree a -> Int #

elem :: Eq a => a -> MerkleTree a -> Bool #

maximum :: Ord a => MerkleTree a -> a #

minimum :: Ord a => MerkleTree a -> a #

sum :: Num a => MerkleTree a -> a #

product :: Num a => MerkleTree a -> a #

Eq a => Eq (MerkleTree a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

(==) :: MerkleTree a -> MerkleTree a -> Bool #

(/=) :: MerkleTree a -> MerkleTree a -> Bool #

Show a => Show (MerkleTree a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Generic (MerkleTree a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Associated Types

type Rep (MerkleTree a) :: Type -> Type #

Methods

from :: MerkleTree a -> Rep (MerkleTree a) x #

to :: Rep (MerkleTree a) x -> MerkleTree a #

NFData a => NFData (MerkleTree a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

rnf :: MerkleTree a -> () #

ToCBOR a => ToCBOR (MerkleTree a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

toCBOR :: MerkleTree a -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (MerkleTree a) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [MerkleTree a] -> Size Source #

(FromCBOR a, ToCBOR a) => FromCBOR (MerkleTree a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep (MerkleTree a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

type Rep (MerkleTree a) = D1 ('MetaData "MerkleTree" "Cardano.Chain.Common.Merkle" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "MerkleEmpty" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MerkleTree" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (MerkleNode a))))

mtRoot :: MerkleTree a -> MerkleRoot a Source #

Returns root of Merkle tree

mkMerkleTree :: ToCBOR a => [a] -> MerkleTree a Source #

Smart constructor for MerkleTree

mkMerkleTreeDecoded :: [Annotated a ByteString] -> MerkleTree a Source #

Reconstruct a MerkleTree from a decoded list of items

MerkleNode

data MerkleNode a Source #

Constructors

MerkleBranch !(MerkleRoot a) !(MerkleNode a) !(MerkleNode a)

MerkleBranch mRoot mLeft mRight

MerkleLeaf !(MerkleRoot a) a

MerkleLeaf mRoot mVal

Instances

Instances details
Foldable MerkleNode Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

fold :: Monoid m => MerkleNode m -> m #

foldMap :: Monoid m => (a -> m) -> MerkleNode a -> m #

foldMap' :: Monoid m => (a -> m) -> MerkleNode a -> m #

foldr :: (a -> b -> b) -> b -> MerkleNode a -> b #

foldr' :: (a -> b -> b) -> b -> MerkleNode a -> b #

foldl :: (b -> a -> b) -> b -> MerkleNode a -> b #

foldl' :: (b -> a -> b) -> b -> MerkleNode a -> b #

foldr1 :: (a -> a -> a) -> MerkleNode a -> a #

foldl1 :: (a -> a -> a) -> MerkleNode a -> a #

toList :: MerkleNode a -> [a] #

null :: MerkleNode a -> Bool #

length :: MerkleNode a -> Int #

elem :: Eq a => a -> MerkleNode a -> Bool #

maximum :: Ord a => MerkleNode a -> a #

minimum :: Ord a => MerkleNode a -> a #

sum :: Num a => MerkleNode a -> a #

product :: Num a => MerkleNode a -> a #

Eq a => Eq (MerkleNode a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

(==) :: MerkleNode a -> MerkleNode a -> Bool #

(/=) :: MerkleNode a -> MerkleNode a -> Bool #

Show a => Show (MerkleNode a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Generic (MerkleNode a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Associated Types

type Rep (MerkleNode a) :: Type -> Type #

Methods

from :: MerkleNode a -> Rep (MerkleNode a) x #

to :: Rep (MerkleNode a) x -> MerkleNode a #

NFData a => NFData (MerkleNode a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

Methods

rnf :: MerkleNode a -> () #

type Rep (MerkleNode a) Source # 
Instance details

Defined in Cardano.Chain.Common.Merkle

mkLeaf :: forall a. ToCBOR a => a -> MerkleNode a Source #

data LovelacePortion Source #

LovelacePortion is a legacy Byron type that we keep only for compatibility. It was originally intended to represent a fraction of stake in the system. It is used only for the thresholds used in the update system rules, most of which are now themselves unused. The remaining case is no longer interpreted as a fraction of all stake, but as a fraction of the number of genesis keys.

It has enormous precision, due to the fact that it was originally intended to represent a fraction of all stake and can cover the precision of all the Lovelace in the system.

It is represented as a rational nominator with a fixed implicit denominator of 1e15. So the nominator must be in the range [0..1e15]. This is also the representation used on-chain (in update proposals) and in the JSON genesis file.

It is interpreted as a Rational via the provided conversion functions.

Instances

Instances details
Eq LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Ord LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Show LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Generic LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Associated Types

type Rep LovelacePortion :: Type -> Type #

NFData LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Methods

rnf :: LovelacePortion -> () #

ToJSON LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

ToCBOR LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

FromCBOR LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

HeapWords LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Buildable LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

NoThunks LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

Monad m => ToJSON m LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

MonadError SchemaError m => FromJSON m LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

type Rep LovelacePortion Source # 
Instance details

Defined in Cardano.Chain.Common.LovelacePortion

type Rep LovelacePortion = D1 ('MetaData "LovelacePortion" "Cardano.Chain.Common.LovelacePortion" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "LovelacePortion" 'PrefixI 'True) (S1 ('MetaSel ('Just "unLovelacePortion") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

rationalToLovelacePortion :: Rational -> LovelacePortion Source #

Make a LovelacePortion from a Rational which must be in the range [0..1].

Lovelace

data Lovelace Source #

Lovelace is the least possible unit of currency

Instances

Instances details
Bounded Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Eq Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Data Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Lovelace -> c Lovelace #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Lovelace #

toConstr :: Lovelace -> Constr #

dataTypeOf :: Lovelace -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Lovelace) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Lovelace) #

gmapT :: (forall b. Data b => b -> b) -> Lovelace -> Lovelace #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Lovelace -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Lovelace -> r #

gmapQ :: (forall d. Data d => d -> u) -> Lovelace -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Lovelace -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Lovelace -> m Lovelace #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Lovelace -> m Lovelace #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Lovelace -> m Lovelace #

Ord Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Show Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Generic Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Associated Types

type Rep Lovelace :: Type -> Type #

Methods

from :: Lovelace -> Rep Lovelace x #

to :: Rep Lovelace x -> Lovelace #

NFData Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Methods

rnf :: Lovelace -> () #

ToJSON Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

ToCBOR Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Methods

toCBOR :: Lovelace -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Lovelace -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Lovelace] -> Size Source #

FromCBOR Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Buildable Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

NoThunks Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Monad m => ToJSON m Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Methods

toJSON :: Lovelace -> m JSValue Source #

ReportSchemaErrors m => FromJSON m Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

type Rep Lovelace Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

type Rep Lovelace = D1 ('MetaData "Lovelace" "Cardano.Chain.Common.Lovelace" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "Lovelace" 'PrefixI 'True) (S1 ('MetaSel ('Just "unLovelace") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

data LovelaceError Source #

Instances

Instances details
Eq LovelaceError Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Data LovelaceError Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LovelaceError -> c LovelaceError #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c LovelaceError #

toConstr :: LovelaceError -> Constr #

dataTypeOf :: LovelaceError -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c LovelaceError) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c LovelaceError) #

gmapT :: (forall b. Data b => b -> b) -> LovelaceError -> LovelaceError #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LovelaceError -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LovelaceError -> r #

gmapQ :: (forall d. Data d => d -> u) -> LovelaceError -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> LovelaceError -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> LovelaceError -> m LovelaceError #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LovelaceError -> m LovelaceError #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LovelaceError -> m LovelaceError #

Show LovelaceError Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

ToCBOR LovelaceError Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

FromCBOR LovelaceError Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

Buildable LovelaceError Source # 
Instance details

Defined in Cardano.Chain.Common.Lovelace

maxLovelaceVal :: Word64 Source #

Maximal possible value of Lovelace

Constructors

mkKnownLovelace :: forall n. (KnownNat n, n <= 45000000000000000) => Lovelace Source #

Construct a Lovelace from a KnownNat, known to be less than maxLovelaceVal

Formatting

lovelaceF :: Format r (Lovelace -> r) Source #

Lovelace formatter which restricts type.

Conversions

unsafeGetLovelace :: Lovelace -> Word64 Source #

Unwraps Lovelace. It's called “unsafe” so that people wouldn't use it willy-nilly if they want to sum lovelace or something. It's actually safe.

Arithmetic operations

sumLovelace :: (Foldable t, Functor t) => t Lovelace -> Either LovelaceError Lovelace Source #

Compute sum of all lovelace in container. Result is Integer as a protection against possible overflow.

addLovelace :: Lovelace -> Lovelace -> Either LovelaceError Lovelace Source #

Addition of lovelace, returning LovelaceError in case of overflow

subLovelace :: Lovelace -> Lovelace -> Either LovelaceError Lovelace Source #

Subtraction of lovelace, returning LovelaceError on underflow

scaleLovelace :: Integral b => Lovelace -> b -> Either LovelaceError Lovelace Source #

Scale a Lovelace by an Integral factor, returning LovelaceError when the result is too large

scaleLovelaceRational :: Lovelace -> Rational -> Lovelace Source #

Scale a Lovelace by a rational factor, rounding down.

scaleLovelaceRationalUp :: Lovelace -> Rational -> Lovelace Source #

Scale a Lovelace by a rational factor, rounding up.

divLovelace :: Integral b => Lovelace -> b -> Either LovelaceError Lovelace Source #

Integer division of a Lovelace by an Integral factor

modLovelace :: Integral b => Lovelace -> b -> Either LovelaceError Lovelace Source #

Integer modulus of a Lovelace by an Integral factor

data CompactAddress Source #

A compact in-memory representation for an Address.

Convert using toCompactAddress and fromCompactAddress.

Instances

Instances details
Eq CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

Ord CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

Show CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

Generic CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

Associated Types

type Rep CompactAddress :: Type -> Type #

NFData CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

Methods

rnf :: CompactAddress -> () #

ToCBOR CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

FromCBOR CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

HeapWords CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

NoThunks CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

type Rep CompactAddress Source # 
Instance details

Defined in Cardano.Chain.Common.Compact

type Rep CompactAddress = D1 ('MetaData "CompactAddress" "Cardano.Chain.Common.Compact" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "CompactAddress" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ShortByteString)))

newtype ChainDifficulty Source #

Chain difficulty represents necessary effort to generate a chain. In the simplest case it can be number of blocks in chain.

Constructors

ChainDifficulty 

Instances

Instances details
Enum ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Eq ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Ord ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Show ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Generic ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Associated Types

type Rep ChainDifficulty :: Type -> Type #

NFData ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Methods

rnf :: ChainDifficulty -> () #

ToJSON ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

ToCBOR ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

FromCBOR ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

Buildable ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

NoThunks ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

type Rep ChainDifficulty Source # 
Instance details

Defined in Cardano.Chain.Common.ChainDifficulty

type Rep ChainDifficulty = D1 ('MetaData "ChainDifficulty" "Cardano.Chain.Common.ChainDifficulty" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "ChainDifficulty" 'PrefixI 'True) (S1 ('MetaSel ('Just "unChainDifficulty") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

CBOR in CBOR

These utilities are is used in the Byron-era chain encodings in cases where there are extensible parts of the encoding. In thse cases we have to be able to handle unknown extensions and thus decode values where we do not know the concrete type.

To solve this, the serialised representation uses nested CBOR-in-CBOR https://tools.ietf.org/html/rfc7049#section-2.4.4.1. The nesting means that the size is known without having to decode the body in those cases where we cannot decode the body.

The functions in this module handle the encoding and decoding for the cases of the known and unknown types.

encodeKnownCborDataItem :: ToCBOR a => a -> Encoding Source #

This is an alias for encodeNestedCbor.

This function is used to handle the case of a known type, but compatible with the encoding used by encodeUnknownCborDataItem.

encodeUnknownCborDataItem :: LByteString -> Encoding Source #

This is an alias for encodeNestedCborBytes, so all its details apply.

This function is used to handle the case of an unknown type, so it takes an opaque blob that is the representation of the value of the unknown type.

decodeKnownCborDataItem :: FromCBOR a => Decoder s a Source #

This is an alias for decodeNestedCbor.

This function is used to handle the case of a known type, but compatible with the encoding used by decodeUnknownCborDataItem.

decodeUnknownCborDataItem :: Decoder s ByteString Source #

This is an alias for decodeNestedCborBytes, so all its details apply.

This function is used to handle the case of an unknown type, so it returns an opaque blob that is the representation of the value of the unknown type.

Cyclic redundancy check

The Byron era address format includes a CRC to help resist accidental corruption. These functions deal with encoding and decoding the format that is used.

encodeCrcProtected :: ToCBOR a => a -> Encoding Source #

Encodes a value of type a, protecting it from accidental corruption by protecting it with a CRC.

encodedCrcProtectedSizeExpr :: forall a. ToCBOR a => (forall t. ToCBOR t => Proxy t -> Size) -> Proxy a -> Size Source #

decodeCrcProtected :: forall s a. FromCBOR a => Decoder s a Source #

Decodes a CBOR blob into a value of type a, checking the serialised CRC corresponds to the computed one

newtype BlockCount Source #

Constructors

BlockCount 

Fields

Instances

Instances details
Enum BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Eq BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Ord BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Read BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Show BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Generic BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Associated Types

type Rep BlockCount :: Type -> Type #

NFData BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Methods

rnf :: BlockCount -> () #

ToCBOR BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

FromCBOR BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

Buildable BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

NoThunks BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

type Rep BlockCount Source # 
Instance details

Defined in Cardano.Chain.Common.BlockCount

type Rep BlockCount = D1 ('MetaData "BlockCount" "Cardano.Chain.Common.BlockCount" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "BlockCount" 'PrefixI 'True) (S1 ('MetaSel ('Just "unBlockCount") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Word64)))

newtype UnparsedFields Source #

Representation of unparsed fields in Attributes. Newtype wrapper is used for clear backward compatibility between previous representation (which was just a single ByteString) during transition from Store to CBOR.

Instances

Instances details
Eq UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Ord UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Show UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Generic UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Associated Types

type Rep UnparsedFields :: Type -> Type #

NFData UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Methods

rnf :: UnparsedFields -> () #

ToJSON UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

HeapWords UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

NoThunks UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep UnparsedFields Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep UnparsedFields = D1 ('MetaData "UnparsedFields" "Cardano.Chain.Common.Attributes" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "UnparsedFields" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map Word8 ByteString))))

data Attributes h Source #

Convenient wrapper for the datatype to represent it (in binary format) as k-v map

Constructors

Attributes 

Fields

Instances

Instances details
Eq h => Eq (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Methods

(==) :: Attributes h -> Attributes h -> Bool #

(/=) :: Attributes h -> Attributes h -> Bool #

Ord h => Ord (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Show h => Show (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Generic (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Associated Types

type Rep (Attributes h) :: Type -> Type #

Methods

from :: Attributes h -> Rep (Attributes h) x #

to :: Rep (Attributes h) x -> Attributes h #

NFData h => NFData (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Methods

rnf :: Attributes h -> () #

ToJSON a => ToJSON (Attributes a) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

ToCBOR (Attributes ()) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Methods

toCBOR :: Attributes () -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy (Attributes ()) -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Attributes ()] -> Size Source #

ToCBOR (Attributes AddrAttributes) Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

FromCBOR (Attributes ()) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

FromCBOR (Attributes AddrAttributes) Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

HeapWords h => HeapWords (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Buildable (Attributes ()) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

Methods

build :: Attributes () -> Builder Source #

Buildable h => Buildable (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

NoThunks h => NoThunks (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep (Attributes h) Source # 
Instance details

Defined in Cardano.Chain.Common.Attributes

type Rep (Attributes h) = D1 ('MetaData "Attributes" "Cardano.Chain.Common.Attributes" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "Attributes" 'PrefixI 'True) (S1 ('MetaSel ('Just "attrData") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 h) :*: S1 ('MetaSel ('Just "attrRemain") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UnparsedFields)))

attributesAreKnown :: Attributes a -> Bool Source #

Check whether all data from Attributes is known, i. e. was successfully parsed into some structured data

fromCBORAttributes :: forall t s. t -> (Word8 -> ByteString -> t -> Decoder s (Maybe t)) -> Decoder s (Attributes t) Source #

dropEmptyAttributes :: Dropper s Source #

Drop `Attributes ()` making sure that the UnparsedFields are empty

data AddrSpendingData Source #

Data which is bound to an address and must be revealed in order to spend lovelace belonging to this address.

Constructors

VerKeyASD !VerificationKey

Funds can be spent by revealing a VerificationKey and providing a valid signature

RedeemASD !RedeemVerificationKey

Funds can be spent by revealing a RedeemVerificationKey and providing a valid signature

Instances

Instances details
Eq AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Show AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Generic AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Associated Types

type Rep AddrSpendingData :: Type -> Type #

NFData AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Methods

rnf :: AddrSpendingData -> () #

ToCBOR AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

FromCBOR AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Buildable AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

type Rep AddrSpendingData Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

type Rep AddrSpendingData = D1 ('MetaData "AddrSpendingData" "Cardano.Chain.Common.AddrSpendingData" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "VerKeyASD" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 VerificationKey)) :+: C1 ('MetaCons "RedeemASD" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RedeemVerificationKey)))

data AddrType Source #

Type of an address. It corresponds to constructors of AddrSpendingData. It's separated, because Address doesn't store AddrSpendingData, but we want to know its type.

Constructors

ATVerKey 
ATRedeem 

Instances

Instances details
Eq AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Ord AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Show AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Generic AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Associated Types

type Rep AddrType :: Type -> Type #

Methods

from :: AddrType -> Rep AddrType x #

to :: Rep AddrType x -> AddrType #

NFData AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Methods

rnf :: AddrType -> () #

ToJSON AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

ToCBOR AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

Methods

toCBOR :: AddrType -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy AddrType -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [AddrType] -> Size Source #

FromCBOR AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

HeapWords AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

NoThunks AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

type Rep AddrType Source # 
Instance details

Defined in Cardano.Chain.Common.AddrSpendingData

type Rep AddrType = D1 ('MetaData "AddrType" "Cardano.Chain.Common.AddrSpendingData" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "ATVerKey" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "ATRedeem" 'PrefixI 'False) (U1 :: Type -> Type))

type AddressHash = AbstractHash Blake2b_224 Source #

Hash used to identify address.

data Address Source #

Address is where you can send Lovelace

Constructors

Address 

Fields

Instances

Instances details
Eq Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Methods

(==) :: Address -> Address -> Bool #

(/=) :: Address -> Address -> Bool #

Ord Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Show Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Generic Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Associated Types

type Rep Address :: Type -> Type #

Methods

from :: Address -> Rep Address x #

to :: Rep Address x -> Address #

NFData Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Methods

rnf :: Address -> () #

ToJSON Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

ToCBOR Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Methods

toCBOR :: Address -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Address -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Address] -> Size Source #

FromCBOR Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

HeapWords Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Buildable Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

NoThunks Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Monad m => ToJSON m Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Methods

toJSON :: Address -> m JSValue Source #

MonadError SchemaError m => FromJSON m Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Monad m => ToObjectKey m Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

MonadError SchemaError m => FromObjectKey m Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Buildable [Address] Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Methods

build :: [Address] -> Builder Source #

type Rep Address Source # 
Instance details

Defined in Cardano.Chain.Common.Address

type Rep Address = D1 ('MetaData "Address" "Cardano.Chain.Common.Address" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "Address" 'PrefixI 'True) (S1 ('MetaSel ('Just "addrRoot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (AddressHash Address')) :*: (S1 ('MetaSel ('Just "addrAttributes") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Attributes AddrAttributes)) :*: S1 ('MetaSel ('Just "addrType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 AddrType))))

newtype Address' Source #

Hash of this data is stored in Address. This type exists mostly for internal usage.

Instances

Instances details
Eq Address' Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Show Address' Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Generic Address' Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Associated Types

type Rep Address' :: Type -> Type #

Methods

from :: Address' -> Rep Address' x #

to :: Rep Address' x -> Address' #

ToCBOR Address' Source # 
Instance details

Defined in Cardano.Chain.Common.Address

Methods

toCBOR :: Address' -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy Address' -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [Address'] -> Size Source #

FromCBOR Address' Source # 
Instance details

Defined in Cardano.Chain.Common.Address

type Rep Address' Source # 
Instance details

Defined in Cardano.Chain.Common.Address

type Rep Address' = D1 ('MetaData "Address'" "Cardano.Chain.Common.Address" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "Address'" 'PrefixI 'True) (S1 ('MetaSel ('Just "unAddress'") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AddrType, AddrSpendingData, Attributes AddrAttributes))))

Formatting

addressF :: Format r (Address -> r) Source #

Specialized formatter for Address

addressDetailedF :: Format r (Address -> r) Source #

A formatter showing guts of an Address

fromCBORTextAddress :: Text -> Either DecoderError Address Source #

Deprecated: Use decodeAddressBase58 instead

A function which decodes base58-encoded Address

Spending data checks

checkAddrSpendingData :: AddrSpendingData -> Address -> Bool Source #

Check whether given AddrSpendingData corresponds to given Address

checkVerKeyAddress :: VerificationKey -> Address -> Bool Source #

Check if given Address is created from given VerificationKey

Encoding/Decoding

decodeAddressBase58 :: Text -> Either DecoderError Address Source #

Decode an address from Base58 encoded Text.

encodeAddressBase58 :: Address -> Text Source #

Encode an address to Text. `decodeAddressBase58 (encodeAddressBase58 x) === Right x`

Utilities

Pattern-matching helpers

isRedeemAddress :: Address -> Bool Source #

Check whether an Address is redeem address

Construction

makeAddress :: AddrSpendingData -> AddrAttributes -> Address Source #

Make an Address from spending data and attributes.

makeVerKeyAddress :: NetworkMagic -> VerificationKey -> Address Source #

A function for making an address from VerificationKey

makeVerKeyHdwAddress Source #

Arguments

:: NetworkMagic 
-> HDAddressPayload

Derivation path

-> VerificationKey 
-> Address 

A function for making an HDW address

data AddrAttributes Source #

Additional information stored along with address. It's intended to be put into Attributes data type to make it extensible with softfork.

Instances

Instances details
Eq AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Ord AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Show AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Generic AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Associated Types

type Rep AddrAttributes :: Type -> Type #

NFData AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Methods

rnf :: AddrAttributes -> () #

ToJSON AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

HeapWords AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Buildable AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

NoThunks AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

ToCBOR (Attributes AddrAttributes) Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

FromCBOR (Attributes AddrAttributes) Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep AddrAttributes Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep AddrAttributes = D1 ('MetaData "AddrAttributes" "Cardano.Chain.Common.AddrAttributes" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'False) (C1 ('MetaCons "AddrAttributes" 'PrefixI 'True) (S1 ('MetaSel ('Just "aaVKDerivationPath") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Maybe HDAddressPayload)) :*: S1 ('MetaSel ('Just "aaNetworkMagic") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 NetworkMagic)))

newtype HDAddressPayload Source #

HDAddressPayload is a specific address attribute that was used by the Cardano wallet at mainnet launch, prior to moving to a BIP-44 style scheme.

It consisted of

  • serialiazed and encrypted using HDPassphrase derivation path from the root key to given descendant key (using ChaChaPoly1305 algorithm)
  • cryptographic tag

It is still distinguished as an attribute, but not used by the ledger, because the attributes size limits treat this attribute specially.

Instances

Instances details
Eq HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Ord HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Show HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Generic HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Associated Types

type Rep HDAddressPayload :: Type -> Type #

NFData HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

Methods

rnf :: HDAddressPayload -> () #

ToJSON HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

ToCBOR HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

FromCBOR HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

HeapWords HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

NoThunks HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep HDAddressPayload Source # 
Instance details

Defined in Cardano.Chain.Common.AddrAttributes

type Rep HDAddressPayload = D1 ('MetaData "HDAddressPayload" "Cardano.Chain.Common.AddrAttributes" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" 'True) (C1 ('MetaCons "HDAddressPayload" 'PrefixI 'True) (S1 ('MetaSel ('Just "getHDAddressPayload") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))