{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE DataKinds #-}
{-# OPTIONS_GHC -Wno-unticked-promoted-constructors #-}
module Cardano.Api.Tx (
Tx(.., Tx),
getTxBody,
getTxWitnesses,
ScriptValidity(..),
ShelleySigningKey(..),
toShelleySigningKey,
signByronTransaction,
signShelleyTransaction,
makeSignedTransaction,
KeyWitness(..),
makeByronKeyWitness,
ShelleyWitnessSigningKey(..),
makeShelleyKeyWitness,
WitnessNetworkIdOrByronAddress (..),
makeShelleyBootstrapWitness,
makeShelleySignature,
getShelleyKeyWitnessVerificationKey,
getTxBodyAndWitnesses,
AsType(AsTx, AsByronTx, AsShelleyTx, AsMaryTx, AsAllegraTx, AsAlonzoTx,
AsKeyWitness, AsByronWitness, AsShelleyWitness),
) where
import Prelude
import Data.Maybe
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as LBS
import Data.Functor.Identity (Identity)
import qualified Data.Map.Strict as Map
import qualified Data.Set as Set
import Data.Type.Equality (TestEquality (..), (:~:) (Refl))
import qualified Data.Vector as Vector
import Cardano.Binary (Annotated (..))
import qualified Cardano.Binary as CBOR
import qualified Cardano.Prelude as CBOR (cborError)
import qualified Cardano.Crypto.DSIGN.Class as Crypto
import qualified Cardano.Crypto.Util as Crypto
import qualified Cardano.Crypto.Wallet as Crypto.HD
import qualified Cardano.Chain.Common as Byron
import qualified Cardano.Chain.UTxO as Byron
import qualified Cardano.Crypto.Hashing as Byron
import qualified Cardano.Crypto.ProtocolMagic as Byron
import qualified Cardano.Crypto.Signing as Byron
import Cardano.Ledger.BaseTypes (maybeToStrictMaybe, strictMaybeToMaybe)
import Cardano.Ledger.Crypto (StandardCrypto)
import qualified Cardano.Ledger.Core as Ledger
import qualified Cardano.Ledger.Era as Ledger
import qualified Cardano.Ledger.Keys as Shelley
import qualified Cardano.Ledger.SafeHash as Ledger
import qualified Cardano.Ledger.Shelley.Address.Bootstrap as Shelley
import qualified Cardano.Ledger.Shelley.Constraints as Shelley
import qualified Cardano.Ledger.Shelley.Tx as Shelley
import qualified Cardano.Ledger.Shelley.TxBody as Ledger (EraIndependentTxBody)
import qualified Cardano.Ledger.Alonzo as Alonzo
import qualified Cardano.Ledger.Alonzo.Tx as Alonzo
import qualified Cardano.Ledger.Alonzo.TxWitness as Alonzo
import Cardano.Api.Address
import Cardano.Api.Certificate
import Cardano.Api.Eras
import Cardano.Api.HasTypeProxy
import Cardano.Api.Key
import Cardano.Api.KeysByron
import Cardano.Api.KeysShelley
import Cardano.Api.NetworkId
import Cardano.Api.SerialiseCBOR
import Cardano.Api.SerialiseTextEnvelope
import Cardano.Api.TxBody
data Tx era where
ByronTx
:: Byron.ATxAux ByteString
-> Tx ByronEra
ShelleyTx
:: ShelleyBasedEra era
-> Ledger.Tx (ShelleyLedgerEra era)
-> Tx era
instance Show (InAnyCardanoEra Tx) where
show :: InAnyCardanoEra Tx -> String
show (InAnyCardanoEra CardanoEra era
_ Tx era
tx) = Tx era -> String
forall a. Show a => a -> String
show Tx era
tx
instance Eq (InAnyCardanoEra Tx) where
== :: InAnyCardanoEra Tx -> InAnyCardanoEra Tx -> Bool
(==) (InAnyCardanoEra CardanoEra era
eraA Tx era
txA) (InAnyCardanoEra CardanoEra era
eraB Tx era
txB) =
case CardanoEra era -> CardanoEra era -> Maybe (era :~: era)
forall k (f :: k -> *) (a :: k) (b :: k).
TestEquality f =>
f a -> f b -> Maybe (a :~: b)
testEquality CardanoEra era
eraA CardanoEra era
eraB of
Maybe (era :~: era)
Nothing -> Bool
False
Just era :~: era
Refl -> Tx era
txA Tx era -> Tx era -> Bool
forall a. Eq a => a -> a -> Bool
== Tx era
Tx era
txB
instance Eq (Tx era) where
== :: Tx era -> Tx era -> Bool
(==) (ByronTx ATxAux ByteString
txA)
(ByronTx ATxAux ByteString
txB) = ATxAux ByteString
txA ATxAux ByteString -> ATxAux ByteString -> Bool
forall a. Eq a => a -> a -> Bool
== ATxAux ByteString
txB
(==) (ShelleyTx ShelleyBasedEra era
era Tx (ShelleyLedgerEra era)
txA)
(ShelleyTx ShelleyBasedEra era
_ Tx (ShelleyLedgerEra era)
txB) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> Tx (ShelleyLedgerEra era)
Tx (ShelleyEra StandardCrypto)
txA Tx (ShelleyEra StandardCrypto)
-> Tx (ShelleyEra StandardCrypto) -> Bool
forall a. Eq a => a -> a -> Bool
== Tx (ShelleyLedgerEra era)
Tx (ShelleyEra StandardCrypto)
txB
ShelleyBasedEra era
ShelleyBasedEraAllegra -> Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Allegra StandardCrypto)
txA Tx (ShelleyMAEra 'Allegra StandardCrypto)
-> Tx (ShelleyMAEra 'Allegra StandardCrypto) -> Bool
forall a. Eq a => a -> a -> Bool
== Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Allegra StandardCrypto)
txB
ShelleyBasedEra era
ShelleyBasedEraMary -> Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Mary StandardCrypto)
txA Tx (ShelleyMAEra 'Mary StandardCrypto)
-> Tx (ShelleyMAEra 'Mary StandardCrypto) -> Bool
forall a. Eq a => a -> a -> Bool
== Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Mary StandardCrypto)
txB
ShelleyBasedEra era
ShelleyBasedEraAlonzo -> Tx (ShelleyLedgerEra era)
ValidatedTx (AlonzoEra StandardCrypto)
txA ValidatedTx (AlonzoEra StandardCrypto)
-> ValidatedTx (AlonzoEra StandardCrypto) -> Bool
forall a. Eq a => a -> a -> Bool
== Tx (ShelleyLedgerEra era)
ValidatedTx (AlonzoEra StandardCrypto)
txB
ShelleyBasedEra era
ShelleyBasedEraBabbage -> Tx (ShelleyLedgerEra era)
ValidatedTx (BabbageEra StandardCrypto)
txA ValidatedTx (BabbageEra StandardCrypto)
-> ValidatedTx (BabbageEra StandardCrypto) -> Bool
forall a. Eq a => a -> a -> Bool
== Tx (ShelleyLedgerEra era)
ValidatedTx (BabbageEra StandardCrypto)
txB
(==) ByronTx{} (ShelleyTx ShelleyBasedEra era
era Tx (ShelleyLedgerEra era)
_) = case ShelleyBasedEra era
era of {}
instance Show (Tx era) where
showsPrec :: Int -> Tx era -> ShowS
showsPrec Int
p (ByronTx ATxAux ByteString
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ByronTx "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ATxAux ByteString -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 ATxAux ByteString
tx
showsPrec Int
p (ShelleyTx ShelleyBasedEra era
ShelleyBasedEraShelley Tx (ShelleyLedgerEra era)
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyTx ShelleyBasedEraShelley "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tx (ShelleyEra StandardCrypto) -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 Tx (ShelleyLedgerEra era)
Tx (ShelleyEra StandardCrypto)
tx
showsPrec Int
p (ShelleyTx ShelleyBasedEra era
ShelleyBasedEraAllegra Tx (ShelleyLedgerEra era)
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyTx ShelleyBasedEraAllegra "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tx (ShelleyMAEra 'Allegra StandardCrypto) -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Allegra StandardCrypto)
tx
showsPrec Int
p (ShelleyTx ShelleyBasedEra era
ShelleyBasedEraMary Tx (ShelleyLedgerEra era)
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyTx ShelleyBasedEraMary "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> Tx (ShelleyMAEra 'Mary StandardCrypto) -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Mary StandardCrypto)
tx
showsPrec Int
p (ShelleyTx ShelleyBasedEra era
ShelleyBasedEraAlonzo Tx (ShelleyLedgerEra era)
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyTx ShelleyBasedEraAlonzo "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ValidatedTx (AlonzoEra StandardCrypto) -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 Tx (ShelleyLedgerEra era)
ValidatedTx (AlonzoEra StandardCrypto)
tx
showsPrec Int
p (ShelleyTx ShelleyBasedEra era
ShelleyBasedEraBabbage Tx (ShelleyLedgerEra era)
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyTx ShelleyBasedEraBabbage "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> ValidatedTx (BabbageEra StandardCrypto) -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 Tx (ShelleyLedgerEra era)
ValidatedTx (BabbageEra StandardCrypto)
tx
instance HasTypeProxy era => HasTypeProxy (Tx era) where
data AsType (Tx era) = AsTx (AsType era)
proxyToAsType :: Proxy (Tx era) -> AsType (Tx era)
proxyToAsType Proxy (Tx era)
_ = AsType era -> AsType (Tx era)
forall era. AsType era -> AsType (Tx era)
AsTx (Proxy era -> AsType era
forall t. HasTypeProxy t => Proxy t -> AsType t
proxyToAsType (Proxy era
forall k (t :: k). Proxy t
Proxy :: Proxy era))
{-# DEPRECATED AsByronTx "Use AsTx AsByronEra instead." #-}
pattern AsByronTx :: AsType (Tx ByronEra)
pattern $bAsByronTx :: AsType (Tx ByronEra)
$mAsByronTx :: forall r. AsType (Tx ByronEra) -> (Void# -> r) -> (Void# -> r) -> r
AsByronTx = AsTx AsByronEra
{-# COMPLETE AsByronTx #-}
{-# DEPRECATED AsShelleyTx "Use AsTx AsShelleyEra instead." #-}
pattern AsShelleyTx :: AsType (Tx ShelleyEra)
pattern $bAsShelleyTx :: AsType (Tx ShelleyEra)
$mAsShelleyTx :: forall r.
AsType (Tx ShelleyEra) -> (Void# -> r) -> (Void# -> r) -> r
AsShelleyTx = AsTx AsShelleyEra
{-# COMPLETE AsShelleyTx #-}
pattern AsMaryTx :: AsType (Tx MaryEra)
pattern $bAsMaryTx :: AsType (Tx MaryEra)
$mAsMaryTx :: forall r. AsType (Tx MaryEra) -> (Void# -> r) -> (Void# -> r) -> r
AsMaryTx = AsTx AsMaryEra
{-# COMPLETE AsMaryTx #-}
pattern AsAllegraTx :: AsType (Tx AllegraEra)
pattern $bAsAllegraTx :: AsType (Tx AllegraEra)
$mAsAllegraTx :: forall r.
AsType (Tx AllegraEra) -> (Void# -> r) -> (Void# -> r) -> r
AsAllegraTx = AsTx AsAllegraEra
{-# COMPLETE AsAllegraTx #-}
pattern AsAlonzoTx :: AsType (Tx AlonzoEra)
pattern $bAsAlonzoTx :: AsType (Tx AlonzoEra)
$mAsAlonzoTx :: forall r.
AsType (Tx AlonzoEra) -> (Void# -> r) -> (Void# -> r) -> r
AsAlonzoTx = AsTx AsAlonzoEra
{-# COMPLETE AsAlonzoTx #-}
instance IsCardanoEra era => SerialiseAsCBOR (Tx era) where
serialiseToCBOR :: Tx era -> ByteString
serialiseToCBOR (ByronTx ATxAux ByteString
tx) = ATxAux ByteString -> ByteString
forall t. Decoded t => t -> ByteString
CBOR.recoverBytes ATxAux ByteString
tx
serialiseToCBOR (ShelleyTx ShelleyBasedEra era
era Tx (ShelleyLedgerEra era)
tx) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> Tx (ShelleyEra StandardCrypto) -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
serialiseShelleyBasedTx Tx (ShelleyLedgerEra era)
Tx (ShelleyEra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraAllegra -> Tx (ShelleyMAEra 'Allegra StandardCrypto) -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
serialiseShelleyBasedTx Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Allegra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraMary -> Tx (ShelleyMAEra 'Mary StandardCrypto) -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
serialiseShelleyBasedTx Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Mary StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraAlonzo -> ValidatedTx (AlonzoEra StandardCrypto) -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
serialiseShelleyBasedTx Tx (ShelleyLedgerEra era)
ValidatedTx (AlonzoEra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraBabbage -> ValidatedTx (BabbageEra StandardCrypto) -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
serialiseShelleyBasedTx Tx (ShelleyLedgerEra era)
ValidatedTx (BabbageEra StandardCrypto)
tx
deserialiseFromCBOR :: AsType (Tx era) -> ByteString -> Either DecoderError (Tx era)
deserialiseFromCBOR AsType (Tx era)
_ ByteString
bs =
case CardanoEra era
forall era. IsCardanoEra era => CardanoEra era
cardanoEra :: CardanoEra era of
CardanoEra era
ByronEra ->
ATxAux ByteString -> Tx ByronEra
ByronTx (ATxAux ByteString -> Tx ByronEra)
-> Either DecoderError (ATxAux ByteString)
-> Either DecoderError (Tx ByronEra)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$>
Text
-> (forall s. Decoder s (ATxAux ByteSpan))
-> LByteString
-> Either DecoderError (ATxAux ByteString)
forall (f :: * -> *).
Functor f =>
Text
-> (forall s. Decoder s (f ByteSpan))
-> LByteString
-> Either DecoderError (f ByteString)
CBOR.decodeFullAnnotatedBytes
Text
"Byron Tx" forall s. Decoder s (ATxAux ByteSpan)
forall a s. FromCBOR a => Decoder s a
fromCBOR (ByteString -> LByteString
LBS.fromStrict ByteString
bs)
CardanoEra era
ShelleyEra -> (Tx (ShelleyEra StandardCrypto) -> Tx ShelleyEra)
-> ByteString -> Either DecoderError (Tx ShelleyEra)
forall tx tx'.
FromCBOR (Annotator tx) =>
(tx -> tx') -> ByteString -> Either DecoderError tx'
deserialiseShelleyBasedTx
(ShelleyBasedEra ShelleyEra
-> Tx (ShelleyLedgerEra ShelleyEra) -> Tx ShelleyEra
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra ShelleyEra
ShelleyBasedEraShelley) ByteString
bs
CardanoEra era
AllegraEra -> (Tx (ShelleyMAEra 'Allegra StandardCrypto) -> Tx AllegraEra)
-> ByteString -> Either DecoderError (Tx AllegraEra)
forall tx tx'.
FromCBOR (Annotator tx) =>
(tx -> tx') -> ByteString -> Either DecoderError tx'
deserialiseShelleyBasedTx
(ShelleyBasedEra AllegraEra
-> Tx (ShelleyLedgerEra AllegraEra) -> Tx AllegraEra
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra AllegraEra
ShelleyBasedEraAllegra) ByteString
bs
CardanoEra era
MaryEra -> (Tx (ShelleyMAEra 'Mary StandardCrypto) -> Tx MaryEra)
-> ByteString -> Either DecoderError (Tx MaryEra)
forall tx tx'.
FromCBOR (Annotator tx) =>
(tx -> tx') -> ByteString -> Either DecoderError tx'
deserialiseShelleyBasedTx
(ShelleyBasedEra MaryEra
-> Tx (ShelleyLedgerEra MaryEra) -> Tx MaryEra
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra MaryEra
ShelleyBasedEraMary) ByteString
bs
CardanoEra era
AlonzoEra -> (ValidatedTx (AlonzoEra StandardCrypto) -> Tx AlonzoEra)
-> ByteString -> Either DecoderError (Tx AlonzoEra)
forall tx tx'.
FromCBOR (Annotator tx) =>
(tx -> tx') -> ByteString -> Either DecoderError tx'
deserialiseShelleyBasedTx
(ShelleyBasedEra AlonzoEra
-> Tx (ShelleyLedgerEra AlonzoEra) -> Tx AlonzoEra
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra AlonzoEra
ShelleyBasedEraAlonzo) ByteString
bs
CardanoEra era
BabbageEra -> (ValidatedTx (BabbageEra StandardCrypto) -> Tx BabbageEra)
-> ByteString -> Either DecoderError (Tx BabbageEra)
forall tx tx'.
FromCBOR (Annotator tx) =>
(tx -> tx') -> ByteString -> Either DecoderError tx'
deserialiseShelleyBasedTx
(ShelleyBasedEra BabbageEra
-> Tx (ShelleyLedgerEra BabbageEra) -> Tx BabbageEra
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra BabbageEra
ShelleyBasedEraBabbage) ByteString
bs
serialiseShelleyBasedTx :: ToCBOR tx => tx -> ByteString
serialiseShelleyBasedTx :: tx -> ByteString
serialiseShelleyBasedTx = tx -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
CBOR.serialize'
deserialiseShelleyBasedTx :: FromCBOR (CBOR.Annotator tx)
=> (tx -> tx')
-> ByteString
-> Either CBOR.DecoderError tx'
deserialiseShelleyBasedTx :: (tx -> tx') -> ByteString -> Either DecoderError tx'
deserialiseShelleyBasedTx tx -> tx'
mkTx ByteString
bs =
tx -> tx'
mkTx (tx -> tx') -> Either DecoderError tx -> Either DecoderError tx'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> (forall s. Decoder s (Annotator tx))
-> LByteString
-> Either DecoderError tx
forall a.
Text
-> (forall s. Decoder s (Annotator a))
-> LByteString
-> Either DecoderError a
CBOR.decodeAnnotator Text
"Shelley Tx" forall s. Decoder s (Annotator tx)
forall a s. FromCBOR a => Decoder s a
fromCBOR (ByteString -> LByteString
LBS.fromStrict ByteString
bs)
instance IsCardanoEra era => HasTextEnvelope (Tx era) where
textEnvelopeType :: AsType (Tx era) -> TextEnvelopeType
textEnvelopeType AsType (Tx era)
_ =
case CardanoEra era
forall era. IsCardanoEra era => CardanoEra era
cardanoEra :: CardanoEra era of
CardanoEra era
ByronEra -> TextEnvelopeType
"TxSignedByron"
CardanoEra era
ShelleyEra -> TextEnvelopeType
"TxSignedShelley"
CardanoEra era
AllegraEra -> TextEnvelopeType
"Tx AllegraEra"
CardanoEra era
MaryEra -> TextEnvelopeType
"Tx MaryEra"
CardanoEra era
AlonzoEra -> TextEnvelopeType
"Tx AlonzoEra"
CardanoEra era
BabbageEra -> TextEnvelopeType
"Tx BabbageEra"
data KeyWitness era where
ByronKeyWitness
:: Byron.TxInWitness
-> KeyWitness ByronEra
ShelleyBootstrapWitness
:: ShelleyBasedEra era
-> Shelley.BootstrapWitness StandardCrypto
-> KeyWitness era
ShelleyKeyWitness
:: ShelleyBasedEra era
-> Shelley.WitVKey Shelley.Witness StandardCrypto
-> KeyWitness era
instance Eq (KeyWitness era) where
== :: KeyWitness era -> KeyWitness era -> Bool
(==) (ByronKeyWitness TxInWitness
wA)
(ByronKeyWitness TxInWitness
wB) = TxInWitness
wA TxInWitness -> TxInWitness -> Bool
forall a. Eq a => a -> a -> Bool
== TxInWitness
wB
(==) (ShelleyBootstrapWitness ShelleyBasedEra era
era BootstrapWitness StandardCrypto
wA)
(ShelleyBootstrapWitness ShelleyBasedEra era
_ BootstrapWitness StandardCrypto
wB) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> BootstrapWitness StandardCrypto
wA BootstrapWitness StandardCrypto
-> BootstrapWitness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== BootstrapWitness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraAllegra -> BootstrapWitness StandardCrypto
wA BootstrapWitness StandardCrypto
-> BootstrapWitness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== BootstrapWitness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraMary -> BootstrapWitness StandardCrypto
wA BootstrapWitness StandardCrypto
-> BootstrapWitness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== BootstrapWitness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraAlonzo -> BootstrapWitness StandardCrypto
wA BootstrapWitness StandardCrypto
-> BootstrapWitness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== BootstrapWitness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraBabbage -> BootstrapWitness StandardCrypto
wA BootstrapWitness StandardCrypto
-> BootstrapWitness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== BootstrapWitness StandardCrypto
wB
(==) (ShelleyKeyWitness ShelleyBasedEra era
era WitVKey 'Witness StandardCrypto
wA)
(ShelleyKeyWitness ShelleyBasedEra era
_ WitVKey 'Witness StandardCrypto
wB) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> WitVKey 'Witness StandardCrypto
wA WitVKey 'Witness StandardCrypto
-> WitVKey 'Witness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== WitVKey 'Witness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraAllegra -> WitVKey 'Witness StandardCrypto
wA WitVKey 'Witness StandardCrypto
-> WitVKey 'Witness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== WitVKey 'Witness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraMary -> WitVKey 'Witness StandardCrypto
wA WitVKey 'Witness StandardCrypto
-> WitVKey 'Witness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== WitVKey 'Witness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraAlonzo -> WitVKey 'Witness StandardCrypto
wA WitVKey 'Witness StandardCrypto
-> WitVKey 'Witness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== WitVKey 'Witness StandardCrypto
wB
ShelleyBasedEra era
ShelleyBasedEraBabbage -> WitVKey 'Witness StandardCrypto
wA WitVKey 'Witness StandardCrypto
-> WitVKey 'Witness StandardCrypto -> Bool
forall a. Eq a => a -> a -> Bool
== WitVKey 'Witness StandardCrypto
wB
(==) KeyWitness era
_ KeyWitness era
_ = Bool
False
instance Show (KeyWitness era) where
showsPrec :: Int -> KeyWitness era -> ShowS
showsPrec Int
p (ByronKeyWitness TxInWitness
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ByronKeyWitness "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> TxInWitness -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 TxInWitness
tx
showsPrec Int
p (ShelleyBootstrapWitness ShelleyBasedEra era
ShelleyBasedEraShelley BootstrapWitness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyBootstrapWitness ShelleyBasedEraShelley "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> BootstrapWitness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 BootstrapWitness StandardCrypto
tx
showsPrec Int
p (ShelleyBootstrapWitness ShelleyBasedEra era
ShelleyBasedEraAllegra BootstrapWitness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyBootstrapWitness ShelleyBasedEraAllegra "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> BootstrapWitness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 BootstrapWitness StandardCrypto
tx
showsPrec Int
p (ShelleyBootstrapWitness ShelleyBasedEra era
ShelleyBasedEraMary BootstrapWitness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyBootstrapWitness ShelleyBasedEraMary "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> BootstrapWitness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 BootstrapWitness StandardCrypto
tx
showsPrec Int
p (ShelleyBootstrapWitness ShelleyBasedEra era
ShelleyBasedEraAlonzo BootstrapWitness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyBootstrapWitness ShelleyBasedEraAlonzo "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> BootstrapWitness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 BootstrapWitness StandardCrypto
tx
showsPrec Int
p (ShelleyBootstrapWitness ShelleyBasedEra era
ShelleyBasedEraBabbage BootstrapWitness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyBootstrapWitness ShelleyBasedEraBabbage "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> BootstrapWitness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 BootstrapWitness StandardCrypto
tx
showsPrec Int
p (ShelleyKeyWitness ShelleyBasedEra era
ShelleyBasedEraShelley WitVKey 'Witness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyKeyWitness ShelleyBasedEraShelley "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> WitVKey 'Witness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 WitVKey 'Witness StandardCrypto
tx
showsPrec Int
p (ShelleyKeyWitness ShelleyBasedEra era
ShelleyBasedEraAllegra WitVKey 'Witness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyKeyWitness ShelleyBasedEraAllegra "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> WitVKey 'Witness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 WitVKey 'Witness StandardCrypto
tx
showsPrec Int
p (ShelleyKeyWitness ShelleyBasedEra era
ShelleyBasedEraMary WitVKey 'Witness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyKeyWitness ShelleyBasedEraMary "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> WitVKey 'Witness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 WitVKey 'Witness StandardCrypto
tx
showsPrec Int
p (ShelleyKeyWitness ShelleyBasedEra era
ShelleyBasedEraAlonzo WitVKey 'Witness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyKeyWitness ShelleyBasedEraAlonzo "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> WitVKey 'Witness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 WitVKey 'Witness StandardCrypto
tx
showsPrec Int
p (ShelleyKeyWitness ShelleyBasedEra era
ShelleyBasedEraBabbage WitVKey 'Witness StandardCrypto
tx) =
Bool -> ShowS -> ShowS
showParen (Int
p Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= Int
11) (ShowS -> ShowS) -> ShowS -> ShowS
forall a b. (a -> b) -> a -> b
$
String -> ShowS
showString String
"ShelleyKeyWitness ShelleyBasedEraBabbage "
ShowS -> ShowS -> ShowS
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> WitVKey 'Witness StandardCrypto -> ShowS
forall a. Show a => Int -> a -> ShowS
showsPrec Int
11 WitVKey 'Witness StandardCrypto
tx
instance HasTypeProxy era => HasTypeProxy (KeyWitness era) where
data AsType (KeyWitness era) = AsKeyWitness (AsType era)
proxyToAsType :: Proxy (KeyWitness era) -> AsType (KeyWitness era)
proxyToAsType Proxy (KeyWitness era)
_ = AsType era -> AsType (KeyWitness era)
forall era. AsType era -> AsType (KeyWitness era)
AsKeyWitness (Proxy era -> AsType era
forall t. HasTypeProxy t => Proxy t -> AsType t
proxyToAsType (Proxy era
forall k (t :: k). Proxy t
Proxy :: Proxy era))
pattern AsByronWitness :: AsType (KeyWitness ByronEra)
pattern $bAsByronWitness :: AsType (KeyWitness ByronEra)
$mAsByronWitness :: forall r.
AsType (KeyWitness ByronEra) -> (Void# -> r) -> (Void# -> r) -> r
AsByronWitness = AsKeyWitness AsByronEra
{-# COMPLETE AsByronWitness #-}
pattern AsShelleyWitness :: AsType (KeyWitness ShelleyEra)
pattern $bAsShelleyWitness :: AsType (KeyWitness ShelleyEra)
$mAsShelleyWitness :: forall r.
AsType (KeyWitness ShelleyEra) -> (Void# -> r) -> (Void# -> r) -> r
AsShelleyWitness = AsKeyWitness AsShelleyEra
{-# COMPLETE AsShelleyWitness #-}
instance IsCardanoEra era => SerialiseAsCBOR (KeyWitness era) where
serialiseToCBOR :: KeyWitness era -> ByteString
serialiseToCBOR (ByronKeyWitness TxInWitness
wit) = TxInWitness -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
CBOR.serialize' TxInWitness
wit
serialiseToCBOR (ShelleyKeyWitness ShelleyBasedEra era
_era WitVKey 'Witness StandardCrypto
wit) =
Encoding -> ByteString
CBOR.serializeEncoding' (Encoding -> ByteString) -> Encoding -> ByteString
forall a b. (a -> b) -> a -> b
$
WitVKey 'Witness StandardCrypto -> Encoding
forall w. ToCBOR w => w -> Encoding
encodeShelleyBasedKeyWitness WitVKey 'Witness StandardCrypto
wit
serialiseToCBOR (ShelleyBootstrapWitness ShelleyBasedEra era
_era BootstrapWitness StandardCrypto
wit) =
Encoding -> ByteString
CBOR.serializeEncoding' (Encoding -> ByteString) -> Encoding -> ByteString
forall a b. (a -> b) -> a -> b
$
BootstrapWitness StandardCrypto -> Encoding
forall w. ToCBOR w => w -> Encoding
encodeShelleyBasedBootstrapWitness BootstrapWitness StandardCrypto
wit
deserialiseFromCBOR :: AsType (KeyWitness era)
-> ByteString -> Either DecoderError (KeyWitness era)
deserialiseFromCBOR AsType (KeyWitness era)
_ ByteString
bs =
case CardanoEra era
forall era. IsCardanoEra era => CardanoEra era
cardanoEra :: CardanoEra era of
CardanoEra era
ByronEra ->
TxInWitness -> KeyWitness ByronEra
ByronKeyWitness (TxInWitness -> KeyWitness ByronEra)
-> Either DecoderError TxInWitness
-> Either DecoderError (KeyWitness ByronEra)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> ByteString -> Either DecoderError TxInWitness
forall a. FromCBOR a => ByteString -> Either DecoderError a
CBOR.decodeFull' ByteString
bs
CardanoEra era
ShelleyEra -> ShelleyBasedEra ShelleyEra
-> ByteString -> Either DecoderError (KeyWitness ShelleyEra)
forall era.
ShelleyBasedEra era
-> ByteString -> Either DecoderError (KeyWitness era)
decodeShelleyBasedWitness ShelleyBasedEra ShelleyEra
ShelleyBasedEraShelley ByteString
bs
CardanoEra era
AllegraEra -> ShelleyBasedEra AllegraEra
-> ByteString -> Either DecoderError (KeyWitness AllegraEra)
forall era.
ShelleyBasedEra era
-> ByteString -> Either DecoderError (KeyWitness era)
decodeShelleyBasedWitness ShelleyBasedEra AllegraEra
ShelleyBasedEraAllegra ByteString
bs
CardanoEra era
MaryEra -> ShelleyBasedEra MaryEra
-> ByteString -> Either DecoderError (KeyWitness MaryEra)
forall era.
ShelleyBasedEra era
-> ByteString -> Either DecoderError (KeyWitness era)
decodeShelleyBasedWitness ShelleyBasedEra MaryEra
ShelleyBasedEraMary ByteString
bs
CardanoEra era
AlonzoEra -> ShelleyBasedEra AlonzoEra
-> ByteString -> Either DecoderError (KeyWitness AlonzoEra)
forall era.
ShelleyBasedEra era
-> ByteString -> Either DecoderError (KeyWitness era)
decodeShelleyBasedWitness ShelleyBasedEra AlonzoEra
ShelleyBasedEraAlonzo ByteString
bs
CardanoEra era
BabbageEra -> ShelleyBasedEra BabbageEra
-> ByteString -> Either DecoderError (KeyWitness BabbageEra)
forall era.
ShelleyBasedEra era
-> ByteString -> Either DecoderError (KeyWitness era)
decodeShelleyBasedWitness ShelleyBasedEra BabbageEra
ShelleyBasedEraBabbage ByteString
bs
encodeShelleyBasedKeyWitness :: ToCBOR w => w -> CBOR.Encoding
encodeShelleyBasedKeyWitness :: w -> Encoding
encodeShelleyBasedKeyWitness w
wit =
Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word -> Encoding
CBOR.encodeWord Word
0 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> w -> Encoding
forall w. ToCBOR w => w -> Encoding
toCBOR w
wit
encodeShelleyBasedBootstrapWitness :: ToCBOR w => w -> CBOR.Encoding
encodeShelleyBasedBootstrapWitness :: w -> Encoding
encodeShelleyBasedBootstrapWitness w
wit =
Word -> Encoding
CBOR.encodeListLen Word
2 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> Word -> Encoding
CBOR.encodeWord Word
1 Encoding -> Encoding -> Encoding
forall a. Semigroup a => a -> a -> a
<> w -> Encoding
forall w. ToCBOR w => w -> Encoding
toCBOR w
wit
decodeShelleyBasedWitness :: forall era.
ShelleyBasedEra era
-> ByteString
-> Either CBOR.DecoderError (KeyWitness era)
decodeShelleyBasedWitness :: ShelleyBasedEra era
-> ByteString -> Either DecoderError (KeyWitness era)
decodeShelleyBasedWitness ShelleyBasedEra era
era =
Text
-> (forall s. Decoder s (Annotator (KeyWitness era)))
-> LByteString
-> Either DecoderError (KeyWitness era)
forall a.
Text
-> (forall s. Decoder s (Annotator a))
-> LByteString
-> Either DecoderError a
CBOR.decodeAnnotator Text
"Shelley Witness" forall s. Decoder s (Annotator (KeyWitness era))
decode (LByteString -> Either DecoderError (KeyWitness era))
-> (ByteString -> LByteString)
-> ByteString
-> Either DecoderError (KeyWitness era)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> LByteString
LBS.fromStrict
where
decode :: CBOR.Decoder s (CBOR.Annotator (KeyWitness era))
decode :: Decoder s (Annotator (KeyWitness era))
decode = do
Int -> Decoder s ()
forall s. Int -> Decoder s ()
CBOR.decodeListLenOf Int
2
Word
t <- Decoder s Word
forall s. Decoder s Word
CBOR.decodeWord
case Word
t of
Word
0 -> (Annotator (WitVKey 'Witness StandardCrypto)
-> Annotator (KeyWitness era))
-> Decoder s (Annotator (WitVKey 'Witness StandardCrypto))
-> Decoder s (Annotator (KeyWitness era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((WitVKey 'Witness StandardCrypto -> KeyWitness era)
-> Annotator (WitVKey 'Witness StandardCrypto)
-> Annotator (KeyWitness era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
ShelleyKeyWitness ShelleyBasedEra era
era)) Decoder s (Annotator (WitVKey 'Witness StandardCrypto))
forall a s. FromCBOR a => Decoder s a
fromCBOR
Word
1 -> (Annotator (BootstrapWitness StandardCrypto)
-> Annotator (KeyWitness era))
-> Decoder s (Annotator (BootstrapWitness StandardCrypto))
-> Decoder s (Annotator (KeyWitness era))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((BootstrapWitness StandardCrypto -> KeyWitness era)
-> Annotator (BootstrapWitness StandardCrypto)
-> Annotator (KeyWitness era)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap (ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
ShelleyBootstrapWitness ShelleyBasedEra era
era)) Decoder s (Annotator (BootstrapWitness StandardCrypto))
forall a s. FromCBOR a => Decoder s a
fromCBOR
Word
_ -> DecoderError -> Decoder s (Annotator (KeyWitness era))
forall e s a. Buildable e => e -> Decoder s a
CBOR.cborError (DecoderError -> Decoder s (Annotator (KeyWitness era)))
-> DecoderError -> Decoder s (Annotator (KeyWitness era))
forall a b. (a -> b) -> a -> b
$ Text -> Word8 -> DecoderError
CBOR.DecoderErrorUnknownTag
Text
"Shelley Witness" (Word -> Word8
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word
t)
instance IsCardanoEra era => HasTextEnvelope (KeyWitness era) where
textEnvelopeType :: AsType (KeyWitness era) -> TextEnvelopeType
textEnvelopeType AsType (KeyWitness era)
_ =
case CardanoEra era
forall era. IsCardanoEra era => CardanoEra era
cardanoEra :: CardanoEra era of
CardanoEra era
ByronEra -> TextEnvelopeType
"TxWitnessByron"
CardanoEra era
ShelleyEra -> TextEnvelopeType
"TxWitness ShelleyEra"
CardanoEra era
AllegraEra -> TextEnvelopeType
"TxWitness AllegraEra"
CardanoEra era
MaryEra -> TextEnvelopeType
"TxWitness MaryEra"
CardanoEra era
AlonzoEra -> TextEnvelopeType
"TxWitness AlonzoEra"
CardanoEra era
BabbageEra -> TextEnvelopeType
"TxWitness BabbageEra"
pattern Tx :: TxBody era -> [KeyWitness era] -> Tx era
pattern $bTx :: TxBody era -> [KeyWitness era] -> Tx era
$mTx :: forall r era.
Tx era
-> (TxBody era -> [KeyWitness era] -> r) -> (Void# -> r) -> r
Tx txbody ws <- (getTxBodyAndWitnesses -> (txbody, ws))
where
Tx TxBody era
txbody [KeyWitness era]
ws = [KeyWitness era] -> TxBody era -> Tx era
forall era. [KeyWitness era] -> TxBody era -> Tx era
makeSignedTransaction [KeyWitness era]
ws TxBody era
txbody
{-# COMPLETE Tx #-}
getTxBodyAndWitnesses :: Tx era -> (TxBody era, [KeyWitness era])
getTxBodyAndWitnesses :: Tx era -> (TxBody era, [KeyWitness era])
getTxBodyAndWitnesses Tx era
tx = (Tx era -> TxBody era
forall era. Tx era -> TxBody era
getTxBody Tx era
tx, Tx era -> [KeyWitness era]
forall era. Tx era -> [KeyWitness era]
getTxWitnesses Tx era
tx)
getTxBody :: forall era. Tx era -> TxBody era
getTxBody :: Tx era -> TxBody era
getTxBody (ByronTx Byron.ATxAux { aTaTx :: forall a. ATxAux a -> Annotated Tx a
Byron.aTaTx = Annotated Tx ByteString
txbody }) =
Annotated Tx ByteString -> TxBody ByronEra
ByronTxBody Annotated Tx ByteString
txbody
getTxBody (ShelleyTx ShelleyBasedEra era
era Tx (ShelleyLedgerEra era)
tx) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> Tx (ShelleyEra StandardCrypto) -> TxBody era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera, UsesValue ledgerera,
ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera) =>
Tx ledgerera -> TxBody era
getShelleyTxBody Tx (ShelleyLedgerEra era)
Tx (ShelleyEra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraAllegra -> Tx (ShelleyMAEra 'Allegra StandardCrypto) -> TxBody era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera, UsesValue ledgerera,
ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera) =>
Tx ledgerera -> TxBody era
getShelleyTxBody Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Allegra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraMary -> Tx (ShelleyMAEra 'Mary StandardCrypto) -> TxBody era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera, UsesValue ledgerera,
ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera) =>
Tx ledgerera -> TxBody era
getShelleyTxBody Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Mary StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraAlonzo ->
ScriptDataSupportedInEra era
-> TxScriptValiditySupportedInEra era
-> ValidatedTx (AlonzoEra StandardCrypto)
-> TxBody era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera) =>
ScriptDataSupportedInEra era
-> TxScriptValiditySupportedInEra era
-> ValidatedTx ledgerera
-> TxBody era
getAlonzoTxBody ScriptDataSupportedInEra era
ScriptDataSupportedInEra AlonzoEra
ScriptDataInAlonzoEra TxScriptValiditySupportedInEra era
TxScriptValiditySupportedInEra AlonzoEra
TxScriptValiditySupportedInAlonzoEra Tx (ShelleyLedgerEra era)
ValidatedTx (AlonzoEra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraBabbage ->
ScriptDataSupportedInEra era
-> TxScriptValiditySupportedInEra era
-> ValidatedTx (BabbageEra StandardCrypto)
-> TxBody era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera) =>
ScriptDataSupportedInEra era
-> TxScriptValiditySupportedInEra era
-> ValidatedTx ledgerera
-> TxBody era
getAlonzoTxBody ScriptDataSupportedInEra era
ScriptDataSupportedInEra BabbageEra
ScriptDataInBabbageEra TxScriptValiditySupportedInEra era
TxScriptValiditySupportedInEra BabbageEra
TxScriptValiditySupportedInBabbageEra Tx (ShelleyLedgerEra era)
ValidatedTx (BabbageEra StandardCrypto)
tx
where
getShelleyTxBody :: forall ledgerera.
ShelleyLedgerEra era ~ ledgerera
=> Shelley.UsesValue ledgerera
=> ToCBOR (Ledger.AuxiliaryData ledgerera)
=> ToCBOR (Ledger.TxBody ledgerera)
=> ToCBOR (Ledger.Script ledgerera)
=> FromCBOR (CBOR.Annotator (Ledger.Script ledgerera))
=> Ledger.Witnesses ledgerera ~ Shelley.WitnessSetHKD Identity ledgerera
=> Shelley.Tx ledgerera
-> TxBody era
getShelleyTxBody :: Tx ledgerera -> TxBody era
getShelleyTxBody Shelley.Tx {
body :: forall era.
Tx era
-> (Era era, ToCBOR (AuxiliaryData era), ToCBOR (TxBody era),
ToCBOR (Witnesses era)) =>
TxBody era
Shelley.body = TxBody ledgerera
txbody,
auxiliaryData :: forall era.
Tx era
-> (Era era, ToCBOR (AuxiliaryData era), ToCBOR (TxBody era),
ToCBOR (Witnesses era)) =>
StrictMaybe (AuxiliaryData era)
Shelley.auxiliaryData = StrictMaybe (AuxiliaryData ledgerera)
txAuxiliaryData,
wits :: forall era.
Tx era
-> (Era era, ToCBOR (AuxiliaryData era), ToCBOR (TxBody era),
ToCBOR (Witnesses era)) =>
Witnesses era
Shelley.wits = Shelley.WitnessSet
_addrWits
msigWits
_bootWits
} =
ShelleyBasedEra era
-> TxBody (ShelleyLedgerEra era)
-> [Script (ShelleyLedgerEra era)]
-> TxBodyScriptData era
-> Maybe (AuxiliaryData (ShelleyLedgerEra era))
-> TxScriptValidity era
-> TxBody era
forall era.
ShelleyBasedEra era
-> TxBody (ShelleyLedgerEra era)
-> [Script (ShelleyLedgerEra era)]
-> TxBodyScriptData era
-> Maybe (AuxiliaryData (ShelleyLedgerEra era))
-> TxScriptValidity era
-> TxBody era
ShelleyTxBody ShelleyBasedEra era
era TxBody ledgerera
TxBody (ShelleyLedgerEra era)
txbody
(Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
-> [Script ledgerera]
forall k a. Map k a -> [a]
Map.elems Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
msigWits)
TxBodyScriptData era
forall era. TxBodyScriptData era
TxBodyNoScriptData
(StrictMaybe (AuxiliaryData ledgerera)
-> Maybe (AuxiliaryData ledgerera)
forall a. StrictMaybe a -> Maybe a
strictMaybeToMaybe StrictMaybe (AuxiliaryData ledgerera)
txAuxiliaryData)
TxScriptValidity era
forall era. TxScriptValidity era
TxScriptValidityNone
getAlonzoTxBody :: forall ledgerera.
ShelleyLedgerEra era ~ ledgerera
=> ScriptDataSupportedInEra era
-> TxScriptValiditySupportedInEra era
-> Alonzo.ValidatedTx ledgerera
-> TxBody era
getAlonzoTxBody :: ScriptDataSupportedInEra era
-> TxScriptValiditySupportedInEra era
-> ValidatedTx ledgerera
-> TxBody era
getAlonzoTxBody ScriptDataSupportedInEra era
scriptDataInEra TxScriptValiditySupportedInEra era
txScriptValidityInEra
Alonzo.ValidatedTx {
body :: forall era. ValidatedTx era -> TxBody era
Alonzo.body = TxBody ledgerera
txbody,
wits :: forall era. ValidatedTx era -> TxWitness era
Alonzo.wits = Alonzo.TxWitness'
Set (WitVKey 'Witness (Crypto ledgerera))
_addrWits
Set (BootstrapWitness (Crypto ledgerera))
_bootWits
Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
txscripts
TxDats ledgerera
txdats
Redeemers ledgerera
redeemers,
auxiliaryData :: forall era. ValidatedTx era -> StrictMaybe (AuxiliaryData era)
Alonzo.auxiliaryData = StrictMaybe (AuxiliaryData ledgerera)
auxiliaryData,
isValid :: forall era. ValidatedTx era -> IsValid
Alonzo.isValid = IsValid
isValid
} =
ShelleyBasedEra era
-> TxBody (ShelleyLedgerEra era)
-> [Script (ShelleyLedgerEra era)]
-> TxBodyScriptData era
-> Maybe (AuxiliaryData (ShelleyLedgerEra era))
-> TxScriptValidity era
-> TxBody era
forall era.
ShelleyBasedEra era
-> TxBody (ShelleyLedgerEra era)
-> [Script (ShelleyLedgerEra era)]
-> TxBodyScriptData era
-> Maybe (AuxiliaryData (ShelleyLedgerEra era))
-> TxScriptValidity era
-> TxBody era
ShelleyTxBody ShelleyBasedEra era
era TxBody ledgerera
TxBody (ShelleyLedgerEra era)
txbody
(Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
-> [Script ledgerera]
forall k a. Map k a -> [a]
Map.elems Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
txscripts)
(ScriptDataSupportedInEra era
-> TxDats (ShelleyLedgerEra era)
-> Redeemers (ShelleyLedgerEra era)
-> TxBodyScriptData era
forall era.
ScriptDataSupportedInEra era
-> TxDats (ShelleyLedgerEra era)
-> Redeemers (ShelleyLedgerEra era)
-> TxBodyScriptData era
TxBodyScriptData ScriptDataSupportedInEra era
scriptDataInEra TxDats ledgerera
TxDats (ShelleyLedgerEra era)
txdats Redeemers ledgerera
Redeemers (ShelleyLedgerEra era)
redeemers)
(StrictMaybe (AuxiliaryData ledgerera)
-> Maybe (AuxiliaryData ledgerera)
forall a. StrictMaybe a -> Maybe a
strictMaybeToMaybe StrictMaybe (AuxiliaryData ledgerera)
auxiliaryData)
(TxScriptValiditySupportedInEra era
-> ScriptValidity -> TxScriptValidity era
forall era.
TxScriptValiditySupportedInEra era
-> ScriptValidity -> TxScriptValidity era
TxScriptValidity TxScriptValiditySupportedInEra era
txScriptValidityInEra (IsValid -> ScriptValidity
isValidToScriptValidity IsValid
isValid))
getTxWitnesses :: forall era. Tx era -> [KeyWitness era]
getTxWitnesses :: Tx era -> [KeyWitness era]
getTxWitnesses (ByronTx Byron.ATxAux { aTaWitness :: forall a. ATxAux a -> Annotated TxWitness a
Byron.aTaWitness = Annotated TxWitness ByteString
witnesses }) =
(TxInWitness -> KeyWitness ByronEra)
-> [TxInWitness] -> [KeyWitness ByronEra]
forall a b. (a -> b) -> [a] -> [b]
map TxInWitness -> KeyWitness ByronEra
ByronKeyWitness
([TxInWitness] -> [KeyWitness ByronEra])
-> (Annotated TxWitness ByteString -> [TxInWitness])
-> Annotated TxWitness ByteString
-> [KeyWitness ByronEra]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxWitness -> [TxInWitness]
forall a. Vector a -> [a]
Vector.toList
(TxWitness -> [TxInWitness])
-> (Annotated TxWitness ByteString -> TxWitness)
-> Annotated TxWitness ByteString
-> [TxInWitness]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Annotated TxWitness ByteString -> TxWitness
forall b a. Annotated b a -> b
unAnnotated
(Annotated TxWitness ByteString -> [KeyWitness ByronEra])
-> Annotated TxWitness ByteString -> [KeyWitness ByronEra]
forall a b. (a -> b) -> a -> b
$ Annotated TxWitness ByteString
witnesses
getTxWitnesses (ShelleyTx ShelleyBasedEra era
era Tx (ShelleyLedgerEra era)
tx) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> Tx (ShelleyEra StandardCrypto) -> [KeyWitness era]
forall ledgerera.
(ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Crypto ledgerera ~ StandardCrypto,
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera,
ToCBOR (Witnesses ledgerera), UsesValue ledgerera) =>
Tx ledgerera -> [KeyWitness era]
getShelleyTxWitnesses Tx (ShelleyLedgerEra era)
Tx (ShelleyEra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraAllegra -> Tx (ShelleyMAEra 'Allegra StandardCrypto) -> [KeyWitness era]
forall ledgerera.
(ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Crypto ledgerera ~ StandardCrypto,
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera,
ToCBOR (Witnesses ledgerera), UsesValue ledgerera) =>
Tx ledgerera -> [KeyWitness era]
getShelleyTxWitnesses Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Allegra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraMary -> Tx (ShelleyMAEra 'Mary StandardCrypto) -> [KeyWitness era]
forall ledgerera.
(ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Crypto ledgerera ~ StandardCrypto,
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera,
ToCBOR (Witnesses ledgerera), UsesValue ledgerera) =>
Tx ledgerera -> [KeyWitness era]
getShelleyTxWitnesses Tx (ShelleyLedgerEra era)
Tx (ShelleyMAEra 'Mary StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraAlonzo -> ValidatedTx (AlonzoEra StandardCrypto) -> [KeyWitness era]
forall ledgerera.
(Crypto ledgerera ~ StandardCrypto) =>
ValidatedTx ledgerera -> [KeyWitness era]
getAlonzoTxWitnesses Tx (ShelleyLedgerEra era)
ValidatedTx (AlonzoEra StandardCrypto)
tx
ShelleyBasedEra era
ShelleyBasedEraBabbage -> ValidatedTx (BabbageEra StandardCrypto) -> [KeyWitness era]
forall ledgerera.
(Crypto ledgerera ~ StandardCrypto) =>
ValidatedTx ledgerera -> [KeyWitness era]
getAlonzoTxWitnesses Tx (ShelleyLedgerEra era)
ValidatedTx (BabbageEra StandardCrypto)
tx
where
getShelleyTxWitnesses :: forall ledgerera.
ToCBOR (Ledger.AuxiliaryData ledgerera)
=> ToCBOR (Ledger.TxBody ledgerera)
=> ToCBOR (Ledger.Script ledgerera)
=> FromCBOR (CBOR.Annotator (Ledger.Script ledgerera))
=> Ledger.Crypto ledgerera ~ StandardCrypto
=> Ledger.Witnesses ledgerera ~ Shelley.WitnessSetHKD Identity ledgerera
=> ToCBOR (Ledger.Witnesses ledgerera)
=> Shelley.UsesValue ledgerera
=> Shelley.Tx ledgerera
-> [KeyWitness era]
getShelleyTxWitnesses :: Tx ledgerera -> [KeyWitness era]
getShelleyTxWitnesses Shelley.Tx {
wits :: forall era.
Tx era
-> (Era era, ToCBOR (AuxiliaryData era), ToCBOR (TxBody era),
ToCBOR (Witnesses era)) =>
Witnesses era
Shelley.wits =
Shelley.WitnessSet
addrWits
_msigWits
bootWits
} =
(BootstrapWitness StandardCrypto -> KeyWitness era)
-> [BootstrapWitness StandardCrypto] -> [KeyWitness era]
forall a b. (a -> b) -> [a] -> [b]
map (ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
ShelleyBootstrapWitness ShelleyBasedEra era
era) (Set (BootstrapWitness StandardCrypto)
-> [BootstrapWitness StandardCrypto]
forall a. Set a -> [a]
Set.elems Set (BootstrapWitness StandardCrypto)
Set (BootstrapWitness (Crypto ledgerera))
bootWits)
[KeyWitness era] -> [KeyWitness era] -> [KeyWitness era]
forall a. [a] -> [a] -> [a]
++ (WitVKey 'Witness StandardCrypto -> KeyWitness era)
-> [WitVKey 'Witness StandardCrypto] -> [KeyWitness era]
forall a b. (a -> b) -> [a] -> [b]
map (ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
ShelleyKeyWitness ShelleyBasedEra era
era) (Set (WitVKey 'Witness StandardCrypto)
-> [WitVKey 'Witness StandardCrypto]
forall a. Set a -> [a]
Set.elems Set (WitVKey 'Witness StandardCrypto)
Set (WitVKey 'Witness (Crypto ledgerera))
addrWits)
getAlonzoTxWitnesses :: forall ledgerera.
Ledger.Crypto ledgerera ~ StandardCrypto
=> Alonzo.ValidatedTx ledgerera
-> [KeyWitness era]
getAlonzoTxWitnesses :: ValidatedTx ledgerera -> [KeyWitness era]
getAlonzoTxWitnesses Alonzo.ValidatedTx {
wits :: forall era. ValidatedTx era -> TxWitness era
Alonzo.wits =
Alonzo.TxWitness'
Set (WitVKey 'Witness (Crypto ledgerera))
addrWits
Set (BootstrapWitness (Crypto ledgerera))
bootWits
Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
_txscripts
TxDats ledgerera
_txdats
Redeemers ledgerera
_txrdmrs
} =
(BootstrapWitness StandardCrypto -> KeyWitness era)
-> [BootstrapWitness StandardCrypto] -> [KeyWitness era]
forall a b. (a -> b) -> [a] -> [b]
map (ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
ShelleyBootstrapWitness ShelleyBasedEra era
era) (Set (BootstrapWitness StandardCrypto)
-> [BootstrapWitness StandardCrypto]
forall a. Set a -> [a]
Set.elems Set (BootstrapWitness StandardCrypto)
Set (BootstrapWitness (Crypto ledgerera))
bootWits)
[KeyWitness era] -> [KeyWitness era] -> [KeyWitness era]
forall a. [a] -> [a] -> [a]
++ (WitVKey 'Witness StandardCrypto -> KeyWitness era)
-> [WitVKey 'Witness StandardCrypto] -> [KeyWitness era]
forall a b. (a -> b) -> [a] -> [b]
map (ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
ShelleyKeyWitness ShelleyBasedEra era
era) (Set (WitVKey 'Witness StandardCrypto)
-> [WitVKey 'Witness StandardCrypto]
forall a. Set a -> [a]
Set.elems Set (WitVKey 'Witness StandardCrypto)
Set (WitVKey 'Witness (Crypto ledgerera))
addrWits)
makeSignedTransaction :: forall era.
[KeyWitness era]
-> TxBody era
-> Tx era
makeSignedTransaction :: [KeyWitness era] -> TxBody era -> Tx era
makeSignedTransaction [KeyWitness era]
witnesses (ByronTxBody Annotated Tx ByteString
txbody) =
ATxAux ByteString -> Tx ByronEra
ByronTx
(ATxAux ByteString -> Tx ByronEra)
-> (TxAux -> ATxAux ByteString) -> TxAux -> Tx ByronEra
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TxAux -> ATxAux ByteString
Byron.annotateTxAux
(TxAux -> Tx ByronEra) -> TxAux -> Tx ByronEra
forall a b. (a -> b) -> a -> b
$ Tx -> TxWitness -> TxAux
Byron.mkTxAux
(Annotated Tx ByteString -> Tx
forall b a. Annotated b a -> b
unAnnotated Annotated Tx ByteString
txbody)
([TxInWitness] -> TxWitness
forall a. [a] -> Vector a
Vector.fromList [ TxInWitness
w | ByronKeyWitness TxInWitness
w <- [KeyWitness era]
witnesses ])
makeSignedTransaction [KeyWitness era]
witnesses (ShelleyTxBody ShelleyBasedEra era
era TxBody (ShelleyLedgerEra era)
txbody
[Script (ShelleyLedgerEra era)]
txscripts
TxBodyScriptData era
txscriptdata
Maybe (AuxiliaryData (ShelleyLedgerEra era))
txmetadata
TxScriptValidity era
scriptValidity
) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> TxBody (ShelleyEra StandardCrypto) -> Tx era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera,
ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Crypto ledgerera ~ StandardCrypto,
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera,
Tx ledgerera ~ Tx ledgerera, ToCBOR (Witnesses ledgerera),
UsesValue ledgerera, ValidateScript ledgerera) =>
TxBody ledgerera -> Tx era
makeShelleySignedTransaction TxBody (ShelleyEra StandardCrypto)
TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraAllegra -> TxBody (ShelleyMAEra 'Allegra StandardCrypto) -> Tx era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera,
ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Crypto ledgerera ~ StandardCrypto,
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera,
Tx ledgerera ~ Tx ledgerera, ToCBOR (Witnesses ledgerera),
UsesValue ledgerera, ValidateScript ledgerera) =>
TxBody ledgerera -> Tx era
makeShelleySignedTransaction TxBody (ShelleyMAEra 'Allegra StandardCrypto)
TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraMary -> TxBody (ShelleyMAEra 'Mary StandardCrypto) -> Tx era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera,
ToCBOR (AuxiliaryData ledgerera), ToCBOR (TxBody ledgerera),
ToCBOR (Script ledgerera), FromCBOR (Annotator (Script ledgerera)),
Crypto ledgerera ~ StandardCrypto,
Witnesses ledgerera ~ WitnessSetHKD Identity ledgerera,
Tx ledgerera ~ Tx ledgerera, ToCBOR (Witnesses ledgerera),
UsesValue ledgerera, ValidateScript ledgerera) =>
TxBody ledgerera -> Tx era
makeShelleySignedTransaction TxBody (ShelleyMAEra 'Mary StandardCrypto)
TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraAlonzo -> TxBody (AlonzoEra StandardCrypto) -> Tx era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera,
Crypto ledgerera ~ StandardCrypto,
Tx ledgerera ~ ValidatedTx ledgerera,
Script ledgerera ~ Script ledgerera, UsesValue ledgerera,
ValidateScript ledgerera) =>
TxBody ledgerera -> Tx era
makeAlonzoSignedTransaction TxBody (AlonzoEra StandardCrypto)
TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraBabbage -> TxBody (BabbageEra StandardCrypto) -> Tx era
forall ledgerera.
(ShelleyLedgerEra era ~ ledgerera,
Crypto ledgerera ~ StandardCrypto,
Tx ledgerera ~ ValidatedTx ledgerera,
Script ledgerera ~ Script ledgerera, UsesValue ledgerera,
ValidateScript ledgerera) =>
TxBody ledgerera -> Tx era
makeAlonzoSignedTransaction TxBody (BabbageEra StandardCrypto)
TxBody (ShelleyLedgerEra era)
txbody
where
makeShelleySignedTransaction
:: forall ledgerera.
ShelleyLedgerEra era ~ ledgerera
=> ToCBOR (Ledger.AuxiliaryData ledgerera)
=> ToCBOR (Ledger.TxBody ledgerera)
=> ToCBOR (Ledger.Script ledgerera)
=> FromCBOR (CBOR.Annotator (Ledger.Script ledgerera))
=> Ledger.Crypto ledgerera ~ StandardCrypto
=> Ledger.Witnesses ledgerera ~ Shelley.WitnessSetHKD Identity ledgerera
=> Ledger.Tx ledgerera ~ Shelley.Tx ledgerera
=> ToCBOR (Ledger.Witnesses ledgerera)
=> Shelley.UsesValue ledgerera
=> Shelley.ValidateScript ledgerera
=> Ledger.TxBody ledgerera
-> Tx era
makeShelleySignedTransaction :: TxBody ledgerera -> Tx era
makeShelleySignedTransaction TxBody ledgerera
txbody' =
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra era
era (Tx (ShelleyLedgerEra era) -> Tx era)
-> Tx (ShelleyLedgerEra era) -> Tx era
forall a b. (a -> b) -> a -> b
$
TxBody ledgerera
-> Witnesses ledgerera
-> StrictMaybe (AuxiliaryData ledgerera)
-> Tx ledgerera
forall era.
(Era era, ToCBOR (AuxiliaryData era), ToCBOR (TxBody era),
ToCBOR (Witnesses era)) =>
TxBody era
-> Witnesses era -> StrictMaybe (AuxiliaryData era) -> Tx era
Shelley.Tx
TxBody ledgerera
txbody'
(Set (WitVKey 'Witness (Crypto ledgerera))
-> Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
-> Set (BootstrapWitness (Crypto ledgerera))
-> WitnessSet ledgerera
forall era.
(Era era, AnnotatedData (Script era)) =>
Set (WitVKey 'Witness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> Set (BootstrapWitness (Crypto era))
-> WitnessSet era
Shelley.WitnessSet
([WitVKey 'Witness StandardCrypto]
-> Set (WitVKey 'Witness StandardCrypto)
forall a. Ord a => [a] -> Set a
Set.fromList [ WitVKey 'Witness StandardCrypto
w | ShelleyKeyWitness ShelleyBasedEra era
_ WitVKey 'Witness StandardCrypto
w <- [KeyWitness era]
witnesses ])
([(ScriptHash StandardCrypto, Script ledgerera)]
-> Map (ScriptHash StandardCrypto) (Script ledgerera)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [ (Script ledgerera -> ScriptHash (Crypto ledgerera)
forall era.
ValidateScript era =>
Script era -> ScriptHash (Crypto era)
Ledger.hashScript @ledgerera Script ledgerera
sw, Script ledgerera
sw)
| Script ledgerera
sw <- [Script ledgerera]
[Script (ShelleyLedgerEra era)]
txscripts ])
([BootstrapWitness StandardCrypto]
-> Set (BootstrapWitness StandardCrypto)
forall a. Ord a => [a] -> Set a
Set.fromList [ BootstrapWitness StandardCrypto
w | ShelleyBootstrapWitness ShelleyBasedEra era
_ BootstrapWitness StandardCrypto
w <- [KeyWitness era]
witnesses ]))
(Maybe (AuxiliaryData ledgerera)
-> StrictMaybe (AuxiliaryData ledgerera)
forall a. Maybe a -> StrictMaybe a
maybeToStrictMaybe Maybe (AuxiliaryData ledgerera)
Maybe (AuxiliaryData (ShelleyLedgerEra era))
txmetadata)
makeAlonzoSignedTransaction
:: forall ledgerera.
ShelleyLedgerEra era ~ ledgerera
=> Ledger.Crypto ledgerera ~ StandardCrypto
=> Ledger.Tx ledgerera ~ Alonzo.ValidatedTx ledgerera
=> Ledger.Script ledgerera ~ Alonzo.Script ledgerera
=> Shelley.UsesValue ledgerera
=> Shelley.ValidateScript ledgerera
=> Ledger.TxBody ledgerera
-> Tx era
makeAlonzoSignedTransaction :: TxBody ledgerera -> Tx era
makeAlonzoSignedTransaction TxBody ledgerera
txbody' =
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
forall era.
ShelleyBasedEra era -> Tx (ShelleyLedgerEra era) -> Tx era
ShelleyTx ShelleyBasedEra era
era (Tx (ShelleyLedgerEra era) -> Tx era)
-> Tx (ShelleyLedgerEra era) -> Tx era
forall a b. (a -> b) -> a -> b
$
TxBody ledgerera
-> TxWitness ledgerera
-> IsValid
-> StrictMaybe (AuxiliaryData ledgerera)
-> ValidatedTx ledgerera
forall era.
TxBody era
-> TxWitness era
-> IsValid
-> StrictMaybe (AuxiliaryData era)
-> ValidatedTx era
Alonzo.ValidatedTx
TxBody ledgerera
txbody'
(Set (WitVKey 'Witness (Crypto ledgerera))
-> Set (BootstrapWitness (Crypto ledgerera))
-> Map (ScriptHash (Crypto ledgerera)) (Script ledgerera)
-> TxDats ledgerera
-> Redeemers ledgerera
-> TxWitness ledgerera
forall era.
(Era era, Script era ~ Script era) =>
Set (WitVKey 'Witness (Crypto era))
-> Set (BootstrapWitness (Crypto era))
-> Map (ScriptHash (Crypto era)) (Script era)
-> TxDats era
-> Redeemers era
-> TxWitness era
Alonzo.TxWitness
([WitVKey 'Witness StandardCrypto]
-> Set (WitVKey 'Witness StandardCrypto)
forall a. Ord a => [a] -> Set a
Set.fromList [ WitVKey 'Witness StandardCrypto
w | ShelleyKeyWitness ShelleyBasedEra era
_ WitVKey 'Witness StandardCrypto
w <- [KeyWitness era]
witnesses ])
([BootstrapWitness StandardCrypto]
-> Set (BootstrapWitness StandardCrypto)
forall a. Ord a => [a] -> Set a
Set.fromList [ BootstrapWitness StandardCrypto
w | ShelleyBootstrapWitness ShelleyBasedEra era
_ BootstrapWitness StandardCrypto
w <- [KeyWitness era]
witnesses ])
([(ScriptHash StandardCrypto, Script ledgerera)]
-> Map (ScriptHash StandardCrypto) (Script ledgerera)
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList [ (Script ledgerera -> ScriptHash (Crypto ledgerera)
forall era.
ValidateScript era =>
Script era -> ScriptHash (Crypto era)
Ledger.hashScript @ledgerera Script ledgerera
Script ledgerera
sw, Script ledgerera
sw)
| Script ledgerera
sw <- [Script ledgerera]
[Script (ShelleyLedgerEra era)]
txscripts ])
TxDats ledgerera
datums
Redeemers ledgerera
redeemers)
(TxScriptValidity era -> IsValid
forall era. TxScriptValidity era -> IsValid
txScriptValidityToIsValid TxScriptValidity era
scriptValidity)
(Maybe (AuxiliaryData ledgerera)
-> StrictMaybe (AuxiliaryData ledgerera)
forall a. Maybe a -> StrictMaybe a
maybeToStrictMaybe Maybe (AuxiliaryData ledgerera)
Maybe (AuxiliaryData (ShelleyLedgerEra era))
txmetadata)
where
(TxDats ledgerera
datums, Redeemers ledgerera
redeemers) =
case TxBodyScriptData era
txscriptdata of
TxBodyScriptData ScriptDataSupportedInEra era
_ TxDats (ShelleyLedgerEra era)
ds Redeemers (ShelleyLedgerEra era)
rs -> (TxDats ledgerera
TxDats (ShelleyLedgerEra era)
ds, Redeemers ledgerera
Redeemers (ShelleyLedgerEra era)
rs)
TxBodyScriptData era
TxBodyNoScriptData -> (TxDats ledgerera
forall a. Monoid a => a
mempty, Map RdmrPtr (Data ledgerera, ExUnits) -> Redeemers ledgerera
forall era.
Era era =>
Map RdmrPtr (Data era, ExUnits) -> Redeemers era
Alonzo.Redeemers Map RdmrPtr (Data ledgerera, ExUnits)
forall a. Monoid a => a
mempty)
makeByronKeyWitness :: forall key.
IsByronKey key
=> NetworkId
-> TxBody ByronEra
-> SigningKey key
-> KeyWitness ByronEra
makeByronKeyWitness :: NetworkId
-> TxBody ByronEra -> SigningKey key -> KeyWitness ByronEra
makeByronKeyWitness NetworkId
_ (ShelleyTxBody ShelleyBasedEra ByronEra
era TxBody (ShelleyLedgerEra ByronEra)
_ [Script (ShelleyLedgerEra ByronEra)]
_ TxBodyScriptData ByronEra
_ Maybe (AuxiliaryData (ShelleyLedgerEra ByronEra))
_ TxScriptValidity ByronEra
_) = case ShelleyBasedEra ByronEra
era of {}
makeByronKeyWitness NetworkId
nw (ByronTxBody Annotated Tx ByteString
txbody) =
let txhash :: Byron.Hash Byron.Tx
txhash :: Hash Tx
txhash = Annotated Tx ByteString
-> Hash (BaseType (Annotated Tx ByteString))
forall t. Decoded t => t -> Hash (BaseType t)
Byron.hashDecoded Annotated Tx ByteString
txbody
pm :: Byron.ProtocolMagicId
pm :: ProtocolMagicId
pm = NetworkId -> ProtocolMagicId
toByronProtocolMagicId NetworkId
nw
in case ByronKeyFormat key
forall key. IsByronKey key => ByronKeyFormat key
byronKeyFormat :: ByronKeyFormat key of
ByronKeyFormat key
ByronLegacyKeyFormat ->
\(ByronSigningKeyLegacy sk) -> SigningKey -> ProtocolMagicId -> Hash Tx -> KeyWitness ByronEra
witness SigningKey
sk ProtocolMagicId
pm Hash Tx
txhash
ByronKeyFormat key
ByronModernKeyFormat ->
\(ByronSigningKey sk) -> SigningKey -> ProtocolMagicId -> Hash Tx -> KeyWitness ByronEra
witness SigningKey
sk ProtocolMagicId
pm Hash Tx
txhash
where
witness :: Byron.SigningKey
-> Byron.ProtocolMagicId
-> Byron.Hash Byron.Tx
-> KeyWitness ByronEra
witness :: SigningKey -> ProtocolMagicId -> Hash Tx -> KeyWitness ByronEra
witness SigningKey
sk ProtocolMagicId
pm Hash Tx
txHash =
TxInWitness -> KeyWitness ByronEra
ByronKeyWitness (TxInWitness -> KeyWitness ByronEra)
-> TxInWitness -> KeyWitness ByronEra
forall a b. (a -> b) -> a -> b
$
VerificationKey -> TxSig -> TxInWitness
Byron.VKWitness
(SigningKey -> VerificationKey
Byron.toVerification SigningKey
sk)
(ProtocolMagicId -> SignTag -> SigningKey -> TxSigData -> TxSig
forall a.
ToCBOR a =>
ProtocolMagicId -> SignTag -> SigningKey -> a -> Signature a
Byron.sign ProtocolMagicId
pm SignTag
Byron.SignTx SigningKey
sk (Hash Tx -> TxSigData
Byron.TxSigData Hash Tx
txHash))
data WitnessNetworkIdOrByronAddress
= WitnessNetworkId !NetworkId
| WitnessByronAddress !(Address ByronAddr)
makeShelleyBootstrapWitness :: forall era.
IsShelleyBasedEra era
=> WitnessNetworkIdOrByronAddress
-> TxBody era
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBootstrapWitness :: WitnessNetworkIdOrByronAddress
-> TxBody era -> SigningKey ByronKey -> KeyWitness era
makeShelleyBootstrapWitness WitnessNetworkIdOrByronAddress
_ ByronTxBody{} SigningKey ByronKey
_ =
case ShelleyBasedEra era
forall era. IsShelleyBasedEra era => ShelleyBasedEra era
shelleyBasedEra :: ShelleyBasedEra era of {}
makeShelleyBootstrapWitness WitnessNetworkIdOrByronAddress
nwOrAddr (ShelleyTxBody ShelleyBasedEra era
era TxBody (ShelleyLedgerEra era)
txbody [Script (ShelleyLedgerEra era)]
_ TxBodyScriptData era
_ Maybe (AuxiliaryData (ShelleyLedgerEra era))
_ TxScriptValidity era
_) SigningKey ByronKey
sk =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley ->
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
forall era.
HashAnnotated
(TxBody (ShelleyLedgerEra era))
EraIndependentTxBody
StandardCrypto =>
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBasedBootstrapWitness ShelleyBasedEra era
era WitnessNetworkIdOrByronAddress
nwOrAddr TxBody (ShelleyLedgerEra era)
txbody SigningKey ByronKey
sk
ShelleyBasedEra era
ShelleyBasedEraAllegra ->
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
forall era.
HashAnnotated
(TxBody (ShelleyLedgerEra era))
EraIndependentTxBody
StandardCrypto =>
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBasedBootstrapWitness ShelleyBasedEra era
era WitnessNetworkIdOrByronAddress
nwOrAddr TxBody (ShelleyLedgerEra era)
txbody SigningKey ByronKey
sk
ShelleyBasedEra era
ShelleyBasedEraMary ->
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
forall era.
HashAnnotated
(TxBody (ShelleyLedgerEra era))
EraIndependentTxBody
StandardCrypto =>
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBasedBootstrapWitness ShelleyBasedEra era
era WitnessNetworkIdOrByronAddress
nwOrAddr TxBody (ShelleyLedgerEra era)
txbody SigningKey ByronKey
sk
ShelleyBasedEra era
ShelleyBasedEraAlonzo ->
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
forall era.
HashAnnotated
(TxBody (ShelleyLedgerEra era))
EraIndependentTxBody
StandardCrypto =>
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBasedBootstrapWitness ShelleyBasedEra era
era WitnessNetworkIdOrByronAddress
nwOrAddr TxBody (ShelleyLedgerEra era)
txbody SigningKey ByronKey
sk
ShelleyBasedEra era
ShelleyBasedEraBabbage ->
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
forall era.
HashAnnotated
(TxBody (ShelleyLedgerEra era))
EraIndependentTxBody
StandardCrypto =>
ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBasedBootstrapWitness ShelleyBasedEra era
era WitnessNetworkIdOrByronAddress
nwOrAddr TxBody (ShelleyLedgerEra era)
txbody SigningKey ByronKey
sk
makeShelleyBasedBootstrapWitness :: forall era.
(Ledger.HashAnnotated
(Ledger.TxBody (ShelleyLedgerEra era))
Ledger.EraIndependentTxBody
StandardCrypto)
=> ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> Ledger.TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBasedBootstrapWitness :: ShelleyBasedEra era
-> WitnessNetworkIdOrByronAddress
-> TxBody (ShelleyLedgerEra era)
-> SigningKey ByronKey
-> KeyWitness era
makeShelleyBasedBootstrapWitness ShelleyBasedEra era
era WitnessNetworkIdOrByronAddress
nwOrAddr TxBody (ShelleyLedgerEra era)
txbody (ByronSigningKey sk) =
ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> BootstrapWitness StandardCrypto -> KeyWitness era
ShelleyBootstrapWitness ShelleyBasedEra era
era (BootstrapWitness StandardCrypto -> KeyWitness era)
-> BootstrapWitness StandardCrypto -> KeyWitness era
forall a b. (a -> b) -> a -> b
$
BootstrapWitness :: forall crypto.
Crypto crypto =>
VKey 'Witness crypto
-> SignedDSIGN crypto (Hash crypto EraIndependentTxBody)
-> ChainCode
-> ByteString
-> BootstrapWitness crypto
Shelley.BootstrapWitness {
bwKey :: VKey 'Witness StandardCrypto
Shelley.bwKey = VKey 'Witness StandardCrypto
vk,
bwSig :: SignedDSIGN
StandardCrypto (Hash StandardCrypto EraIndependentTxBody)
Shelley.bwSig = SignedDSIGN
StandardCrypto (Hash StandardCrypto EraIndependentTxBody)
signature,
bwChainCode :: ChainCode
Shelley.bwChainCode = ChainCode
chainCode,
bwAttributes :: ByteString
Shelley.bwAttributes = ByteString
attributes
}
where
(VKey 'Witness StandardCrypto
vk, ChainCode
chainCode) = VerificationKey -> (VKey 'Witness StandardCrypto, ChainCode)
forall crypto.
(DSIGN crypto ~ Ed25519DSIGN) =>
VerificationKey -> (VKey 'Witness crypto, ChainCode)
Shelley.unpackByronVKey (SigningKey -> VerificationKey
Byron.toVerification SigningKey
sk)
signature :: Shelley.SignedDSIGN StandardCrypto
(Shelley.Hash StandardCrypto Ledger.EraIndependentTxBody)
signature :: SignedDSIGN
StandardCrypto (Hash StandardCrypto EraIndependentTxBody)
signature = Hash Blake2b_256 EraIndependentTxBody
-> ShelleySigningKey
-> SignedDSIGN
StandardCrypto (Hash Blake2b_256 EraIndependentTxBody)
forall tosign.
SignableRepresentation tosign =>
tosign -> ShelleySigningKey -> SignedDSIGN StandardCrypto tosign
makeShelleySignature
Hash Blake2b_256 EraIndependentTxBody
Hash StandardCrypto EraIndependentTxBody
txhash
(XPrv -> ShelleySigningKey
ShelleyExtendedSigningKey (SigningKey -> XPrv
Byron.unSigningKey SigningKey
sk))
txhash :: Shelley.Hash StandardCrypto Ledger.EraIndependentTxBody
txhash :: Hash StandardCrypto EraIndependentTxBody
txhash = SafeHash StandardCrypto EraIndependentTxBody
-> Hash StandardCrypto EraIndependentTxBody
forall crypto i. SafeHash crypto i -> Hash (HASH crypto) i
Ledger.extractHash (TxBody (ShelleyLedgerEra era)
-> SafeHash StandardCrypto EraIndependentTxBody
forall c i x.
(HasAlgorithm c, HashAnnotated x i c) =>
x -> SafeHash c i
Ledger.hashAnnotated TxBody (ShelleyLedgerEra era)
txbody)
attributes :: ByteString
attributes =
Attributes AddrAttributes -> ByteString
forall tx. ToCBOR tx => tx -> ByteString
CBOR.serialize' (Attributes AddrAttributes -> ByteString)
-> Attributes AddrAttributes -> ByteString
forall a b. (a -> b) -> a -> b
$
AddrAttributes -> Attributes AddrAttributes
forall h. h -> Attributes h
Byron.mkAttributes AddrAttributes :: Maybe HDAddressPayload -> NetworkMagic -> AddrAttributes
Byron.AddrAttributes {
aaVKDerivationPath :: Maybe HDAddressPayload
Byron.aaVKDerivationPath = Maybe HDAddressPayload
derivationPath,
aaNetworkMagic :: NetworkMagic
Byron.aaNetworkMagic = NetworkMagic
networkMagic
}
eitherNwOrAddr :: Either NetworkId (Address ByronAddr)
eitherNwOrAddr :: Either NetworkId (Address ByronAddr)
eitherNwOrAddr =
case WitnessNetworkIdOrByronAddress
nwOrAddr of
WitnessNetworkId NetworkId
nw -> NetworkId -> Either NetworkId (Address ByronAddr)
forall a b. a -> Either a b
Left NetworkId
nw
WitnessByronAddress Address ByronAddr
addr -> Address ByronAddr -> Either NetworkId (Address ByronAddr)
forall a b. b -> Either a b
Right Address ByronAddr
addr
unByronAddr :: Address ByronAddr -> Byron.Address
unByronAddr :: Address ByronAddr -> Address
unByronAddr (ByronAddress Address
addr) = Address
addr
unAddrAttrs :: Address ByronAddr -> Byron.AddrAttributes
unAddrAttrs :: Address ByronAddr -> AddrAttributes
unAddrAttrs = Attributes AddrAttributes -> AddrAttributes
forall h. Attributes h -> h
Byron.attrData (Attributes AddrAttributes -> AddrAttributes)
-> (Address ByronAddr -> Attributes AddrAttributes)
-> Address ByronAddr
-> AddrAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Address -> Attributes AddrAttributes
Byron.addrAttributes (Address -> Attributes AddrAttributes)
-> (Address ByronAddr -> Address)
-> Address ByronAddr
-> Attributes AddrAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Address ByronAddr -> Address
unByronAddr
derivationPath :: Maybe Byron.HDAddressPayload
derivationPath :: Maybe HDAddressPayload
derivationPath =
(NetworkId -> Maybe HDAddressPayload)
-> (Address ByronAddr -> Maybe HDAddressPayload)
-> Either NetworkId (Address ByronAddr)
-> Maybe HDAddressPayload
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either
(Maybe HDAddressPayload -> NetworkId -> Maybe HDAddressPayload
forall a b. a -> b -> a
const Maybe HDAddressPayload
forall a. Maybe a
Nothing)
(AddrAttributes -> Maybe HDAddressPayload
Byron.aaVKDerivationPath (AddrAttributes -> Maybe HDAddressPayload)
-> (Address ByronAddr -> AddrAttributes)
-> Address ByronAddr
-> Maybe HDAddressPayload
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Address ByronAddr -> AddrAttributes
unAddrAttrs)
Either NetworkId (Address ByronAddr)
eitherNwOrAddr
networkMagic :: Byron.NetworkMagic
networkMagic :: NetworkMagic
networkMagic =
(NetworkId -> NetworkMagic)
-> (Address ByronAddr -> NetworkMagic)
-> Either NetworkId (Address ByronAddr)
-> NetworkMagic
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either
NetworkId -> NetworkMagic
toByronNetworkMagic
(AddrAttributes -> NetworkMagic
Byron.aaNetworkMagic (AddrAttributes -> NetworkMagic)
-> (Address ByronAddr -> AddrAttributes)
-> Address ByronAddr
-> NetworkMagic
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Address ByronAddr -> AddrAttributes
unAddrAttrs)
Either NetworkId (Address ByronAddr)
eitherNwOrAddr
data ShelleyWitnessSigningKey =
WitnessPaymentKey (SigningKey PaymentKey)
| WitnessPaymentExtendedKey (SigningKey PaymentExtendedKey)
| WitnessStakeKey (SigningKey StakeKey)
| WitnessStakeExtendedKey (SigningKey StakeExtendedKey)
| WitnessStakePoolKey (SigningKey StakePoolKey)
| WitnessGenesisKey (SigningKey GenesisKey)
| WitnessGenesisExtendedKey (SigningKey GenesisExtendedKey)
| WitnessGenesisDelegateKey (SigningKey GenesisDelegateKey)
| WitnessGenesisDelegateExtendedKey
(SigningKey GenesisDelegateExtendedKey)
| WitnessGenesisUTxOKey (SigningKey GenesisUTxOKey)
makeShelleyKeyWitness :: forall era
. IsShelleyBasedEra era
=> TxBody era
-> ShelleyWitnessSigningKey
-> KeyWitness era
makeShelleyKeyWitness :: TxBody era -> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyKeyWitness (ShelleyTxBody ShelleyBasedEra era
era TxBody (ShelleyLedgerEra era)
txbody [Script (ShelleyLedgerEra era)]
_ TxBodyScriptData era
_ Maybe (AuxiliaryData (ShelleyLedgerEra era))
_ TxScriptValidity era
_) =
case ShelleyBasedEra era
era of
ShelleyBasedEra era
ShelleyBasedEraShelley -> TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
(UsesValue (ShelleyLedgerEra era),
Crypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyBasedKeyWitness TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraAllegra -> TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
(UsesValue (ShelleyLedgerEra era),
Crypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyBasedKeyWitness TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraMary -> TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
(UsesValue (ShelleyLedgerEra era),
Crypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyBasedKeyWitness TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraAlonzo -> TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
(UsesValue (ShelleyLedgerEra era),
Crypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyBasedKeyWitness TxBody (ShelleyLedgerEra era)
txbody
ShelleyBasedEra era
ShelleyBasedEraBabbage -> TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
(UsesValue (ShelleyLedgerEra era),
Crypto (ShelleyLedgerEra era) ~ StandardCrypto) =>
TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyBasedKeyWitness TxBody (ShelleyLedgerEra era)
txbody
where
makeShelleyBasedKeyWitness :: Shelley.UsesValue (ShelleyLedgerEra era)
=> Ledger.Crypto (ShelleyLedgerEra era) ~ StandardCrypto
=> Ledger.TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey
-> KeyWitness era
makeShelleyBasedKeyWitness :: TxBody (ShelleyLedgerEra era)
-> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyBasedKeyWitness TxBody (ShelleyLedgerEra era)
txbody' =
let txhash :: Shelley.Hash StandardCrypto Ledger.EraIndependentTxBody
txhash :: Hash StandardCrypto EraIndependentTxBody
txhash = SafeHash StandardCrypto EraIndependentTxBody
-> Hash StandardCrypto EraIndependentTxBody
forall crypto i. SafeHash crypto i -> Hash (HASH crypto) i
Ledger.extractHash (TxBody (ShelleyLedgerEra era)
-> SafeHash StandardCrypto EraIndependentTxBody
forall c i x.
(HasAlgorithm c, HashAnnotated x i c) =>
x -> SafeHash c i
Ledger.hashAnnotated TxBody (ShelleyLedgerEra era)
txbody')
in \ShelleyWitnessSigningKey
wsk ->
let sk :: ShelleySigningKey
sk = ShelleyWitnessSigningKey -> ShelleySigningKey
toShelleySigningKey ShelleyWitnessSigningKey
wsk
vk :: VKey 'Witness StandardCrypto
vk = ShelleySigningKey -> VKey 'Witness StandardCrypto
getShelleyKeyWitnessVerificationKey ShelleySigningKey
sk
signature :: SignedDSIGN StandardCrypto (Hash Blake2b_256 EraIndependentTxBody)
signature = Hash Blake2b_256 EraIndependentTxBody
-> ShelleySigningKey
-> SignedDSIGN
StandardCrypto (Hash Blake2b_256 EraIndependentTxBody)
forall tosign.
SignableRepresentation tosign =>
tosign -> ShelleySigningKey -> SignedDSIGN StandardCrypto tosign
makeShelleySignature Hash Blake2b_256 EraIndependentTxBody
Hash StandardCrypto EraIndependentTxBody
txhash ShelleySigningKey
sk
in ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
forall era.
ShelleyBasedEra era
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
ShelleyKeyWitness ShelleyBasedEra era
era (WitVKey 'Witness StandardCrypto -> KeyWitness era)
-> WitVKey 'Witness StandardCrypto -> KeyWitness era
forall a b. (a -> b) -> a -> b
$
VKey 'Witness StandardCrypto
-> SignedDSIGN
StandardCrypto (Hash StandardCrypto EraIndependentTxBody)
-> WitVKey 'Witness StandardCrypto
forall (kr :: KeyRole) crypto.
(Typeable kr, Crypto crypto) =>
VKey kr crypto
-> SignedDSIGN crypto (Hash crypto EraIndependentTxBody)
-> WitVKey kr crypto
Shelley.WitVKey VKey 'Witness StandardCrypto
vk SignedDSIGN StandardCrypto (Hash Blake2b_256 EraIndependentTxBody)
SignedDSIGN
StandardCrypto (Hash StandardCrypto EraIndependentTxBody)
signature
makeShelleyKeyWitness ByronTxBody{} =
case ShelleyBasedEra era
forall era. IsShelleyBasedEra era => ShelleyBasedEra era
shelleyBasedEra :: ShelleyBasedEra era of {}
data ShelleySigningKey =
ShelleyNormalSigningKey (Shelley.SignKeyDSIGN StandardCrypto)
| ShelleyExtendedSigningKey Crypto.HD.XPrv
toShelleySigningKey :: ShelleyWitnessSigningKey -> ShelleySigningKey
toShelleySigningKey :: ShelleyWitnessSigningKey -> ShelleySigningKey
toShelleySigningKey ShelleyWitnessSigningKey
key = case ShelleyWitnessSigningKey
key of
WitnessPaymentKey (PaymentSigningKey sk) -> SignKeyDSIGN StandardCrypto -> ShelleySigningKey
ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk
WitnessStakeKey (StakeSigningKey sk) -> SignKeyDSIGN StandardCrypto -> ShelleySigningKey
ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk
WitnessStakePoolKey (StakePoolSigningKey sk) -> SignKeyDSIGN StandardCrypto -> ShelleySigningKey
ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk
WitnessGenesisKey (GenesisSigningKey sk) -> SignKeyDSIGN StandardCrypto -> ShelleySigningKey
ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk
WitnessGenesisUTxOKey (GenesisUTxOSigningKey sk) -> SignKeyDSIGN StandardCrypto -> ShelleySigningKey
ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk
WitnessGenesisDelegateKey (GenesisDelegateSigningKey sk) ->
SignKeyDSIGN StandardCrypto -> ShelleySigningKey
ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk
WitnessPaymentExtendedKey (PaymentExtendedSigningKey sk) ->
XPrv -> ShelleySigningKey
ShelleyExtendedSigningKey XPrv
sk
WitnessStakeExtendedKey (StakeExtendedSigningKey sk) ->
XPrv -> ShelleySigningKey
ShelleyExtendedSigningKey XPrv
sk
WitnessGenesisExtendedKey (GenesisExtendedSigningKey sk) ->
XPrv -> ShelleySigningKey
ShelleyExtendedSigningKey XPrv
sk
WitnessGenesisDelegateExtendedKey (GenesisDelegateExtendedSigningKey sk) ->
XPrv -> ShelleySigningKey
ShelleyExtendedSigningKey XPrv
sk
getShelleyKeyWitnessVerificationKey
:: ShelleySigningKey
-> Shelley.VKey Shelley.Witness StandardCrypto
getShelleyKeyWitnessVerificationKey :: ShelleySigningKey -> VKey 'Witness StandardCrypto
getShelleyKeyWitnessVerificationKey (ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk) =
(VKey 'Payment StandardCrypto -> VKey 'Witness StandardCrypto
forall (a :: KeyRole -> * -> *) (r :: KeyRole) crypto
(r' :: KeyRole).
HasKeyRole a =>
a r crypto -> a r' crypto
Shelley.coerceKeyRole :: Shelley.VKey Shelley.Payment StandardCrypto
-> Shelley.VKey Shelley.Witness StandardCrypto)
(VKey 'Payment StandardCrypto -> VKey 'Witness StandardCrypto)
-> (SignKeyDSIGN Ed25519DSIGN -> VKey 'Payment StandardCrypto)
-> SignKeyDSIGN Ed25519DSIGN
-> VKey 'Witness StandardCrypto
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\(PaymentVerificationKey vk) -> VKey 'Payment StandardCrypto
vk)
(VerificationKey PaymentKey -> VKey 'Payment StandardCrypto)
-> (SignKeyDSIGN Ed25519DSIGN -> VerificationKey PaymentKey)
-> SignKeyDSIGN Ed25519DSIGN
-> VKey 'Payment StandardCrypto
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SigningKey PaymentKey -> VerificationKey PaymentKey
forall keyrole.
Key keyrole =>
SigningKey keyrole -> VerificationKey keyrole
getVerificationKey
(SigningKey PaymentKey -> VerificationKey PaymentKey)
-> (SignKeyDSIGN Ed25519DSIGN -> SigningKey PaymentKey)
-> SignKeyDSIGN Ed25519DSIGN
-> VerificationKey PaymentKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SignKeyDSIGN Ed25519DSIGN -> SigningKey PaymentKey
SignKeyDSIGN StandardCrypto -> SigningKey PaymentKey
PaymentSigningKey
(SignKeyDSIGN Ed25519DSIGN -> VKey 'Witness StandardCrypto)
-> SignKeyDSIGN Ed25519DSIGN -> VKey 'Witness StandardCrypto
forall a b. (a -> b) -> a -> b
$ SignKeyDSIGN Ed25519DSIGN
SignKeyDSIGN StandardCrypto
sk
getShelleyKeyWitnessVerificationKey (ShelleyExtendedSigningKey XPrv
sk) =
(VKey 'Payment StandardCrypto -> VKey 'Witness StandardCrypto
forall (a :: KeyRole -> * -> *) (r :: KeyRole) crypto
(r' :: KeyRole).
HasKeyRole a =>
a r crypto -> a r' crypto
Shelley.coerceKeyRole :: Shelley.VKey Shelley.Payment StandardCrypto
-> Shelley.VKey Shelley.Witness StandardCrypto)
(VKey 'Payment StandardCrypto -> VKey 'Witness StandardCrypto)
-> (XPrv -> VKey 'Payment StandardCrypto)
-> XPrv
-> VKey 'Witness StandardCrypto
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (\(PaymentVerificationKey vk) -> VKey 'Payment StandardCrypto
vk)
(VerificationKey PaymentKey -> VKey 'Payment StandardCrypto)
-> (XPrv -> VerificationKey PaymentKey)
-> XPrv
-> VKey 'Payment StandardCrypto
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (VerificationKey PaymentExtendedKey -> VerificationKey PaymentKey
forall keyroleA keyroleB.
CastVerificationKeyRole keyroleA keyroleB =>
VerificationKey keyroleA -> VerificationKey keyroleB
castVerificationKey :: VerificationKey PaymentExtendedKey
-> VerificationKey PaymentKey)
(VerificationKey PaymentExtendedKey -> VerificationKey PaymentKey)
-> (XPrv -> VerificationKey PaymentExtendedKey)
-> XPrv
-> VerificationKey PaymentKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SigningKey PaymentExtendedKey -> VerificationKey PaymentExtendedKey
forall keyrole.
Key keyrole =>
SigningKey keyrole -> VerificationKey keyrole
getVerificationKey
(SigningKey PaymentExtendedKey
-> VerificationKey PaymentExtendedKey)
-> (XPrv -> SigningKey PaymentExtendedKey)
-> XPrv
-> VerificationKey PaymentExtendedKey
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XPrv -> SigningKey PaymentExtendedKey
PaymentExtendedSigningKey
(XPrv -> VKey 'Witness StandardCrypto)
-> XPrv -> VKey 'Witness StandardCrypto
forall a b. (a -> b) -> a -> b
$ XPrv
sk
makeShelleySignature
:: Crypto.SignableRepresentation tosign
=> tosign
-> ShelleySigningKey
-> Shelley.SignedDSIGN StandardCrypto tosign
makeShelleySignature :: tosign -> ShelleySigningKey -> SignedDSIGN StandardCrypto tosign
makeShelleySignature tosign
tosign (ShelleyNormalSigningKey SignKeyDSIGN StandardCrypto
sk) =
ContextDSIGN Ed25519DSIGN
-> tosign
-> SignKeyDSIGN Ed25519DSIGN
-> SignedDSIGN Ed25519DSIGN tosign
forall v a.
(DSIGNAlgorithm v, Signable v a) =>
ContextDSIGN v -> a -> SignKeyDSIGN v -> SignedDSIGN v a
Crypto.signedDSIGN () tosign
tosign SignKeyDSIGN Ed25519DSIGN
SignKeyDSIGN StandardCrypto
sk
makeShelleySignature tosign
tosign (ShelleyExtendedSigningKey XPrv
sk) =
XSignature -> SignedDSIGN StandardCrypto tosign
forall b. XSignature -> SignedDSIGN StandardCrypto b
fromXSignature (XSignature -> SignedDSIGN StandardCrypto tosign)
-> XSignature -> SignedDSIGN StandardCrypto tosign
forall a b. (a -> b) -> a -> b
$
ByteString -> XPrv -> ByteString -> XSignature
forall passPhrase msg.
(ByteArrayAccess passPhrase, ByteArrayAccess msg) =>
passPhrase -> XPrv -> msg -> XSignature
Crypto.HD.sign
ByteString
BS.empty
XPrv
sk
(tosign -> ByteString
forall a. SignableRepresentation a => a -> ByteString
Crypto.getSignableRepresentation tosign
tosign)
where
fromXSignature :: Crypto.HD.XSignature
-> Shelley.SignedDSIGN StandardCrypto b
fromXSignature :: XSignature -> SignedDSIGN StandardCrypto b
fromXSignature =
SigDSIGN Ed25519DSIGN -> SignedDSIGN Ed25519DSIGN b
forall v a. SigDSIGN v -> SignedDSIGN v a
Crypto.SignedDSIGN
(SigDSIGN Ed25519DSIGN -> SignedDSIGN Ed25519DSIGN b)
-> (XSignature -> SigDSIGN Ed25519DSIGN)
-> XSignature
-> SignedDSIGN Ed25519DSIGN b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. SigDSIGN Ed25519DSIGN
-> Maybe (SigDSIGN Ed25519DSIGN) -> SigDSIGN Ed25519DSIGN
forall a. a -> Maybe a -> a
fromMaybe SigDSIGN Ed25519DSIGN
forall a. a
impossible
(Maybe (SigDSIGN Ed25519DSIGN) -> SigDSIGN Ed25519DSIGN)
-> (XSignature -> Maybe (SigDSIGN Ed25519DSIGN))
-> XSignature
-> SigDSIGN Ed25519DSIGN
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ByteString -> Maybe (SigDSIGN Ed25519DSIGN)
forall v. DSIGNAlgorithm v => ByteString -> Maybe (SigDSIGN v)
Crypto.rawDeserialiseSigDSIGN
(ByteString -> Maybe (SigDSIGN Ed25519DSIGN))
-> (XSignature -> ByteString)
-> XSignature
-> Maybe (SigDSIGN Ed25519DSIGN)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XSignature -> ByteString
Crypto.HD.unXSignature
impossible :: a
impossible =
String -> a
forall a. HasCallStack => String -> a
error String
"makeShelleyKeyWitnessSignature: byron and shelley signature sizes do not match"
signByronTransaction :: NetworkId
-> TxBody ByronEra
-> [SigningKey ByronKey]
-> Tx ByronEra
signByronTransaction :: NetworkId
-> TxBody ByronEra -> [SigningKey ByronKey] -> Tx ByronEra
signByronTransaction NetworkId
nw TxBody ByronEra
txbody [SigningKey ByronKey]
sks =
[KeyWitness ByronEra] -> TxBody ByronEra -> Tx ByronEra
forall era. [KeyWitness era] -> TxBody era -> Tx era
makeSignedTransaction [KeyWitness ByronEra]
witnesses TxBody ByronEra
txbody
where
witnesses :: [KeyWitness ByronEra]
witnesses = (SigningKey ByronKey -> KeyWitness ByronEra)
-> [SigningKey ByronKey] -> [KeyWitness ByronEra]
forall a b. (a -> b) -> [a] -> [b]
map (NetworkId
-> TxBody ByronEra -> SigningKey ByronKey -> KeyWitness ByronEra
forall key.
IsByronKey key =>
NetworkId
-> TxBody ByronEra -> SigningKey key -> KeyWitness ByronEra
makeByronKeyWitness NetworkId
nw TxBody ByronEra
txbody) [SigningKey ByronKey]
sks
signShelleyTransaction :: IsShelleyBasedEra era
=> TxBody era
-> [ShelleyWitnessSigningKey]
-> Tx era
signShelleyTransaction :: TxBody era -> [ShelleyWitnessSigningKey] -> Tx era
signShelleyTransaction TxBody era
txbody [ShelleyWitnessSigningKey]
sks =
[KeyWitness era] -> TxBody era -> Tx era
forall era. [KeyWitness era] -> TxBody era -> Tx era
makeSignedTransaction [KeyWitness era]
witnesses TxBody era
txbody
where
witnesses :: [KeyWitness era]
witnesses = (ShelleyWitnessSigningKey -> KeyWitness era)
-> [ShelleyWitnessSigningKey] -> [KeyWitness era]
forall a b. (a -> b) -> [a] -> [b]
map (TxBody era -> ShelleyWitnessSigningKey -> KeyWitness era
forall era.
IsShelleyBasedEra era =>
TxBody era -> ShelleyWitnessSigningKey -> KeyWitness era
makeShelleyKeyWitness TxBody era
txbody) [ShelleyWitnessSigningKey]
sks