# generated by datamodel-codegen:
#   filename:  ogmios.wsp.json
#   timestamp: 2023-05-29T12:12:30+00:00

from __future__ import annotations

from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional, Union

from pydantic import AnyUrl, BaseModel, Extra, Field, confloat, conint, constr

from . import Digest_Blake2b___Block___
from .Digest_Blake2b___Block_Byron_ import body
from .Digest_Blake2b___Block_Byron_.body import txPayload__


class Type(Enum):
    jsonwsp_request = "jsonwsp/request"


class Version(Enum):
    field_1_0 = "1.0"


class Servicename(Enum):
    ogmios = "ogmios"


class Methodname(Enum):
    RequestNext = "RequestNext"


class RequestNext(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type
    version: Version
    servicename: Servicename
    methodname: Methodname
    args: Optional[Dict[str, Any]] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class Type1(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type2(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname2(Enum):
    FindIntersect = "FindIntersect"


class Type3(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type4(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname4(Enum):
    SubmitTx = "SubmitTx"


class Args1(BaseModel):
    class Config:
        extra = Extra.forbid

    submit: Union[constr(regex=r"^[A-Za-z0-9]+=?=?$"), constr(regex=r"^[0-9a-f]+$")]


class SubmitTx(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type4
    version: Version
    servicename: Servicename
    methodname: Methodname4
    args: Optional[Args1] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class Type5(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type6(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname6(Enum):
    EvaluateTx = "EvaluateTx"


class Type7(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type8(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname8(Enum):
    Acquire = "Acquire"


class Type9(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type10(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname10(Enum):
    Release = "Release"


class Release(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type10
    version: Version
    servicename: Servicename
    methodname: Methodname10
    args: Optional[Dict[str, Any]] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class Type11(Enum):
    jsonwsp_response = "jsonwsp/response"


class Result(Enum):
    Released = "Released"


class ReleaseResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type11
    version: Version
    servicename: Servicename
    methodname: Methodname10
    result: Result
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Type12(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname12(Enum):
    AwaitAcquire = "AwaitAcquire"


class AwaitAcquire(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type12
    version: Version
    servicename: Servicename
    methodname: Methodname12
    args: Optional[Dict[str, Any]] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class Type13(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type14(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname14(Enum):
    NextTx = "NextTx"


class Fields(Enum):
    all = "all"


class Args4(BaseModel):
    class Config:
        extra = Extra.forbid

    fields: Optional[Fields] = None


class NextTx(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type14
    version: Version
    servicename: Servicename
    methodname: Methodname14
    args: Optional[Args4] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class Type15(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type16(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname16(Enum):
    HasTx = "HasTx"


class Type17(Enum):
    jsonwsp_response = "jsonwsp/response"


class HasTxResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type17
    version: Version
    servicename: Servicename
    methodname: Methodname16
    result: bool
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Type18(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname18(Enum):
    SizeAndCapacity = "SizeAndCapacity"


class SizeAndCapacity(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type18
    version: Version
    servicename: Servicename
    methodname: Methodname18
    args: Optional[Dict[str, Any]] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class Type19(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type20(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname20(Enum):
    ReleaseMempool = "ReleaseMempool"


class ReleaseMempool(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type20
    version: Version
    servicename: Servicename
    methodname: Methodname20
    args: Optional[Dict[str, Any]] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class Type21(Enum):
    jsonwsp_response = "jsonwsp/response"


class ReleaseMempoolResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type21
    version: Version
    servicename: Servicename
    methodname: Methodname20
    result: Result
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Type22(Enum):
    jsonwsp_request = "jsonwsp/request"


class Methodname22(Enum):
    Query = "Query"


class QueryEnum(Enum):
    eraStart = "eraStart"


class QueryEnum1(Enum):
    eraSummaries = "eraSummaries"


class QueryEnum2(Enum):
    ledgerTip = "ledgerTip"


class QueryEnum3(Enum):
    currentEpoch = "currentEpoch"


class QueryEnum4(Enum):
    currentProtocolParameters = "currentProtocolParameters"


class QueryEnum5(Enum):
    proposedProtocolParameters = "proposedProtocolParameters"


class QueryEnum6(Enum):
    stakeDistribution = "stakeDistribution"


class QueryEnum7(Enum):
    utxo = "utxo"


class GenesisConfig(Enum):
    byron = "byron"
    shelley = "shelley"
    alonzo = "alonzo"


class QueryItem4(BaseModel):
    class Config:
        extra = Extra.forbid

    genesisConfig: GenesisConfig


class QueryEnum8(Enum):
    rewardsProvenance = "rewardsProvenance"


class QueryEnum9(Enum):
    rewardsProvenance_ = "rewardsProvenance'"


class QueryEnum10(Enum):
    poolsRanking = "poolsRanking"


class QueryEnum11(Enum):
    poolIds = "poolIds"


class QueryEnum12(Enum):
    chainTip = "chainTip"


class QueryEnum13(Enum):
    blockHeight = "blockHeight"


class QueryEnum14(Enum):
    systemStart = "systemStart"


class Type23(Enum):
    jsonwsp_response = "jsonwsp/response"


class Type42(Enum):
    jsonwsp_fault = "jsonwsp/fault"


class Code(Enum):
    incompatible = "incompatible"
    server = "server"
    client = "client"


class Fault1(BaseModel):
    class Config:
        extra = Extra.forbid

    code: Code = Field(
        ..., description="An error code telling about the nature of the fault."
    )
    string: str = Field(
        ..., description="A descriptive error message giving hints about the fault."
    )


class Fault(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type42
    version: Version
    servicename: Servicename
    fault: Fault1


class InputSource(Enum):
    inputs = "inputs"
    collaterals = "collaterals"


class AcquireFailureDetails(Enum):
    pointTooOld = "pointTooOld"
    pointNotOnChain = "pointNotOnChain"


class Address(BaseModel):
    __root__: constr(regex=r"[1-9A-HJ-NP-Za-km-z]*") = Field(
        ...,
        description="A Cardano address (either legacy format or new format).",
        examples=[
            "addr1q9d34spgg2kdy47n82e7x9pdd6vql6d2engxmpj20jmhuc2047yqd4xnh7u6u5jp4t0q3fkxzckph4tgnzvamlu7k5psuahzcp",
            "DdzFFzCqrht8mbSTZHqpM2u4HeND2mdspsaBhdQ1BowPJBMzbDeBMeKgqdoKqo1D4sdPusEdZJVrFJRBBxX1jUEofNDYCJSZLg8MkyCE",
        ],
    )


class AddressAttributes(BaseModel):
    __root__: str = Field(
        ...,
        description="Extra attributes carried by Byron addresses (network magic and/or HD payload).",
    )


class AssetQuantity(BaseModel):
    __root__: int = Field(
        ..., description="A number of asset, can be negative went burning assets."
    )


class DigestBlake2bAuxiliaryDataBody(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description="A Blake2b 32-byte digest of an 'AuxiliaryDataBody', serialised as CBOR.",
        examples=["c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d"],
    )


class MetadatumItem(BaseModel):
    class Config:
        extra = Extra.forbid

    int: int


class MetadatumItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    string: str


class MetadatumItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    bytes: constr(regex=r"^[0-9a-f]*$")


class TxId(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ..., description="A Blake2b 32-byte digest of a transaction body, CBOR-encoded."
    )


class Lovelace(BaseModel):
    __root__: int = Field(
        ..., description="A number of lovelace, possibly large when summed up."
    )


class DigestBlake2bCredential(BaseModel):
    __root__: constr(min_length=56, max_length=56) = Field(
        ...,
        description="A Blake2b 28-byte digest of a verification key or a script.",
        examples=["90181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d3"],
    )


class Withdrawals(BaseModel):
    __root__: Optional[Dict[str, Lovelace]] = None


class BlockNo(BaseModel):
    __root__: conint(ge=0, le=18446744073709552999) = Field(
        ..., description="A block number, the i-th block to be minted is number i."
    )


class Origin(Enum):
    origin = "origin"


class UInt32(BaseModel):
    __root__: conint(ge=0, le=4294967295)


class Epoch(BaseModel):
    __root__: conint(ge=0, le=18446744073709552000) = Field(
        ..., description="An epoch number or length."
    )


class BlockSize(BaseModel):
    __root__: conint(ge=0, le=18446744073709552999) = Field(
        ..., description="The size of the block in bytes."
    )


class Signature(BaseModel):
    __root__: str = Field(
        ...,
        description="A signature coming from an Ed25519 or Ed25519-BIP32 signing key.",
    )


class RelativeTime(BaseModel):
    __root__: confloat(ge=0.0) = Field(
        ...,
        description="A time in seconds relative to another one (typically, system start or era start). Starting from v5.5.4, this can be a floating number. Before v5.5.4, the floating value would be rounded to the nearest second.",
    )


class VrfProof(BaseModel):
    __root__: str


class ChainCode(BaseModel):
    __root__: str = Field(
        ..., description="An Ed25519-BIP32 chain-code for key deriviation."
    )


class Int64(BaseModel):
    __root__: conint(ge=-9223372036854775808, le=9223372036854775807)


class Datum(BaseModel):
    __root__: str


class PoolId(BaseModel):
    __root__: constr(regex=r"^pool1[0-9a-z]*$") = Field(
        ...,
        description="A Blake2b 32-byte digest of a pool's verification key.",
        examples=[
            "pool1qqqqpanw9zc0rzh0yp247nzf2s35uvnsm7aaesfl2nnejaev0uc",
            "pool1qqqqqdk4zhsjuxxd8jyvwncf5eucfskz0xjjj64fdmlgj735lr9",
        ],
    )


class DigestBlake2bDatum(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description="A Blake2b 32-byte digest of a serialized datum, CBOR-encoded.",
        examples=["c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d"],
    )


class DigestBlake2bMerkleRoot(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description="A Blake2b 32-byte digest of a Merkle tree (or all block's transactions) root hash.",
        examples=["c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d"],
    )


class DigestBlake2bNonce(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description="A Blake2b 32-byte digest of some arbitrary to make a nonce.",
        examples=["c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d"],
    )


class DigestBlake2bPoolMetadata(BaseModel):
    __root__: str = Field(
        ...,
        description="A Blake2b 32-byte digest of stake pool (canonical) JSON metadata.",
        examples=["c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d"],
    )


class DigestBlake2bScript(BaseModel):
    __root__: constr(min_length=56, max_length=56) = Field(
        ...,
        description="A Blake2b 32-byte digest of a phase-1 or phase-2 script, CBOR-encoded.",
        examples=["90181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d3"],
    )


class DigestBlake2bScriptIntegrity(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description="A Blake2b 32-byte digest of a script-integrity hash (i.e redeemers, datums and cost model, CBOR-encoded).",
        examples=["c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d"],
    )


class DigestBlake2bVerificationKey(BaseModel):
    __root__: constr(min_length=56, max_length=56) = Field(
        ...,
        description="A Blake2b 28-byte digest of an Ed25519 verification key.",
        examples=["90181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d3"],
    )


class DigestBlake2bVrfVerificationKey(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description="A Blake2b 32-byte digest of a VRF verification key.",
        examples=["c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d"],
    )


class Era(Enum):
    Byron = "Byron"
    Shelley = "Shelley"
    Allegra = "Allegra"
    Mary = "Mary"
    Alonzo = "Alonzo"
    Babbage = "Babbage"


class EraMismatch1(BaseModel):
    class Config:
        extra = Extra.forbid

    queryEra: Era
    ledgerEra: Era


class EraMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    eraMismatch: EraMismatch1


class SlotLength(BaseModel):
    __root__: float = Field(
        ...,
        description="A slot length, in seconds. Starting from v5.5.4, this can be a floating number. Before v5.5.4, the floating value would be rounded to the nearest second.",
    )


class SubmitTxErrorExtraRedeemers(BaseModel):
    class Config:
        extra = Extra.forbid

    extraRedeemers: List[str]


class IncompatibleEra(Enum):
    Byron = "Byron"
    Shelley = "Shelley"
    Allegra = "Allegra"
    Mary = "Mary"


class EvaluationFailureIncompatibleEra(BaseModel):
    class Config:
        extra = Extra.forbid

    IncompatibleEra: IncompatibleEra = Field(
        ..., description="The era in which the transaction has been identified."
    )


class NotEnoughSynced(BaseModel):
    class Config:
        extra = Extra.forbid

    minimumRequiredEra: Era
    currentNodeEra: Era


class EvaluationFailureNotEnoughSynced(BaseModel):
    class Config:
        extra = Extra.forbid

    NotEnoughSynced: NotEnoughSynced


class CannotCreateEvaluationContext(BaseModel):
    class Config:
        extra = Extra.forbid

    reason: str


class EvaluationFailureCannotCreateEvaluationContext(BaseModel):
    class Config:
        extra = Extra.forbid

    CannotCreateEvaluationContext: CannotCreateEvaluationContext


class UInt64(BaseModel):
    __root__: conint(ge=0, le=18446744073709552999)


class UtcTime(BaseModel):
    __root__: datetime


class NetworkMagic(BaseModel):
    __root__: conint(ge=0, le=4294967296) = Field(
        ...,
        description="A magic number for telling networks apart. (e.g. 764824073)",
        examples=[764824073],
    )


class Null(BaseModel):
    __root__: None


class GenesisDelegate(BaseModel):
    class Config:
        extra = Extra.forbid

    delegate: DigestBlake2bVerificationKey
    vrf: DigestBlake2bVrfVerificationKey


class Metadatum1(BaseModel):
    class Config:
        extra = Extra.forbid

    hash: DigestBlake2bPoolMetadata
    url: AnyUrl


class Ratio(BaseModel):
    __root__: constr(regex=r"^-?[0-9]+/[0-9]+$") = Field(
        ...,
        description="A ratio of two integers, to express exact fractions.",
        examples=["2/3", "7/8"],
    )


class GenesisVerificationKey(BaseModel):
    __root__: constr(min_length=128, max_length=128) = Field(
        ...,
        description="An Ed25519-BIP32 Byron genesis delegate verification key with chain-code.",
    )


class Type43(Enum):
    address = "address"


class InvalidEntityItem(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type43
    entity: Address


class Type44(Enum):
    poolRegistration = "poolRegistration"


class InvalidEntityItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type44
    entity: PoolId


class Type45(Enum):
    rewardAccount = "rewardAccount"


class RewardAccount(BaseModel):
    __root__: constr(regex=r"^stake(_test)?1[0-9a-z]+$") = Field(
        ...,
        description="A reward account, also known as 'stake address'.",
        examples=["stake1ux7pt9adw8z46tgqn2f8fvurrhk325gcm4mf75mkmmxpx6gae9mzv"],
    )


class IssuerVrfVerificationKey(BaseModel):
    __root__: str = Field(..., description="A key identifying a block issuer.")


class IssuerSignature(BaseModel):
    __root__: str = Field(
        ...,
        description="Signature proving a block was issued by a given issuer VRF key.",
    )


class Language(Enum):
    plutus_v1 = "plutus:v1"
    plutus_v2 = "plutus:v2"


class LovelaceDelta(BaseModel):
    __root__: conint(ge=-9223372036854775808, le=9223372036854775807) = Field(
        ...,
        description="An amount, possibly negative, in Lovelace (1e6 Lovelace = 1 Ada).",
    )


class KesVerificationKey(BaseModel):
    __root__: str


class MempoolSizeAndCapacity(BaseModel):
    class Config:
        extra = Extra.forbid

    capacity: UInt32
    currentSize: UInt32
    numberOfTxs: UInt32


class Network(Enum):
    mainnet = "mainnet"
    testnet = "testnet"


class NonceEnum(Enum):
    neutral = "neutral"


class Nonce(BaseModel):
    __root__: Union[NonceEnum, DigestBlake2bNonce]


class NonMyopicMemberRewards(BaseModel):
    __root__: Optional[Dict[str, Dict[str, confloat(ge=0.0)]]] = None


class NullableRatio(BaseModel):
    __root__: Union[Ratio, Null]


class OpCert(BaseModel):
    class Config:
        extra = Extra.forbid

    count: Optional[UInt64] = None
    sigma: Optional[Signature] = None
    kesPeriod: Optional[UInt64] = None
    hotVk: Optional[KesVerificationKey] = None


class Slot(BaseModel):
    __root__: conint(ge=0, le=18446744073709552000) = Field(
        ..., description="An absolute slot number."
    )


class PolicyId(BaseModel):
    __root__: DigestBlake2bScript


class PoolDistribution1(BaseModel):
    class Config:
        extra = Extra.forbid

    stake: Ratio
    vrf: DigestBlake2bVrfVerificationKey


class PoolDistribution(BaseModel):
    __root__: Optional[Dict[str, PoolDistribution1]] = None


class PoolsRanking1(BaseModel):
    class Config:
        extra = Extra.forbid

    score: float
    estimatedHitRate: float


class PoolsRanking(BaseModel):
    __root__: Optional[Dict[str, PoolsRanking1]] = None


class Prices(BaseModel):
    class Config:
        extra = Extra.forbid

    memory: Ratio
    steps: Ratio


class ProtocolMagicId(BaseModel):
    __root__: conint(ge=0, le=4294967295) = Field(..., examples=[764824073])


class TxFeePolicy(BaseModel):
    class Config:
        extra = Extra.forbid

    coefficient: Ratio
    constant: float


class ProtocolVersion(BaseModel):
    class Config:
        extra = Extra.forbid

    major: UInt32
    minor: UInt32
    patch: Optional[UInt32] = None


class QueryUnavailableInCurrentEra(Enum):
    QueryUnavailableInCurrentEra = "QueryUnavailableInCurrentEra"


class RedeemerData(BaseModel):
    __root__: str = Field(..., description="Plutus data, CBOR-serialised.")


class RedeemerPointer(BaseModel):
    __root__: constr(regex=r"^(spend|mint|certificate|withdrawal):[0-9]+$")


class RelayItem(BaseModel):
    class Config:
        extra = Extra.forbid

    ipv4: Union[str, Null]
    ipv6: Union[str, Null]
    port: Union[conint(ge=0, le=65535), Null]


class RelayItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    hostname: str
    port: Union[conint(ge=0, le=65535), Null]


class Relay(BaseModel):
    __root__: Union[RelayItem, RelayItem1]


class Rewards(BaseModel):
    __root__: Optional[Dict[str, LovelaceDelta]] = None


class PoolParameters1(BaseModel):
    class Config:
        extra = Extra.forbid

    cost: Lovelace
    margin: Ratio
    pledge: Lovelace


class RewardInfoPool(BaseModel):
    class Config:
        extra = Extra.forbid

    stake: Lovelace
    ownerStake: Lovelace = Field(
        ...,
        description="The number of Lovelace owned by the stake pool owners. If this value is not at least as large as the 'pledgeRatio', the stake pool will not earn any rewards for the given epoch.",
    )
    approximatePerformance: confloat(ge=0.0) = Field(
        ...,
        description="Number of blocks produced divided by expected number of blocks (based on stake and epoch progress). Can be larger than 1.0 for pools that get lucky.",
    )
    poolParameters: PoolParameters1 = Field(
        ...,
        description="Some of the pool parameters relevant for the reward calculation.",
    )


class RewardPot(Enum):
    reserves = "reserves"
    treasury = "treasury"


class RewardsProvenance(BaseModel):
    class Config:
        extra = Extra.forbid

    desiredNumberOfPools: conint(ge=0, le=18446744073709552999) = Field(
        ..., description="Desired number of stake pools."
    )
    poolInfluence: constr(regex=r"^-?[0-9]+/[0-9]+$") = Field(
        ...,
        description="Influence of the pool owner's pledge on rewards, as a ratio of two integers.",
        examples=["2/3", "7/8"],
    )
    totalRewards: int = Field(
        ..., description="Total rewards available for the given epoch."
    )
    activeStake: int = Field(
        ..., description="The total amount of staked Lovelace during this epoch."
    )
    pools: Dict[str, RewardInfoPool]


class SafeZone(BaseModel):
    __root__: conint(ge=0, le=18446744073709552999) = Field(
        ...,
        description="Number of slots from the tip of the ledger in which it is guaranteed that no hard fork can take place. This should be (at least) the number of slots in which we are guaranteed to have k blocks.",
    )


class ScriptNativeItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    expiresAt: Slot


class ScriptNativeItem3(BaseModel):
    class Config:
        extra = Extra.forbid

    startsAt: Slot


class ScriptPlutus(BaseModel):
    __root__: str = Field(
        ...,
        description="A phase-2 Plutus script; or said differently, a serialized Plutus-core program.",
    )


class MissingRequiredScripts(BaseModel):
    class Config:
        extra = Extra.forbid

    missing: List[RedeemerPointer]
    resolved: Dict[str, DigestBlake2bScript]


class ScriptFailureMissingRequiredScripts(BaseModel):
    class Config:
        extra = Extra.forbid

    missingRequiredScripts: MissingRequiredScripts


class ValidatorFailed(BaseModel):
    class Config:
        extra = Extra.forbid

    error: str
    traces: List[str]


class ScriptFailureValidatorFailed(BaseModel):
    class Config:
        extra = Extra.forbid

    validatorFailed: ValidatorFailed


class ScriptFailureNoCostModelForLanguage(BaseModel):
    class Config:
        extra = Extra.forbid

    noCostModelForLanguage: Language


class ScriptPurposeItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    mint: PolicyId


class ScriptPurposeItem3(BaseModel):
    class Config:
        extra = Extra.forbid

    withdrawal: RewardAccount


class SoftwareVersion(BaseModel):
    class Config:
        extra = Extra.forbid

    appName: str
    number: UInt32


class SoftForkRule(BaseModel):
    class Config:
        extra = Extra.forbid

    initThreshold: NullableRatio
    minThreshold: NullableRatio
    decrementThreshold: NullableRatio


class StakeAddress(BaseModel):
    __root__: constr(regex=r"^(stake|stake_test)1[0-9a-z]*$") = Field(
        ...,
        description="A stake address (a.k.a reward account)",
        examples=["stake179kzq4qulejydh045yzxwk4ksx780khkl4gdve9kzwd9vjcek9u8h"],
    )


class StakeCredential(BaseModel):
    __root__: Union[
        DigestBlake2bCredential,
        constr(regex=r"^(stake_vkh|script)1[0-9a-z]*$"),
        StakeAddress,
    ]


class VerificationKey(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ..., description="An Ed25519 verification key."
    )


class SubmitTxErrorMissingVkWitnesses(BaseModel):
    class Config:
        extra = Extra.forbid

    missingVkWitnesses: List[DigestBlake2bVerificationKey]


class SubmitTxErrorMissingScriptWitnesses(BaseModel):
    class Config:
        extra = Extra.forbid

    missingScriptWitnesses: List[DigestBlake2bScript]


class SubmitTxErrorScriptWitnessNotValidating(BaseModel):
    class Config:
        extra = Extra.forbid

    scriptWitnessNotValidating: List[DigestBlake2bScript]


class SubmitTxErrorInsufficientGenesisSignatures(BaseModel):
    class Config:
        extra = Extra.forbid

    insufficientGenesisSignatures: List[DigestBlake2bVerificationKey]


class SubmitTxErrorMissingTxMetadata(BaseModel):
    class Config:
        extra = Extra.forbid

    missingTxMetadata: DigestBlake2bAuxiliaryDataBody


class SubmitTxErrorMissingTxMetadataHash(BaseModel):
    class Config:
        extra = Extra.forbid

    missingTxMetadataHash: DigestBlake2bAuxiliaryDataBody


class TxMetadataHashMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    includedHash: DigestBlake2bAuxiliaryDataBody
    expectedHash: DigestBlake2bAuxiliaryDataBody


class SubmitTxErrorTxMetadataHashMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    txMetadataHashMismatch: TxMetadataHashMismatch


class ExpiredUtxo(BaseModel):
    class Config:
        extra = Extra.forbid

    currentSlot: Slot
    transactionTimeToLive: Slot


class SubmitTxErrorExpiredUtxo(BaseModel):
    class Config:
        extra = Extra.forbid

    expiredUtxo: ExpiredUtxo


class ValidityInterval(BaseModel):
    class Config:
        extra = Extra.forbid

    invalidBefore: Union[Slot, Null]
    invalidHereafter: Union[Slot, Null]


class TxTooLarge(BaseModel):
    class Config:
        extra = Extra.forbid

    maximumSize: Int64
    actualSize: Int64


class SubmitTxErrorTxTooLarge(BaseModel):
    class Config:
        extra = Extra.forbid

    txTooLarge: TxTooLarge


class SubmitTxErrorMissingAtLeastOneInputUtxo(BaseModel):
    class Config:
        extra = Extra.forbid

    missingAtLeastOneInputUtxo: None


class SubmitTxErrorInvalidMetadata(BaseModel):
    class Config:
        extra = Extra.forbid

    invalidMetadata: None


class FeeTooSmall(BaseModel):
    class Config:
        extra = Extra.forbid

    requiredFee: Lovelace
    actualFee: Lovelace


class SubmitTxErrorFeeTooSmall(BaseModel):
    class Config:
        extra = Extra.forbid

    feeTooSmall: FeeTooSmall


class SubmitTxErrorAddressAttributesTooLarge(BaseModel):
    class Config:
        extra = Extra.forbid

    addressAttributesTooLarge: List[Address]


class SubmitTxErrorTriesToForgeAda(BaseModel):
    class Config:
        extra = Extra.forbid

    triesToForgeAda: None


class SubmitTxErrorDelegateNotRegistered(BaseModel):
    class Config:
        extra = Extra.forbid

    delegateNotRegistered: PoolId


class SubmitTxErrorUnknownOrIncompleteWithdrawals(BaseModel):
    class Config:
        extra = Extra.forbid

    unknownOrIncompleteWithdrawals: Withdrawals


class SubmitTxErrorStakePoolNotRegistered(BaseModel):
    class Config:
        extra = Extra.forbid

    stakePoolNotRegistered: PoolId


class WrongRetirementEpoch(BaseModel):
    class Config:
        extra = Extra.forbid

    currentEpoch: Epoch
    requestedEpoch: Epoch
    firstUnreachableEpoch: Epoch


class SubmitTxErrorWrongRetirementEpoch(BaseModel):
    class Config:
        extra = Extra.forbid

    wrongRetirementEpoch: WrongRetirementEpoch


class UInt8(BaseModel):
    __root__: conint(ge=0, le=255)


class SubmitTxErrorStakeKeyAlreadyRegistered(BaseModel):
    class Config:
        extra = Extra.forbid

    stakeKeyAlreadyRegistered: DigestBlake2bVerificationKey


class PoolCostTooSmall(BaseModel):
    class Config:
        extra = Extra.forbid

    minimumCost: Lovelace


class SubmitTxErrorPoolCostTooSmall(BaseModel):
    class Config:
        extra = Extra.forbid

    poolCostTooSmall: PoolCostTooSmall


class PoolMetadataHashTooBig(BaseModel):
    class Config:
        extra = Extra.forbid

    poolId: PoolId
    measuredSize: Int64


class SubmitTxErrorPoolMetadataHashTooBig(BaseModel):
    class Config:
        extra = Extra.forbid

    poolMetadataHashTooBig: PoolMetadataHashTooBig


class SubmitTxErrorStakeKeyNotRegistered(BaseModel):
    class Config:
        extra = Extra.forbid

    stakeKeyNotRegistered: DigestBlake2bVerificationKey


class SubmitTxErrorRewardAccountNotExisting(BaseModel):
    class Config:
        extra = Extra.forbid

    rewardAccountNotExisting: None


class RewardAccountNotEmpty(BaseModel):
    class Config:
        extra = Extra.forbid

    balance: Lovelace


class SubmitTxErrorRewardAccountNotEmpty(BaseModel):
    class Config:
        extra = Extra.forbid

    rewardAccountNotEmpty: RewardAccountNotEmpty


class SubmitTxErrorWrongCertificateType(BaseModel):
    class Config:
        extra = Extra.forbid

    wrongCertificateType: None


class SubmitTxErrorUnknownGenesisKey(BaseModel):
    class Config:
        extra = Extra.forbid

    unknownGenesisKey: DigestBlake2bVerificationKey


class SubmitTxErrorAlreadyDelegating(BaseModel):
    class Config:
        extra = Extra.forbid

    alreadyDelegating: DigestBlake2bVerificationKey


class InsufficientFundsForMir(BaseModel):
    class Config:
        extra = Extra.forbid

    rewardSource: RewardPot
    sourceSize: Lovelace
    requestedAmount: Lovelace


class SubmitTxErrorInsufficientFundsForMir(BaseModel):
    class Config:
        extra = Extra.forbid

    insufficientFundsForMir: InsufficientFundsForMir


class TooLateForMir(BaseModel):
    class Config:
        extra = Extra.forbid

    currentSlot: Slot
    lastAllowedSlot: Slot


class SubmitTxErrorTooLateForMir(BaseModel):
    class Config:
        extra = Extra.forbid

    tooLateForMir: TooLateForMir


class SubmitTxErrorMirTransferNotCurrentlyAllowed(BaseModel):
    class Config:
        extra = Extra.forbid

    mirTransferNotCurrentlyAllowed: None


class SubmitTxErrorMirNegativeTransferNotCurrentlyAllowed(BaseModel):
    class Config:
        extra = Extra.forbid

    mirNegativeTransferNotCurrentlyAllowed: None


class SubmitTxErrorMirProducesNegativeUpdate(BaseModel):
    class Config:
        extra = Extra.forbid

    mirProducesNegativeUpdate: None


class MirNegativeTransfer(BaseModel):
    class Config:
        extra = Extra.forbid

    rewardSource: RewardPot
    attemptedTransfer: Lovelace


class SubmitTxErrorMirNegativeTransfer(BaseModel):
    class Config:
        extra = Extra.forbid

    mirNegativeTransfer: MirNegativeTransfer


class SubmitTxErrorDuplicateGenesisVrf(BaseModel):
    class Config:
        extra = Extra.forbid

    duplicateGenesisVrf: DigestBlake2bVrfVerificationKey


class NonGenesisVoters(BaseModel):
    class Config:
        extra = Extra.forbid

    currentlyVoting: List[DigestBlake2bVerificationKey]
    shouldBeVoting: List[DigestBlake2bVerificationKey]


class SubmitTxErrorNonGenesisVoters(BaseModel):
    class Config:
        extra = Extra.forbid

    nonGenesisVoters: NonGenesisVoters


class VotingPeriod(Enum):
    voteForThisEpoch = "voteForThisEpoch"
    voteForNextEpoch = "voteForNextEpoch"


class SubmitTxErrorProtocolVersionCannotFollow(BaseModel):
    class Config:
        extra = Extra.forbid

    protocolVersionCannotFollow: ProtocolVersion


class MissingRequiredDatums(BaseModel):
    class Config:
        extra = Extra.forbid

    provided: Optional[List[DigestBlake2bDatum]] = None
    missing: List[DigestBlake2bDatum]


class SubmitTxErrorMissingRequiredDatums(BaseModel):
    class Config:
        extra = Extra.forbid

    missingRequiredDatums: MissingRequiredDatums


class UnspendableDatums(BaseModel):
    class Config:
        extra = Extra.forbid

    nonSpendable: List[DigestBlake2bDatum]
    acceptable: List[DigestBlake2bDatum]


class SubmitTxErrorUnspendableDatums(BaseModel):
    class Config:
        extra = Extra.forbid

    unspendableDatums: UnspendableDatums


class ExtraDataMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    provided: Union[DigestBlake2bScriptIntegrity, Null]
    inferredFromParameters: Union[DigestBlake2bScriptIntegrity, Null]


class SubmitTxErrorExtraDataMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    extraDataMismatch: ExtraDataMismatch


class SubmitTxErrorMissingRequiredSignatures(BaseModel):
    class Config:
        extra = Extra.forbid

    missingRequiredSignatures: List[DigestBlake2bVerificationKey]


class SubmitTxErrorMissingCollateralInputs(BaseModel):
    class Config:
        extra = Extra.forbid

    missingCollateralInputs: None


class CollateralTooSmall(BaseModel):
    class Config:
        extra = Extra.forbid

    requiredCollateral: Lovelace
    actualCollateral: Lovelace


class SubmitTxErrorCollateralTooSmall(BaseModel):
    class Config:
        extra = Extra.forbid

    collateralTooSmall: CollateralTooSmall


class TooManyCollateralInputs(BaseModel):
    class Config:
        extra = Extra.forbid

    maximumCollateralInputs: UInt64
    actualCollateralInputs: UInt64


class SubmitTxErrorTooManyCollateralInputs(BaseModel):
    class Config:
        extra = Extra.forbid

    tooManyCollateralInputs: TooManyCollateralInputs


class SubmitTxErrorOutsideForecast(BaseModel):
    class Config:
        extra = Extra.forbid

    outsideForecast: Slot


class SubmitTxErrorValidationTagMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    validationTagMismatch: None


class CollectError1(BaseModel):
    class Config:
        extra = Extra.forbid

    noWitness: DigestBlake2bScript


class CollectError2(BaseModel):
    class Config:
        extra = Extra.forbid

    noCostModel: Language


class CollectError3(BaseModel):
    class Config:
        extra = Extra.forbid

    badTranslation: str = Field(
        ...,
        description="An (hopefully) informative error about the transaction execution failure.",
    )


class SubmitTxErrorExtraScriptWitnesses(BaseModel):
    class Config:
        extra = Extra.forbid

    extraScriptWitnesses: List[DigestBlake2bScript]


class TotalCollateralMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    computedFromDelta: Lovelace
    declaredInField: Lovelace


class SubmitTxErrorTotalCollateralMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    totalCollateralMismatch: TotalCollateralMismatch


class SubmitTxErrorMalformedReferenceScripts(BaseModel):
    class Config:
        extra = Extra.forbid

    malformedReferenceScripts: List[DigestBlake2bScript]


class SubmitTxErrorMalformedScriptWitnesses(BaseModel):
    class Config:
        extra = Extra.forbid

    malformedScriptWitnesses: List[DigestBlake2bScript]


class TipOrOriginItem(BaseModel):
    class Config:
        extra = Extra.forbid

    slot: Slot
    hash: Digest_Blake2b___Block___.Header
    blockNo: BlockNo


class TipOrOrigin(BaseModel):
    __root__: Union[TipOrOriginItem, Origin]


class WitnessVk(BaseModel):
    class Config:
        extra = Extra.forbid

    key: DigestBlake2bVerificationKey
    signature: Signature


class TxWitnes(BaseModel):
    class Config:
        extra = Extra.forbid

    witnessVk: WitnessVk


class RedeemWitness(BaseModel):
    class Config:
        extra = Extra.forbid

    key: VerificationKey
    signature: Signature


class TxWitnes1(BaseModel):
    class Config:
        extra = Extra.forbid

    redeemWitness: RedeemWitness


class TxWitness(BaseModel):
    __root__: Union[TxWitnes, TxWitnes1]


class Vote(BaseModel):
    class Config:
        extra = Extra.forbid

    voterVk: VerificationKey
    proposalId: DigestBlake2bVerificationKey
    signature: Signature


class VrfOutput(BaseModel):
    __root__: str


class HeaderHash(BaseModel):
    __root__: Digest_Blake2b___Block___.Header


class IntersectionNotFound(BaseModel):
    class Config:
        extra = Extra.forbid

    tip: TipOrOrigin


class ResultItem3(BaseModel):
    class Config:
        extra = Extra.forbid

    IntersectionNotFound: IntersectionNotFound


class SubmitSuccess(BaseModel):
    class Config:
        extra = Extra.forbid

    txId: TxId


class ResultItem4(BaseModel):
    class Config:
        extra = Extra.forbid

    SubmitSuccess: SubmitSuccess


class AcquireFailure(BaseModel):
    class Config:
        extra = Extra.forbid

    failure: AcquireFailureDetails


class ResultItem7(BaseModel):
    class Config:
        extra = Extra.forbid

    AcquireFailure: AcquireFailure


class AwaitAcquired(BaseModel):
    class Config:
        extra = Extra.forbid

    slot: Slot


class Result1(BaseModel):
    class Config:
        extra = Extra.forbid

    AwaitAcquired: AwaitAcquired


class AwaitAcquireResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type13
    version: Version
    servicename: Servicename
    methodname: Methodname12
    result: Result1 = Field(..., title="AwaitAcquired")
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Args5(BaseModel):
    class Config:
        extra = Extra.forbid

    id: TxId


class HasTx(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type16
    version: Version
    servicename: Servicename
    methodname: Methodname16
    args: Optional[Args5] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class SizeAndCapacityResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type19
    version: Version
    servicename: Servicename
    methodname: Methodname18
    result: MempoolSizeAndCapacity
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryItem(BaseModel):
    class Config:
        extra = Extra.forbid

    nonMyopicMemberRewards: Union[List[Lovelace], List[StakeCredential]]


class QueryItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    delegationsAndRewards: List[StakeCredential]


class QueryItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    utxo: List[Address]


class QueryItem5(BaseModel):
    class Config:
        extra = Extra.forbid

    poolParameters: List[Union[PoolId, constr(regex=r"^[0-9a-f]+$")]]


class QueryResponseCurrentEpoch(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[Epoch, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseNonMyopicMemberRewards(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[NonMyopicMemberRewards, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseStakeDistribution(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[PoolDistribution, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseRewardsProvenance1(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[RewardsProvenance, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponsePoolIds(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[List[PoolId], EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponsePoolsRanking(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[PoolsRanking, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseSystemStart(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[UtcTime, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Header2(BaseModel):
    class Config:
        extra = Extra.forbid

    blockHeight: BlockNo
    epoch: Epoch
    prevHash: Digest_Blake2b___Block___.Header


class BlockByronItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    hash: Digest_Blake2b___Block___.Header
    header: Header2


class TxIn(BaseModel):
    class Config:
        extra = Extra.forbid

    txId: TxId
    index: UInt32


class Value(BaseModel):
    class Config:
        extra = Extra.forbid

    coins: Lovelace
    assets: Optional[Dict[str, AssetQuantity]] = None


class StakeDelegation(BaseModel):
    class Config:
        extra = Extra.forbid

    delegator: DigestBlake2bCredential
    delegatee: PoolId


class CertificateItem(BaseModel):
    class Config:
        extra = Extra.forbid

    stakeDelegation: StakeDelegation


class CertificateItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    stakeKeyRegistration: DigestBlake2bCredential


class CertificateItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    stakeKeyDeregistration: DigestBlake2bCredential


class PoolRetirement(BaseModel):
    class Config:
        extra = Extra.forbid

    retirementEpoch: Epoch
    poolId: PoolId


class CertificateItem4(BaseModel):
    class Config:
        extra = Extra.forbid

    poolRetirement: PoolRetirement


class GenesisDelegation(BaseModel):
    class Config:
        extra = Extra.forbid

    delegateKeyHash: DigestBlake2bVerificationKey
    verificationKeyHash: DigestBlake2bVerificationKey
    vrfVerificationKeyHash: DigestBlake2bVrfVerificationKey


class CertificateItem5(BaseModel):
    class Config:
        extra = Extra.forbid

    genesisDelegation: GenesisDelegation


class MoveInstantaneousRewards(BaseModel):
    class Config:
        extra = Extra.forbid

    rewards: Optional[Rewards] = None
    value: Optional[Lovelace] = None
    pot: RewardPot


class CertificateItem6(BaseModel):
    class Config:
        extra = Extra.forbid

    moveInstantaneousRewards: MoveInstantaneousRewards


class BlockNoOrOrigin(BaseModel):
    __root__: Union[BlockNo, Origin]


class Utxo1(BaseModel):
    class Config:
        extra = Extra.forbid

    number: UInt32
    root: DigestBlake2bMerkleRoot
    witnessesHash: txPayload__.Witness


class BlockProof(BaseModel):
    class Config:
        extra = Extra.forbid

    utxo: Utxo1
    delegation: body.DlgPayload
    update: body.UpdatePayload


class DlgCertificate(BaseModel):
    class Config:
        extra = Extra.forbid

    epoch: Epoch
    issuerVk: GenesisVerificationKey
    delegateVk: GenesisVerificationKey
    signature: IssuerSignature


class BootstrapWitness(BaseModel):
    class Config:
        extra = Extra.forbid

    signature: Signature
    chainCode: Union[ChainCode, Null]
    addressAttributes: Union[AddressAttributes, Null]
    key: VerificationKey


class Bound(BaseModel):
    class Config:
        extra = Extra.forbid

    time: RelativeTime
    slot: Slot
    epoch: Epoch


class CertifiedVrf(BaseModel):
    class Config:
        extra = Extra.forbid

    proof: Optional[VrfProof] = None
    output: Optional[VrfOutput] = None


class CostModel(BaseModel):
    __root__: Optional[Dict[str, Int64]] = None


class DelegationsAndRewards(BaseModel):
    class Config:
        extra = Extra.forbid

    delegate: Optional[PoolId] = None
    rewards: Optional[Lovelace] = None


class EraParameters(BaseModel):
    class Config:
        extra = Extra.forbid

    epochLength: Epoch
    slotLength: SlotLength
    safeZone: Optional[SafeZone]


class EraSummary(BaseModel):
    class Config:
        extra = Extra.forbid

    start: Bound
    end: Optional[Bound]
    parameters: EraParameters


class EvaluationFailureAdditionalUtxoOverlap(BaseModel):
    class Config:
        extra = Extra.forbid

    AdditionalUtxoOverlap: List[TxIn]


class ExUnits(BaseModel):
    class Config:
        extra = Extra.forbid

    memory: UInt64
    steps: UInt64


class NullableUInt64(BaseModel):
    __root__: Union[UInt64, Null]


class PoolParameters(BaseModel):
    class Config:
        extra = Extra.forbid

    owners: List[DigestBlake2bVerificationKey]
    cost: Lovelace
    margin: Ratio
    pledge: Lovelace
    vrf: DigestBlake2bVrfVerificationKey
    metadata: Union[Null, Metadatum1]
    id: PoolId
    relays: List[Relay]
    rewardAccount: RewardAccount


class IndividualPoolRewardsProvenance(BaseModel):
    class Config:
        extra = Extra.forbid

    totalMintedBlocks: UInt64 = Field(
        ..., description="The number of blocks the pool produced."
    )
    totalStakeShare: Ratio = Field(
        ..., description="The stake pool's stake share (portion of the total stake)."
    )
    activeStakeShare: Ratio = Field(
        ...,
        description="The stake pool's active stake share (portion of the active stake).",
    )
    ownerStake: Lovelace = Field(
        ...,
        description="The number of Lovelace owned by the stake pool owners. If this value is not at least as large as the 'pledgeRatio', the stake pool will not earn any rewards for the given epoch.",
    )
    parameters: PoolParameters
    pledgeRatio: Ratio = Field(
        ..., description="The stake pool's pledge ratio (over its total stake)."
    )
    maxRewards: Lovelace = Field(
        ..., description="The maximum number of Lovelace this stake pool can earn."
    )
    apparentPerformance: Ratio = Field(
        ...,
        description="The stake pool's apparent performance according to Section 5.5.2 of the Shelley Design Spec.",
    )
    totalRewards: Lovelace = Field(
        ..., description="The total Lovelace earned by the stake pool."
    )
    leaderRewards: Lovelace = Field(
        ..., description="The total Lovelace earned by the stake pool leader."
    )


class InvalidEntityItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type45
    entity: RewardAccount


class InvalidEntity(BaseModel):
    __root__: Union[InvalidEntityItem, InvalidEntityItem1, InvalidEntityItem2]


class PointOrOriginItem(BaseModel):
    class Config:
        extra = Extra.forbid

    slot: Slot
    hash: Digest_Blake2b___Block___.Header


class PointOrOrigin(BaseModel):
    __root__: Union[PointOrOriginItem, Origin]


class ProtocolParametersByron(BaseModel):
    class Config:
        extra = Extra.forbid

    heavyDlgThreshold: NullableRatio
    maxBlockSize: NullableUInt64
    maxHeaderSize: NullableUInt64
    maxProposalSize: NullableUInt64
    maxTxSize: NullableUInt64
    mpcThreshold: NullableRatio
    scriptVersion: NullableUInt64
    slotDuration: NullableUInt64
    unlockStakeEpoch: NullableUInt64
    updateProposalThreshold: NullableRatio
    updateProposalTimeToLive: NullableUInt64
    updateVoteThreshold: NullableRatio
    txFeePolicy: Union[TxFeePolicy, Null]
    softforkRule: Union[SoftForkRule, Null]


class ProtocolParametersShelley(BaseModel):
    class Config:
        extra = Extra.forbid

    minFeeCoefficient: NullableUInt64
    minFeeConstant: NullableUInt64
    maxBlockBodySize: NullableUInt64
    maxBlockHeaderSize: NullableUInt64
    maxTxSize: NullableUInt64
    stakeKeyDeposit: NullableUInt64
    poolDeposit: NullableUInt64
    poolRetirementEpochBound: NullableUInt64
    desiredNumberOfPools: NullableUInt64
    poolInfluence: NullableRatio
    monetaryExpansion: NullableRatio
    treasuryExpansion: NullableRatio
    decentralizationParameter: NullableRatio
    minUtxoValue: NullableUInt64
    minPoolCost: NullableUInt64
    extraEntropy: Union[Nonce, Null]
    protocolVersion: Union[ProtocolVersion, Null]


class Redeemer(BaseModel):
    class Config:
        extra = Extra.forbid

    redeemer: RedeemerData
    executionUnits: ExUnits


class RewardsProvenanceModel(BaseModel):
    class Config:
        extra = Extra.forbid

    epochLength: Epoch
    decentralizationParameter: Ratio
    maxLovelaceSupply: Lovelace
    mintedBlocks: Dict[str, UInt64] = Field(
        ..., description="Number of blocks minted by each pool."
    )
    totalMintedBlocks: Int64 = Field(
        ..., description="The total number of blocks minted during the given epoch."
    )
    totalExpectedBlocks: Int64 = Field(
        ...,
        description="The number of blocks expected to be produced during the given epoch.",
    )
    incentive: Lovelace = Field(
        ...,
        description="The maximum amount of Lovelace which can be removed from the reserves to be given out as rewards for the given epoch.",
    )
    rewardsGap: Lovelace = Field(
        ...,
        description="The difference between the 'availableRewards' and what was actually distributed.",
    )
    availableRewards: Lovelace = Field(
        ...,
        description="The total Lovelace available for rewards for the given epoch, equal to 'totalRewards' less 'treasuryTax'.",
    )
    totalRewards: Lovelace = Field(
        ...,
        description="The reward pot for the given epoch, equal to the 'incentive' plus the fee pot.",
    )
    treasuryTax: Lovelace = Field(
        ...,
        description="The amount of Lovelace taken for the treasury for the given epoch.",
    )
    activeStake: Lovelace = Field(
        ...,
        description="The amount of Lovelace that is delegated during the given epoch.",
    )
    pools: Dict[str, IndividualPoolRewardsProvenance]


class ScriptItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    plutus_v1: ScriptPlutus = Field(..., alias="plutus:v1")


class ScriptItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    plutus_v2: ScriptPlutus = Field(..., alias="plutus:v2")


class ScriptFailureUnknownInputReferencedByRedeemer(BaseModel):
    class Config:
        extra = Extra.forbid

    unknownInputReferencedByRedeemer: TxIn


class ScriptFailureNonScriptInputReferencedByRedeemer(BaseModel):
    class Config:
        extra = Extra.forbid

    nonScriptInputReferencedByRedeemer: TxIn


class ScriptFailureIllFormedExecutionBudget(BaseModel):
    class Config:
        extra = Extra.forbid

    illFormedExecutionBudget: Union[ExUnits, Null]


class ScriptPurposeItem(BaseModel):
    class Config:
        extra = Extra.forbid

    spend: TxIn


class SubmitTxErrorInvalidWitnesses(BaseModel):
    class Config:
        extra = Extra.forbid

    invalidWitnesses: List[VerificationKey]


class SubmitTxErrorBadInputs(BaseModel):
    class Config:
        extra = Extra.forbid

    badInputs: List[TxIn]


class OutsideOfValidityInterval(BaseModel):
    class Config:
        extra = Extra.forbid

    currentSlot: Slot
    interval: ValidityInterval


class SubmitTxErrorOutsideOfValidityInterval(BaseModel):
    class Config:
        extra = Extra.forbid

    outsideOfValidityInterval: OutsideOfValidityInterval


class ValueNotConserved(BaseModel):
    class Config:
        extra = Extra.forbid

    consumed: Union[LovelaceDelta, Value]
    produced: Union[LovelaceDelta, Value]


class SubmitTxErrorValueNotConserved(BaseModel):
    class Config:
        extra = Extra.forbid

    valueNotConserved: ValueNotConserved


class NetworkMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    expectedNetwork: Network
    invalidEntities: List[InvalidEntity]


class SubmitTxErrorNetworkMismatch(BaseModel):
    class Config:
        extra = Extra.forbid

    networkMismatch: NetworkMismatch


class SubmitTxErrorWrongPoolCertificate(BaseModel):
    class Config:
        extra = Extra.forbid

    wrongPoolCertificate: UInt8


class UpdateWrongEpoch(BaseModel):
    class Config:
        extra = Extra.forbid

    currentEpoch: Epoch
    requestedEpoch: Epoch
    votingPeriod: VotingPeriod


class SubmitTxErrorUpdateWrongEpoch(BaseModel):
    class Config:
        extra = Extra.forbid

    updateWrongEpoch: UpdateWrongEpoch


class SubmitTxErrorUnspendableScriptInputs(BaseModel):
    class Config:
        extra = Extra.forbid

    unspendableScriptInputs: List[TxIn]


class SubmitTxErrorMissingDatumHashesForInputs(BaseModel):
    class Config:
        extra = Extra.forbid

    missingDatumHashesForInputs: List[TxIn]


class SubmitTxErrorCollateralHasNonAdaAssets(BaseModel):
    class Config:
        extra = Extra.forbid

    collateralHasNonAdaAssets: Value


class ExecutionUnitsTooLarge(BaseModel):
    class Config:
        extra = Extra.forbid

    maximumExecutionUnits: ExUnits
    actualExecutionUnits: ExUnits


class SubmitTxErrorExecutionUnitsTooLarge(BaseModel):
    class Config:
        extra = Extra.forbid

    executionUnitsTooLarge: ExecutionUnitsTooLarge


class UpdateShelleyItem(BaseModel):
    class Config:
        extra = Extra.forbid

    epoch: Epoch
    proposal: Dict[str, ProtocolParametersShelley]


class UpdateShelley(BaseModel):
    __root__: Union[Null, UpdateShelleyItem]


class Header(BaseModel):
    class Config:
        extra = Extra.forbid

    blockHeight: BlockNo
    slot: Slot
    prevHash: Digest_Blake2b___Block___.Header
    issuerVk: VerificationKey
    issuerVrf: IssuerVrfVerificationKey
    nonce: Optional[CertifiedVrf] = None
    leaderValue: CertifiedVrf
    blockSize: BlockSize
    blockHash: Digest_Blake2b___Block___.Body
    opCert: OpCert
    protocolVersion: ProtocolVersion
    signature: IssuerSignature


class RollBackward(BaseModel):
    class Config:
        extra = Extra.forbid

    point: PointOrOrigin
    tip: TipOrOrigin


class ResultItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    RollBackward: RollBackward


class Args(BaseModel):
    class Config:
        extra = Extra.forbid

    points: Optional[List[PointOrOrigin]] = None


class FindIntersect(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type2
    version: Version
    servicename: Servicename
    methodname: Methodname2
    args: Optional[Args] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class IntersectionFound(BaseModel):
    class Config:
        extra = Extra.forbid

    point: PointOrOrigin
    tip: TipOrOrigin


class ResultItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    IntersectionFound: IntersectionFound


class FindIntersectResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type3
    version: Version
    servicename: Servicename
    methodname: Methodname2
    result: Union[ResultItem2, ResultItem3] = Field(
        ...,
        description="Intersection found if any, alongside the cardano-node's current tip.",
    )
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Args3(BaseModel):
    class Config:
        extra = Extra.forbid

    point: PointOrOrigin


class Acquire(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type8
    version: Version
    servicename: Servicename
    methodname: Methodname8
    args: Optional[Args3] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class AcquireSuccess(BaseModel):
    class Config:
        extra = Extra.forbid

    point: PointOrOrigin


class ResultItem6(BaseModel):
    class Config:
        extra = Extra.forbid

    AcquireSuccess: AcquireSuccess


class AcquireResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type9
    version: Version
    servicename: Servicename
    methodname: Methodname8
    result: Union[ResultItem6, ResultItem7]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryItem3(BaseModel):
    class Config:
        extra = Extra.forbid

    utxo: List[TxIn]


class Args6(BaseModel):
    class Config:
        extra = Extra.forbid

    query: Union[
        QueryEnum,
        QueryEnum1,
        QueryEnum2,
        QueryEnum3,
        QueryItem,
        QueryItem1,
        QueryEnum4,
        QueryEnum5,
        QueryEnum6,
        QueryEnum7,
        QueryItem2,
        QueryItem3,
        QueryItem4,
        QueryEnum8,
        QueryEnum9,
        QueryEnum10,
        QueryEnum11,
        QueryItem5,
        QueryEnum12,
        QueryEnum13,
        QueryEnum14,
    ]


class Query(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type22
    version: Version
    servicename: Servicename
    methodname: Methodname22
    args: Optional[Args6] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class QueryResponseEraStart(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[Bound, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseEraSummaries(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[QueryUnavailableInCurrentEra, List[EraSummary]]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseLedgerTip(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[PointOrOrigin, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseDelegationsAndRewards(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[
        Dict[str, DelegationsAndRewards], EraMismatch, QueryUnavailableInCurrentEra
    ]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseRewardsProvenance(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[RewardsProvenanceModel, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponsePoolParameters(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[Dict[str, PoolParameters], EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseBlockHeight(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[BlockNoOrOrigin, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseChainTip(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[PointOrOrigin, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class HeaderModel(BaseModel):
    class Config:
        extra = Extra.forbid

    blockHeight: BlockNo
    slot: Slot
    prevHash: Digest_Blake2b___Block___.Header
    issuerVk: VerificationKey
    issuerVrf: IssuerVrfVerificationKey
    blockSize: BlockSize
    blockHash: Digest_Blake2b___Block___.Body
    opCert: OpCert
    protocolVersion: ProtocolVersion
    signature: IssuerSignature
    vrfInput: CertifiedVrf


class Body2(BaseModel):
    class Config:
        extra = Extra.forbid

    protocolVersion: ProtocolVersion
    softwareVersion: SoftwareVersion
    metadata: Dict[str, str]
    parametersUpdate: ProtocolParametersByron


class ProposalItem(BaseModel):
    class Config:
        extra = Extra.forbid

    body: Body2
    issuer: IssuerVrfVerificationKey
    signature: IssuerSignature


class UpdatePayload(BaseModel):
    class Config:
        extra = Extra.forbid

    proposal: Union[Null, ProposalItem]
    votes: List[Vote]


class Header3(BaseModel):
    class Config:
        extra = Extra.forbid

    blockHeight: BlockNo
    slot: Slot
    prevHash: Digest_Blake2b___Block___.Header
    issuerVk: VerificationKey
    issuerVrf: IssuerVrfVerificationKey
    nonce: Optional[CertifiedVrf] = None
    leaderValue: CertifiedVrf
    blockSize: BlockSize
    blockHash: Digest_Blake2b___Block___.Body
    opCert: OpCert
    protocolVersion: ProtocolVersion
    signature: IssuerSignature


class CertificateItem3(BaseModel):
    class Config:
        extra = Extra.forbid

    poolRegistration: PoolParameters


class Certificate(BaseModel):
    __root__: Union[
        CertificateItem,
        CertificateItem1,
        CertificateItem2,
        CertificateItem3,
        CertificateItem4,
        CertificateItem5,
        CertificateItem6,
    ]


class BlockSignature(BaseModel):
    class Config:
        extra = Extra.forbid

    dlgCertificate: DlgCertificate
    signature: IssuerSignature


class CostModels(BaseModel):
    __root__: Optional[Dict[str, CostModel]] = None


class ScriptFailure(BaseModel):
    __root__: List[
        Union[
            SubmitTxErrorExtraRedeemers,
            SubmitTxErrorMissingRequiredDatums,
            ScriptFailureMissingRequiredScripts,
            ScriptFailureValidatorFailed,
            ScriptFailureUnknownInputReferencedByRedeemer,
            ScriptFailureNonScriptInputReferencedByRedeemer,
            ScriptFailureIllFormedExecutionBudget,
            ScriptFailureNoCostModelForLanguage,
        ]
    ] = Field(
        ..., description="Errors which may occur when evaluating an on-chain script."
    )


class EvaluationResult(BaseModel):
    class Config:
        extra = Extra.forbid

    EvaluationResult: Dict[str, ExUnits]


class GenesisByron(BaseModel):
    class Config:
        extra = Extra.forbid

    genesisKeyHashes: List[DigestBlake2bVerificationKey]
    genesisDelegations: Dict[str, DlgCertificate]
    systemStart: UtcTime
    initialFunds: Dict[str, Lovelace]
    initialCoinOffering: Dict[str, Lovelace]
    securityParameter: UInt64
    networkMagic: NetworkMagic
    protocolParameters: ProtocolParametersByron


class GenesisAlonzo(BaseModel):
    class Config:
        extra = Extra.forbid

    coinsPerUtxoWord: UInt64
    collateralPercentage: UInt64
    costModels: CostModels
    maxCollateralInputs: NullableUInt64
    maxExecutionUnitsPerBlock: ExUnits
    maxExecutionUnitsPerTransaction: ExUnits
    maxValueSize: NullableUInt64
    prices: Prices


class GenesisPools(BaseModel):
    class Config:
        extra = Extra.forbid

    pools: Dict[str, PoolParameters]
    delegators: Dict[str, PoolId]


class ProtocolParametersAlonzo(BaseModel):
    class Config:
        extra = Extra.forbid

    minFeeCoefficient: NullableUInt64
    minFeeConstant: NullableUInt64
    maxBlockBodySize: NullableUInt64
    maxBlockHeaderSize: NullableUInt64
    maxTxSize: NullableUInt64
    stakeKeyDeposit: NullableUInt64
    poolDeposit: NullableUInt64
    poolRetirementEpochBound: NullableUInt64
    desiredNumberOfPools: NullableUInt64
    poolInfluence: NullableRatio
    monetaryExpansion: NullableRatio
    treasuryExpansion: NullableRatio
    decentralizationParameter: NullableRatio
    minPoolCost: NullableUInt64
    coinsPerUtxoWord: NullableUInt64
    maxValueSize: NullableUInt64
    collateralPercentage: NullableUInt64
    maxCollateralInputs: NullableUInt64
    extraEntropy: Union[Nonce, Null]
    protocolVersion: Union[ProtocolVersion, Null]
    costModels: Union[CostModels, Null]
    prices: Union[Prices, Null]
    maxExecutionUnitsPerTransaction: Union[ExUnits, Null]
    maxExecutionUnitsPerBlock: Union[ExUnits, Null]


class ProtocolParametersBabbage(BaseModel):
    class Config:
        extra = Extra.forbid

    minFeeCoefficient: NullableUInt64
    minFeeConstant: NullableUInt64
    maxBlockBodySize: NullableUInt64
    maxBlockHeaderSize: NullableUInt64
    maxTxSize: NullableUInt64
    stakeKeyDeposit: NullableUInt64
    poolDeposit: NullableUInt64
    poolRetirementEpochBound: NullableUInt64
    desiredNumberOfPools: NullableUInt64
    poolInfluence: NullableRatio
    monetaryExpansion: NullableRatio
    treasuryExpansion: NullableRatio
    minPoolCost: NullableUInt64
    coinsPerUtxoByte: NullableUInt64
    maxValueSize: NullableUInt64
    collateralPercentage: NullableUInt64
    maxCollateralInputs: NullableUInt64
    protocolVersion: Union[ProtocolVersion, Null]
    costModels: Union[CostModels, Null]
    prices: Union[Prices, Null]
    maxExecutionUnitsPerTransaction: Union[ExUnits, Null]
    maxExecutionUnitsPerBlock: Union[ExUnits, Null]


class ScriptPurposeItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    certificate: Certificate


class ScriptPurpose(BaseModel):
    __root__: Union[
        ScriptPurposeItem, ScriptPurposeItem1, ScriptPurposeItem2, ScriptPurposeItem3
    ]


class MissingRequiredRedeemers(BaseModel):
    class Config:
        extra = Extra.forbid

    missing: List[Dict[str, ScriptPurpose]]


class SubmitTxErrorMissingRequiredRedeemers(BaseModel):
    class Config:
        extra = Extra.forbid

    missingRequiredRedeemers: MissingRequiredRedeemers


class CollectError(BaseModel):
    class Config:
        extra = Extra.forbid

    noRedeemer: ScriptPurpose


class SubmitTxErrorCollectErrors(BaseModel):
    class Config:
        extra = Extra.forbid

    collectErrors: List[
        Union[CollectError, CollectError1, CollectError2, CollectError3]
    ]


class UpdateAlonzoItem(BaseModel):
    class Config:
        extra = Extra.forbid

    epoch: Epoch
    proposal: Dict[str, ProtocolParametersAlonzo]


class UpdateAlonzo(BaseModel):
    __root__: Union[Null, UpdateAlonzoItem]


class UpdateBabbageItem(BaseModel):
    class Config:
        extra = Extra.forbid

    epoch: Epoch
    proposal: Dict[str, ProtocolParametersBabbage]


class UpdateBabbage(BaseModel):
    __root__: Union[Null, UpdateBabbageItem]


class QueryResponseCurrentProtocolParameters(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[
        ProtocolParametersShelley,
        ProtocolParametersAlonzo,
        ProtocolParametersBabbage,
        EraMismatch,
        QueryUnavailableInCurrentEra,
    ]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseProposedProtocolParameters(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[
        Dict[str, ProtocolParametersShelley],
        Dict[str, ProtocolParametersAlonzo],
        Dict[str, ProtocolParametersBabbage],
        EraMismatch,
        QueryUnavailableInCurrentEra,
    ]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Header1(BaseModel):
    class Config:
        extra = Extra.forbid

    blockHeight: BlockNo
    genesisKey: GenesisVerificationKey
    prevHash: Digest_Blake2b___Block___.Header
    proof: BlockProof
    protocolMagicId: ProtocolMagicId
    protocolVersion: ProtocolVersion
    signature: BlockSignature
    slot: Slot
    softwareVersion: SoftwareVersion


class EvaluationFailureScriptFailures(BaseModel):
    class Config:
        extra = Extra.forbid

    ScriptFailures: Dict[str, ScriptFailure]


class GenesisShelley(BaseModel):
    class Config:
        extra = Extra.forbid

    systemStart: UtcTime
    networkMagic: NetworkMagic
    network: Network
    activeSlotsCoefficient: Ratio
    securityParameter: UInt64
    epochLength: Epoch
    slotsPerKesPeriod: UInt64
    maxKesEvolutions: UInt64
    slotLength: SlotLength
    updateQuorum: UInt64
    maxLovelaceSupply: UInt64
    protocolParameters: ProtocolParametersShelley
    initialDelegates: Dict[str, GenesisDelegate] = Field(..., title="InitialDelegates")
    initialFunds: Dict[str, Lovelace] = Field(..., title="InitialFunds")
    initialPools: GenesisPools


class QueryResponseGenesisConfig(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[
        GenesisByron,
        GenesisShelley,
        GenesisAlonzo,
        EraMismatch,
        QueryUnavailableInCurrentEra,
    ]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class EvaluationFailure(BaseModel):
    class Config:
        extra = Extra.forbid

    EvaluationFailure: Union[
        EvaluationFailureScriptFailures,
        EvaluationFailureIncompatibleEra,
        EvaluationFailureAdditionalUtxoOverlap,
        EvaluationFailureNotEnoughSynced,
        EvaluationFailureCannotCreateEvaluationContext,
    ]


class EvaluateTxResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type7
    version: Version
    servicename: Servicename
    methodname: Methodname6
    result: Union[EvaluationResult, EvaluationFailure]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class RollForward(BaseModel):
    class Config:
        extra = Extra.forbid

    block: Block
    tip: TipOrOrigin


class ResultItem(BaseModel):
    class Config:
        extra = Extra.forbid

    RollForward: RollForward


class RequestNextResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type1
    version: Version
    servicename: Servicename
    methodname: Methodname
    result: Union[ResultItem, ResultItem1]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class ResultItem5(BaseModel):
    class Config:
        extra = Extra.forbid

    SubmitFail: SubmitTxError


class SubmitTxResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type5
    version: Version
    servicename: Servicename
    methodname: Methodname4
    result: Union[ResultItem4, ResultItem5]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Args2(BaseModel):
    class Config:
        extra = Extra.forbid

    evaluate: Union[constr(regex=r"^[A-Za-z0-9]+=?=?$"), constr(regex=r"^[0-9a-f]+$")]
    additionalUtxoSet: Optional[Utxo] = None


class EvaluateTx(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type6
    version: Version
    servicename: Servicename
    methodname: Methodname6
    args: Optional[Args2] = None
    mirror: Optional[Any] = Field(
        None,
        description="An arbitrary JSON value that will be mirrored back in the response.",
    )


class NextTxResponse(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type15
    version: Version
    servicename: Servicename
    methodname: Methodname14
    result: Union[TxId, TxAlonzo, TxBabbage, Null]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class QueryResponseUtxo(BaseModel):
    class Config:
        extra = Extra.forbid

    type: Type23
    version: Version
    servicename: Servicename
    methodname: Methodname22
    result: Union[Utxo, EraMismatch, QueryUnavailableInCurrentEra]
    reflection: Optional[Any] = Field(
        None,
        description="Any value that was set by a client request in the 'mirror' field.",
    )


class Ogmios(BaseModel):
    RequestNext: RequestNext = Field(
        ..., description="Request next block from the current cardano-node's cursor."
    )
    RequestNextResponse: RequestNextResponse = Field(
        ..., description="Request next block from the current cardano-node's cursor."
    )
    FindIntersect: FindIntersect = Field(
        ...,
        description="Ask cardano-node to find an intersection between its local chain and the given points.",
    )
    FindIntersectResponse: FindIntersectResponse
    SubmitTx: SubmitTx = Field(
        ..., description="Submit a signed and serialized transaction to the network."
    )
    SubmitTxResponse: SubmitTxResponse
    EvaluateTx: EvaluateTx = Field(
        ...,
        description="Evaluate execution units for which redeemers's budget hasn't yet been set.",
    )
    EvaluateTxResponse: EvaluateTxResponse
    Acquire: Acquire = Field(
        ..., description="Acquire a point on chain from which run queries."
    )
    AcquireResponse: AcquireResponse = Field(
        ..., description="Response to an 'Acquire' request."
    )
    Release: Release = Field(
        ..., description="Release a point on chain previously acquired."
    )
    ReleaseResponse: ReleaseResponse = Field(
        ..., description="Response to a 'Release' request."
    )
    AwaitAcquire: AwaitAcquire = Field(
        ...,
        description="Acquire a mempool snapshot. This is blocking until a new (i.e different) snapshot is available.",
    )
    AwaitAcquireResponse: AwaitAcquireResponse = Field(
        ..., description="Response to a 'AwaitAcquire' request."
    )
    NextTx: NextTx = Field(
        ..., description="Request the next transaction from an acquired snapshot."
    )
    NextTxResponse: NextTxResponse = Field(
        ..., description="Response to a 'NextTx' request."
    )
    HasTx: HasTx = Field(
        ...,
        description="Ask whether a given transaction is present in the acquired mempool snapshot.",
    )
    HasTxResponse: HasTxResponse = Field(
        ..., description="Response to a 'HasTx' request."
    )
    SizeAndCapacity: SizeAndCapacity = Field(
        ..., description="Get size and capacities of the mempool (acquired snapshot)."
    )
    SizeAndCapacityResponse: SizeAndCapacityResponse = Field(
        ..., description="Response to a 'SizeAndCapacity' request."
    )
    ReleaseMempool: Optional[ReleaseMempool] = Field(
        None, description="Release a previously acquired mempool snapshot."
    )
    ReleaseMempoolResponse: Optional[ReleaseMempoolResponse] = Field(
        None, description="Response to a 'ReleaseMempool' request."
    )
    Query: Query = Field(..., description="Query the ledger / node.")
    QueryResponse_eraStart_: QueryResponseEraStart = Field(
        ..., alias="QueryResponse[eraStart]"
    )
    QueryResponse_eraSummaries_: QueryResponseEraSummaries = Field(
        ..., alias="QueryResponse[eraSummaries]"
    )
    QueryResponse_ledgerTip_: QueryResponseLedgerTip = Field(
        ..., alias="QueryResponse[ledgerTip]"
    )
    QueryResponse_currentEpoch_: QueryResponseCurrentEpoch = Field(
        ..., alias="QueryResponse[currentEpoch]"
    )
    QueryResponse_nonMyopicMemberRewards_: QueryResponseNonMyopicMemberRewards = Field(
        ..., alias="QueryResponse[nonMyopicMemberRewards]"
    )
    QueryResponse_delegationsAndRewards_: QueryResponseDelegationsAndRewards = Field(
        ..., alias="QueryResponse[delegationsAndRewards]"
    )
    QueryResponse_currentProtocolParameters_: QueryResponseCurrentProtocolParameters = (
        Field(..., alias="QueryResponse[currentProtocolParameters]")
    )
    QueryResponse_proposedProtocolParameters_: QueryResponseProposedProtocolParameters = Field(
        ..., alias="QueryResponse[proposedProtocolParameters]"
    )
    QueryResponse_stakeDistribution_: QueryResponseStakeDistribution = Field(
        ..., alias="QueryResponse[stakeDistribution]"
    )
    QueryResponse_utxo_: QueryResponseUtxo = Field(..., alias="QueryResponse[utxo]")
    QueryResponse_genesisConfig_: QueryResponseGenesisConfig = Field(
        ..., alias="QueryResponse[genesisConfig]"
    )
    QueryResponse_rewardsProvenance_: QueryResponseRewardsProvenance = Field(
        ...,
        alias="QueryResponse[rewardsProvenance]",
        description="This query is now deprecated. Use /rewardsProvenance'/ instead.",
    )
    QueryResponse_rewardsProvenance__: QueryResponseRewardsProvenance1 = Field(
        ..., alias="QueryResponse[rewardsProvenance']"
    )
    QueryResponse_poolIds_: QueryResponsePoolIds = Field(
        ..., alias="QueryResponse[poolIds]"
    )
    QueryResponse_poolParameters_: QueryResponsePoolParameters = Field(
        ..., alias="QueryResponse[poolParameters]"
    )
    QueryResponse_poolsRanking_: QueryResponsePoolsRanking = Field(
        ..., alias="QueryResponse[poolsRanking]"
    )
    QueryResponse_blockHeight_: QueryResponseBlockHeight = Field(
        ..., alias="QueryResponse[blockHeight]"
    )
    QueryResponse_chainTip_: QueryResponseChainTip = Field(
        ..., alias="QueryResponse[chainTip]"
    )
    QueryResponse_systemStart_: QueryResponseSystemStart = Field(
        ..., alias="QueryResponse[systemStart]"
    )
    Fault: Fault = Field(
        ...,
        description="A fault in the JSON-WSP protocol. This is returned by the server when a request from clients is deemed invalid or, when the server was unable to reply to a well-formed request.",
        examples=[
            {
                "type": "jsonwsp/fault",
                "version": "1.0",
                "servicename": "ogmios",
                "fault": {
                    "string": "Invalid request: invalid query.",
                    "code": "client",
                },
            }
        ],
    )


class BlockItem(BaseModel):
    class Config:
        extra = Extra.forbid

    babbage: BlockBabbage


class BlockItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    alonzo: BlockAlonzo


class BlockItem2(BaseModel):
    class Config:
        extra = Extra.forbid

    mary: BlockMary


class BlockItem3(BaseModel):
    class Config:
        extra = Extra.forbid

    allegra: BlockAllegra


class BlockItem4(BaseModel):
    class Config:
        extra = Extra.forbid

    shelley: BlockShelley


class BlockItem5(BaseModel):
    class Config:
        extra = Extra.forbid

    byron: BlockByron


class Block(BaseModel):
    __root__: Union[
        BlockItem, BlockItem1, BlockItem2, BlockItem3, BlockItem4, BlockItem5
    ] = Field(
        ...,
        description="A Cardano Block, which can take different forms depending on the era.",
    )


class BlockBabbage(BaseModel):
    class Config:
        extra = Extra.forbid

    body: List[TxBabbage]
    headerHash: Digest_Blake2b___Block___.Header
    header: HeaderModel


class Body(BaseModel):
    class Config:
        extra = Extra.forbid

    inputs: List[TxIn]
    references: List[TxIn]
    collaterals: List[TxIn]
    collateralReturn: Union[TxOut, Null]
    totalCollateral: Union[Lovelace, Null]
    outputs: List[TxOut]
    certificates: List[Certificate]
    withdrawals: Withdrawals
    fee: Lovelace
    validityInterval: ValidityInterval
    update: UpdateBabbage
    mint: Value
    network: Union[Network, Null]
    scriptIntegrityHash: Union[DigestBlake2bScriptIntegrity, Null]
    requiredExtraSignatures: List[DigestBlake2bVerificationKey]


class Witness(BaseModel):
    class Config:
        extra = Extra.forbid

    signatures: Dict[str, Signature]
    scripts: Dict[str, Script]
    bootstrap: List[BootstrapWitness]
    datums: Dict[str, Datum]
    redeemers: Dict[str, Redeemer]


class TxBabbage(BaseModel):
    class Config:
        extra = Extra.forbid

    id: Digest_Blake2b___Block___.Body
    inputSource: InputSource
    body: Body
    witness: Witness
    metadata: Union[AuxiliaryData, Null]
    raw: str = Field(
        ..., description="The raw serialized transaction, as found on-chain."
    )


class AuxiliaryData(BaseModel):
    class Config:
        extra = Extra.forbid

    hash: DigestBlake2bAuxiliaryDataBody
    body: AuxiliaryDataBody


class AuxiliaryDataBody(BaseModel):
    class Config:
        extra = Extra.forbid

    blob: Optional[Metadata] = None
    scripts: Optional[List[Script]] = None


class Metadata(BaseModel):
    __root__: Optional[Dict[str, Metadatum]] = None


class MetadatumItem3(BaseModel):
    class Config:
        extra = Extra.forbid

    list: List[Metadatum]


class MetadatumItem4(BaseModel):
    class Config:
        extra = Extra.forbid

    map: List[MetadatumMap]


class Metadatum(BaseModel):
    __root__: Union[
        MetadatumItem, MetadatumItem1, MetadatumItem2, MetadatumItem3, MetadatumItem4
    ]


class MetadatumMap(BaseModel):
    class Config:
        extra = Extra.forbid

    k: Metadatum
    v: Metadatum


class Body1(BaseModel):
    class Config:
        extra = Extra.forbid

    txPayload: List[TxByron]
    dlgPayload: List[DlgCertificate]
    updatePayload: UpdatePayload


class BlockByronItem(BaseModel):
    class Config:
        extra = Extra.forbid

    hash: Digest_Blake2b___Block___.Header
    header: Header1
    body: Body1


class BlockByron(BaseModel):
    __root__: Union[BlockByronItem, BlockByronItem1] = Field(
        ...,
        description="A block in the Byron era. Most blocks are stanard blocks, but once at the beginning of each era is an additional epoch boundary block (a.k.a. EBB)",
    )


class BlockShelley(BaseModel):
    class Config:
        extra = Extra.forbid

    body: List[TxShelley]
    headerHash: Digest_Blake2b___Block___.Header
    header: Header3


class Body3(BaseModel):
    class Config:
        extra = Extra.forbid

    inputs: List[TxIn]
    outputs: List[TxOut]
    certificates: List[Certificate]
    withdrawals: Withdrawals
    fee: Lovelace
    timeToLive: Slot
    update: UpdateShelley


class Witness1(BaseModel):
    class Config:
        extra = Extra.forbid

    signatures: Dict[str, Signature]
    scripts: Dict[str, Script]
    bootstrap: List[BootstrapWitness]


class TxShelley(BaseModel):
    class Config:
        extra = Extra.forbid

    id: Digest_Blake2b___Block___.Body
    body: Body3
    witness: Witness1
    metadata: Union[AuxiliaryData, Null]
    raw: str = Field(
        ..., description="The raw serialized transaction, as found on-chain."
    )


class BlockAllegra(BaseModel):
    class Config:
        extra = Extra.forbid

    body: List[TxAllegra]
    headerHash: HeaderHash
    header: Header


class Body4(BaseModel):
    class Config:
        extra = Extra.forbid

    inputs: List[TxIn]
    outputs: List[TxOut]
    certificates: List[Certificate]
    withdrawals: Withdrawals
    fee: Lovelace
    validityInterval: ValidityInterval
    update: UpdateShelley


class TxAllegra(BaseModel):
    class Config:
        extra = Extra.forbid

    id: Digest_Blake2b___Block___.Body
    body: Body4
    witness: Witness1
    metadata: Union[AuxiliaryData, Null]
    raw: str = Field(
        ..., description="The raw serialized transaction, as found on-chain."
    )


class TxOut(BaseModel):
    class Config:
        extra = Extra.forbid

    address: Address
    value: Value
    datumHash: Optional[Union[DigestBlake2bDatum, Null]] = None
    datum: Optional[Union[Any, Datum, Null]] = None
    script: Optional[Union[Script, Null]] = None


class BlockMary(BaseModel):
    class Config:
        extra = Extra.forbid

    body: List[TxMary]
    headerHash: HeaderHash
    header: Header


class Body5(BaseModel):
    class Config:
        extra = Extra.forbid

    inputs: List[TxIn]
    outputs: List[TxOut]
    certificates: List[Certificate]
    withdrawals: Withdrawals
    fee: Lovelace
    validityInterval: ValidityInterval
    update: UpdateShelley
    mint: Value


class TxMary(BaseModel):
    class Config:
        extra = Extra.forbid

    id: Digest_Blake2b___Block___.Body
    body: Body5
    witness: Witness1
    metadata: Union[AuxiliaryData, Null]
    raw: str = Field(
        ..., description="The raw serialized transaction, as found on-chain."
    )


class BlockAlonzo(BaseModel):
    class Config:
        extra = Extra.forbid

    body: List[TxAlonzo]
    headerHash: HeaderHash
    header: Header


class Body6(BaseModel):
    class Config:
        extra = Extra.forbid

    inputs: List[TxIn]
    collaterals: List[TxIn]
    outputs: List[TxOut]
    certificates: List[Certificate]
    withdrawals: Withdrawals
    fee: Lovelace
    validityInterval: ValidityInterval
    update: UpdateAlonzo
    mint: Value
    network: Union[Network, Null]
    scriptIntegrityHash: Union[DigestBlake2bScriptIntegrity, Null]
    requiredExtraSignatures: List[DigestBlake2bVerificationKey]


class Witness4(BaseModel):
    class Config:
        extra = Extra.forbid

    signatures: Dict[str, Signature]
    scripts: Dict[str, Script]
    bootstrap: List[BootstrapWitness]
    datums: Dict[str, Datum]
    redeemers: Dict[str, Redeemer]


class TxAlonzo(BaseModel):
    class Config:
        extra = Extra.forbid

    id: Digest_Blake2b___Block___.Body
    inputSource: InputSource
    body: Body6
    witness: Witness4
    metadata: Union[AuxiliaryData, Null]
    raw: str = Field(
        ..., description="The raw serialized transaction, as found on-chain."
    )


class ScriptItem(BaseModel):
    class Config:
        extra = Extra.forbid

    native: ScriptNative


class Script(BaseModel):
    __root__: Union[ScriptItem, ScriptItem1, ScriptItem2]


class ScriptNativeItem(BaseModel):
    class Config:
        extra = Extra.forbid

    any: List[ScriptNative]


class ScriptNativeItem1(BaseModel):
    class Config:
        extra = Extra.forbid

    all: List[ScriptNative]


class ScriptNative(BaseModel):
    __root__: Union[
        DigestBlake2bVerificationKey,
        ScriptNativeItem,
        ScriptNativeItem1,
        Dict[str, List[ScriptNative]],
        ScriptNativeItem2,
        ScriptNativeItem3,
    ] = Field(
        ...,
        description="A phase-1 monetary script. Timelocks constraints are only supported since Allegra.",
        examples=[
            "3c07030e36bfff7cd2f004356ef320f3fe3c07030e7cd2f004356437",
            {
                "all": [
                    "ec09e5293d384637cd2f004356ef320f3fe3c07030e36bfffe67e2e2",
                    "3c07030e36bfff7cd2f004356ef320f3fe3c07030e7cd2f004356437",
                ]
            },
        ],
    )


class SubmitTxError(BaseModel):
    __root__: List[
        Union[
            EraMismatch,
            SubmitTxErrorInvalidWitnesses,
            SubmitTxErrorMissingVkWitnesses,
            SubmitTxErrorMissingScriptWitnesses,
            SubmitTxErrorScriptWitnessNotValidating,
            SubmitTxErrorInsufficientGenesisSignatures,
            SubmitTxErrorMissingTxMetadata,
            SubmitTxErrorMissingTxMetadataHash,
            SubmitTxErrorTxMetadataHashMismatch,
            SubmitTxErrorBadInputs,
            SubmitTxErrorExpiredUtxo,
            SubmitTxErrorOutsideOfValidityInterval,
            SubmitTxErrorTxTooLarge,
            SubmitTxErrorMissingAtLeastOneInputUtxo,
            SubmitTxErrorInvalidMetadata,
            SubmitTxErrorFeeTooSmall,
            SubmitTxErrorValueNotConserved,
            SubmitTxErrorNetworkMismatch,
            SubmitTxErrorOutputTooSmall,
            SubmitTxErrorTooManyAssetsInOutput,
            SubmitTxErrorAddressAttributesTooLarge,
            SubmitTxErrorTriesToForgeAda,
            SubmitTxErrorDelegateNotRegistered,
            SubmitTxErrorUnknownOrIncompleteWithdrawals,
            SubmitTxErrorStakePoolNotRegistered,
            SubmitTxErrorWrongRetirementEpoch,
            SubmitTxErrorWrongPoolCertificate,
            SubmitTxErrorStakeKeyAlreadyRegistered,
            SubmitTxErrorPoolCostTooSmall,
            SubmitTxErrorPoolMetadataHashTooBig,
            SubmitTxErrorStakeKeyNotRegistered,
            SubmitTxErrorRewardAccountNotExisting,
            SubmitTxErrorRewardAccountNotEmpty,
            SubmitTxErrorWrongCertificateType,
            SubmitTxErrorUnknownGenesisKey,
            SubmitTxErrorAlreadyDelegating,
            SubmitTxErrorInsufficientFundsForMir,
            SubmitTxErrorTooLateForMir,
            SubmitTxErrorMirTransferNotCurrentlyAllowed,
            SubmitTxErrorMirNegativeTransferNotCurrentlyAllowed,
            SubmitTxErrorMirProducesNegativeUpdate,
            SubmitTxErrorDuplicateGenesisVrf,
            SubmitTxErrorNonGenesisVoters,
            SubmitTxErrorUpdateWrongEpoch,
            SubmitTxErrorProtocolVersionCannotFollow,
            SubmitTxErrorMissingRequiredRedeemers,
            SubmitTxErrorMissingRequiredDatums,
            SubmitTxErrorUnspendableDatums,
            SubmitTxErrorExtraDataMismatch,
            SubmitTxErrorMissingRequiredSignatures,
            SubmitTxErrorUnspendableScriptInputs,
            SubmitTxErrorExtraRedeemers,
            SubmitTxErrorMissingDatumHashesForInputs,
            SubmitTxErrorMissingCollateralInputs,
            SubmitTxErrorCollateralTooSmall,
            SubmitTxErrorCollateralIsScript,
            SubmitTxErrorCollateralHasNonAdaAssets,
            SubmitTxErrorTooManyCollateralInputs,
            SubmitTxErrorExecutionUnitsTooLarge,
            SubmitTxErrorOutsideForecast,
            SubmitTxErrorValidationTagMismatch,
            SubmitTxErrorCollectErrors,
            SubmitTxErrorExtraScriptWitnesses,
            SubmitTxErrorMirNegativeTransfer,
            SubmitTxErrorTotalCollateralMismatch,
            SubmitTxErrorMalformedReferenceScripts,
            SubmitTxErrorMalformedScriptWitnesses,
        ]
    ]


class OutputTooSmallItem(BaseModel):
    class Config:
        extra = Extra.forbid

    output: TxOut
    minimumRequiredValue: Lovelace


class SubmitTxErrorOutputTooSmall(BaseModel):
    class Config:
        extra = Extra.forbid

    outputTooSmall: List[Union[TxOut, OutputTooSmallItem]]


class SubmitTxErrorTooManyAssetsInOutput(BaseModel):
    class Config:
        extra = Extra.forbid

    tooManyAssetsInOutput: List[TxOut]


class SubmitTxErrorCollateralIsScript(BaseModel):
    class Config:
        extra = Extra.forbid

    collateralIsScript: Utxo


class Utxo(BaseModel):
    __root__: List[List[Union[TxIn, TxOut]]]


class Body7(BaseModel):
    class Config:
        extra = Extra.forbid

    inputs: List[TxIn]
    outputs: List[TxOut]


class TxByron(BaseModel):
    class Config:
        extra = Extra.forbid

    id: TxId
    body: Body7
    witness: List[TxWitness]
    raw: str = Field(
        ..., description="The raw serialized transaction, as found on-chain."
    )


RollForward.update_forward_refs()
ResultItem5.update_forward_refs()
Args2.update_forward_refs()
NextTxResponse.update_forward_refs()
QueryResponseUtxo.update_forward_refs()
BlockItem.update_forward_refs()
BlockItem1.update_forward_refs()
BlockItem2.update_forward_refs()
BlockItem3.update_forward_refs()
BlockItem4.update_forward_refs()
BlockItem5.update_forward_refs()
BlockBabbage.update_forward_refs()
Body.update_forward_refs()
Witness.update_forward_refs()
TxBabbage.update_forward_refs()
AuxiliaryData.update_forward_refs()
AuxiliaryDataBody.update_forward_refs()
Metadata.update_forward_refs()
MetadatumItem3.update_forward_refs()
MetadatumItem4.update_forward_refs()
Body1.update_forward_refs()
BlockShelley.update_forward_refs()
Body3.update_forward_refs()
Witness1.update_forward_refs()
BlockAllegra.update_forward_refs()
Body4.update_forward_refs()
TxOut.update_forward_refs()
BlockMary.update_forward_refs()
BlockAlonzo.update_forward_refs()
Witness4.update_forward_refs()
ScriptItem.update_forward_refs()
ScriptNativeItem.update_forward_refs()
ScriptNativeItem1.update_forward_refs()
SubmitTxError.update_forward_refs()
SubmitTxErrorCollateralIsScript.update_forward_refs()
