| Maintainer | emi@haskell.fyi |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Agora.Utils
Description
Plutarch utility functions that should be upstreamed or don't belong anywhere else.
Synopsis
- scriptHashFromAddress :: Term s (PAddress :--> PMaybe PValidatorHash)
- findOutputsToAddress :: Term s (PBuiltinList (PAsData PTxOut) :--> (PAddress :--> PBuiltinList (PAsData PTxOut)))
- findTxOutDatum :: Term s (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> (PTxOut :--> PMaybe PDatum))
- validatorHashToTokenName :: ValidatorHash -> TokenName
- pvalidatorHashToTokenName :: forall (s :: S). Term s PValidatorHash -> Term s PTokenName
- getMintingPolicySymbol :: ClosedTerm PMintingPolicy -> CurrencySymbol
- hasOnlyOneTokenOfCurrencySymbol :: forall (keys :: KeyGuarantees) (amounts :: AmountGuarantees) (s :: S). Term s (PCurrencySymbol :--> (PValue keys amounts :--> PBool))
- mustFindDatum' :: forall (datum :: PType). (PIsData datum, PTryFrom PData (PAsData datum)) => forall s. Term s (PMaybeData PDatumHash :--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> datum))
- mustBePJust :: forall a s. Term s (PString :--> (PMaybe a :--> a))
- mustBePDJust :: forall a s. PIsData a => Term s (PString :--> (PMaybeData a :--> a))
- validatorHashToAddress :: ValidatorHash -> Address
- isScriptAddress :: Term s (PAddress :--> PBool)
- isPubKey :: Term s (PCredential :--> PBool)
Documentation
scriptHashFromAddress :: Term s (PAddress :--> PMaybe PValidatorHash) Source #
Get script hash from an Address.
Since: 0.1.0
findOutputsToAddress :: Term s (PBuiltinList (PAsData PTxOut) :--> (PAddress :--> PBuiltinList (PAsData PTxOut))) Source #
Find all TxOuts sent to an Address
Since: 0.1.0
findTxOutDatum :: Term s (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> (PTxOut :--> PMaybe PDatum)) Source #
Find the data corresponding to a TxOut, if there is one
Since: 0.1.0
validatorHashToTokenName :: ValidatorHash -> TokenName Source #
Safely convert a PValidatorHash into a PTokenName. This can be useful for tagging
tokens for extra safety.
Since: 0.1.0
pvalidatorHashToTokenName :: forall (s :: S). Term s PValidatorHash -> Term s PTokenName Source #
Plutarch level validatorHashToTokenName.
Since: 0.1.0
getMintingPolicySymbol :: ClosedTerm PMintingPolicy -> CurrencySymbol Source #
Get the CurrencySymbol of a PMintingPolicy.
Since: 0.1.0
hasOnlyOneTokenOfCurrencySymbol :: forall (keys :: KeyGuarantees) (amounts :: AmountGuarantees) (s :: S). Term s (PCurrencySymbol :--> (PValue keys amounts :--> PBool)) Source #
The entire value only contains one token of the given currency symbol.
Since: 0.1.0
mustFindDatum' :: forall (datum :: PType). (PIsData datum, PTryFrom PData (PAsData datum)) => forall s. Term s (PMaybeData PDatumHash :--> (PBuiltinList (PAsData (PTuple PDatumHash PDatum)) :--> datum)) Source #
Find datum given a maybe datum hash
Since: 0.1.0
mustBePJust :: forall a s. Term s (PString :--> (PMaybe a :--> a)) Source #
Extract the value stored in a PMaybe container. If there's no value, throw an error with the given message.
Since: 0.1.0
mustBePDJust :: forall a s. PIsData a => Term s (PString :--> (PMaybeData a :--> a)) Source #
Extract the value stored in a PMaybeData container. If there's no value, throw an error with the given message.
Since: 0.1.0
validatorHashToAddress :: ValidatorHash -> Address Source #
Create an Address from a given ValidatorHash with no StakingCredential.
Since: 0.1.0