Skip to content

Commit

Permalink
Revert "Make publicKeyFromBech32 an Effect"
Browse files Browse the repository at this point in the history
This reverts commit 9c806be.
  • Loading branch information
jy14898 committed May 23, 2022
1 parent 223b4cc commit de593da
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Serialization.purs
Expand Up @@ -197,7 +197,7 @@ foreign import newVkeywitness :: Vkey -> Ed25519Signature -> Effect Vkeywitness
foreign import addVkeywitness :: Vkeywitnesses -> Vkeywitness -> Effect Unit
foreign import newVkeyFromPublicKey :: PublicKey -> Effect Vkey
foreign import _publicKeyFromBech32
:: MaybeFfiHelper -> Bech32String -> Effect (Maybe PublicKey)
:: MaybeFfiHelper -> Bech32String -> Maybe PublicKey

foreign import publicKeyHash :: PublicKey -> Ed25519KeyHash
foreign import newEd25519Signature :: Bech32String -> Effect Ed25519Signature
Expand Down Expand Up @@ -568,7 +568,7 @@ convertWithdrawals mp =
Tuple k <$> fromJustEff "convertWithdrawals: Failed to convert BigNum"
(bigNumFromBigInt v)

publicKeyFromBech32 :: Bech32String -> Effect (Maybe PublicKey)
publicKeyFromBech32 :: Bech32String -> Maybe PublicKey
publicKeyFromBech32 = _publicKeyFromBech32 maybeFfiHelper

convertCerts :: Array T.Certificate -> Effect Certificates
Expand Down
4 changes: 2 additions & 2 deletions src/Types/ScriptLookups.purs
Expand Up @@ -851,9 +851,9 @@ processConstraint mpsMap osMap = do
MustBeSignedBy pkh -> runExceptT do
ppkh <- use _lookups <#> unwrap >>> _.paymentPubKeyHashes
sigs <- for (lookup pkh ppkh) $
payPubKeyRequiredSigner >>> liftEffect >=>
payPubKeyRequiredSigner >>>
maybe (throwError (CannotConvertPaymentPubKeyHash pkh))
(pure <<< Array.singleton)
(pure <<< Array.singleton)
_cpsToTxBody <<< _requiredSigners <>= sigs
MustSpendAtLeast plutusValue -> do
let value = unwrap $ fromPlutusType plutusValue
Expand Down
5 changes: 2 additions & 3 deletions src/Types/UnbalancedTransaction.purs
Expand Up @@ -25,7 +25,6 @@ import Data.Maybe (Maybe)
import Data.Newtype (class Newtype)
import Data.Show.Generic (genericShow)
import Data.Tuple (Tuple(Tuple))
import Effect (Effect)
import Serialization
( publicKeyFromBech32
, publicKeyHash
Expand Down Expand Up @@ -63,9 +62,9 @@ instance Show ScriptOutput where
payPubKeyVkey :: PaymentPubKey -> Vkey
payPubKeyVkey (PaymentPubKey pk) = Vkey pk

payPubKeyRequiredSigner :: PaymentPubKey -> Effect (Maybe RequiredSigner)
payPubKeyRequiredSigner :: PaymentPubKey -> Maybe RequiredSigner
payPubKeyRequiredSigner (PaymentPubKey (PublicKey bech32)) =
map (RequiredSigner <<< publicKeyHash) <$> publicKeyFromBech32 bech32
RequiredSigner <<< publicKeyHash <$> publicKeyFromBech32 bech32

-- | An unbalanced transaction. It needs to be balanced and signed before it
-- | can be submitted to the ledger.
Expand Down

0 comments on commit de593da

Please sign in to comment.