cardano-api-8.36.1.1: The cardano api
Safe HaskellNone
LanguageHaskell2010

Cardano.Api.Value

Description

Currency values

Synopsis

Documentation

newtype Lovelace Source #

Constructors

Lovelace Integer 

Instances

Instances details
Enum Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Eq Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Integral Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Num Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Ord Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Real Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Show Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Semigroup Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Monoid Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

FromCBOR Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Methods

fromCBOR :: Decoder s Lovelace #

label :: Proxy Lovelace -> Text #

FromJSON Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Methods

parseJSON :: Value -> Parser Lovelace #

parseJSONList :: Value -> Parser [Lovelace] #

omittedField :: Maybe Lovelace #

ToCBOR Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toCBOR :: Lovelace -> Encoding #

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

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

ToJSON Lovelace Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toJSON :: Lovelace -> Value #

toEncoding :: Lovelace -> Encoding #

toJSONList :: [Lovelace] -> Value #

toEncodingList :: [Lovelace] -> Encoding #

omitField :: Lovelace -> Bool #

Multi-asset values

newtype Quantity Source #

Constructors

Quantity Integer 

Instances

Instances details
Eq Quantity Source # 
Instance details

Defined in Cardano.Api.Value

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 #

Num Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Ord Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Show Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Semigroup Quantity Source # 
Instance details

Defined in Cardano.Api.Value

Monoid Quantity Source # 
Instance details

Defined in Cardano.Api.Value

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 #

newtype PolicyId Source #

Constructors

PolicyId 

Instances

Instances details
Eq PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Ord PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Show PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

IsString PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

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 #

HasTypeProxy PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

Associated Types

data AsType PolicyId Source #

SerialiseAsRawBytes 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
Eq AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Ord AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Show AssetName Source # 
Instance details

Defined in Cardano.Api.Value

IsString AssetName Source # 
Instance details

Defined in Cardano.Api.Value

FromJSON AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Methods

parseJSON :: Value -> Parser AssetName #

parseJSONList :: Value -> Parser [AssetName] #

omittedField :: Maybe 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]

HasTypeProxy AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Associated Types

data AsType AssetName Source #

FromJSONKey AssetName Source # 
Instance details

Defined in Cardano.Api.Value

Methods

fromJSONKey :: FromJSONKeyFunction AssetName

fromJSONKeyList :: FromJSONKeyFunction [AssetName]

SerialiseAsRawBytes 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
Eq AssetId Source # 
Instance details

Defined in Cardano.Api.Value

Ord AssetId Source # 
Instance details

Defined in Cardano.Api.Value

Show AssetId Source # 
Instance details

Defined in Cardano.Api.Value

data Value Source #

Instances

Instances details
Eq Value Source # 
Instance details

Defined in Cardano.Api.Value

Methods

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

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

Show Value Source # 
Instance details

Defined in Cardano.Api.Value

Semigroup Value Source # 
Instance details

Defined in Cardano.Api.Value

Monoid Value Source # 
Instance details

Defined in Cardano.Api.Value

FromJSON Value Source # 
Instance details

Defined in Cardano.Api.Value

Methods

parseJSON :: Value0 -> Parser Value #

parseJSONList :: Value0 -> Parser [Value] #

omittedField :: Maybe Value #

ToJSON Value Source # 
Instance details

Defined in Cardano.Api.Value

Methods

toJSON :: Value -> Value0 #

toEncoding :: Value -> Encoding #

toJSONList :: [Value] -> Value0 #

toEncodingList :: [Value] -> Encoding #

omitField :: Value -> Bool #

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 / Lovelace specifically

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 ConwayEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType BabbageEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType AlonzoEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType MaryEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType AllegraEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType ShelleyEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType ByronEra Source # 
Instance details

Defined in Cardano.Api.Eras.Core

data AsType TxId Source # 
Instance details

Defined in Cardano.Api.TxIn

data AsType TxMetadata Source # 
Instance details

Defined in Cardano.Api.TxMetadata

data AsType TextEnvelope Source # 
Instance details

Defined in Cardano.Api.SerialiseTextEnvelope

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 StakePoolKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType GenesisUTxOKey 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 CommitteeColdKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType CommitteeHotKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType GenesisKey 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 PaymentExtendedKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType PaymentKey Source # 
Instance details

