module Test.Cardano.Chain.Delegation.Example (
  exampleCertificates,
) where

import Cardano.Chain.Delegation (Certificate, signCertificate)
import Cardano.Chain.Slotting (EpochNumber (..))
import Cardano.Crypto (ProtocolMagicId (..))
import Cardano.Prelude
import Data.List (zipWith4)
import Test.Cardano.Crypto.Example (exampleVerificationKeys, staticSafeSigners)

staticProtocolMagics :: [ProtocolMagicId]
staticProtocolMagics :: [ProtocolMagicId]
staticProtocolMagics = Word32 -> ProtocolMagicId
ProtocolMagicId (Word32 -> ProtocolMagicId) -> [Word32] -> [ProtocolMagicId]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Word32
0 .. Word32
5]

exampleCertificates :: [Certificate]
exampleCertificates :: [Certificate]
exampleCertificates =
  (ProtocolMagicId
 -> VerificationKey -> EpochNumber -> SafeSigner -> Certificate)
-> [ProtocolMagicId]
-> [VerificationKey]
-> [EpochNumber]
-> [SafeSigner]
-> [Certificate]
forall a b c d e.
(a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]
zipWith4
    ProtocolMagicId
-> VerificationKey -> EpochNumber -> SafeSigner -> Certificate
signCertificate
    [ProtocolMagicId]
staticProtocolMagics
    (Int -> Int -> [VerificationKey]
exampleVerificationKeys Int
1 Int
6)
    [EpochNumber]
exampleEpochIndices
    [SafeSigner]
staticSafeSigners
  where
    exampleEpochIndices :: [EpochNumber]
exampleEpochIndices = Word64 -> EpochNumber
EpochNumber (Word64 -> EpochNumber) -> [Word64] -> [EpochNumber]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [Word64
5, Word64
1, Word64
3, Word64
27, Word64
99, Word64
247]