Safe Haskell | None |
---|---|
Language | Haskell2010 |
Currency values
Synopsis
- newtype Coin = Coin {}
- newtype Quantity = Quantity Integer
- newtype PolicyId = PolicyId {}
- scriptPolicyId :: Script lang -> PolicyId
- newtype AssetName = AssetName ByteString
- data AssetId
- data Value
- selectAsset :: Value -> AssetId -> Quantity
- valueFromList :: [(AssetId, Quantity)] -> Value
- valueToList :: Value -> [(AssetId, Quantity)]
- filterValue :: (AssetId -> Bool) -> Value -> Value
- allPositive :: Value -> Bool
- negateValue :: Value -> Value
- negateLedgerValue :: ShelleyBasedEra era -> Value (ShelleyLedgerEra era) -> Value (ShelleyLedgerEra era)
- calcMinimumDeposit :: Value -> Lovelace -> Lovelace
- type Lovelace = Coin
- quantityToLovelace :: Quantity -> Lovelace
- lovelaceToQuantity :: Lovelace -> Quantity
- selectLovelace :: Value -> Lovelace
- lovelaceToValue :: Lovelace -> Value
- valueToLovelace :: Value -> Maybe Lovelace
- newtype ValueNestedRep = ValueNestedRep [ValueNestedBundle]
- data ValueNestedBundle
- valueToNestedRep :: Value -> ValueNestedRep
- valueFromNestedRep :: ValueNestedRep -> Value
- renderValue :: Value -> Text
- renderValuePretty :: Value -> Text
- toByronLovelace :: Lovelace -> Maybe Lovelace
- fromByronLovelace :: Lovelace -> Lovelace
- fromShelleyDeltaLovelace :: DeltaCoin -> Lovelace
- toMaryValue :: Value -> MaryValue StandardCrypto
- fromMaryValue :: MaryValue StandardCrypto -> Value
- fromLedgerValue :: ShelleyBasedEra era -> Value (ShelleyLedgerEra era) -> Value
- toLedgerValue :: MaryEraOnwards era -> Value -> Value (ShelleyLedgerEra era)
- data family AsType t
Documentation
The amount of value held by a transaction output.
Instances
Multi-asset values
Instances
FromJSON Quantity Source # | |
Defined in Cardano.Api.Value | |
ToJSON Quantity Source # | |
Defined in Cardano.Api.Value | |
Data Quantity Source # | |
Defined in Cardano.Api.Value 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 # | |
Semigroup Quantity Source # | |
Num Quantity Source # | |
Defined in Cardano.Api.Value (+) :: Quantity -> Quantity -> Quantity Source # (-) :: Quantity -> Quantity -> Quantity Source # (*) :: Quantity -> Quantity -> Quantity Source # negate :: Quantity -> Quantity Source # abs :: Quantity -> Quantity Source # signum :: Quantity -> Quantity Source # fromInteger :: Integer -> Quantity Source # | |
Show Quantity Source # | |
Eq Quantity Source # | |
Ord Quantity Source # | |
Defined in Cardano.Api.Value |
Instances
FromJSON PolicyId Source # | |||||
Defined in Cardano.Api.Value | |||||
ToJSON PolicyId Source # | |||||
Defined in Cardano.Api.Value | |||||
IsString PolicyId Source # | |||||
Defined in Cardano.Api.Value fromString :: String -> PolicyId Source # | |||||
Show PolicyId Source # | |||||
HasTypeProxy PolicyId Source # | |||||
Defined in Cardano.Api.Value
| |||||
SerialiseAsRawBytes PolicyId Source # | |||||
Defined in Cardano.Api.Value | |||||
Eq PolicyId Source # | |||||
Ord PolicyId Source # | |||||
Defined in Cardano.Api.Value | |||||
data AsType PolicyId Source # | |||||
Defined in Cardano.Api.Value |
scriptPolicyId :: Script lang -> PolicyId Source #
Instances
FromJSON AssetName Source # | |||||
Defined in Cardano.Api.Value | |||||
FromJSONKey AssetName Source # | |||||
Defined in Cardano.Api.Value fromJSONKey :: FromJSONKeyFunction AssetName fromJSONKeyList :: FromJSONKeyFunction [AssetName] | |||||
ToJSON AssetName Source # | |||||
Defined in Cardano.Api.Value | |||||
ToJSONKey AssetName Source # | |||||
Defined in Cardano.Api.Value toJSONKey :: ToJSONKeyFunction AssetName toJSONKeyList :: ToJSONKeyFunction [AssetName] | |||||
IsString AssetName Source # | |||||
Defined in Cardano.Api.Value fromString :: String -> AssetName Source # | |||||
Show AssetName Source # | |||||
HasTypeProxy AssetName Source # | |||||
Defined in Cardano.Api.Value
| |||||
SerialiseAsRawBytes AssetName Source # | |||||
Defined in Cardano.Api.Value | |||||
Eq AssetName Source # | |||||
Ord AssetName Source # | |||||
Defined in Cardano.Api.Value | |||||
data AsType AssetName Source # | |||||
Defined in Cardano.Api.Value |
Instances
Show AssetId Source # | |
Eq AssetId Source # | |
Ord AssetId Source # | |
Instances
FromJSON Value Source # | |
Defined in Cardano.Api.Value parseJSON :: Value -> Parser Value # parseJSONList :: Value -> Parser [Value] # omittedField :: Maybe Value # | |
ToJSON Value Source # | |
Defined in Cardano.Api.Value | |
Monoid Value Source # | |
Semigroup Value Source # | |
IsList Value Source # | |
Show Value Source # | |
Eq Value Source # | |
type Item Value Source # | |
Defined in Cardano.Api.Value |
negateValue :: Value -> Value Source #
This lets you write a - b
as a <> negateValue b
.
negateLedgerValue :: ShelleyBasedEra era -> Value (ShelleyLedgerEra era) -> Value (ShelleyLedgerEra era) Source #
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
selectLovelace :: Value -> Lovelace Source #
lovelaceToValue :: Lovelace -> Value Source #
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 #
Instances
FromJSON ValueNestedRep Source # | |
Defined in Cardano.Api.Value parseJSON :: Value -> Parser ValueNestedRep # parseJSONList :: Value -> Parser [ValueNestedRep] # | |
ToJSON ValueNestedRep Source # | |
Defined in Cardano.Api.Value toJSON :: ValueNestedRep -> Value # toEncoding :: ValueNestedRep -> Encoding # toJSONList :: [ValueNestedRep] -> Value # toEncodingList :: [ValueNestedRep] -> Encoding # omitField :: ValueNestedRep -> Bool # | |
Show ValueNestedRep Source # | |
Defined in Cardano.Api.Value | |
Eq ValueNestedRep Source # | |
Defined in Cardano.Api.Value (==) :: ValueNestedRep -> ValueNestedRep -> Bool Source # (/=) :: ValueNestedRep -> ValueNestedRep -> Bool Source # | |
Ord ValueNestedRep Source # | |
Defined in Cardano.Api.Value compare :: ValueNestedRep -> ValueNestedRep -> Ordering Source # (<) :: ValueNestedRep -> ValueNestedRep -> Bool Source # (<=) :: ValueNestedRep -> ValueNestedRep -> Bool Source # (>) :: ValueNestedRep -> ValueNestedRep -> Bool Source # (>=) :: ValueNestedRep -> ValueNestedRep -> Bool Source # max :: ValueNestedRep -> ValueNestedRep -> ValueNestedRep Source # min :: ValueNestedRep -> ValueNestedRep -> ValueNestedRep Source # |
data ValueNestedBundle Source #
A bundle within a ValueNestedRep
for a single PolicyId
, or for the
special case of ada.
Instances
Show ValueNestedBundle Source # | |
Defined in Cardano.Api.Value | |
Eq ValueNestedBundle Source # | |
Defined in Cardano.Api.Value (==) :: ValueNestedBundle -> ValueNestedBundle -> Bool Source # (/=) :: ValueNestedBundle -> ValueNestedBundle -> Bool Source # | |
Ord ValueNestedBundle Source # | |
Defined in Cardano.Api.Value compare :: ValueNestedBundle -> ValueNestedBundle -> Ordering Source # (<) :: ValueNestedBundle -> ValueNestedBundle -> Bool Source # (<=) :: ValueNestedBundle -> ValueNestedBundle -> Bool Source # (>) :: ValueNestedBundle -> ValueNestedBundle -> Bool Source # (>=) :: ValueNestedBundle -> ValueNestedBundle -> Bool Source # max :: ValueNestedBundle -> ValueNestedBundle -> ValueNestedBundle Source # min :: ValueNestedBundle -> ValueNestedBundle -> ValueNestedBundle Source # |
Rendering
Internal conversion functions
fromByronLovelace :: Lovelace -> Lovelace Source #
fromLedgerValue :: ShelleyBasedEra era -> Value (ShelleyLedgerEra era) -> Value Source #
toLedgerValue :: MaryEraOnwards era -> Value -> Value (ShelleyLedgerEra era) Source #
Data family instances
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
data AsType AddressAny Source # | |
Defined in Cardano.Api.Address | |
data AsType ByronAddr Source # | |
Defined in Cardano.Api.Address | |
data AsType ShelleyAddr Source # | |
Defined in Cardano.Api.Address | |
data AsType StakeAddress Source # | |
Defined in Cardano.Api.Address | |
data AsType BlockHeader Source # | |
Defined in Cardano.Api.Block | |
data AsType DRepMetadata Source # | |
Defined in Cardano.Api.DRepMetadata | |
data AsType AllegraEra Source # | |
Defined in Cardano.Api.Eras.Core | |
data AsType AlonzoEra Source # | |
Defined in Cardano.Api.Eras.Core | |
data AsType BabbageEra Source # | |
Defined in Cardano.Api.Eras.Core | |
data AsType ByronEra Source # | |
Defined in Cardano.Api.Eras.Core | |
data AsType ConwayEra Source # | |
Defined in Cardano.Api.Eras.Core | |
data AsType MaryEra Source # | |
Defined in Cardano.Api.Eras.Core | |
data AsType ShelleyEra Source # | |
Defined in Cardano.Api.Eras.Core | |
data AsType GovernancePoll Source # | |
Defined in Cardano.Api.Governance.Poll | |
data AsType GovernancePollAnswer Source # | |
Defined in Cardano.Api.Governance.Poll | |
data AsType ByronKey Source # | |
Defined in Cardano.Api.Keys.Byron | |
data AsType ByronKeyLegacy Source # | |
Defined in Cardano.Api.Keys.Byron | |
data AsType KesKey Source # | |
Defined in Cardano.Api.Keys.Praos | |
data AsType VrfKey Source # | |
Defined in Cardano.Api.Keys.Praos | |
data AsType CommitteeColdExtendedKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType CommitteeColdKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType CommitteeHotExtendedKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType CommitteeHotKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType DRepExtendedKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType DRepKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType GenesisDelegateExtendedKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType GenesisDelegateKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType GenesisExtendedKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType GenesisKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType GenesisUTxOKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType PaymentExtendedKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType PaymentKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType StakeExtendedKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType StakeKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType StakePoolKey Source # | |
Defined in Cardano.Api.Keys.Shelley | |
data AsType OperationalCertificate Source # | |
data AsType OperationalCertificateIssueCounter Source # | |
data AsType PraosNonce Source # | |
Defined in Cardano.Api.ProtocolParameters | |
data AsType UpdateProposal Source # | |
Defined in Cardano.Api.ProtocolParameters | |
data AsType PlutusScriptV1 Source # | |
Defined in Cardano.Api.Script | |
data AsType PlutusScriptV2 Source # | |
Defined in Cardano.Api.Script | |
data AsType PlutusScriptV3 Source # | |
Defined in Cardano.Api.Script | |
data AsType ScriptHash Source # | |
Defined in Cardano.Api.Script | |
data AsType ScriptInAnyLang Source # | |
Defined in Cardano.Api.Script | |
data AsType SimpleScript' Source # | |
Defined in Cardano.Api.Script | |
data AsType HashableScriptData Source # | |
Defined in Cardano.Api.ScriptData | |
data AsType ScriptData Source # | |
Defined in Cardano.Api.ScriptData | |
data AsType TextEnvelope Source # | |
Defined in Cardano.Api.SerialiseTextEnvelope | |
data AsType ByronUpdateProposal Source # | |
Defined in Cardano.Api.SpecialByron | |
data AsType ByronVote Source # | |
Defined in Cardano.Api.SpecialByron | |
data AsType StakePoolMetadata Source # | |
Defined in Cardano.Api.StakePoolMetadata | |
data AsType TxId Source # | |
Defined in Cardano.Api.TxIn | |
data AsType TxMetadata Source # | |
Defined in Cardano.Api.TxMetadata | |
data AsType AssetName Source # | |
Defined in Cardano.Api.Value | |
data AsType PolicyId Source # | |
Defined in Cardano.Api.Value | |
data AsType (Address addrtype) Source # | |
Defined in Cardano.Api.Address | |
data AsType (AddressInEra era) Source # | |
Defined in Cardano.Api.Address | |
data AsType (Certificate era) Source # | |
Defined in Cardano.Api.Certificate | |
data AsType (Proposal era) Source # | |
data AsType (VotingProcedure era) Source # | |
data AsType (VotingProcedures era) Source # | |
data AsType (Hash a) Source # | |
Defined in Cardano.Api.Hash | |
data AsType (SigningKey a) Source # | |
Defined in Cardano.Api.Keys.Class | |
data AsType (VerificationKey a) Source # | |
Defined in Cardano.Api.Keys.Class | |
data AsType (PlutusScript lang) Source # | |
Defined in Cardano.Api.Script | |
data AsType (Script lang) Source # | |
Defined in Cardano.Api.Script | |
data AsType (ScriptInEra era) Source # | |
Defined in Cardano.Api.Script | |
data AsType (KeyWitness era) Source # | |
Defined in Cardano.Api.Tx.Sign | |
data AsType (Tx era) Source # | |
Defined in Cardano.Api.Tx.Sign | |
data AsType (TxBody era) Source # | |
Defined in Cardano.Api.Tx.Sign |