{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# OPTIONS_GHC -Wno-orphans #-}

module Cardano.Ledger.Shelley.HuddleSpec (
  module Cardano.Ledger.Huddle,
  module Cardano.Ledger.Core.HuddleSpec,
  shelleyCDDL,
  shelleyProtocolVersionGroup,
  headerRule,
  proposedProtocolParameterUpdatesRule,
  updateRule,
  protocolParamUpdateRule,
  headerBodyRule,
  transactionWitnessSetRule,
  vkeywitnessRule,
  bootstrapWitnessRule,
  shelleyOperationalCertGroup,
  genesisHashRule,
  scriptPubkeyGroup,
  scriptAllGroup,
  scriptAnyGroup,
  transactionIdRule,
  transactionInputRule,
  transactionOutputRule,
  withdrawalsRule,
  dnsNameRule,
  urlRule,
  poolMetadataRule,
  singleHostAddrGroup,
  singleHostNameGroup,
  multiHostNameGroup,
  relayRule,
  poolParamsGroup,
  poolRegistrationCertGroup,
  poolRetirementCertGroup,
  genesisDelegateHashRule,
  genesisDelegationCertGroup,
  deltaCoinRule,
  moveInstantaneousRewardRule,
  moveInstantaneousRewardsCertGroup,
  accountRegistrationCertGroup,
  accountUnregistrationCertGroup,
  delegationToStakePoolCertGroup,
  certificateRule,
  untaggedSet,
) where

import Cardano.Ledger.Core.HuddleSpec (majorProtocolVersionRule)
import Cardano.Ledger.Huddle
import Cardano.Ledger.Shelley (ShelleyEra)
import Codec.CBOR.Cuddle.Comments ((//-))
import Codec.CBOR.Cuddle.Huddle
import Data.Proxy (Proxy (..))
import Data.Word (Word64)
import Text.Heredoc
import Prelude hiding ((/))

shelleyCDDL :: Huddle
shelleyCDDL :: Huddle
shelleyCDDL =
  [HuddleItem] -> Huddle
collectFrom
    [ Rule -> HuddleItem
HIRule (Rule -> HuddleItem) -> Rule -> HuddleItem
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"block" (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @ShelleyEra)
    , Rule -> HuddleItem
HIRule (Rule -> HuddleItem) -> Rule -> HuddleItem
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction" (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @ShelleyEra)
    , Rule -> HuddleItem
HIRule (Rule -> HuddleItem) -> Rule -> HuddleItem
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"signkey_kes" (forall t. Proxy t
forall {k} (t :: k). Proxy t
Proxy @ShelleyEra)
    ]

shelleyProtocolVersionGroup ::
  forall era. HuddleRule "major_protocol_version" era => Proxy era -> Named Group
shelleyProtocolVersionGroup :: forall era.
HuddleRule "major_protocol_version" era =>
Proxy era -> Named Group
shelleyProtocolVersionGroup Proxy era
p = Text
"protocol_version" Text -> Group -> Named Group
=:~ Group -> Group
grp [Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"major_protocol_version" Proxy era
p, Value Int -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value Int
VUInt]

headerRule :: forall era. HuddleRule "header_body" era => Proxy era -> Rule
headerRule :: forall era. HuddleRule "header_body" era => Proxy era -> Rule
headerRule Proxy era
p =
  Text
"header"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"header_body" Proxy era
p, Key
"body_signature" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"kes_signature" Proxy era
p]

proposedProtocolParameterUpdatesRule ::
  forall era.
  (HuddleRule "genesis_hash" era, HuddleRule "protocol_param_update" era) => Proxy era -> Rule
proposedProtocolParameterUpdatesRule :: forall era.
(HuddleRule "genesis_hash" era,
 HuddleRule "protocol_param_update" era) =>
Proxy era -> Rule
proposedProtocolParameterUpdatesRule Proxy era
p =
  Text
"proposed_protocol_parameter_updates"
    Text -> MapChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp [Word64
0 Word64 -> MapEntry -> MapEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> Key
forall r. IsType0 r => r -> Key
asKey (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"genesis_hash" Proxy era
p) Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"protocol_param_update" Proxy era
p]

updateRule ::
  forall era. HuddleRule "proposed_protocol_parameter_updates" era => Proxy era -> Rule
updateRule :: forall era.
HuddleRule "proposed_protocol_parameter_updates" era =>
Proxy era -> Rule
updateRule Proxy era
p =
  Text
"update"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"proposed_protocol_parameter_updates" Proxy era
p, Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"epoch" Proxy era
p]

protocolParamUpdateRule ::
  forall era. HuddleGroup "protocol_version" era => Proxy era -> Rule
protocolParamUpdateRule :: forall era. HuddleGroup "protocol_version" era => Proxy era -> Rule
protocolParamUpdateRule Proxy era
p =
  Text
"protocol_param_update"
    Text -> MapChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
0 Key -> Value Int -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"minfee A"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
1 Key -> Value Int -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"minfee B"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
2 Key -> Value Int -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"max block body size"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
3 Key -> Value Int -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"max transaction size"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
4 Key -> Constrained -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt Value Int -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
2 :: Word64)) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"max block header size"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
5 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"key deposit"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
6 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"pool deposit"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
7 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"epoch_interval" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"maximum epoch"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
8 Key -> Constrained -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt Value Int -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
2 :: Word64)) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"n_opt: desired number of stake pools"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
9 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"nonnegative_interval" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"pool pledge influence"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
10 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"unit_interval" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"expansion rate"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
11 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"unit_interval" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"treasury growth rate"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
12 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"unit_interval" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"decentralization constant"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
13 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"nonce" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"extra entropy"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
14 Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"protocol_version" Proxy era
p]) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"protocol version"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
15 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"min utxo value"
      , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
