From a7591dc0b9f2227aa5dca35c7650c1f75b676312 Mon Sep 17 00:00:00 2001 From: Daniel Firth Date: Sun, 8 Dec 2024 15:01:17 +0000 Subject: [PATCH] Remove unused Hydra.Cardano.Api.KeyWitness --- hydra-cardano-api/hydra-cardano-api.cabal | 1 - hydra-cardano-api/src/Hydra/Cardano/Api.hs | 1 - .../src/Hydra/Cardano/Api/KeyWitness.hs | 74 ------------------- 3 files changed, 76 deletions(-) delete mode 100644 hydra-cardano-api/src/Hydra/Cardano/Api/KeyWitness.hs diff --git a/hydra-cardano-api/hydra-cardano-api.cabal b/hydra-cardano-api/hydra-cardano-api.cabal index 4ea8d2e0929..1d567e4abe5 100644 --- a/hydra-cardano-api/hydra-cardano-api.cabal +++ b/hydra-cardano-api/hydra-cardano-api.cabal @@ -50,7 +50,6 @@ library Hydra.Cardano.Api.CtxUTxO Hydra.Cardano.Api.ExecutionUnits Hydra.Cardano.Api.Hash - Hydra.Cardano.Api.KeyWitness Hydra.Cardano.Api.Network Hydra.Cardano.Api.NetworkId Hydra.Cardano.Api.PlutusScript diff --git a/hydra-cardano-api/src/Hydra/Cardano/Api.hs b/hydra-cardano-api/src/Hydra/Cardano/Api.hs index 3311853452b..f2f3d32e8de 100644 --- a/hydra-cardano-api/src/Hydra/Cardano/Api.hs +++ b/hydra-cardano-api/src/Hydra/Cardano/Api.hs @@ -130,7 +130,6 @@ import Hydra.Cardano.Api.CtxTx as Extras import Hydra.Cardano.Api.CtxUTxO as Extras import Hydra.Cardano.Api.ExecutionUnits as Extras import Hydra.Cardano.Api.Hash as Extras -import Hydra.Cardano.Api.KeyWitness as Extras import Hydra.Cardano.Api.NetworkId () import Hydra.Cardano.Api.PlutusScript as Extras import Hydra.Cardano.Api.PolicyId as Extras diff --git a/hydra-cardano-api/src/Hydra/Cardano/Api/KeyWitness.hs b/hydra-cardano-api/src/Hydra/Cardano/Api/KeyWitness.hs deleted file mode 100644 index f97b96a7b10..00000000000 --- a/hydra-cardano-api/src/Hydra/Cardano/Api/KeyWitness.hs +++ /dev/null @@ -1,74 +0,0 @@ -module Hydra.Cardano.Api.KeyWitness where - -import Hydra.Cardano.Api.Prelude - -import Cardano.Ledger.Alonzo.TxWits qualified as Ledger -import Cardano.Ledger.Era qualified as Ledger -import Cardano.Ledger.Keys qualified as Ledger -import Data.Set qualified as Set - --- * Extras - --- | Construct a 'KeyWitness' from a transaction id and credentials. -signWith :: - forall era. - IsShelleyBasedEra era => - TxId -> - SigningKey PaymentKey -> - KeyWitness era -signWith (TxId h) signingKey@(PaymentSigningKey sk) = - let (PaymentVerificationKey vk) = getVerificationKey signingKey - in ShelleyKeyWitness (shelleyBasedEra @era) $ - Ledger.WitVKey - (Ledger.asWitness vk) - (Ledger.signedDSIGN @StandardCrypto sk h) - --- * Type Conversions - --- | Convert a 'List' of cardano-api's 'KeyWitness' into a 'Set' of --- cardano-ledger's 'WitVKey'. --- --- NOTE: 'KeyWitness' is a bigger type than 'WitVKey' witness, this function --- does not only the type conversion but also the selection of the right --- underlying constructors. That means the size of the resulting set may be --- smaller than the size of the list (but never bigger). -toLedgerKeyWitness :: - [KeyWitness era] -> - Set (Ledger.WitVKey 'Ledger.Witness StandardCrypto) -toLedgerKeyWitness vkWits = - Set.fromList [w | ShelleyKeyWitness _ w <- vkWits] - --- | Convert a 'List' of cardano-api's 'KeyWitness' into a 'Set' of --- cardano-ledger's 'BootstrapWitness'. --- --- NOTE: See note on 'toLedgerKeyWitness'. -toLedgerBootstrapWitness :: - [KeyWitness era] -> - Set (Ledger.BootstrapWitness StandardCrypto) -toLedgerBootstrapWitness vkWits = - Set.fromList [w | ShelleyBootstrapWitness _ w <- vkWits] - --- | Convert a cardano-ledger's 'TxWitness' object into a list of cardano-api's --- 'KeyWitness'. --- --- NOTE: this only concerns key and bootstrap witnesses. Scripts and auxiliary --- data are obviously not part of the resulting list. -fromLedgerTxWitness :: - forall era. - ( IsShelleyBasedEra era - , UsesStandardCrypto era - , Ledger.Era (ShelleyLedgerEra era) - ) => - Ledger.AlonzoTxWits (ShelleyLedgerEra era) -> - [KeyWitness era] -fromLedgerTxWitness wits = - mconcat - [ Set.foldr - ((:) . ShelleyKeyWitness shelleyBasedEra) - [] - (Ledger.txwitsVKey' wits) - , Set.foldr - ((:) . ShelleyBootstrapWitness shelleyBasedEra) - [] - (Ledger.txwitsBoot' wits) - ]