agora-0.1.0
Maintaineremi@haskell.fyi
Safe HaskellSafe-Inferred
LanguageHaskell2010

Agora.Utils

Description

Plutarch utility functions that should be upstreamed or don't belong anywhere else.

Synopsis

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

isScriptAddress :: Term s (PAddress :--> PBool) Source #

Return true if the given address is a script address.

Since: 0.1.0

isPubKey :: Term s (PCredential :--> PBool) Source #

Return true if the given credential is a pub-key-hash.

Since: 0.1.0