Defined in Cardano.Api.Keys.Shelley

data AsType VrfKey Source # 
Instance details

Defined in Cardano.Api.Keys.Praos

data AsType KesKey Source # 
Instance details

Defined in Cardano.Api.Keys.Praos

data AsType ByronKeyLegacy Source # 
Instance details

Defined in Cardano.Api.Keys.Byron

data AsType ByronKey Source # 
Instance details

Defined in Cardano.Api.Keys.Byron

data AsType ByronVote Source # 
Instance details

Defined in Cardano.Api.SpecialByron

data AsType ByronUpdateProposal Source # 
Instance details

Defined in Cardano.Api.SpecialByron

data AsType ScriptData Source # 
Instance details

Defined in Cardano.Api.ScriptData

data AsType HashableScriptData Source # 
Instance details

Defined in Cardano.Api.ScriptData

data AsType ScriptHash Source # 
Instance details

Defined in Cardano.Api.Script

data AsType ScriptInAnyLang Source # 
Instance details

Defined in Cardano.Api.Script

data AsType PlutusScriptV3 Source # 
Instance details

Defined in Cardano.Api.Script

data AsType PlutusScriptV2 Source # 
Instance details

Defined in Cardano.Api.Script

data AsType PlutusScriptV1 Source # 
Instance details

Defined in Cardano.Api.Script

data AsType SimpleScript' Source # 
Instance details

Defined in Cardano.Api.Script

data AsType AssetName Source # 
Instance details

Defined in Cardano.Api.Value

data AsType PolicyId Source # 
Instance details

Defined in Cardano.Api.Value

data AsType StakePoolMetadata Source # 
Instance details

Defined in Cardano.Api.StakePoolMetadata

data AsType DRepMetadata Source # 
Instance details

Defined in Cardano.Api.DRepMetadata

data AsType StakeAddress Source # 
Instance details

Defined in Cardano.Api.Address

data AsType AddressAny Source # 
Instance details

Defined in Cardano.Api.Address

data AsType ShelleyAddr Source # 
Instance details

Defined in Cardano.Api.Address

data AsType ByronAddr Source # 
Instance details

Defined in Cardano.Api.Address

data AsType UpdateProposal Source # 
Instance details

Defined in Cardano.Api.ProtocolParameters

data AsType PraosNonce Source # 
Instance details

Defined in Cardano.Api.ProtocolParameters

data AsType GovernancePollAnswer Source # 
Instance details

Defined in Cardano.Api.Governance.Poll

data AsType GovernancePoll Source # 
Instance details

Defined in Cardano.Api.Governance.Poll

data AsType BlockHeader Source # 
Instance details

Defined in Cardano.Api.Block

data AsType OperationalCertificateIssueCounter Source # 
Instance details

Defined in Cardano.Api.OperationalCertificate

data AsType OperationalCertificate Source # 
Instance details

Defined in Cardano.Api.OperationalCertificate

data AsType (Hash a) Source # 
Instance details

Defined in Cardano.Api.Hash

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

Defined in Cardano.Api.Keys.Class

data AsType (SigningKey a) Source # 
Instance details

Defined in Cardano.Api.Keys.Class

data AsType (PlutusScript lang) Source # 
Instance details

Defined in Cardano.Api.Script

data AsType (ScriptInEra era) 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 (AddressInEra era) Source # 
Instance details

Defined in Cardano.Api.Address

data AsType (Address addrtype) Source # 
Instance details

Defined in Cardano.Api.Address

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

Defined in Cardano.Api.Governance.Actions.ProposalProcedure

data AsType (VotingProcedures era) Source # 
Instance details

Defined in Cardano.Api.Governance.Actions.VotingProcedure

data AsType (VotingProcedure era) Source # 
Instance details

Defined in Cardano.Api.Governance.Actions.VotingProcedure

data AsType (Certificate era) Source # 
Instance details

Defined in Cardano.Api.Certificate

data AsType (TxBody era) Source # 
Instance details

Defined in Cardano.Api.TxBody

data AsType (TxBody era) = AsTxBody (AsType era)
data AsType (KeyWitness era) Source # 
Instance details

Defined in Cardano.Api.Tx

data AsType (Tx era) Source # 
Instance details

Defined in Cardano.Api.Tx

data AsType (Tx era) = AsTx (AsType era)