Emily's suggestions & fixed building
This commit is contained in:
parent
744316a5a6
commit
339e28fc15
1 changed files with 7 additions and 7 deletions
|
|
@ -153,7 +153,7 @@ pfromMaybe = phoistAcyclic $
|
||||||
PJust a' -> a'
|
PJust a' -> a'
|
||||||
PNothing -> e
|
PNothing -> e
|
||||||
|
|
||||||
-- | Yield True if a given PMaybe is of form PJust _
|
-- | Yield True if a given PMaybe is of form PJust _.
|
||||||
pisJust :: forall a s. Term s (PMaybe a :--> PBool)
|
pisJust :: forall a s. Term s (PMaybe a :--> PBool)
|
||||||
pisJust = phoistAcyclic $
|
pisJust = phoistAcyclic $
|
||||||
plam $ \v' -> P.do
|
plam $ \v' -> P.do
|
||||||
|
|
@ -421,26 +421,26 @@ findTxOutByTxOutRef = phoistAcyclic $
|
||||||
-- | Get script hash from an Address.
|
-- | Get script hash from an Address.
|
||||||
scriptHashFromAddress :: Term s (PAddress :--> PMaybe PValidatorHash)
|
scriptHashFromAddress :: Term s (PAddress :--> PMaybe PValidatorHash)
|
||||||
scriptHashFromAddress = phoistAcyclic $
|
scriptHashFromAddress = phoistAcyclic $
|
||||||
plam $ \addr -> P.do
|
plam $ \addr ->
|
||||||
cred <- pmatch $ pfromData $ pfield @"credential" # addr
|
pmatch (pfromData $ pfield @"credential" # addr) $ \case
|
||||||
case cred of
|
|
||||||
PScriptCredential h -> pcon $ PJust $ pfield @"_0" # h
|
PScriptCredential h -> pcon $ PJust $ pfield @"_0" # h
|
||||||
_ -> pcon PNothing
|
_ -> pcon PNothing
|
||||||
|
|
||||||
-- | Find all TxOuts sent to an Address
|
-- | Find all TxOuts sent to an Address
|
||||||
findOutputsToAddress :: Term s (PTxInfo :--> PAddress :--> PList PTxOut)
|
findOutputsToAddress :: Term s (PTxInfo :--> PAddress :--> PBuiltinList PTxOut)
|
||||||
findOutputsToAddress = phoistAcyclic $
|
findOutputsToAddress = phoistAcyclic $
|
||||||
plam $ \info address' -> P.do
|
plam $ \info address' -> P.do
|
||||||
address <- plet $ pdata address'
|
address <- plet $ pdata address'
|
||||||
let outputs = pfromData $ pfield @"outputs" # info
|
let outputs = pfromData $ pfield @"outputs" # info
|
||||||
filteredOutputs =
|
filteredOutputs =
|
||||||
pfilter
|
pfilter
|
||||||
# ( plam $ \(pfromData -> txOut) -> P.do
|
# plam
|
||||||
|
( \(pfromData -> txOut) -> P.do
|
||||||
selfAddress <- plet $ pfield @"address" # txOut
|
selfAddress <- plet $ pfield @"address" # txOut
|
||||||
selfAddress #== address
|
selfAddress #== address
|
||||||
)
|
)
|
||||||
# outputs
|
# outputs
|
||||||
pmap @PList # plam pfromData #$ pconvertLists # filteredOutputs
|
pmap # plam pfromData #$ pconvertLists # 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