cardano-ledger-mary-1.6.0.0: Cardano ledger with multiasset support.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cardano.Ledger.Mary.Value

Contents

Synopsis

Documentation

newtype PolicyID c Source #

Policy ID

Constructors

PolicyID 

Fields

Instances

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

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

Generic (PolicyID c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep (PolicyID c) ∷ TypeType Source #

Methods

fromPolicyID c → Rep (PolicyID c) x Source #

toRep (PolicyID c) x → PolicyID c Source #

Show (PolicyID c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORPolicyID c → Encoding Source #

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

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

NFData (PolicyID c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfPolicyID c → () Source #

Eq (PolicyID c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

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

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

Ord (PolicyID c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

comparePolicyID c → PolicyID c → Ordering Source #

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

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

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

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

maxPolicyID c → PolicyID c → PolicyID c Source #

minPolicyID c → PolicyID c → PolicyID c Source #

NoThunks (PolicyID c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (PolicyID c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (PolicyID c) = D1 ('MetaData "PolicyID" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.6.0.0-inplace" 'True) (C1 ('MetaCons "PolicyID" 'PrefixI 'True) (S1 ('MetaSel ('Just "policyID") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ScriptHash c))))

newtype AssetName Source #

Asset Name

Constructors

AssetName 

Instances

Instances details
ToJSON AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

ToJSONKey AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Show AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

DecCBOR AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORAssetNameEncoding Source #

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

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

NFData AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfAssetName → () Source #

Eq AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Ord AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks AssetName Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

data MaryValue c Source #

The Value representing MultiAssets

Constructors

MaryValue !Coin !(MultiAsset c) 

Instances

Instances details
Inject Coin (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

injectCoinMaryValue c Source #

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

Defined in Cardano.Ledger.Mary.Value

Monoid (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Semigroup (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

(<>)MaryValue c → MaryValue c → MaryValue c Source #

sconcatNonEmpty (MaryValue c) → MaryValue c Source #

stimesIntegral b ⇒ b → MaryValue c → MaryValue c Source #

Generic (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep (MaryValue c) ∷ TypeType Source #

Methods

fromMaryValue c → Rep (MaryValue c) x Source #

toRep (MaryValue c) x → MaryValue c Source #

Show (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Show (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Crypto c ⇒ DecCBOR (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

Crypto c ⇒ EncCBOR (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORCompactForm (MaryValue c) → Encoding Source #

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

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

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

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORMaryValue c → Encoding Source #

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

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

Crypto c ⇒ Compactible (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

data CompactForm (MaryValue c) Source #

Crypto c ⇒ Val (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NFData (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfCompactForm (MaryValue c) → () Source #

NFData (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfMaryValue c → () Source #

Crypto c ⇒ Eq (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Crypto c ⇒ Eq (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

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

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

Abelian (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Group (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

invertMaryValue c → MaryValue c Source #

(~~)MaryValue c → MaryValue c → MaryValue c Source #

powIntegral x ⇒ MaryValue c → x → MaryValue c Source #

NoThunks (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (MaryValue c) = D1 ('MetaData "MaryValue" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.6.0.0-inplace" 'False) (C1 ('MetaCons "MaryValue" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Coin) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (MultiAsset c))))
newtype CompactForm (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

newtype MultiAsset c Source #

The MultiAssets map

Constructors

MultiAsset (Map (PolicyID c) (Map AssetName Integer)) 

Instances

Instances details
Crypto c ⇒ ToJSON (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Monoid (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Semigroup (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Generic (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep (MultiAsset c) ∷ TypeType Source #

Methods

fromMultiAsset c → Rep (MultiAsset c) x Source #

toRep (MultiAsset c) x → MultiAsset c Source #

Show (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORMultiAsset c → Encoding Source #

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

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

NFData (MultiAsset cypto) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfMultiAsset cypto → () Source #

Crypto c ⇒ Eq (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

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

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

Group (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

invertMultiAsset c → MultiAsset c Source #

(~~)MultiAsset c → MultiAsset c → MultiAsset c Source #

powIntegral x ⇒ MultiAsset c → x → MultiAsset c Source #

NoThunks (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (MultiAsset c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (MultiAsset c) = D1 ('MetaData "MultiAsset" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.6.0.0-inplace" 'True) (C1 ('MetaCons "MultiAsset" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (PolicyID c) (Map AssetName Integer)))))

insert ∷ (IntegerIntegerInteger) → PolicyID c → AssetNameIntegerMultiAsset c → MultiAsset c Source #

Deprecated: In favor of insertMultiAsset

insert comb policy asset n v, if comb = old new -> old, the integer in the MultiAsset is prefered over n if comb = old new -> new, then n is prefered over the integer in the MultiAsset if (comb old new) == 0, then that value should not be stored in the MultiAsset

insertMultiAsset ∷ (IntegerIntegerInteger) → PolicyID c → AssetNameIntegerMultiAsset c → MultiAsset c Source #

insertMultiAsset comb policy asset n v, if comb = old new -> old, the integer in the MultiAsset is prefered over n if comb = old new -> new, then n is prefered over the integer in the MultiAsset if (comb old new) == 0, then that value should not be stored in the MultiAsset

lookupPolicyID c → AssetNameMaryValue c → Integer Source #

Deprecated: In favor of lookupMultiAsset

multiAssetFromList ∷ [(PolicyID era, AssetName, Integer)] → MultiAsset era Source #

Rather than using prune to remove 0 assets, when can avoid adding them in the first place by using valueFromList to construct a MultiAsset

policiesMultiAsset c → Set (PolicyID c) Source #

Extract the set of policies in the Value.

This function is equivalent to computing the support of the value in the spec.

mapMaybeMultiAsset ∷ (PolicyID c → AssetNameIntegerMaybe Integer) → MultiAsset c → MultiAsset c Source #

Map a function over each multi asset value while optionally filtering values out. Canonical form is preserved.

filterMultiAsset Source #

Arguments

∷ (PolicyID c → AssetNameIntegerBool)

Predicate that needs to return True whenever an asset should be retained.

MultiAsset c 
MultiAsset c 

Filter multi assets. Canonical form is preserved.

pruneZeroMultiAssetMultiAsset c → MultiAsset c Source #

Remove all assets with that have zero amount specified

showValueMaryValue c → String Source #

Display a MaryValue as a String, one token per line

data CompactValue c Source #

Instances

Instances details
Generic (CompactValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Associated Types

type Rep (CompactValue c) ∷ TypeType Source #

Show (CompactValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

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

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORCompactValue c → Encoding Source #

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

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

NFData (CompactValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfCompactValue c → () Source #

Crypto c ⇒ Eq (CompactValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

NoThunks (CompactValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (CompactValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

type Rep (CompactValue c) = D1 ('MetaData "CompactValue" "Cardano.Ledger.Mary.Value" "cardano-ledger-mary-1.6.0.0-inplace" 'False) (C1 ('MetaCons "CompactValueAdaOnly" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 (CompactForm Coin))) :+: C1 ('MetaCons "CompactValueMultiAsset" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 (CompactForm Coin)) :*: (S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Word32) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 ShortByteString))))

data family CompactForm a Source #

Instances

Instances details
FromJSON (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

ToJSON (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

ToJSON (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Monoid (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Semigroup (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Show (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Show (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Show (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

ToCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

toCBORCompactForm CoinEncoding Source #

encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy (CompactForm Coin) → Size Source #

encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [CompactForm Coin] → Size Source #

DecCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

DecCBOR (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Crypto c ⇒ DecCBOR (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

EncCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

EncCBOR (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Crypto c ⇒ EncCBOR (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

encCBORCompactForm (MaryValue c) → Encoding Source #

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

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

NFData (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

rnfCompactForm Coin → () Source #

NFData (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

rnfCompactForm DeltaCoin → () Source #

NFData (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

rnfCompactForm (MaryValue c) → () Source #

Eq (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Eq (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

Crypto c ⇒ Eq (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Ord (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Abelian (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Group (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

HeapWords (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

HeapWords (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

NoThunks (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

NoThunks (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

NoThunks (CompactForm (MaryValue c)) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

Prim (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Prim (CompactForm DeltaCoin) 
Instance details

Defined in Cardano.Ledger.Coin

newtype CompactForm Coin 
Instance details

Defined in Cardano.Ledger.Coin

newtype CompactForm DeltaCoin 
Instance details

Defined in Cardano.Ledger.Coin

newtype CompactForm (MaryValue c) Source # 
Instance details

Defined in Cardano.Ledger.Mary.Value

isMultiAssetSmallEnoughMultiAsset c → Bool Source #

Unlike representationSize, this function cheaply checks whether any offset within a MultiAsset compact representation is likely to overflow Word16.

compact form inequality: 8n (Word64) + 2n (Word16) + 2n (Word16) + 28p (policy ids) + sum of lengths of unique asset names <= 65535 maximum size for the asset name is 32 bytes, so: 8n + 2n + 2n + 28p + 32n <= 65535 where: n = total number of assets, p = number of unique policy ids

Deprecated

pruneMap (PolicyID c) (Map AssetName Integer) → Map (PolicyID c) (Map AssetName Integer) Source #

Deprecated: In favor of pruneZeroMultiAsset

Remove 0 assets from a MultiAsset