fixes
This commit is contained in:
parent
339e28fc15
commit
aba51c91e7
1 changed files with 4 additions and 8 deletions
|
|
@ -67,7 +67,6 @@ import Plutarch.Api.V1.AssocMap (PMap (PMap))
|
||||||
import Plutarch.Api.V1.Value (PValue (PValue))
|
import Plutarch.Api.V1.Value (PValue (PValue))
|
||||||
import Plutarch.Builtin (ppairDataBuiltin)
|
import Plutarch.Builtin (ppairDataBuiltin)
|
||||||
import Plutarch.Internal (punsafeCoerce)
|
import Plutarch.Internal (punsafeCoerce)
|
||||||
import Plutarch.List (pconvertLists)
|
|
||||||
import Plutarch.Monadic qualified as P
|
import Plutarch.Monadic qualified as P
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
@ -423,11 +422,11 @@ scriptHashFromAddress :: Term s (PAddress :--> PMaybe PValidatorHash)
|
||||||
scriptHashFromAddress = phoistAcyclic $
|
scriptHashFromAddress = phoistAcyclic $
|
||||||
plam $ \addr ->
|
plam $ \addr ->
|
||||||
pmatch (pfromData $ pfield @"credential" # addr) $ \case
|
pmatch (pfromData $ pfield @"credential" # addr) $ \case
|
||||||
PScriptCredential h -> pcon $ PJust $ pfield @"_0" # h
|
PScriptCredential ((pfield @"_0" #) -> h) -> pcon $ PJust h
|
||||||
_ -> pcon PNothing
|
_ -> pcon PNothing
|
||||||
|
|
||||||
-- | Find all TxOuts sent to an Address
|
-- | Find all TxOuts sent to an Address
|
||||||
findOutputsToAddress :: Term s (PTxInfo :--> PAddress :--> PBuiltinList PTxOut)
|
findOutputsToAddress :: Term s (PTxInfo :--> PAddress :--> PBuiltinList (PAsData PTxOut))
|
||||||
findOutputsToAddress = phoistAcyclic $
|
findOutputsToAddress = phoistAcyclic $
|
||||||
plam $ \info address' -> P.do
|
plam $ \info address' -> P.do
|
||||||
address <- plet $ pdata address'
|
address <- plet $ pdata address'
|
||||||
|
|
@ -435,12 +434,9 @@ findOutputsToAddress = phoistAcyclic $
|
||||||
filteredOutputs =
|
filteredOutputs =
|
||||||
pfilter
|
pfilter
|
||||||
# plam
|
# plam
|
||||||
( \(pfromData -> txOut) -> P.do
|
(\(pfromData -> txOut) -> pfield @"address" # txOut #== address)
|
||||||
selfAddress <- plet $ pfield @"address" # txOut
|
|
||||||
selfAddress #== address
|
|
||||||
)
|
|
||||||
# outputs
|
# outputs
|
||||||
pmap # plam pfromData #$ pconvertLists # filteredOutputs
|
filteredOutputs
|
||||||
|
|
||||||
-- | Find the data corresponding to a TxOut, if there is one
|
-- | Find the data corresponding to a TxOut, if there is one
|
||||||
findTxOutDatum :: Term s (PTxInfo :--> PTxOut :--> PMaybe PDatum)
|
findTxOutDatum :: Term s (PTxInfo :--> PTxOut :--> PMaybe PDatum)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue