{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE OverloadedLists #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}

{-# HLINT ignore "Use camelCase" #-}

-- | Common CDDL Definitions
module Cardano.Ledger.CanonicalState.Namespace.CDDL.Common where

import Codec.CBOR.Cuddle.Huddle
import Data.Function (($))
import Data.Int (Int64)
import Data.Word
import GHC.Integer (Integer)
import GHC.Real (Integral (toInteger))
-- after drop of the GHC-9.10 we can switch to Data.Bounded
import Text.Heredoc
import Prelude (Bounded (..))

--------------------------------------------------------------------------------
-- Coins and Assets
--------------------------------------------------------------------------------

coin :: Rule
coin :: Rule
coin = Name
"coin" Name -> Value Int -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value Int
VUInt

positive_coin :: Rule
positive_coin :: Rule
positive_coin =
  Name
"positive_coin"
    Name -> Ranged -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= (Integer
1 :: Integer)
    Integer -> Integer -> Ranged
forall a b. (IsRangeBound a, IsRangeBound b) => a -> b -> Ranged
... Word64 -> Integer
forall a. Integral a => a -> Integer
toInteger (forall a. Bounded a => a
maxBound @Word64)

policy_id :: Rule
policy_id :: Rule
policy_id = Name
"policy_id" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash28

asset_name :: Rule
asset_name :: Rule
asset_name = Name
"asset_name" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> (Word64, Word64) -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
32 :: Word64)

multiasset :: IsType0 a => a -> GRuleCall
multiasset :: forall a. IsType0 a => a -> GRuleCall
multiasset = (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 ->
  Name
"multiasset"
    Name -> MapChoice -> Rule
forall a. IsType0 a => Name -> 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 Rule
policy_id Key -> MapChoice -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> MapChoice -> MapChoice
mp [Word64
1 Word64 -> MapEntry -> MapEntry
forall a. CanQuantify a => Word64 -> a -> a
<+ Rule -> Key
forall r. IsType0 r => r -> Key
asKey Rule
asset_name Key -> GRef -> MapEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> GRef
x]]

value :: Rule
value :: Rule
value = Name
"value" Name -> Choice Type2 -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
coin Rule -> Seal (Choice ArrayChoice) -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> Seal (Choice ArrayChoice)
sarr [Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
coin, GRuleCall -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule -> GRuleCall
forall a. IsType0 a => a -> GRuleCall
multiasset Rule
positive_coin)]

--------------------------------------------------------------------------------
-- Slots and Blocks
--------------------------------------------------------------------------------

slot_no :: Rule
slot_no :: Rule
slot_no = Name
"slot_no" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value Int
VUInt Value Int -> Word -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word
8 :: Word)

--------------------------------------------------------------------------------
-- Address
--------------------------------------------------------------------------------

address :: Rule
address :: Rule
address = Name
"address" Name -> Value ByteString -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes

--------------------------------------------------------------------------------
-- Crypto
--------------------------------------------------------------------------------

keyhash32 :: Rule
keyhash32 :: Rule
keyhash32 = Name
"keyhash32" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash32

keyhash28 :: Rule
keyhash28 :: Rule
keyhash28 = Name
"keyhash28" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash28

hash28 :: Rule
hash28 :: Rule
hash28 = Name
"hash28" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
28 :: Word64)

hash32 :: Rule
hash32 :: Rule
hash32 = Name
"hash32" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= 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)

vkey :: Rule
vkey :: Rule
vkey = Name
"vkey" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= 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)

vrf_vkey :: Rule
vrf_vkey :: Rule
vrf_vkey = Name
"vrf_vkey" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= 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)

vrf_keyhash :: Rule
vrf_keyhash :: Rule
vrf_keyhash = Name
"vrf_keyhash" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash32

vrf_cert :: Rule
vrf_cert :: Rule
vrf_cert = Name
"vrf_cert" Name -> ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Value ByteString -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value ByteString
VBytes, Constrained -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
80 :: Word64))]

kes_vkey :: Rule
kes_vkey :: Rule
kes_vkey = Name
"kes_vkey" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= 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)

kes_signature :: Rule
kes_signature :: Rule
kes_signature = Name
"kes_signature" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
448 :: Word64)

signkeyKES :: Rule
signkeyKES :: Rule
signkeyKES = Name
"signkeyKES" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
64 :: Word64)

signature :: Rule
signature :: Rule
signature = Name
"signature" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
64 :: Word64)

-------------------------------------------------------------------------------
-- Numbers
--------------------------------------------------------------------------------

big_int :: Rule
big_int :: Rule
big_int = Name
"big_int" Name -> Choice Type2 -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value Int
VInt Value Int -> Rule -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Rule
big_uint Choice Type2 -> Rule -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Rule
big_nint

big_uint :: Rule
big_uint :: Rule
big_uint = Name
"big_uint" Name -> Tagged Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Word64 -> Rule -> Tagged Rule
forall a. Word64 -> a -> Tagged a
tag Word64
2 Rule
bounded_bytes