16 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p) MapEntry -> Comment -> MapEntry
forall a. HasComment a => a -> Comment -> a
//- Comment
"min pool cost"
      ]

headerBodyRule ::
  forall era.
  ( HuddleGroup "operational_cert" era
  , HuddleGroup "protocol_version" era
  ) =>
  Proxy era ->
  Rule
headerBodyRule :: forall era.
(HuddleGroup "operational_cert" era,
 HuddleGroup "protocol_version" era) =>
Proxy era -> Rule
headerBodyRule Proxy era
p =
  Text
"header_body"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"block_number" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"block_number" Proxy era
p
      , Key
"slot" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"slot" Proxy era
p
      , Key
"prev_hash" Key -> Choice Type2 -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"hash32" Proxy era
p Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Key
"issuer_vkey" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vkey" Proxy era
p
      , Key
"vrf_vkey" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vrf_vkey" Proxy era
p
      , Key
"nonce_vrf" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vrf_cert" Proxy era
p
      , Key
"leader_vrf" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vrf_cert" Proxy era
p
      , Key
"block_body_size" Key -> Constrained -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt Value Int -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
4 :: Word64)
      , Key
"block_body_hash" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"hash32" Proxy era
p
      , Named Group -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"operational_cert" Proxy era
p)
      , Named Group -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"protocol_version" Proxy era
p)
      ]

transactionWitnessSetRule ::
  forall era.
  ( HuddleRule "vkeywitness" era
  , HuddleRule "native_script" era
  , HuddleRule "bootstrap_witness" era
  ) =>
  Proxy era ->
  Rule
transactionWitnessSetRule :: forall era.
(HuddleRule "vkeywitness" era, HuddleRule "native_script" era,
 HuddleRule "bootstrap_witness" era) =>
Proxy era -> Rule
transactionWitnessSetRule Proxy era
p =
  Text
"transaction_witness_set"
    Text -> MapChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
      [ Item MapChoice -> Item MapChoice
forall a. CanQuantify a => a -> a
opt (Item MapChoice -> Item MapChoice)
-> Item MapChoice -> Item MapChoice
forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
0 Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vkeywitness" Proxy era
p)]
      , Item MapChoice -> Item MapChoice
forall a. CanQuantify a => a -> a
opt (Item MapChoice -> Item MapChoice)
-> Item MapChoice -> Item MapChoice
forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
1 Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"native_script" Proxy era
p)]
      , Item MapChoice -> Item MapChoice
forall a. CanQuantify a => a -> a
opt (Item MapChoice -> Item MapChoice)
-> Item MapChoice -> Item MapChoice
forall a b. (a -> b) -> a -> b
$ Word64 -> Key
idx Word64
2 Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"bootstrap_witness" Proxy era
p)]
      ]

vkeywitnessRule :: forall era. Era era => Proxy era -> Rule
vkeywitnessRule :: forall era. Era era => Proxy era -> Rule
vkeywitnessRule Proxy era
p =
  Text
"vkeywitness"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vkey" Proxy era
p, Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"signature" Proxy era
p]

