diff --git a/src/base/lib/Convex/PlutusLedger.hs b/src/base/lib/Convex/PlutusLedger.hs index a5a3b9f9..e529a2b3 100644 --- a/src/base/lib/Convex/PlutusLedger.hs +++ b/src/base/lib/Convex/PlutusLedger.hs @@ -19,6 +19,9 @@ module Convex.PlutusLedger( transStakeKeyHash, unTransStakeKeyHash, + transStakePoolKeyHash, + unTransStakePoolKeyHash, + -- * Asset names transAssetName, toMaryAssetName, @@ -139,6 +142,14 @@ unTransStakeKeyHash (PV1.PubKeyHash pkh) = let bsx = PlutusTx.fromBuiltin pkh in C.deserialiseFromRawBytes (C.AsHash C.AsStakeKey) bsx +transStakePoolKeyHash :: C.Hash C.StakePoolKey -> PV1.PubKeyHash +transStakeKeyHash = PV1.PubKeyHash . PlutusTx.toBuiltin . C.serialiseToRawBytes + +unTransStakePoolKeyHash :: PV1.PubKeyHash -> Either C.SerialiseAsRawBytesError (C.Hash C.StakePoolKey) +unTransStakeKeyHash (PV1.PubKeyHash pkh) = + let bsx = PlutusTx.fromBuiltin pkh + in C.deserialiseFromRawBytes (C.AsHash C.AsStakePoolKey) bsx + unTransCredential :: PV1.Credential -> Either C.SerialiseAsRawBytesError C.PaymentCredential unTransCredential = \case PV1.PubKeyCredential c -> C.PaymentCredentialByKey <$> unTransPubKeyHash c