cardano-api:internal
Safe HaskellNone
LanguageHaskell2010

Cardano.Api.Value

Description

Currency values

Synopsis

Documentation

newtype Coin Source #

The amount of value held by a transaction output.

Constructors

Coin 

Fields

Instances

Instances details
FromJSON Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

parseJSON :: Value -> Parser Coin #

parseJSONList :: Value -> Parser [Coin] #

omittedField :: Maybe Coin #

ToJSON Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

toJSON :: Coin -> Value #

toEncoding :: Coin -> Encoding #

toJSONList :: [Coin] -> Value #

toEncodingList :: [Coin] -> Encoding #

omitField :: Coin -> Bool #

Monoid Coin 
Instance details

Defined in Cardano.Ledger.Coin

Semigroup Coin 
Instance details

Defined in Cardano.Ledger.Coin

Enum Coin 
Instance details

Defined in Cardano.Ledger.Coin

Generic Coin 
Instance details

Defined in Cardano.Ledger.Coin

Associated Types

type Rep Coin 
Instance details

Defined in Cardano.Ledger.Coin

type Rep Coin = D1 ('MetaData "Coin" "Cardano.Ledger.Coin" "cardano-ledger-core-1.15.0.0-2e27acc191d04ed2274d46f93f1cbbd0e33c9b0ece6c9a0c5701a53b3db5b148" 'True) (C1 ('MetaCons "Coin" 'PrefixI 'True) (S1 ('MetaSel ('Just "unCoin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))

Methods

from :: Coin -> Rep Coin x Source #

to :: Rep Coin x -> Coin Source #

Num Coin Source # 
Instance details

Defined in Cardano.Api.Orphans

Integral Coin Source # 
Instance details

Defined in Cardano.Api.Orphans

Real Coin Source #

These instances originally existed on the Lovelace type. As the Lovelace type is deleted and we use L.Coin instead, these instances are added to L.Coin. The instances are purely for the convenience of writing expressions involving L.Coin but be aware that not all uses of these typeclasses are valid.

Instance details

Defined in Cardano.Api.Orphans

Show Coin 
Instance details

Defined in Cardano.Ledger.Coin

FromCBOR Coin 
Instance details

Defined in Cardano.Ledger.Coin

ToCBOR Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

toCBOR :: Coin -> Encoding Source #

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

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

DecCBOR Coin 
Instance details

Defined in Cardano.Ledger.Coin

EncCBOR Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

encCBOR :: Coin -> Encoding Source #

encodedSizeExpr :: (forall t. EncCBOR t => Proxy t -> Size) -> Proxy Coin -> Size Source #

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

Compactible Coin 
Instance details

Defined in Cardano.Ledger.Coin

Associated Types

newtype CompactForm Coin 
Instance details

Defined in Cardano.Ledger.Coin

ToPlutusData Coin 
Instance details

Defined in Cardano.Ledger.Plutus.ToPlutusData

Val Coin 
Instance details

Defined in Cardano.Ledger.Val

NFData Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

rnf :: Coin -> () Source #

Eq Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

(==) :: Coin -> Coin -> Bool Source #

(/=) :: Coin -> Coin -> Bool Source #

Ord Coin 
Instance details

Defined in Cardano.Ledger.Coin

Abelian Coin 
Instance details

Defined in Cardano.Ledger.Coin

Group Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

invert :: Coin -> Coin

(~~) :: Coin -> Coin -> Coin

pow :: Integral x => Coin -> x -> Coin

HeapWords Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

heapWords :: Coin -> Int

NoThunks Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

noThunks :: Context -> Coin -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> Coin -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy Coin -> String #

PartialOrd Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

(<=) :: Coin -> Coin -> Bool

(>=) :: Coin -> Coin -> Bool

(==) :: Coin -> Coin -> Bool

(/=) :: Coin -> Coin -> Bool

(<) :: Coin -> Coin -> Bool

(>) :: Coin -> Coin -> Bool

compare :: Coin -> Coin -> Maybe Ordering

Pretty Coin Source # 
Instance details

Defined in Cardano.Api.Orphans

Methods

pretty :: Coin -> Doc ann #

prettyList :: [Coin] -> Doc ann #

Uniform Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

uniformM :: StatefulGen g m => g -> m Coin

UniformRange Coin 
Instance details

Defined in Cardano.Ledger.Coin

Methods

uniformRM :: StatefulGen g m => (Coin, Coin) -> g -> m Coin

Inject Coin DeltaCoin 
Instance details

Defined in Cardano.Ledger.Coin

Inject Coin (MaryValue c) 
Instance details

Defined in Cardano.Ledger.Mary.Value

Methods

inject :: Coin -> MaryValue c Source #

FromJSON (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

parseJSON :: Value -> Parser (CompactForm Coin) #

parseJSONList :: Value -> Parser [CompactForm Coin] #

omittedField :: Maybe (CompactForm Coin) #

ToJSON (CompactForm Coin) 
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

ToCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

DecCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

EncCBOR (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

NFData (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

rnf :: CompactForm Coin -> () Source #

Eq (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

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

NoThunks (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

noThunks :: Context -> CompactForm Coin -> IO (Maybe ThunkInfo) #

wNoThunks :: Context -> CompactForm Coin -> IO (Maybe ThunkInfo) #

showTypeOf :: Proxy (CompactForm Coin) -> String #

Prim (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Uniform (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

uniformM :: StatefulGen g m => g -> m (CompactForm Coin)

UniformRange (CompactForm Coin) 
Instance details

Defined in Cardano.Ledger.Coin

Methods

uniformRM :: StatefulGen g m => (CompactForm Coin, CompactForm Coin) -> g -> m (CompactForm Coin)

type Rep Coin 
Instance details

Defined in Cardano.Ledger.Coin

type Rep Coin = D1 ('MetaData "Coin" "Cardano.Ledger.Coin" "cardano-ledger-core-1.15.0.0-2e27acc191d04ed2274d46f93f1cbbd0e33c9b0ece6c9a0c5701a53b3db5b148" 'True) (C1 ('MetaCons "Coin" 'PrefixI 'True) (S1 ('MetaSel ('Just "unCoin") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Integer)))
newtype CompactForm Coin 
Instance details

Defined in Cardano.Ledger.Coin

Multi-asset values

newtype Quantity Source #

Constructors

Quantity Integer 

Instances

Instances details
FromJSON Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Methods

parseJSON :: Value -> Parser Quantity #

parseJSONList :: Value -> Parser [Quantity] #

omittedField :: Maybe Quantity #

ToJSON Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toJSON :: Quantity -> Value #

toEncoding :: Quantity -> Encoding #

toJSONList :: [Quantity] -> Value #

toEncodingList :: [Quantity] -> Encoding #

omitField :: Quantity -> Bool #

Data Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Methods

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

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

toConstr :: Quantity -> Constr Source #

dataTypeOf :: Quantity -> DataType Source #

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

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

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

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

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

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

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

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

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

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

Monoid Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Semigroup Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Num Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Show Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Eq Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Ord Quantity Source # 
Instance details

Defined in Cardano.Api.Value

newtype PolicyId Source #

Constructors

PolicyId 

Instances

Instances details
FromJSON PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Methods

parseJSON :: Value -> Parser PolicyId #

parseJSONList :: Value -> Parser [PolicyId] #

omittedField :: Maybe PolicyId #

ToJSON PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toJSON :: PolicyId -> Value #

toEncoding :: PolicyId -> Encoding #

toJSONList :: [PolicyId] -> Value #

toEncodingList :: [PolicyId] -> Encoding #

omitField :: PolicyId -> Bool #

IsString PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Show PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

HasTypeProxy PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Associated Types

data AsType PolicyId 
Instance details

Defined in Cardano.Api.Value

SerialiseAsRawBytes PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Eq PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Ord PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

data AsType PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

newtype AssetName Source #

Constructors

AssetName ByteString 

Instances

Instances details
FromJSON AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Methods

parseJSON :: Value -> Parser AssetName #

parseJSONList :: Value -> Parser [AssetName] #

omittedField :: Maybe AssetName #

FromJSONKey AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Methods

fromJSONKey :: FromJSONKeyFunction AssetName

fromJSONKeyList :: FromJSONKeyFunction [AssetName]

ToJSON AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toJSON :: AssetName -> Value #

toEncoding :: AssetName -> Encoding #

toJSONList :: [AssetName] -> Value #

toEncodingList :: [AssetName] -> Encoding #

omitField :: AssetName -> Bool #

ToJSONKey AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toJSONKey :: ToJSONKeyFunction AssetName

toJSONKeyList :: ToJSONKeyFunction [AssetName]

IsString AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Show AssetName Source # 
Instance details

Defined in Cardano.Api.Value

HasTypeProxy AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Associated Types

data AsType AssetName 
Instance details

Defined in Cardano.Api.Value

SerialiseAsRawBytes AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Eq AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Ord AssetName Source # 
Instance details

Defined in Cardano.Api.Value

data AsType AssetName Source # 
Instance details

Defined in Cardano.Api.Value

data AssetId Source #

Instances

Instances details
Show AssetId Source # 
Instance details

Defined in Cardano.Api.Value

Eq AssetId Source # 
Instance details

Defined in Cardano.Api.Value

Ord AssetId Source # 
Instance details

Defined in Cardano.Api.Value

data Value Source #

Instances

Instances details
FromJSON Value Source # 
Instance details

Defined in Cardano.Api.Value

Methods

parseJSON :: Value -> Parser Value #

parseJSONList :: Value -> Parser [Value] #

omittedField :: Maybe Value #

ToJSON Value Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toJSON :: Value -> Value #

toEncoding :: Value -> Encoding #

toJSONList :: [Value] -> Value #

toEncodingList :: [Value] -> Encoding #

omitField :: Value -> Bool #

Monoid Value Source # 
Instance details

Defined in Cardano.Api.Value

Semigroup Value Source # 
Instance details

Defined in Cardano.Api.Value

IsList Value Source # 
Instance details

Defined in Cardano.Api.Value

Associated Types

type Item Value 
Instance details

Defined in Cardano.Api.Value

Show Value Source # 
Instance details

Defined in Cardano.Api.Value

Eq Value Source # 
Instance details

Defined in Cardano.Api.Value

Methods

(==) :: Value -> Value -> Bool Source #

(/=) :: Value -> Value -> Bool Source #

type Item Value Source # 
Instance details

Defined in Cardano.Api.Value

valueFromList :: [(AssetId, Quantity)] -> Value Source #

Deprecated: Use fromList instead.

valueToList :: Value -> [(AssetId, Quantity)] Source #

Deprecated: Use toList instead.

allPositive :: Value -> Bool Source #

Check if the Value consists of only positive quantities.

negateValue :: Value -> Value Source #

This lets you write a - b as a <> negateValue b.

calcMinimumDeposit :: Value -> Lovelace -> Lovelace Source #

Calculate cost of making a UTxO entry for a given Value and mininimum UTxO value derived from the ProtocolParameters

Ada / L.Coin specifically

type Lovelace = Coin Source #

A Coin is a Lovelace.

valueToLovelace :: Value -> Maybe Lovelace Source #

Check if the Value consists of only Lovelace and no other assets, and if so then return the Lovelace

See also selectLovelace to select the Lovelace quantity from the Value, ignoring other assets.

Alternative nested representation

newtype ValueNestedRep Source #

An alternative nested representation for Value that groups assets that share a PolicyId.

Rendering

renderValue :: Value -> Text Source #

Render a textual representation of a Value.

renderValuePretty :: Value -> Text Source #

Render a "prettified" textual representation of a Value.

Internal conversion functions

Data family instances

data family AsType t Source #

A family of singleton types used in this API to indicate which type to use where it would otherwise be ambiguous or merely unclear.

Values of this type are passed to deserialisation functions for example.

Instances

Instances details
data AsType AddressAny Source # 
Instance details

Defined in Cardano.Api.Address

data AsType ByronAddr Source # 
Instance details

Defined in Cardano.Api.Address

data AsType ShelleyAddr Source # 
Instance details

Defined in Cardano.Api.Address

data AsType StakeAddress Source # 
Instance details

Defined in Cardano.Api.Address

data AsType BlockHeader Source # 
Instance details

Defined in Cardano.Api.Block

data AsType DRepMetadata Source # 
Instance details

Defined in Cardano.Api.DRepMetadata

data AsType AllegraEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType AlonzoEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType BabbageEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType ByronEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType ConwayEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType MaryEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType ShelleyEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType GovernancePoll Source # 
Instance details

Defined in Cardano.Api.Governance.Poll

data AsType GovernancePollAnswer Source # 
Instance details

Defined in Cardano.Api.Governance.Poll

data AsType ByronKey Source # 
Instance details

Defined in Cardano.Api.Keys.Byron

data AsType ByronKeyLegacy Source # 
Instance details

Defined in Cardano.Api.Keys.Byron

data AsType KesKey Source # 
Instance details

Defined in Cardano.Api.Keys.Praos

data AsType VrfKey Source # 
Instance details

Defined in Cardano.Api.Keys.Praos

data AsType CommitteeColdExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType CommitteeColdKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType CommitteeHotExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType CommitteeHotKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType DRepExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType DRepKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType GenesisDelegateExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType GenesisDelegateKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType GenesisExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType GenesisKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType GenesisUTxOKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType PaymentExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType PaymentKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType StakeExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType StakeKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType StakePoolKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType OperationalCertificate Source # 
Instance details

Defined in Cardano.Api.OperationalCertificate

data AsType OperationalCertificateIssueCounter Source # 
Instance details

Defined in Cardano.Api.OperationalCertificate

data AsType PraosNonce Source # 
Instance details

Defined in Cardano.Api.ProtocolParameters

data AsType UpdateProposal Source # 
Instance details

Defined in Cardano.Api.ProtocolParameters

data AsType PlutusScriptV1 Source # 
Instance details

Defined in Cardano.Api.Script

data AsType PlutusScriptV2 Source # 
Instance details

Defined in Cardano.Api.Script

data AsType PlutusScriptV3 Source # 
Instance details

Defined in Cardano.Api.Script

data AsType ScriptHash Source # 
Instance details

Defined in Cardano.Api.Script

data AsType ScriptInAnyLang Source # 
Instance details

Defined in Cardano.Api.Script

data AsType SimpleScript' Source # 
Instance details

Defined in Cardano.Api.Script

data AsType HashableScriptData Source # 
Instance details

Defined in Cardano.Api.ScriptData

data AsType ScriptData Source # 
Instance details

Defined in Cardano.Api.ScriptData

data AsType TextEnvelope Source # 
Instance details

Defined in Cardano.Api.SerialiseTextEnvelope

data AsType ByronUpdateProposal Source # 
Instance details

Defined in Cardano.Api.SpecialByron

data AsType ByronVote Source # 
Instance details

Defined in Cardano.Api.SpecialByron

data AsType StakePoolMetadata Source # 
Instance details

Defined in Cardano.Api.StakePoolMetadata

data AsType TxId Source # 
Instance details

Defined in Cardano.Api.TxIn

data AsType TxMetadata Source # 
Instance details

Defined in Cardano.Api.TxMetadata

data AsType AssetName Source # 
Instance details

Defined in Cardano.Api.Value

data AsType PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

data AsType (Address addrtype) Source # 
Instance details

Defined in Cardano.Api.Address

data AsType (Address addrtype) = AsAddress (AsType addrtype)
data AsType (AddressInEra era) Source # 
Instance details

Defined in Cardano.Api.Address

data AsType (Certificate era) Source # 
Instance details

Defined in Cardano.Api.Certificate

data AsType (Proposal era) Source # 
Instance details

Defined in Cardano.Api.Governance.Actions.ProposalProcedure

data AsType (VotingProcedure era) Source # 
Instance details

Defined in Cardano.Api.Governance.Actions.VotingProcedure

data AsType (VotingProcedures era) Source # 
Instance details

Defined in Cardano.Api.Governance.Actions.VotingProcedure

data AsType (Hash a) Source # 
Instance details

Defined in Cardano.Api.Hash

data AsType (Hash a) = AsHash (AsType a)
data AsType (SigningKey a) Source # 
Instance details

Defined in Cardano.Api.Keys.Class

data AsType (VerificationKey a) Source # 
Instance details

Defined in Cardano.Api.Keys.Class

data AsType (PlutusScript lang) Source # 
Instance details

Defined in Cardano.Api.Script

data AsType (Script lang) Source # 
Instance details

Defined in Cardano.Api.Script

data AsType (Script lang) = AsScript (AsType lang)
data AsType (ScriptInEra era) Source # 
Instance details

Defined in Cardano.Api.Script

data AsType (KeyWitness era) Source # 
Instance details

Defined in Cardano.Api.Tx.Sign

data AsType (Tx era) Source # 
Instance details

Defined in Cardano.Api.Tx.Sign

data AsType (Tx era) = AsTx (AsType era)
data AsType (TxBody era) Source # 
Instance details

Defined in Cardano.Api.Tx.Sign

data AsType (TxBody era) = AsTxBody (AsType era)