bootstrapWitnessRule :: forall era. Era era => Proxy era -> Rule
bootstrapWitnessRule :: forall era. Era era => Proxy era -> Rule
bootstrapWitnessRule Proxy era
p =
  Text
"bootstrap_witness"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"public_key" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vkey" Proxy era
p
      , Key
"signature" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"signature" Proxy era
p
      , Key
"chain_code" Key -> Constrained -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
32 :: Word64)
      , Key
"attributes" Key -> Value ByteString -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value ByteString
VBytes
      ]

shelleyOperationalCertGroup :: forall era. Era era => Proxy era -> Named Group
shelleyOperationalCertGroup :: forall era. Era era => Proxy era -> Named Group
shelleyOperationalCertGroup Proxy era
p =
  Text
"operational_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Key
"hot_vkey" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"kes_vkey" Proxy era
p
      , Key
"sequence_number" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"sequence_number" Proxy era
p
      , Key
"kes_period" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"kes_period" Proxy era
p
      , Key
"sigma" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"signature" Proxy era
p
      ]

genesisHashRule :: forall era. Era era => Proxy era -> Rule
genesisHashRule :: forall era. Era era => Proxy era -> Rule
genesisHashRule Proxy era
p = Text
"genesis_hash" Text -> Rule -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"hash28" Proxy era
p

scriptPubkeyGroup :: forall era. Era era => Proxy era -> Named Group
scriptPubkeyGroup :: forall era. Era era => Proxy era -> Named Group
scriptPubkeyGroup Proxy era
p = Text
"script_pubkey" Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
0, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"addr_keyhash" Proxy era
p]

scriptAllGroup :: forall era. HuddleRule "native_script" era => Proxy era -> Named Group
scriptAllGroup :: forall era.
HuddleRule "native_script" era =>
Proxy era -> Named Group
scriptAllGroup Proxy era
p = Text
"script_all" Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
1, ArrayChoice -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> Item Group) -> ArrayChoice -> Item Group
forall a b. (a -> b) -> a -> b
$ ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"native_script" Proxy era
p)]]

scriptAnyGroup :: forall era. HuddleRule "native_script" era => Proxy era -> Named Group
scriptAnyGroup :: forall era.
HuddleRule "native_script" era =>
Proxy era -> Named Group
scriptAnyGroup Proxy era
p = Text
"script_any" Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
2, ArrayChoice -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> Item Group) -> ArrayChoice -> Item Group
forall a b. (a -> b) -> a -> b
$ ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"native_script" Proxy era
p)]]

transactionIdRule :: forall era. Era era => Proxy era -> Rule
transactionIdRule :: forall era. Era era => Proxy era -> Rule
transactionIdRule Proxy era
p = Text
"transaction_id" Text -> Rule -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"hash32" Proxy era
p

transactionInputRule :: forall era. HuddleRule "transaction_id" era => Proxy era -> Rule
transactionInputRule :: forall era. HuddleRule "transaction_id" era => Proxy era -> Rule
transactionInputRule Proxy era
p =
  Text
"transaction_input"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Key
"id" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_id" Proxy era
p
      , Key
"index" Key -> Constrained -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt Value Int -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
2 :: Word64)
      ]

transactionOutputRule :: forall era. Era era => Proxy era -> Rule
transactionOutputRule :: forall era. Era era => Proxy era -> Rule
transactionOutputRule Proxy era
p =
  Text
"transaction_output"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"address" Proxy era
p, Key
"amount" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p]

withdrawalsRule :: forall era. Era era => Proxy era -> Rule
withdrawalsRule :: forall era. Era era => Proxy era -> Rule
withdrawalsRule Proxy era
p =
  Text
"withdrawals"
    Text -> MapChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp [Word64
0 Word64 -> MapEntry -> MapEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> Key
forall r. IsType0 r => r -> Key
asKey (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"reward_account" Proxy era
p) Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p]

dnsNameRule :: Rule
dnsNameRule :: Rule
dnsNameRule = Text
"dns_name" Text -> Constrained -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= Value Text
VText Value Text -> (Word64, Word64) -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
64 :: Word64)

urlRule :: Rule
urlRule :: Rule
urlRule = Text
"url" Text -> Constrained -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= Value Text
VText Value Text -> (Word64, Word64) -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
64 :: Word64)

poolMetadataRule :: forall era. HuddleRule "url" era => Proxy era -> Rule
poolMetadataRule :: forall era. HuddleRule "url" era => Proxy era -> Rule
poolMetadataRule Proxy era
p =
  Text
