Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
TrustlessSidechain.Utils
Description
This module provides utility functions for working with Plutus data structures.
Synopsis
- fromSingleton :: (() -> a) -> [a] -> a
- fromSingletonData :: UnsafeFromData a => (() -> a) -> List a -> a
- fromJust :: (() -> a) -> Maybe a -> a
- currencySymbolValueOf :: Value -> CurrencySymbol -> Integer
- oneTokenBurned :: Value -> CurrencySymbol -> TokenName -> Bool
- scriptToPlutusScript :: SerialisedScript -> PlutusScript PlutusScriptV2
- oneTokenMinted :: TxInfo -> CurrencySymbol -> TokenName -> Bool
- getOutputsAt :: TxInfo -> Address -> List TxOut
- getInputsAt :: TxInfo -> Address -> List TxOut
Documentation
Arguments
:: (() -> a) | Error thunk evaluated if the list is not a singleton. We do this so the Plutus optimizer can strip out the error string when `remove-trace` is enabled. If the string is passed directly it will be included in the CBOR output even if not used. |
-> [a] | Input list |
-> a | The only element in the list (or error) |
Unwrap a singleton list, or fail with a custom error.
Arguments
:: UnsafeFromData a | |
=> (() -> a) | Error thunk evaluated if the list is not a singleton. We do this so the Plutus optimizer can strip out the error string when `remove-trace` is enabled. If the string is passed directly it will be included in the CBOR output even if not used. |
-> List a | Plutus list |
-> a | The only element in the list (or error) |
Unwrap a singleton Plutus list, or fail with a custom error.
Arguments
:: (() -> a) | Error thunk evaluated if the value is |
-> Maybe a | Input optional value |
-> a | The contained value (or error) |
Unwrap a Maybe
value, or fail with a custom error.
Arguments
:: Value | Value to inspect |
-> CurrencySymbol | Currency symbol to extract total quantity for |
-> Integer | Total quantity of that currency symbol |
Get the total amount of a given currency symbol in a value, ignoring token names.
Arguments
:: Value | The |
-> CurrencySymbol | Currency symbol |
-> TokenName | Token name |
-> Bool | True if exactly one token was burned |
Check that exactly one token of the specified currency and token name was burned.
Arguments
:: SerialisedScript | Serialized script (from |
-> PlutusScript PlutusScriptV2 | Wrapped script for use in transactions |
Convert a serialized Plutus script to a PlutusScript
suitable for submission via the Cardano API.
Arguments
:: TxInfo | Transaction info |
-> CurrencySymbol | Currency symbol |
-> TokenName | Token name |
-> Bool | True if exactly one token was minted |
Check that exactly one token of the specified currency and token name was minted.