View on GitHub
File Changes
    , toEpochSlots
    , toPoint
    , toSlotNo
+
    , toGenTx

                      
    , fromByronBlock
    , fromTxAux

                      
import Prelude

                      
+
import GHC.Stack
+
    ( HasCallStack )
import Cardano.Binary
    ( serialize' )
import Cardano.Chain.Block
import Data.Word
    ( Word16, Word32 )
import Ouroboros.Consensus.Ledger.Byron
-
    ( ByronBlock (..), ByronHash (..) )
+
    ( ByronBlock (..), ByronHash (..), GenTx (..), decodeByronGenTx )
import Ouroboros.Network.Block
    ( BlockNo (..)
    , ChainHash (..)
    ( NodeToClientVersionData (..), nodeToClientCodecCBORTerm )
import Ouroboros.Network.Point
    ( WithOrigin (..) )
+
import Cardano.Wallet.Unsafe
+
    ( unsafeFromHex, unsafeDeserialiseCbor )

                      
+
import qualified Data.ByteString.Lazy as BL
import qualified Cardano.Chain.Genesis as Genesis
import qualified Crypto.Hash as Crypto
import qualified Data.ByteArray as BA
import qualified Ouroboros.Network.Block as O
import qualified Ouroboros.Network.Point as Point

                      
-
import Cardano.Wallet.Unsafe
-
    ( unsafeFromHex )
-

                      
import qualified Cardano.Wallet.Primitive.Types as W

                      
data Byron
toSlotNo =
    SlotNo . W.flatSlot byronEpochLength

                      
+
-- | SealedTx are the result of rightfully constructed byron transactions so, it
+
-- is relatively safe to unserialize them from CBOR.
+
toGenTx :: HasCallStack => W.SealedTx -> GenTx ByronBlock
+
toGenTx =
+
    unsafeDeserialiseCbor decodeByronGenTx . BL.fromStrict . W.getSealedTx
+

                      
fromByronBlock :: W.Hash "Genesis" -> ByronBlock -> W.Block
fromByronBlock genesisHash byronBlk = case byronBlockRaw byronBlk of
  ABOBBlock blk  ->