"pool_metadata"
    Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"url" Proxy era
p, Value ByteString -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value ByteString
VBytes]

singleHostAddrGroup :: forall era. Era era => Proxy era -> Named Group
singleHostAddrGroup :: forall era. Era era => Proxy era -> Named Group
singleHostAddrGroup Proxy era
p =
  Text
"single_host_addr"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Item Group
ArrayEntry
0
      , Choice Type2 -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Choice Type2 -> Item Group) -> Choice Type2 -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"port" Proxy era
p Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Choice Type2 -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Choice Type2 -> Item Group) -> Choice Type2 -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"ipv4" Proxy era
p Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      , Choice Type2 -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Choice Type2 -> Item Group) -> Choice Type2 -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"ipv6" Proxy era
p Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
      ]

singleHostNameGroup :: forall era. HuddleRule "dns_name" era => Proxy era -> Named Group
singleHostNameGroup :: forall era. HuddleRule "dns_name" era => Proxy era -> Named Group
singleHostNameGroup Proxy era
p =
  Text -> Named Group -> Named Group
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
    Text
"dns_name: An A or AAAA DNS record"
    (Named Group -> Named Group) -> Named Group -> Named Group
forall a b. (a -> b) -> a -> b
$ Text
"single_host_name"
      Text -> Group -> Named Group
=:~ Group -> Group
grp
        [ Item Group
ArrayEntry
1
        , Choice Type2 -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Choice Type2 -> Item Group) -> Choice Type2 -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"port" Proxy era
p Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
        , Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"dns_name" Proxy era
p
        ]

multiHostNameGroup :: forall era. HuddleRule "dns_name" era => Proxy era -> Named Group
multiHostNameGroup :: forall era. HuddleRule "dns_name" era => Proxy era -> Named Group
multiHostNameGroup Proxy era
p =
  Text -> Named Group -> Named Group
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
    Text
"dns_name: An SRV DNS record"
    (Named Group -> Named Group) -> Named Group -> Named Group
forall a b. (a -> b) -> a -> b
$ Text
"multi_host_name"
      Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
2, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"dns_name" Proxy era
p]

relayRule ::
  forall era.
  ( HuddleGroup "single_host_addr" era
  , HuddleGroup "single_host_name" era
  , HuddleGroup "multi_host_name" era
  ) =>
  Proxy era ->
  Rule
relayRule :: forall era.
(HuddleGroup "single_host_addr" era,
 HuddleGroup "single_host_name" era,
 HuddleGroup "multi_host_name" era) =>
Proxy era -> Rule
relayRule Proxy era
p =
  Text
"relay"
    Text -> Choice ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"single_host_addr" Proxy era
p]
    ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"single_host_name" Proxy era
p]
    Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"multi_host_name" Proxy era
p]

poolParamsGroup ::
  forall era.
  ( HuddleRule "relay" era
  , HuddleRule "pool_metadata" era
  ) =>
  Proxy era ->
  Named Group
poolParamsGroup :: forall era.
(HuddleRule "relay" era, HuddleRule "pool_metadata" era) =>
Proxy era -> Named Group
poolParamsGroup Proxy era
p =
  Text -> Named Group -> Named Group
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
    Text
"Pool parameters for stake pool registration"
    (Named Group -> Named Group) -> Named Group -> Named Group
forall a b. (a -> b) -> a -> b
$ Text
"pool_params"
      Text -> Group -> Named Group
=:~ Group -> Group
grp
        [ Key
"operator" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"pool_keyhash" Proxy era
p
        , Key
"vrf_keyhash" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vrf_keyhash" Proxy era
p
        , Key
"pledge" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p
        , Key
"cost" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p
        , Key
"margin" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"unit_interval" Proxy era
p
        , Key
"reward_account" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"reward_account" Proxy era
p
        , Key
"pool_owners" Key -> GRuleCall -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule -> GRuleCall
forall a. IsType0 a => a -> GRuleCall
untaggedSet (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"addr_keyhash" Proxy era
p)
        , Key
"relays" Key -> ArrayChoice -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"relay" Proxy era
p)]
        , Key
"pool_metadata" Key -> Choice Type2 -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"pool_metadata" Proxy era
p Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
        ]

