| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Tx.Utils
Synopsis
- hydraHeadV2AssetName :: AssetName
- hydraMetadataLabel :: Word64
- mkHydraHeadV2TxName :: Text -> TxMetadata
- assetNameToOnChainId :: AssetName -> OnChainId
- onChainIdToAssetName :: OnChainId -> AssetName
- findFirst :: Foldable t => (a -> Maybe b) -> t a -> Maybe b
- verificationKeyToOnChainId :: VerificationKey PaymentKey -> OnChainId
- headTokensFromValue :: PlutusScript -> Value -> PolicyAssets
- addMetadata :: TxMetadata -> Tx -> Tx TopTx LedgerEra -> Tx TopTx LedgerEra
- data IncrementalAction
- setIncrementalActionMaybe :: Maybe UTxO -> Maybe UTxO -> Maybe IncrementalAction
- findStateToken :: TxOut ctx -> Maybe HeadId
- findHeadAssetId :: TxOut ctx -> Maybe (PolicyId, AssetName)
Documentation
hydraHeadV2AssetName :: 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.
mkHydraHeadV2TxName :: Text -> TxMetadata Source #
Create a transaction metadata entry to identify Hydra transactions (for informational purposes).
assetNameToOnChainId :: AssetName -> OnChainId Source #
onChainIdToAssetName :: OnChainId -> AssetName Source #
findFirst :: Foldable t => (a -> Maybe b) -> t a -> Maybe b Source #
Find first occurrence including a transformation.
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 available to plutus validators.
headTokensFromValue :: PlutusScript -> Value -> PolicyAssets Source #
addMetadata :: TxMetadata -> Tx -> Tx TopTx LedgerEra -> Tx TopTx LedgerEra Source #
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 introduces a lot of checks if the value is Nothing or mempty.
TODO: Remove this type. Since GHSA-f825-9gwc-h5xq, closeTx
no longer distinguishes ToCommit from ToDecommit (which accumulator to
store is decided by comparing the snapshot version with the open version),
so the only remaining uses are picking CloseAny when nothing is pending
and rejecting a snapshot with both a commit and a decommit. Both can be
expressed directly on the snapshot's utxoToCommit / utxoToDecommit.
Constructors
| ToCommit | |
| ToDecommit | |
| 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 # | |
setIncrementalActionMaybe :: Maybe UTxO -> Maybe UTxO -> Maybe IncrementalAction Source #
findStateToken :: TxOut ctx -> Maybe HeadId Source #
Find (if it exists) the head identifier contained in given TxOut.
findHeadAssetId :: TxOut ctx -> Maybe (PolicyId, AssetName) Source #