big_nint :: Rule
big_nint :: Rule
big_nint = Name
"big_nint" Name -> Tagged Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Word64 -> Rule -> Tagged Rule
forall a. Word64 -> a -> Tagged a
tag Word64
3 Rule
bounded_bytes

int64 :: Rule
int64 :: Rule
int64 = Name
"int64" Name -> Ranged -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Int64 -> Integer
forall a. Integral a => a -> Integer
toInteger (forall a. Bounded a => a
minBound @Int64) Integer -> Integer -> Ranged
forall a b. (IsRangeBound a, IsRangeBound b) => a -> b -> Ranged
... Int64 -> Integer
forall a. Integral a => a -> Integer
toInteger (forall a. Bounded a => a
maxBound @Int64)

word64 :: Rule
word64 :: Rule
word64 = Name
"word64" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value Int
VUInt Value Int -> Word -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word
8 :: Word)

-------------------------------------------------------------------------------
-- Utility
--------------------------------------------------------------------------------

bounded_bytes :: Rule
bounded_bytes :: Rule
bounded_bytes =
  Comment -> Rule -> Rule
forall a. HasComment a => Comment -> a -> a
comment
    Comment
[str|The real bounded_bytes does not have this limit. it instead has
        |a different limit which cannot be expressed in CDDL.
        |
        |The limit is as follows:
        | - bytes with a definite-length encoding are limited to size 0..64
        | - for bytes with an indefinite-length CBOR encoding, each chunk is
        |   limited to size 0..64
        | ( reminder: in CBOR, the indefinite-length encoding of
        | bytestrings consists of a token #2.31 followed by a sequence
        | of definite-length encoded bytestrings and a stop code )
        |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Name
"bounded_bytes"
      Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes
      Value ByteString -> (Word64, Word64) -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
0 :: Word64, Word64
64 :: Word64)

url :: Rule
url :: Rule
url = Name
"url" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> 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
128 :: Word64)

dns_name :: Rule
dns_name :: Rule
dns_name = Name
"dns_name" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> 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
128 :: Word64)

port :: Rule
port :: Rule
port = Name
"port" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value Int
VUInt Value Int -> Word64 -> Constrained
forall a c.
(IsComparable a, IsConstrainable c a) =>
c -> Word64 -> Constrained
`le` Word64
65535

ipv4 :: Rule
ipv4 :: Rule
ipv4 = Name
"ipv4" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
4 :: Word64)

ipv6 :: Rule
ipv6 :: Rule
ipv6 = Name
"ipv6" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
16 :: Word64)

unit_interval :: Rule
unit_interval :: Rule
unit_interval =
  Comment -> Rule -> Rule
forall a. HasComment a => Comment -> a -> a
comment
    Comment
[str|NOTE: The real unit_interval is: #6.30([uint, uint])
        |
        | A unit interval is a number in the range between 0 and 1, which
        | means there are two extra constraints:
        |    1. numerator <= denominator
        |    2. denominator > 0
        |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Name
"unit_interval"
      Name -> Tagged ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Word64 -> ArrayChoice -> Tagged ArrayChoice
forall a. Word64 -> a -> Tagged a
tag
        Word64
30
        ( ArrayChoice -> ArrayChoice
arr
            [ Constrained -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Value Int
VUInt Value Int -> Word64 -> Constrained
forall a c.
(IsComparable a, IsConstrainable c a) =>
c -> Word64 -> Constrained
`le` (Word64
forall a. Bounded a => a
maxBound :: Word64))
            , Constrained -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Value Int
VUInt Value Int -> Word64 -> Constrained
forall a c.
(IsComparable a, IsConstrainable c a) =>
c -> Word64 -> Constrained
`le` (Word64
forall a. Bounded a => a
maxBound :: Word64))
            ]
        )

set :: IsType0 t0 => t0 -> GRuleCall
set :: forall a. IsType0 a => a -> GRuleCall
set = (GRef -> Rule) -> t0 -> GRuleCall
forall t0. IsType0 t0 => (GRef -> Rule) -> t0 -> GRuleCall
binding ((GRef -> Rule) -> t0 -> GRuleCall)
-> (GRef -> Rule) -> t0 -> GRuleCall
forall a b. (a -> b) -> a -> b
$ \GRef
x -> Name
"set" Name -> Tagged ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Word64 -> ArrayChoice -> Tagged ArrayChoice
forall a. Word64 -> a -> Tagged a
tag Word64
258 (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])

-- | nonnegative_interval = tag 30 [uint, positive_int]
nonnegative_interval :: Rule
nonnegative_interval :: Rule
nonnegative_interval = Name
"nonnegative_interval" Name -> Tagged ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Word64 -> ArrayChoice -> Tagged ArrayChoice
forall a. Word64 -> a -> Tagged a
tag Word64
30 (ArrayChoice -> ArrayChoice
arr [Value Int -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value Int
VUInt, Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
positive_int])