poolRegistrationCertGroup :: forall era. HuddleGroup "pool_params" era => Proxy era -> Named Group
poolRegistrationCertGroup :: forall era.
HuddleGroup "pool_params" era =>
Proxy era -> Named Group
poolRegistrationCertGroup Proxy era
p = Text
"pool_registration_cert" Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
3, Named Group -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item Group) -> Named Group -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"pool_params" Proxy era
p]

poolRetirementCertGroup :: forall era. Era era => Proxy era -> Named Group
poolRetirementCertGroup :: forall era. Era era => Proxy era -> Named Group
poolRetirementCertGroup Proxy era
p =
  Text
"pool_retirement_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
4, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"pool_keyhash" Proxy era
p, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"epoch" Proxy era
p]

genesisDelegateHashRule :: forall era. Era era => Proxy era -> Rule
genesisDelegateHashRule :: forall era. Era era => Proxy era -> Rule
genesisDelegateHashRule Proxy era
p = Text
"genesis_delegate_hash" Text -> Rule -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"hash28" Proxy era
p

genesisDelegationCertGroup ::
  forall era.
  ( HuddleRule "genesis_hash" era
  , HuddleRule "genesis_delegate_hash" era
  ) =>
  Proxy era ->
  Named Group
genesisDelegationCertGroup :: forall era.
(HuddleRule "genesis_hash" era,
 HuddleRule "genesis_delegate_hash" era) =>
Proxy era -> Named Group
genesisDelegationCertGroup Proxy era
p =
  Text
"genesis_delegation_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp
      [ Item Group
ArrayEntry
5
      , Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"genesis_hash" Proxy era
p
      , Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"genesis_delegate_hash" Proxy era
p
      , Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"vrf_keyhash" Proxy era
p
      ]

deltaCoinRule :: Rule
deltaCoinRule :: Rule
deltaCoinRule =
  Text -> Rule -> Rule
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
    Text
"This too has been introduced in Shelley as a backport from Alonzo."
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Text
"delta_coin" Text -> Value Int -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= Value Int
VInt

moveInstantaneousRewardRule :: forall era. HuddleRule "delta_coin" era => Proxy era -> Rule
moveInstantaneousRewardRule :: forall era. HuddleRule "delta_coin" era => Proxy era -> Rule
moveInstantaneousRewardRule Proxy era
p =
  Text -> Rule -> Rule
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
    Text
[str|The first field determines where the funds are drawn from.
        |  0 denotes the reserves,
        |  1 denotes the treasury.
        |If the second field is a map, funds are moved to stake credentials.
        |Otherwise, the funds are given to the other accounting pot.
        |NOTE:
        |  This has been safely backported to Shelley from Alonzo.
        |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Text
"move_instantaneous_reward"
      Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
        [ Choice Type2 -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Integer -> Literal
int Integer
0 Literal -> Literal -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Integer -> Literal
int Integer
1)
        , Choice Type2 -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a
            ( MapChoice -> Seal Map
smp
                [Word64
0 Word64 -> MapEntry -> MapEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> Key
forall r. IsType0 r => r -> Key
asKey (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"stake_credential" Proxy era
p) Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"delta_coin" Proxy era
p]
                Seal Map -> Rule -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy era
p
            )
        ]

moveInstantaneousRewardsCertGroup ::
  forall era. HuddleRule "move_instantaneous_reward" era => Proxy era -> Named Group
moveInstantaneousRewardsCertGroup :: forall era.
HuddleRule "move_instantaneous_reward" era =>
Proxy era -> Named Group
moveInstantaneousRewardsCertGroup Proxy era
p =
  Text
"move_instantaneous_rewards_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
6, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"move_instantaneous_reward" Proxy era
p]

accountRegistrationCertGroup :: forall era. Era era => Proxy era -> Named Group
accountRegistrationCertGroup :: forall era. Era era => Proxy era -> Named Group
accountRegistrationCertGroup Proxy era
p =
  Text -> Named Group -> Named Group
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
    Text
"This certificate will be deprecated in a future era"
    (Named Group -> Named Group) -> Named Group -> Named Group
forall a b. (a -> b) -> a -> b
$ Text
"account_registration_cert"
      Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
0, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"stake_credential" Proxy era
p]

accountUnregistrationCertGroup :: forall era. Era era => Proxy era -> Named Group
accountUnregistrationCertGroup :: forall era. Era era => Proxy era -> Named Group
accountUnregistrationCertGroup Proxy era
p =
  Text -> Named Group -> Named Group
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
    Text
"This certificate will be deprecated in a future era"
    (Named Group -> Named Group) -> Named Group -> Named Group
