diff --git a/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs b/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs index 5375d56b3f0..809b833b92b 100644 --- a/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs +++ b/lib/byron/src/Cardano/Wallet/Byron/Compatibility.hs @@ -126,6 +126,10 @@ import Ouroboros.Network.Block , Point (..) , SlotNo (..) , Tip (..) + , blockHash + , blockNo + , blockPrevHash + , blockSlot , genesisPoint , getLegacyTipBlockNo , getTipPoint diff --git a/lib/core/src/Ouroboros/Network/Client/Wallet.hs b/lib/core/src/Ouroboros/Network/Client/Wallet.hs index fdd219ce899..79ba9e00d35 100644 --- a/lib/core/src/Ouroboros/Network/Client/Wallet.hs +++ b/lib/core/src/Ouroboros/Network/Client/Wallet.hs @@ -77,7 +77,9 @@ import Ouroboros.Network.Block , Point (..) , Serialised (..) , Tip (..) + , blockNo , blockPoint + , blockSlot , castTip , getTipPoint , pointSlot diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs index 87e0069d363..e62ec7e356f 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Compatibility.hs @@ -90,10 +90,10 @@ import Prelude import Cardano.Address.Derivation ( XPub, xpubPublicKey ) +import Cardano.Api.Shelley.Genesis + ( ShelleyGenesis (..) ) import Cardano.Binary ( fromCBOR, serialize' ) -import Cardano.Config.Shelley.Genesis - ( ShelleyGenesis (..) ) import Cardano.Crypto.Hash.Class ( Hash (UnsafeHash), getHash ) import Cardano.Slotting.Slot diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs index c76f463954c..c17e42f0db3 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Launch.hs @@ -41,14 +41,14 @@ module Cardano.Wallet.Shelley.Launch import Prelude +import Cardano.Api.Shelley.Genesis + ( ShelleyGenesis (..) ) import Cardano.BM.Data.Severity ( Severity (..) ) import Cardano.BM.Data.Tracer ( HasPrivacyAnnotation (..), HasSeverityAnnotation (..) ) import Cardano.CLI ( optionT ) -import Cardano.Config.Shelley.Genesis - ( ShelleyGenesis (..) ) import Cardano.Launcher ( LauncherLog, ProcessHasExited (..) ) import Cardano.Launcher.Node diff --git a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs index 8b910791605..2ea0cbefa24 100644 --- a/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs +++ b/lib/shelley/src/Cardano/Wallet/Shelley/Transaction.hs @@ -94,8 +94,6 @@ import Control.Monad ( forM ) import Crypto.Error ( throwCryptoError ) -import Crypto.Hash.Utils - ( blake2b256 ) import Data.ByteString ( ByteString ) import Data.Map.Strict @@ -116,13 +114,10 @@ import Type.Reflection ( Typeable ) import qualified Cardano.Api as Cardano -import qualified Cardano.Byron.Codec.Cbor as CBOR +import qualified Cardano.Api.Typed as CardanoTyped import qualified Cardano.Crypto.Hash.Class as Hash import qualified Cardano.Crypto.Wallet as CC import qualified Cardano.Wallet.Primitive.CoinSelection as CS -import qualified Cardano.Wallet.Primitive.Types as W -import qualified Codec.CBOR.Read as CBOR -import qualified Codec.CBOR.Write as CBOR import qualified Crypto.PubKey.Ed25519 as Ed25519 import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BL @@ -332,26 +327,11 @@ _decodeSignedTx :: ByteString -> Either ErrDecodeSignedTx (Tx, SealedTx) _decodeSignedTx bytes = do - case Cardano.txSignedFromCBOR bytes of - Right (Cardano.TxSignedShelley txValid) -> + case CardanoTyped.deserialiseFromCBOR CardanoTyped.AsShelleyTx bytes of + Right (CardanoTyped.ShelleyTx txValid) -> pure $ toSealed txValid - Right (Cardano.TxSignedByron{}) -> - case CBOR.deserialiseFromBytes CBOR.decodeSignedTx (BL.fromStrict bytes) of - Left e -> - Left $ ErrDecodeSignedTxWrongPayload $ T.pack $ show e - Right (_, ((inps, outs), _)) -> Right - ( W.Tx - { W.txId = Hash - $ blake2b256 - $ CBOR.toStrictByteString - $ CBOR.encodeTx (inps, outs) - , W.resolvedInputs = (,Coin 0) <$> inps - , W.outputs = outs - } - , SealedTx bytes - ) - Left apiErr -> - Left $ ErrDecodeSignedTxWrongPayload (Cardano.renderApiError apiErr) + Left decodeErr -> + Left $ ErrDecodeSignedTxWrongPayload (T.pack $ show decodeErr) _minimumFee :: forall (n :: NetworkDiscriminant). Typeable n