Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Hydra.Tx.Utils
Synopsis
- data IncrementalAction
- = ToCommit UTxO
- | ToDecommit UTxO
- | NoThing
- findStateToken :: TxOut ctx -> Maybe HeadId
- headTokensFromValue :: PlutusScript -> Value -> [(AssetName, Quantity)]
- mkHydraHeadV1TxName :: Text -> TxMetadata
- addMetadata :: TxMetadata -> Tx -> AlonzoTx (ConwayEra StandardCrypto) -> AlonzoTx (ConwayEra StandardCrypto)
- assetNameToOnChainId :: AssetName -> OnChainId
- findFirst :: Foldable t => (a -> Maybe b) -> t a -> Maybe b
- hydraHeadV1AssetName :: AssetName
- onChainIdToAssetName :: OnChainId -> AssetName
- hydraMetadataLabel :: Word64
- verificationKeyToOnChainId :: VerificationKey PaymentKey -> OnChainId
- splitUTxO :: UTxO -> (UTxO, UTxO)
- adaOnly :: TxOut CtxUTxO -> TxOut CtxUTxO
- setIncrementalActionMaybe :: Maybe UTxO -> Maybe UTxO -> Maybe IncrementalAction
- findHeadAssetId :: TxOut ctx -> Maybe (PolicyId, AssetName)
- dummyValidatorScript :: PlutusScript
Documentation
data IncrementalAction Source #
Type to encapsulate one of the two possible incremental actions or a regular snapshot. This actually signals that our snapshot modeling is likely not ideal but for now we want to keep track of both fields (de/commit) since we might want to support batch de/commits too in the future, but having both fields be Maybe UTxO intruduces a lot of checks if the value is Nothing or mempty.
Constructors
ToCommit UTxO | |
ToDecommit UTxO | |
NoThing |
Instances
Show IncrementalAction Source # | |
Defined in Hydra.Tx.Utils | |
Eq IncrementalAction Source # | |
Defined in Hydra.Tx.Utils Methods (==) :: IncrementalAction -> IncrementalAction -> Bool Source # (/=) :: IncrementalAction -> IncrementalAction -> Bool Source # |
findStateToken :: TxOut ctx -> Maybe HeadId Source #
Find (if it exists) the head identifier contained in given TxOut
.
headTokensFromValue :: PlutusScript -> Value -> [(AssetName, Quantity)] Source #
mkHydraHeadV1TxName :: Text -> TxMetadata Source #
Create a transaction metadata entry to identify Hydra transactions (for informational purposes).
addMetadata :: TxMetadata -> Tx -> AlonzoTx (ConwayEra StandardCrypto) -> AlonzoTx (ConwayEra StandardCrypto) Source #
assetNameToOnChainId :: AssetName -> OnChainId Source #
findFirst :: Foldable t => (a -> Maybe b) -> t a -> Maybe b Source #
Find first occurrence including a transformation.
hydraHeadV1AssetName :: AssetName Source #
onChainIdToAssetName :: OnChainId -> AssetName Source #
hydraMetadataLabel :: Word64 Source #
The metadata label used for identifying Hydra protocol transactions. As suggested by a friendly large language model: The number most commonly associated with Hydra is 5, as in the mythological creature Hydra, which had multiple heads, and the number 5 often symbolizes multiplicity or diversity. However, there is no specific numerical association for Hydra smaller than 10000 beyond this mythological reference.
verificationKeyToOnChainId :: VerificationKey PaymentKey -> OnChainId Source #
Derive the OnChainId
from a Cardano PaymentKey
. The on-chain identifier
is the public key hash as it is also availble to plutus validators.
splitUTxO :: UTxO -> (UTxO, UTxO) Source #
Split a given UTxO into two, such that the second UTxO is non-empty. This is useful to pick a UTxO to decommit.
setIncrementalActionMaybe :: Maybe UTxO -> Maybe UTxO -> Maybe IncrementalAction Source #
findHeadAssetId :: TxOut ctx -> Maybe (PolicyId, AssetName) Source #
dummyValidatorScript :: PlutusScript #