forall a b. (a -> b) -> a -> b
$ Text
"account_unregistration_cert"
      Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
1, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"stake_credential" Proxy era
p]

delegationToStakePoolCertGroup :: forall era. Era era => Proxy era -> Named Group
delegationToStakePoolCertGroup :: forall era. Era era => Proxy era -> Named Group
delegationToStakePoolCertGroup Proxy era
p =
  Text
"delegation_to_stake_pool_cert"
    Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
2, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"stake_credential" Proxy era
p, Rule -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item Group) -> Rule -> Item Group
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"pool_keyhash" Proxy era
p]

certificateRule ::
  forall era.
  ( HuddleGroup "account_registration_cert" era
  , HuddleGroup "account_unregistration_cert" era
  , HuddleGroup "delegation_to_stake_pool_cert" era
  , HuddleGroup "pool_registration_cert" era
  , HuddleGroup "pool_retirement_cert" era
  , HuddleGroup "genesis_delegation_cert" era
  , HuddleGroup "move_instantaneous_rewards_cert" era
  ) =>
  Proxy era ->
  Rule
certificateRule :: forall era.
(HuddleGroup "account_registration_cert" era,
 HuddleGroup "account_unregistration_cert" era,
 HuddleGroup "delegation_to_stake_pool_cert" era,
 HuddleGroup "pool_registration_cert" era,
 HuddleGroup "pool_retirement_cert" era,
 HuddleGroup "genesis_delegation_cert" era,
 HuddleGroup "move_instantaneous_rewards_cert" era) =>
Proxy era -> Rule
certificateRule Proxy era
p =
  Text
"certificate"
    Text -> Choice ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"account_registration_cert" Proxy era
p]
    ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"account_unregistration_cert" Proxy era
p]
    Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"delegation_to_stake_pool_cert" Proxy era
p]
    Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"pool_registration_cert" Proxy era
p]
    Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"pool_retirement_cert" Proxy era
p]
    Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"genesis_delegation_cert" Proxy era
p]
    Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"move_instantaneous_rewards_cert" Proxy era
p]

untaggedSet :: IsType0 a => a -> GRuleCall
untaggedSet :: forall a. IsType0 a => a -> GRuleCall
untaggedSet = (GRef -> Rule) -> a -> GRuleCall
forall t0. IsType0 t0 => (GRef -> Rule) -> t0 -> GRuleCall
binding ((GRef -> Rule) -> a -> GRuleCall)
-> (GRef -> Rule) -> a -> GRuleCall
forall a b. (a -> b) -> a -> b
$ \GRef
x -> Text
"set" Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ GRef -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a GRef
x]

instance HuddleRule "dns_name" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule Proxy ShelleyEra
_ = Rule
dnsNameRule

instance HuddleRule "url" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule Proxy ShelleyEra
_ = Rule
urlRule

instance HuddleRule "pool_metadata" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. HuddleRule "url" era => Proxy era -> Rule
poolMetadataRule @ShelleyEra

instance HuddleGroup "single_host_addr" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. Era era => Proxy era -> Named Group
singleHostAddrGroup @ShelleyEra

instance HuddleGroup "single_host_name" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. HuddleRule "dns_name" era => Proxy era -> Named Group
singleHostNameGroup @ShelleyEra

instance HuddleGroup "multi_host_name" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. HuddleRule "dns_name" era => Proxy era -> Named Group
multiHostNameGroup @ShelleyEra

instance HuddleRule "relay" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era.
(HuddleGroup "single_host_addr" era,
 HuddleGroup "single_host_name" era,
 HuddleGroup "multi_host_name" era) =>
Proxy era -> Rule
relayRule @ShelleyEra

instance HuddleGroup "pool_params" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era.
(HuddleRule "relay" era, HuddleRule "pool_metadata" era) =>
Proxy era -> Named Group
poolParamsGroup @ShelleyEra

instance HuddleGroup "pool_registration_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era.
HuddleGroup "pool_params" era =>
Proxy era -> Named Group
poolRegistrationCertGroup @ShelleyEra

instance HuddleGroup "pool_retirement_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. Era era => Proxy era -> Named Group
poolRetirementCertGroup @ShelleyEra

instance HuddleRule "genesis_hash" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
genesisHashRule @ShelleyEra

instance HuddleRule "genesis_delegate_hash" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
genesisDelegateHashRule @ShelleyEra