positive_int :: Rule
positive_int :: Rule
positive_int = Name
"positive_int" Name -> Ranged -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= (Integer
1 :: Integer) Integer -> Integer -> Ranged
forall a b. (IsRangeBound a, IsRangeBound b) => a -> b -> Ranged
... Integer
maxWord64

maxWord64 :: Integer
maxWord64 :: Integer
maxWord64 = Integer
18446744073709551615

credential :: Rule
credential :: Rule
credential =
  Name
"credential"
    Name -> Choice ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Item ArrayChoice
ArrayEntry
0, Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
addr_keyhash]
    ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Item ArrayChoice
ArrayEntry
1, Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
script_hash]

addr_keyhash :: Rule
addr_keyhash :: Rule
addr_keyhash = Name
"addr_keyhash" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash28

script_hash :: Rule
script_hash :: Rule
script_hash =
  Comment -> Rule -> Rule
forall a. HasComment a => Comment -> a -> a
comment
    Comment
[str| To compute a script hash, note that you must prepend
        | a tag to the bytes of the script before hashing.
        | The tag is determined by the language.
        | The tags in the Conway era are:
        |  - "\x00" for multisig scripts
        |  - "\x01" for Plutus V1 scripts
        |  - "\x02" for Plutus V2 scripts
        |  - "\x03" for Plutus V3 scripts
    |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Name
"script_hash" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash28

anchor :: Rule
anchor :: Rule
anchor =
  Comment -> Rule -> Rule
forall a. HasComment a => Comment -> a -> a
comment
    Comment
[str|
    | Signed url
    |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Name
"anchor"
      Name -> ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
        [ Key
"anchor_url" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
url
        , Key
"anchor_data_hash" Key -> Value ByteString -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Value ByteString
VBytes
        ]

epoch_no :: Rule
epoch_no :: Rule
epoch_no = Name
"epoch_no" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value Int
VUInt Value Int -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
8 :: Word64)

pool_keyhash :: Rule
pool_keyhash :: Rule
pool_keyhash = Name
"pool_keyhash" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash28

reward_account :: Rule
reward_account :: Rule
reward_account =
  Comment -> Rule -> Rule
forall a. HasComment a => Comment -> a -> a
comment
    Comment
[str| 28 bytes hash and one byte for the network type |]
    (Rule -> Rule) -> Rule -> Rule
forall a b. (a -> b) -> a -> b
$ Name
"reward_account" Name -> Constrained -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value ByteString
VBytes Value ByteString -> Word64 -> Constrained
forall c a s.
(IsSizeable a, IsSize s, IsConstrainable c a) =>
c -> s -> Constrained
`sized` (Word64
29 :: Word64)

protocol_version :: Rule
protocol_version :: Rule
protocol_version = Name
"protocol_version" Name -> ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
major_protocol_version, Value Int -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value Int
VUInt]

major_protocol_version :: Rule
major_protocol_version :: Rule
major_protocol_version = Name
"major_protocol_version" Name -> Value Int -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Value Int
VUInt

gov_action_id :: Rule
gov_action_id :: Rule
gov_action_id =
  Name
"gov_action_id"
    Name -> ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr [Key
"transaction_id" Key -> Rule -> ArrayEntry
forall a me. (IsType0 a, IsEntryLike me) => Key -> a -> me
==> Rule
hash32, Key
"gov_action_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)]

staking_keyhash :: Rule
staking_keyhash :: Rule
staking_keyhash = Name
"staking_keyhash" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
hash28

account_id :: Rule
account_id :: Rule
account_id = Name
"account_id" Name -> Rule -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= Rule
credential

relay :: Rule
relay :: Rule
relay =
  Name
"relay"
    Name -> Choice ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [ Item ArrayChoice
ArrayEntry
0
      , Choice Type2 -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
port Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      , Choice Type2 -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
ipv4 Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      , Choice Type2 -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
ipv6 Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil)
      ]
    ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Item ArrayChoice
ArrayEntry
1, Choice Type2 -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a (Rule
port Rule -> Value Void -> Choice Type2
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ Value Void
VNil), Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
dns_name]
    Choice ArrayChoice -> ArrayChoice -> Choice ArrayChoice
forall a c b.
(IsChoosable a c, IsChoosable b c) =>
a -> b -> Choice c
/ ArrayChoice -> ArrayChoice
arr [Item ArrayChoice
ArrayEntry
2, Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
dns_name]

pool_metadata :: Rule
pool_metadata :: Rule
pool_metadata =
  Name
"pool_metadata"
    Name -> ArrayChoice -> Rule
forall a. IsType0 a => Name -> a -> Rule
=:= ArrayChoice -> ArrayChoice
arr
      [Rule -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Rule
url, Value ByteString -> ArrayEntry
forall a e. (IsType0 a, IsGroupOrArrayEntry e) => a -> e
a Value ByteString
VBytes]