{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}

module Test.Cardano.Ledger.Shelley.Address.Bootstrap (
  aliceByronAddr,
)
where

import qualified Cardano.Chain.Common as Byron
import qualified Cardano.Crypto.Signing as Byron
import qualified Cardano.Crypto.Wallet as Byron
import Data.ByteString (ByteString)
import Test.Cardano.Ledger.Shelley.Generator.ShelleyEraGen ()

aliceSigningKey :: Byron.SigningKey
aliceSigningKey :: SigningKey
aliceSigningKey = XPrv -> SigningKey
Byron.SigningKey forall a b. (a -> b) -> a -> b
$ forall passPhrase seed.
(ByteArrayAccess passPhrase, ByteArrayAccess seed) =>
seed -> passPhrase -> XPrv
Byron.generate ByteString
seed (forall a. Monoid a => a
mempty :: ByteString)
  where
    seed :: ByteString -- 32 bytes
    seed :: ByteString
seed = ByteString
"12345678901234567890123456789012"

aliceByronAddr :: Byron.Address
aliceByronAddr :: Address
aliceByronAddr = AddrSpendingData -> AddrAttributes -> Address
Byron.makeAddress AddrSpendingData
asd AddrAttributes
attrs
  where
    asd :: AddrSpendingData
asd = VerificationKey -> AddrSpendingData
Byron.VerKeyASD VerificationKey
byronVerificationKey
    attrs :: AddrAttributes
attrs =
      Maybe HDAddressPayload -> NetworkMagic -> AddrAttributes
Byron.AddrAttributes
        (forall a. a -> Maybe a
Just (ByteString -> HDAddressPayload
Byron.HDAddressPayload ByteString
"a compressed lenna.png"))
        (Word32 -> NetworkMagic
Byron.NetworkTestnet Word32
0)
    byronVerificationKey :: VerificationKey
byronVerificationKey = SigningKey -> VerificationKey
Byron.toVerification SigningKey
aliceSigningKey