instance HuddleGroup "genesis_delegation_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era.
(HuddleRule "genesis_hash" era,
 HuddleRule "genesis_delegate_hash" era) =>
Proxy era -> Named Group
genesisDelegationCertGroup @ShelleyEra

instance HuddleRule "delta_coin" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule Proxy ShelleyEra
_ = Rule
deltaCoinRule

instance HuddleRule "move_instantaneous_reward" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. HuddleRule "delta_coin" era => Proxy era -> Rule
moveInstantaneousRewardRule @ShelleyEra

instance HuddleGroup "move_instantaneous_rewards_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era.
HuddleRule "move_instantaneous_reward" era =>
Proxy era -> Named Group
moveInstantaneousRewardsCertGroup @ShelleyEra

instance HuddleGroup "account_registration_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. Era era => Proxy era -> Named Group
accountRegistrationCertGroup @ShelleyEra

instance HuddleGroup "account_unregistration_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. Era era => Proxy era -> Named Group
accountUnregistrationCertGroup @ShelleyEra

instance HuddleGroup "delegation_to_stake_pool_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. Era era => Proxy era -> Named Group
delegationToStakePoolCertGroup @ShelleyEra

instance HuddleRule "certificate" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era.
(HuddleGroup "account_registration_cert" era,
 HuddleGroup "account_unregistration_cert" era,
 HuddleGroup "delegation_to_stake_pool_cert" era,
 HuddleGroup "pool_registration_cert" era,
 HuddleGroup "pool_retirement_cert" era,
 HuddleGroup "genesis_delegation_cert" era,
 HuddleGroup "move_instantaneous_rewards_cert" era) =>
Proxy era -> Rule
certificateRule @ShelleyEra

instance HuddleRule "withdrawals" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
withdrawalsRule @ShelleyEra

instance HuddleRule "major_protocol_version" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
majorProtocolVersionRule @ShelleyEra

instance HuddleGroup "protocol_version" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era.
HuddleRule "major_protocol_version" era =>
Proxy era -> Named Group
shelleyProtocolVersionGroup @ShelleyEra

instance HuddleRule "protocol_param_update" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. HuddleGroup "protocol_version" era => Proxy era -> Rule
protocolParamUpdateRule @ShelleyEra

instance HuddleRule "proposed_protocol_parameter_updates" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era.
(HuddleRule "genesis_hash" era,
 HuddleRule "protocol_param_update" era) =>
Proxy era -> Rule
proposedProtocolParameterUpdatesRule @ShelleyEra

instance HuddleRule "update" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era.
HuddleRule "proposed_protocol_parameter_updates" era =>
Proxy era -> Rule
updateRule @ShelleyEra

instance HuddleGroup "operational_cert" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. Era era => Proxy era -> Named Group
shelleyOperationalCertGroup @ShelleyEra

instance HuddleRule "header_body" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era.
(HuddleGroup "operational_cert" era,
 HuddleGroup "protocol_version" era) =>
Proxy era -> Rule
headerBodyRule @ShelleyEra

instance HuddleRule "header" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. HuddleRule "header_body" era => Proxy era -> Rule
headerRule @ShelleyEra

instance HuddleRule "transaction_id" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
transactionIdRule @ShelleyEra

instance HuddleRule "transaction_input" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. HuddleRule "transaction_id" era => Proxy era -> Rule
transactionInputRule @ShelleyEra

instance HuddleRule "transaction_output" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
transactionOutputRule @ShelleyEra

instance HuddleGroup "script_pubkey" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era. Era era => Proxy era -> Named Group
scriptPubkeyGroup @ShelleyEra

instance HuddleGroup "script_all" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era.
HuddleRule "native_script" era =>
Proxy era -> Named Group
scriptAllGroup @ShelleyEra

instance HuddleGroup "script_any" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup = forall era.
HuddleRule "native_script" era =>
Proxy era -> Named Group
scriptAnyGroup @ShelleyEra

instance HuddleGroup "script_n_of_k" ShelleyEra where
  huddleGroup :: Proxy ShelleyEra -> Named Group
huddleGroup Proxy ShelleyEra
p =
    Text
"script_n_of_k"
      Text -> Group -> Named Group
=:~ Group -> Group
grp [Item Group
ArrayEntry
3, Key
"n" Key -> Value Int -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value Int
VUInt, ArrayChoice -> Item Group
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (ArrayChoice -> Item Group) -> ArrayChoice -> Item Group
forall a b. (a -> b) -> a -> b
$ ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"native_script" Proxy ShelleyEra
p)]]

instance HuddleRule "native_script" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule Proxy ShelleyEra
p =
    Text -> Rule -> Rule
forall a. HasField' "description" a (Maybe Text) => Text -> a -> a
comment
      Text
[str|Native scripts support 4 operations:
          |  - Signature verification (script_pubkey)
          |  - Conjunctions (script_all)
          |  - Disjunctions (script_any)
          |  - M-of-N thresholds (script_n_of_k)
          |
          |Note: Shelley uses VUInt for the threshold in script_n_of_k.
          |]
      (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Text
"native_script"
        Text -> Choice ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"script_pubkey" Proxy ShelleyEra
p]
        ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"script_all" Proxy ShelleyEra
p]
        Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"script_any" Proxy ShelleyEra
p]
        Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Named Group -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Named Group -> Item ArrayChoice)
-> Named Group -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleGroup name era =>
Proxy era -> Named Group
huddleGroup @"script_n_of_k" Proxy ShelleyEra
p]

instance HuddleRule "vkeywitness" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
vkeywitnessRule @ShelleyEra

instance HuddleRule "bootstrap_witness" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era. Era era => Proxy era -> Rule
bootstrapWitnessRule @ShelleyEra

instance HuddleRule "transaction_witness_set" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule = forall era.
(HuddleRule "vkeywitness" era, HuddleRule "native_script" era,
 HuddleRule "bootstrap_witness" era) =>
Proxy era -> Rule
transactionWitnessSetRule @ShelleyEra

instance HuddleRule "transaction_body" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule Proxy ShelleyEra
p =
    Text
"transaction_body"
      Text -> MapChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= MapChoice -> MapChoice
mp
        [ Word64 -> Key
idx Word64
0 Key -> GRuleCall -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule -> GRuleCall
forall a. IsType0 a => a -> GRuleCall
untaggedSet (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_input" Proxy ShelleyEra
p)
        , Word64 -> Key
idx Word64
1 Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_output" Proxy ShelleyEra
p)]
        , Word64 -> Key
idx Word64
2 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"coin" Proxy ShelleyEra
p
        , Word64 -> Key
idx Word64
3 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"slot" Proxy ShelleyEra
p
        , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
4 Key -> ArrayChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"certificate" Proxy ShelleyEra
p)])
        , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
5 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"withdrawals" Proxy ShelleyEra
p)
        , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
6 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"update" Proxy ShelleyEra
p)
        , MapEntry -> MapEntry
forall a. CanQuantify a => a -> a
opt (Word64 -> Key
idx Word64
7 Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"auxiliary_data_hash" Proxy ShelleyEra
p)
        ]

instance HuddleRule "transaction" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule Proxy ShelleyEra
p =
    Text
"transaction"
      Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
        [ Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_body" Proxy ShelleyEra
p
        , Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_witness_set" Proxy ShelleyEra
p
        , Choice Type2 -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Choice Type2 -> Item ArrayChoice)
-> Choice Type2 -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"metadata" Proxy ShelleyEra
p Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil
        ]

instance HuddleRule "block" ShelleyEra where
  huddleRule :: Proxy ShelleyEra -> Rule
huddleRule Proxy ShelleyEra
p =
    Text
"block"
      Text -> ArrayChoice -> Rule
forall a. IsType0 a => Text -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
        [ Rule -> Item ArrayChoice
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> Item ArrayChoice) -> Rule -> Item ArrayChoice
forall a b. (a -> b) -> a -> b
$ forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"header" Proxy ShelleyEra
p
        , Key
"transaction_bodies" Key -> ArrayChoice -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_body" Proxy ShelleyEra
p)]
        , Key
"transaction_witness_sets" Key -> ArrayChoice -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> ArrayChoice -> ArrayChoice
arr [Word64
0 Word64 -> ArrayEntry -> ArrayEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_witness_set" Proxy ShelleyEra
p)]
        , Key
"transaction_metadata_set"
            Key -> MapChoice -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> MapChoice -> MapChoice
mp
              [ Word64
0 Word64 -> MapEntry -> MapEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> Key
forall r. IsType0 r => r -> Key
asKey (forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"transaction_index" Proxy ShelleyEra
p) Key -> Rule -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> forall (name :: Symbol) era.
HuddleRule name era =>
Proxy era -> Rule
huddleRule @"metadata" Proxy ShelleyEra
p
              ]
        ]