# generated by datamodel-codegen:
#   filename:  ogmios.json
#   timestamp: 2023-10-18T20:09:35+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


class Jsonrpc(Enum):
    field_2_0 = '2.0'


class Method(Enum):
    findIntersection = 'findIntersection'


class Code(Enum):
    integer_1000 = 1000


class Code1(Enum):
    integer_1001 = 1001


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

    code: Code1
    message: str


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

    jsonrpc: Jsonrpc
    method: Method
    error: Error1 = Field(
        ...,
        description="An internal error indicating that requests were interleaved in an unexpected way. Shouldn't ever happen.",
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Method4(Enum):
    nextBlock = 'nextBlock'


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

    jsonrpc: Jsonrpc
    method: Method4
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Direction(Enum):
    forward = 'forward'


class Direction1(Enum):
    backward = 'backward'


class Method6(Enum):
    submitTransaction = 'submitTransaction'


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

    cbor: constr(regex=r'^[0-9a-f]+$') = Field(
        ..., description='CBOR-serialized signed transaction (base16)'
    )


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

    transaction: Transaction


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

    jsonrpc: Jsonrpc
    method: Method6
    params: Params1
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method10(Enum):
    evaluateTransaction = 'evaluateTransaction'


class Method14(Enum):
    acquireLedgerState = 'acquireLedgerState'


class Code2(Enum):
    integer_2000 = 2000


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

    code: Code2
    message: str
    data: str = Field(..., description='A reason for the failure.')


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

    jsonrpc: Jsonrpc
    method: Method14
    error: Error2 = Field(
        ..., description='Unable to acquire the ledger state at the request point.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Acquired(Enum):
    ledgerState = 'ledgerState'


class Method17(Enum):
    releaseLedgerState = 'releaseLedgerState'


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

    jsonrpc: Jsonrpc
    method: Method17
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Released(Enum):
    ledgerState = 'ledgerState'


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

    released: Released


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

    jsonrpc: Jsonrpc
    method: Method17
    result: Result3
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Method19(Enum):
    queryLedgerState_epoch = 'queryLedgerState/epoch'
    queryLedgerState_eraStart = 'queryLedgerState/eraStart'
    queryLedgerState_eraSummaries = 'queryLedgerState/eraSummaries'
    queryLedgerState_liveStakeDistribution = 'queryLedgerState/liveStakeDistribution'
    queryLedgerState_projectedRewards = 'queryLedgerState/projectedRewards'
    queryLedgerState_protocolParameters = 'queryLedgerState/protocolParameters'
    queryLedgerState_proposedProtocolParameters = 'queryLedgerState/proposedProtocolParameters'
    queryLedgerState_rewardAccountSummaries = 'queryLedgerState/rewardAccountSummaries'
    queryLedgerState_rewardsProvenance = 'queryLedgerState/rewardsProvenance'
    queryLedgerState_stakePools = 'queryLedgerState/stakePools'
    queryLedgerState_utxo = 'queryLedgerState/utxo'
    queryLedgerState_tip = 'queryLedgerState/tip'


class Code3(Enum):
    integer_2001 = 2001


class Code4(Enum):
    integer_2002 = 2002


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

    code: Code4
    message: str


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

    jsonrpc: Jsonrpc
    method: Method19
    error: Error4 = Field(
        ..., description='Some query is not available for the requested ledger era.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Code5(Enum):
    integer_2003 = 2003


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

    code: Code5
    message: str
    data: str = Field(..., description='A reason for the failure.')


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

    jsonrpc: Jsonrpc
    method: Method19
    error: Error5 = Field(
        ..., description='Previously acquired ledger state is no longer available.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Method22(Enum):
    queryLedgerState_epoch = 'queryLedgerState/epoch'


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

    jsonrpc: Jsonrpc
    method: Method22
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method24(Enum):
    queryLedgerState_eraStart = 'queryLedgerState/eraStart'


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

    jsonrpc: Jsonrpc
    method: Method24
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method26(Enum):
    queryLedgerState_eraSummaries = 'queryLedgerState/eraSummaries'


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

    jsonrpc: Jsonrpc
    method: Method26
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method28(Enum):
    queryLedgerState_liveStakeDistribution = 'queryLedgerState/liveStakeDistribution'


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

    jsonrpc: Jsonrpc
    method: Method28
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method30(Enum):
    queryLedgerState_projectedRewards = 'queryLedgerState/projectedRewards'


class Method32(Enum):
    queryLedgerState_proposedProtocolParameters = 'queryLedgerState/proposedProtocolParameters'


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

    jsonrpc: Jsonrpc
    method: Method32
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method34(Enum):
    queryLedgerState_protocolParameters = 'queryLedgerState/protocolParameters'


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

    jsonrpc: Jsonrpc
    method: Method34
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method36(Enum):
    queryLedgerState_rewardAccountSummaries = 'queryLedgerState/rewardAccountSummaries'


class Method38(Enum):
    queryLedgerState_rewardsProvenance = 'queryLedgerState/rewardsProvenance'


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

    jsonrpc: Jsonrpc
    method: Method38
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method40(Enum):
    queryLedgerState_stakePools = 'queryLedgerState/stakePools'


class Method42(Enum):
    queryLedgerState_tip = 'queryLedgerState/tip'


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

    jsonrpc: Jsonrpc
    method: Method42
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method44(Enum):
    queryLedgerState_utxo = 'queryLedgerState/utxo'


class Method46(Enum):
    queryNetwork_blockHeight = 'queryNetwork/blockHeight'


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

    jsonrpc: Jsonrpc
    method: Method46
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method48(Enum):
    queryNetwork_genesisConfiguration = 'queryNetwork/genesisConfiguration'


class Method50(Enum):
    queryNetwork_startTime = 'queryNetwork/startTime'


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

    jsonrpc: Jsonrpc
    method: Method50
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method52(Enum):
    queryNetwork_tip = 'queryNetwork/tip'


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

    jsonrpc: Jsonrpc
    method: Method52
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method54(Enum):
    acquireMempool = 'acquireMempool'


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

    jsonrpc: Jsonrpc
    method: Method54
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Acquired1(Enum):
    mempool = 'mempool'


class Method56(Enum):
    nextTransaction = 'nextTransaction'


class Fields(Enum):
    all = 'all'


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

    fields: Optional[Fields] = None


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

    jsonrpc: Jsonrpc
    method: Method56
    params: Optional[Params8] = None
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method57(Enum):
    hasTransaction = 'hasTransaction'
    nextTransaction = 'nextTransaction'
    sizeOfMempool = 'sizeOfMempool'
    releaseMempool = 'releaseMempool'


class Code6(Enum):
    integer_4000 = 4000


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

    code: Code6
    message: str


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

    jsonrpc: Jsonrpc
    method: Method57
    error: Error6 = Field(
        ..., description='Must acquire a mempool snapshot prior to performing any query.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Method58(Enum):
    nextTransaction = 'nextTransaction'


class Method59(Enum):
    hasTransaction = 'hasTransaction'


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

    jsonrpc: Jsonrpc
    method: Method59
    result: bool
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Method61(Enum):
    sizeOfMempool = 'sizeOfMempool'


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

    jsonrpc: Jsonrpc
    method: Method61
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Method63(Enum):
    releaseMempool = 'releaseMempool'


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

    jsonrpc: Jsonrpc
    method: Method63
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


class Released1(Enum):
    mempool = 'mempool'


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

    released: Released1


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

    jsonrpc: Jsonrpc
    method: Method63
    result: Result6
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    code: conint(ge=-32700, le=-32000) = Field(
        ..., description='An error code telling about the nature of the error.'
    )
    message: Optional[str] = Field(
        None, description='A descriptive error message giving hints about the error.'
    )
    data: Optional[Any] = Field(
        None,
        description='Some optional data / context about the error. The exact type of this (optional) field depends on the error.',
    )


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

    jsonrpc: Jsonrpc
    error: Error7
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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


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',
        ],
        title='Address',
    )


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


class DigestAny(BaseModel):
    __root__: str = Field(
        ...,
        description='A hash digest from an unspecified algorithm and length.',
        examples=['90181c517a5beadc9c3fe64bf8'],
        title='Digest<Any>',
    )


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


class Assets(BaseModel):
    __root__: Optional[Dict[str, Dict[str, AssetQuantity]]] = None


class Type(Enum):
    ebb = 'ebb'


class Era(Enum):
    byron = 'byron'


class DigestBlake2b256(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description='A Blake2b 32-byte hash digest, encoded in base16.',
        examples=['c248757d390181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d'],
        title='Digest<Blake2b, 256>',
    )


class Type1(Enum):
    bft = 'bft'


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


class Type2(Enum):
    praos = 'praos'


class Era2(Enum):
    shelley = 'shelley'
    allegra = 'allegra'
    mary = 'mary'
    alonzo = 'alonzo'
    babbage = 'babbage'


class AncestorEnum(Enum):
    genesis = 'genesis'


class VrfProof(BaseModel):
    __root__: str = Field(..., title='VrfProof')


class UInt32(BaseModel):
    __root__: conint(ge=0, le=4294967295) = Field(..., title='UInt32')


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


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


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'],
        title='Ratio',
    )


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

    verificationKey: VerificationKey


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

    id: DigestBlake2b256


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

    voter: Voter
    proposal: Proposal1


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

    seconds: int


class Type3(Enum):
    stakeDelegation = 'stakeDelegation'


class Type4(Enum):
    stakeCredentialRegistration = 'stakeCredentialRegistration'


class Type5(Enum):
    stakeCredentialDeregistration = 'stakeCredentialDeregistration'


class Type6(Enum):
    stakePoolRegistration = 'stakePoolRegistration'


class Type7(Enum):
    stakePoolRetirement = 'stakePoolRetirement'


class Type8(Enum):
    genesisDelegation = 'genesisDelegation'


class Type9(Enum):
    constitutionalCommitteeHotKeyRegistration = 'constitutionalCommitteeHotKeyRegistration'


class Type10(Enum):
    constitutionalCommitteeRetirement = 'constitutionalCommitteeRetirement'


class Type11(Enum):
    delegateRepresentativeRegistration = 'delegateRepresentativeRegistration'


class Type12(Enum):
    delegateRepresentativeRetirement = 'delegateRepresentativeRetirement'


class DigestBlake2b224(BaseModel):
    __root__: constr(min_length=56, max_length=56) = Field(
        ...,
        description='A Blake2b 28-byte hash digest, encoded in base16.',
        examples=['90181c517a5beadc9c3fe64bf821d3e889a963fc717003ec248757d3'],
        title='Digest<Blake2b, 224>',
    )


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


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

    id: DigestBlake2b224


class Int64(BaseModel):
    __root__: conint(ge=-9223372036854775808, le=9223372036854775807) = Field(..., title='Int64')


class Datum(BaseModel):
    __root__: str = Field(..., title='Datum')


class Type13(Enum):
    registered = 'registered'


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

    id: DigestBlake2b224
    type: Type13


class Type14(Enum):
    noConfidence = 'noConfidence'


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

    type: Type14 = Field(
        ...,
        description='A special delegate representative which always vote no, except on votes of no-confidence.',
    )


class Type15(Enum):
    abstain = 'abstain'


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

    type: Type15 = Field(..., description='A special delegate representative which always abstain.')


class DelegateRepresentative(BaseModel):
    __root__: Union[
        DelegateRepresentativeItem, DelegateRepresentativeItem1, DelegateRepresentativeItem2
    ] = Field(..., title='DelegateRepresentative')


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


class Era3(Enum):
    byron = 'byron'
    shelley = 'shelley'
    allegra = 'allegra'
    mary = 'mary'
    alonzo = 'alonzo'
    babbage = 'babbage'
    conway = 'conway'


class EraWithGenesis(Enum):
    byron = 'byron'
    shelley = 'shelley'
    alonzo = 'alonzo'
    conway = 'conway'


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

    milliseconds: int


class UInt64(BaseModel):
    __root__: conint(ge=0, le=18446744073709552999) = Field(..., title='UInt64')


class Era4(Enum):
    byron = 'byron'


class UtcTime(BaseModel):
    __root__: datetime = Field(..., title='UtcTime')


class Era5(Enum):
    shelley = 'shelley'


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


class Era6(Enum):
    alonzo = 'alonzo'


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

    bytes: Int64


class Era7(Enum):
    conway = 'conway'


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

    id: DigestBlake2b224


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

    id: DigestBlake2b224
    vrfVerificationKeyHash: DigestBlake2b256


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


class Type16(Enum):
    protocolParametersUpdate = 'protocolParametersUpdate'


class Type17(Enum):
    hardForkInitiation = 'hardForkInitiation'


class Type18(Enum):
    treasuryTransfer = 'treasuryTransfer'


class Source(Enum):
    reserves = 'reserves'
    treasury = 'treasury'


class Target(Enum):
    reserves = 'reserves'
    treasury = 'treasury'


class Type19(Enum):
    treasuryWithdrawals = 'treasuryWithdrawals'


class Type20(Enum):
    constitutionalCommittee = 'constitutionalCommittee'


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

    type: Type20
    members: ConstitutionalCommitteeMember
    quorum: Ratio


class Type21(Enum):
    constitution = 'constitution'


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

    type: Type21
    hash: DigestBlake2b256


class Type22(Enum):
    noConfidence = 'noConfidence'


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

    type: Type22


class Type23(Enum):
    information = 'information'


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

    type: Type23


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

    lovelace: int = Field(..., description='A number of lovelace, possibly large when summed up.')


class TransactionId(BaseModel):
    __root__: constr(min_length=64, max_length=64) = Field(
        ...,
        description='A Blake2b 32-byte hash digest of a transaction body',
        title='TransactionId',
    )


class Vote(Enum):
    yes = 'yes'
    no = 'no'
    abstain = 'abstain'


class Role(Enum):
    genesisDelegate = 'genesisDelegate'


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

    role: Role
    id: DigestBlake2b224


class Role1(Enum):
    constitutionalCommittee = 'constitutionalCommittee'


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

    role: Role1
    id: DigestBlake2b224


class Role2(Enum):
    delegateRepresentative = 'delegateRepresentative'


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

    role: Role2
    id: DigestBlake2b224


class Role3(Enum):
    stakePoolOperator = 'stakePoolOperator'


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

    role: Role3
    id: StakePoolId


class GovernanceVoter(BaseModel):
    __root__: Union[
        GovernanceVoterItem, GovernanceVoterItem1, GovernanceVoterItem2, GovernanceVoterItem3
    ]


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


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


class Language(Enum):
    plutus_v1 = 'plutus:v1'
    plutus_v2 = 'plutus:v2'
    plutus_v3 = 'plutus:v3'


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

    lovelace: conint(ge=-9223372036854775808, le=9223372036854775807) = Field(
        ..., description='An amount, possibly negative, in Lovelace (1e6 Lovelace = 1 Ada).'
    )


class KesVerificationKey(BaseModel):
    __root__: str = Field(..., title='KesVerificationKey')


class Metadatum(BaseModel):
    __root__: Union[int, str, List[Metadatum], Dict[str, Metadatum]] = Field(..., title='Metadatum')


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


class NonceEnum(Enum):
    neutral = 'neutral'


class Nonce(BaseModel):
    __root__: Union[NonceEnum, DigestBlake2b256] = Field(..., title='Nonce')


class Null(BaseModel):
    __root__: None


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

    period: UInt64
    verificationKey: KesVerificationKey


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

    count: UInt64
    kes: Kes


class Origin(Enum):
    origin = 'origin'


class PolicyId(BaseModel):
    __root__: DigestBlake2b224 = Field(..., title='PolicyId')


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

    memory: Ratio
    cpu: Ratio


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


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


class Type24(Enum):
    ipAddress = 'ipAddress'


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

    type: Type24
    ipv4: Optional[str] = None
    ipv6: Optional[str] = None
    port: Optional[conint(ge=0, le=65535)] = None


class Type25(Enum):
    hostname = 'hostname'


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

    type: Type25
    hostname: str
    port: Optional[conint(ge=0, le=65535)] = None


class Relay(BaseModel):
    __root__: Union[RelayItem, RelayItem1] = Field(..., title='Relay')


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'],
        title='RewardAccount',
    )


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


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.',
        title='SafeZone',
    )


class Language1(Enum):
    native = 'native'


class Language2(Enum):
    plutus_v1 = 'plutus:v1'
    plutus_v2 = 'plutus:v2'
    plutus_v3 = 'plutus:v3'


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

    language: Language2
    cbor: str


class Clause(Enum):
    signature = 'signature'


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

    clause: Clause
    from_: DigestBlake2b224 = Field(..., alias='from')


class Clause1(Enum):
    any = 'any'


class Clause2(Enum):
    all = 'all'


class Clause3(Enum):
    some = 'some'


class Clause4(Enum):
    before = 'before'


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

    clause: Clause4
    slot: Slot


class Clause5(Enum):
    after = 'after'


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

    clause: Clause5
    slot: Slot


class Purpose(Enum):
    spend = 'spend'


class Purpose1(Enum):
    mint = 'mint'


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

    purpose: Purpose1
    policy: PolicyId


class Purpose2(Enum):
    publish = 'publish'


class Purpose3(Enum):
    withdraw = 'withdraw'


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

    purpose: Purpose3
    rewardAccount: RewardAccount


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

    id: TransactionId


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

    transaction: Transaction4
    index: UInt32


class Signature(BaseModel):
    __root__: constr(min_length=128, max_length=128) = Field(
        ..., description='An EdDSA signature.', title='Signature'
    )


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

    key: VerificationKey
    signature: Signature
    chainCode: Optional[ChainCode] = None
    addressAttributes: Optional[AddressAttributes] = None


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

    appName: str
    number: UInt32


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'],
        title='StakeAddress',
    )


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

    slot: Slot
    id: DigestBlake2b256
    height: BlockHeight


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

    lovelace: int


class Value(BaseModel):
    ada: Ada


class UInt8(BaseModel):
    __root__: conint(ge=0, le=255) = Field(..., title='UInt8')


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

    invalidBefore: Optional[Slot] = None
    invalidAfter: Optional[Slot] = None


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


class VrfOutput(BaseModel):
    __root__: str = Field(..., title='VrfOutput')


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


class AnyStakeCredential(BaseModel):
    __root__: Union[
        constr(min_length=56, max_length=56),
        constr(regex=r'^(stake_vkh|script)1[0-9a-z]*$'),
        StakeAddress,
    ] = Field(..., title='AnyStakeCredential')


class Code7(Enum):
    integer__32602 = -32602


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

    shelley: str
    allegra: str
    mary: str
    alonzo: str
    babbage: str
    conway: str


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

    code: Code7
    message: str
    data: Data1


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

    queryEra: Era3
    ledgerEra: Era3


class Code8(Enum):
    integer_3000 = 3000


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

    incompatibleEra: Era3


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

    code: Code8
    message: str
    data: Data2 = Field(..., description='The era in which the transaction has been identified.')


class Code9(Enum):
    integer_3001 = 3001


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

    unsupportedEra: Era3


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

    code: Code9
    message: str
    data: Data3 = Field(..., description='The era in which the transaction has been identified.')


class Code10(Enum):
    integer_3002 = 3002


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

    overlappingOutputReferences: List[TransactionOutputReference]


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

    code: Code10
    message: str
    data: Data4


class Code11(Enum):
    integer_3003 = 3003


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

    minimumRequiredEra: Era3
    currentNodeEra: Era3


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

    code: Code11
    message: str
    data: Data5


class Code12(Enum):
    integer_3004 = 3004


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

    reason: str


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

    code: Code12
    message: str
    data: Data6


class Code13(Enum):
    integer_3010 = 3010


class Code14(Enum):
    integer_3011 = 3011


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

    missingScripts: List[RedeemerPointer]


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

    code: Code14
    message: str
    data: Data7


class Code15(Enum):
    integer_3012 = 3012


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

    validationError: str
    traces: List[str]


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

    code: Code15
    message: str
    data: Data8


class Code16(Enum):
    integer_3013 = 3013


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

    unsuitableOutputReference: TransactionOutputReference


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

    code: Code16
    message: str
    data: Data9


class Code17(Enum):
    integer_3110 = 3110


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

    extraneousRedeemers: List[RedeemerPointer]


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

    code: Code17
    message: str
    data: Data10


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

    stake: Ratio
    vrf: DigestBlake2b256


class LiveStakeDistribution(BaseModel):
    __root__: Optional[Dict[str, LiveStakeDistribution1]] = None


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

    count: UInt32


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

    maxCapacity: NumberOfBytes
    currentSize: NumberOfBytes
    transactions: Transactions


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


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

    id: StakePoolId


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

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


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

    lovelace: int


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

    lovelace: int


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

    cost: Lovelace
    margin: Ratio
    pledge: Lovelace


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

    id: StakePoolId
    stake: Lovelace
    ownerStake: Lovelace
    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.',
    )
    parameters: Parameters = Field(
        ..., description='Some of the pool parameters relevant for the reward calculation.'
    )


class Code18(Enum):
    integer_3005 = 3005


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

    code: Code18
    message: str
    data: EraMismatch


class Code19(Enum):
    integer_3100 = 3100


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

    invalidSignatories: List[VerificationKey]


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

    code: Code19
    message: str
    data: Data11


class Code20(Enum):
    integer_3101 = 3101


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

    missingSignatories: List[DigestBlake2b224]


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

    code: Code20
    message: str
    data: Data12


class Code21(Enum):
    integer_3102 = 3102


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

    missingScripts: List[DigestBlake2b224]


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

    code: Code21
    message: str
    data: Data13


class Code22(Enum):
    integer_3103 = 3103


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

    failingNativeScripts: List[DigestBlake2b224]


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

    code: Code22
    message: str
    data: Data14


class Code23(Enum):
    integer_3104 = 3104


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

    extraneousScripts: List[DigestBlake2b224]


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

    code: Code23
    message: str
    data: Data15


class Code24(Enum):
    integer_3105 = 3105


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

    hash: DigestBlake2b256


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

    metadata: Metadata1


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

    code: Code24
    message: str
    data: Data16


class Code25(Enum):
    integer_3106 = 3106


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

    metadata: Metadata1


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

    code: Code25
    message: str
    data: Data17


class Code26(Enum):
    integer_3107 = 3107


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

    hash: DigestBlake2b256


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

    hash: DigestBlake2b256


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

    provided: Provided
    computed: Computed


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

    code: Code26
    message: str
    data: Data18


class Code27(Enum):
    integer_3108 = 3108


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

    code: Code27
    message: str


class Code28(Enum):
    integer_3109 = 3109


class Code29(Enum):
    integer_3112 = 3112


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

    extraneousDatums: List[DigestBlake2b256]


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

    code: Code29
    message: str
    data: Data20


class Code30(Enum):
    integer_3113 = 3113


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

    providedScriptIntegrity: Union[DigestBlake2b256, Null]
    computedScriptIntegrity: Union[DigestBlake2b256, Null]


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

    code: Code30
    message: str
    data: Data21


class Code31(Enum):
    integer_3114 = 3114


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

    orphanInputs: Optional[List[TransactionOutputReference]] = None


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

    code: Code31
    message: str
    data: Data22


class Code32(Enum):
    integer_3116 = 3116


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

    malformedScripts: List[DigestBlake2b224]


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

    code: Code32
    message: str
    data: Data23


class Code33(Enum):
    integer_3118 = 3118


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

    validityInterval: ValidityInterval
    currentSlot: Slot


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

    code: Code33
    message: str
    data: Data24


class Code34(Enum):
    integer_3119 = 3119


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

    measuredTransactionSize: NumberOfBytes
    maximumTransactionSize: NumberOfBytes


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

    code: Code34
    message: str
    data: Data25


class Code35(Enum):
    integer_3120 = 3120


class Code36(Enum):
    integer_3121 = 3121


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

    code: Code36
    message: str


class Code37(Enum):
    integer_3122 = 3122


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

    minimumRequiredFee: Lovelace
    providedFee: Lovelace


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

    code: Code37
    message: str
    data: Data27


class Code38(Enum):
    integer_3123 = 3123


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

    valueConsumed: Value
    valueProduced: Value


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

    code: Code38
    message: str
    data: Data28


class Code39(Enum):
    integer_3124 = 3124


class DiscriminatedType(Enum):
    address = 'address'


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

    expectedNetwork: Network
    discriminatedType: DiscriminatedType
    invalidEntities: List[Address]


class DiscriminatedType1(Enum):
    rewardAccount = 'rewardAccount'


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

    expectedNetwork: Network
    discriminatedType: DiscriminatedType1
    invalidEntities: List[RewardAccount]


class DiscriminatedType2(Enum):
    stakePoolCertificate = 'stakePoolCertificate'


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

    expectedNetwork: Network
    discriminatedType: DiscriminatedType2
    invalidEntities: List[StakePoolId]


class DiscriminatedType3(Enum):
    transaction = 'transaction'


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

    expectedNetwork: Network
    discriminatedType: DiscriminatedType3


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

    code: Code39
    message: str
    data: Union[Datum2, Datum3, Datum4, Datum5]


class Code40(Enum):
    integer_3125 = 3125


class Code41(Enum):
    integer_3126 = 3126


class Code42(Enum):
    integer_3127 = 3127


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

    code: Code42
    message: str


class Code43(Enum):
    integer_3128 = 3128


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

    providedCollateral: Lovelace
    minimumRequiredCollateral: Lovelace


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

    code: Code43
    message: str
    data: Data31


class Code44(Enum):
    integer_3129 = 3129


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

    unsuitableCollateralInputs: List[TransactionOutputReference]


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

    code: Code44
    message: str
    data: Data32


class Code45(Enum):
    integer_3130 = 3130


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

    unforeseeableSlot: Slot


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

    code: Code45
    message: str
    data: Data33


class Code46(Enum):
    integer_3131 = 3131


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

    maximumCollateralInputs: UInt32
    countedCollateralInputs: UInt32


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

    code: Code46
    message: str
    data: Data34


class Code47(Enum):
    integer_3132 = 3132


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

    code: Code47
    message: str


class Code48(Enum):
    integer_3133 = 3133


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

    unsuitableCollateralValue_: Optional[Value] = Field(None, alias="unsuitableCollateralValue'")


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

    code: Code48
    message: str
    data: Data35


class Code49(Enum):
    integer_3134 = 3134


class Code50(Enum):
    integer_3135 = 3135


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

    declaredTotalCollateral: Lovelace
    computedTotalCollateral: Lovelace


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

    code: Code50
    message: str
    data: Data37


class Code51(Enum):
    integer_3136 = 3136


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

    declaredSpending: Optional[InputSource] = None
    mismatchReason: str


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

    code: Code51
    message: str
    data: Data38


class Code52(Enum):
    integer_3137 = 3137


class Code53(Enum):
    integer_3138 = 3138


class Code54(Enum):
    integer_3139 = 3139


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

    code: Code54
    message: str


class Code55(Enum):
    integer_3140 = 3140


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

    unknownStakePool: StakePoolId


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

    code: Code55
    message: str
    data: Data41


class Code56(Enum):
    integer_3141 = 3141


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

    incompleteWithdrawals: Withdrawals


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

    code: Code56
    message: str
    data: Data42


class Code57(Enum):
    integer_3142 = 3142


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

    currentEpoch: Epoch
    declaredEpoch: Epoch
    firstInvalidEpoch: Epoch


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

    code: Code57
    message: str
    data: Data43


class Code58(Enum):
    integer_3143 = 3143


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

    minimumStakePoolCost: Lovelace
    declaredStakePoolCost: Lovelace


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

    code: Code58
    message: str
    data: Data44


class Code59(Enum):
    integer_3144 = 3144


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

    id: StakePoolId


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

    infringingStakePool: InfringingStakePool
    computedMetadataHashSize: NumberOfBytes


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

    code: Code59
    message: str
    data: Data45


class Code60(Enum):
    integer_3145 = 3145


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

    knownCredential: DigestBlake2b224


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

    code: Code60
    message: str
    data: Data46


class Code61(Enum):
    integer_3146 = 3146


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

    unknownCredential: DigestBlake2b224


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

    code: Code61
    message: str
    data: Data47


class Code62(Enum):
    integer_3147 = 3147


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

    nonEmptyRewardAccountBalance: Lovelace


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

    code: Code62
    message: str
    data: Data48


class Code63(Enum):
    integer_3148 = 3148


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

    code: Code63
    message: str


class Code64(Enum):
    integer_3149 = 3149


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

    code: Code64
    message: str


class Code65(Enum):
    integer_3150 = 3150


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

    marginalizedCredentials: List[DigestBlake2b224]


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

    code: Code65
    message: str
    data: Data49


class Code66(Enum):
    integer_3151 = 3151


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

    code: Code66
    message: str


class Code67(Enum):
    integer_3152 = 3152


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

    knownDelegateRepresentative: DelegateRepresentative


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

    code: Code67
    message: str
    data: Data50


class Code68(Enum):
    integer_3153 = 3153


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

    unknownDelegateRepresentative: DelegateRepresentative


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

    code: Code68
    message: str
    data: Data51


class Code69(Enum):
    integer_3154 = 3154


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

    unknownConstitutionalCommitteeMember: ConstitutionalCommitteeMember


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

    code: Code69
    message: str
    data: Data52


class Code70(Enum):
    integer_3998 = 3998


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

    code: Code70
    message: str


class Code71(Enum):
    integer_3111 = 3111


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

    missingDatums: List[DigestBlake2b256]


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

    code: Code71
    message: str
    data: Data53


class Code72(Enum):
    integer_3117 = 3117


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

    unknownOutputReferences: List[TransactionOutputReference]


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

    code: Code72
    message: str
    data: Data54


class Code73(Enum):
    integer_3115 = 3115


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

    missingCostModels: List[Language]


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

    code: Code73
    message: str
    data: Data55


class Code74(Enum):
    integer_3999 = 3999


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

    code: Code74
    message: str


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


class Method65(Enum):
    acquireLedgerState = 'acquireLedgerState'


class Code75(Enum):
    integer_2000 = 2000


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

    code: Code75
    message: str
    data: str = Field(..., description='A reason for the failure.')


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

    jsonrpc: Jsonrpc
    method: Method65
    error: Error8 = Field(
        ..., description='Unable to acquire the ledger state at the request point.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Method66(Enum):
    queryLedgerState_epoch = 'queryLedgerState/epoch'
    queryLedgerState_eraStart = 'queryLedgerState/eraStart'
    queryLedgerState_eraSummaries = 'queryLedgerState/eraSummaries'
    queryLedgerState_liveStakeDistribution = 'queryLedgerState/liveStakeDistribution'
    queryLedgerState_projectedRewards = 'queryLedgerState/projectedRewards'
    queryLedgerState_protocolParameters = 'queryLedgerState/protocolParameters'
    queryLedgerState_proposedProtocolParameters = 'queryLedgerState/proposedProtocolParameters'
    queryLedgerState_rewardAccountSummaries = 'queryLedgerState/rewardAccountSummaries'
    queryLedgerState_rewardsProvenance = 'queryLedgerState/rewardsProvenance'
    queryLedgerState_stakePools = 'queryLedgerState/stakePools'
    queryLedgerState_utxo = 'queryLedgerState/utxo'
    queryLedgerState_tip = 'queryLedgerState/tip'


class Code76(Enum):
    integer_2001 = 2001


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

    code: Code76
    message: str
    data: EraMismatch


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

    jsonrpc: Jsonrpc
    method: Method66
    error: Error9 = Field(
        ...,
        description='An era mismatch between a client request and the era the ledger is in. This may occur when running queries on a syncing node and/or when the node is crossing an era.',
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Code77(Enum):
    integer_2002 = 2002


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

    code: Code77
    message: str


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

    jsonrpc: Jsonrpc
    method: Method66
    error: Error10 = Field(
        ..., description='Some query is not available for the requested ledger era.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Code78(Enum):
    integer_2003 = 2003


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

    code: Code78
    message: str
    data: str = Field(..., description='A reason for the failure.')


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

    jsonrpc: Jsonrpc
    method: Method66
    error: Error11 = Field(
        ..., description='Previously acquired ledger state is no longer available.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


class Method69(Enum):
    hasTransaction = 'hasTransaction'
    nextTransaction = 'nextTransaction'
    sizeOfMempool = 'sizeOfMempool'
    releaseMempool = 'releaseMempool'


class Code79(Enum):
    integer_4000 = 4000


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

    code: Code79
    message: str


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

    jsonrpc: Jsonrpc
    method: Method69
    error: Error12 = Field(
        ..., description='Must acquire a mempool snapshot prior to performing any query.'
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    tip: TipOrOrigin


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

    code: Code
    message: str
    data: Data


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

    jsonrpc: Jsonrpc
    method: Method
    error: Error = Field(..., description='No intersection found with the requested points.')
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    transaction: Transaction4


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

    jsonrpc: Jsonrpc
    method: Method6
    result: Result1
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method6
    error: DeserialisationFailure
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method10
    error: DeserialisationFailure
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    code: Code3
    message: str
    data: EraMismatch


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

    jsonrpc: Jsonrpc
    method: Method19
    error: Error3 = Field(
        ...,
        description='An era mismatch between a client request and the era the ledger is in. This may occur when running queries on a syncing node and/or when the node is crossing an era.',
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method22
    result: Epoch
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method28
    result: LiveStakeDistribution
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    stake: Optional[List[Lovelace]] = None
    scripts: Optional[List[AnyStakeCredential]] = None
    keys: Optional[List[AnyStakeCredential]] = None


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

    jsonrpc: Jsonrpc
    method: Method30
    params: Params4
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    jsonrpc: Jsonrpc
    method: Method30
    result: ProjectedRewards
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    scripts: Optional[List[AnyStakeCredential]] = None
    keys: Optional[List[AnyStakeCredential]] = None


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

    jsonrpc: Jsonrpc
    method: Method36
    params: Params5
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    jsonrpc: Jsonrpc
    method: Method36
    result: Dict[str, RewardAccountSummary] = Field(..., title='RewardAccountSummaries')
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    id: StakePoolId


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

    stakePools: List[StakePool]


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

    jsonrpc: Jsonrpc
    method: Method40
    params: Optional[Params6] = None
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    outputReferences: List[TransactionOutputReference]


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

    addresses: List[Address]


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

    jsonrpc: Jsonrpc
    method: Method44
    params: Optional[Union[Param, Param1, Dict[str, Any]]] = None
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    jsonrpc: Jsonrpc
    method: Method46
    result: Union[BlockHeight, Origin]
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    era: EraWithGenesis


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

    jsonrpc: Jsonrpc
    method: Method48
    params: Params7
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    jsonrpc: Jsonrpc
    method: Method50
    result: UtcTime
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    acquired: Acquired1
    slot: Slot


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

    jsonrpc: Jsonrpc
    method: Method54
    result: Result4
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    id: TransactionId


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

    id: TransactionId


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

    jsonrpc: Jsonrpc
    method: Method59
    params: Params9
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    jsonrpc: Jsonrpc
    method: Method61
    result: MempoolSizeAndCapacity
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    slot: Slot
    id: DigestBlake2b256


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


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

    hash: DigestAny
    url: AnyUrl


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

    type: Type
    era: Era
    id: DigestBlake2b256
    ancestor: DigestBlake2b256
    height: BlockHeight


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

    verificationKey: ExtendedVerificationKey


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

    verificationKey: ExtendedVerificationKey


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

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


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

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


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

    verificationKey: Union[VerificationKey, ExtendedVerificationKey]  # Edited


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

    verificationKey: Union[VerificationKey, ExtendedVerificationKey]  # Edited


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

    issuer: Issuer2
    delegate: Delegate1


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

    heavyDelegationThreshold: Optional[Ratio] = None
    maxBlockBodySize: Optional[NumberOfBytes] = None
    maxBlockHeaderSize: Optional[NumberOfBytes] = None
    maxUpdateProposalSize: Optional[NumberOfBytes] = None
    maxTransactionSize: Optional[NumberOfBytes] = None
    multiPartyComputationThreshold: Optional[Ratio] = None
    scriptVersion: Optional[UInt64] = None
    slotDuration: Optional[UInt64] = None
    unlockStakeEpoch: Optional[UInt64] = None
    updateProposalThreshold: Optional[Ratio] = None
    updateProposalTimeToLive: Optional[UInt64] = None
    updateVoteThreshold: Optional[Ratio] = None
    softForkInitThreshold: Optional[Ratio] = None
    softForkMinThreshold: Optional[Ratio] = None
    softForkDecrementThreshold: Optional[Ratio] = None
    minFeeCoefficient: Optional[UInt64] = None
    minFeeConstant: Optional[Lovelace] = None


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

    time: RelativeTime
    slot: Slot
    epoch: Epoch


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

    type: Type3
    credential: DigestBlake2b224
    stakePool: Optional[StakePool] = None
    delegateRepresentative: Optional[DelegateRepresentative] = None


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

    type: Type4
    credential: DigestBlake2b224
    deposit: Optional[Lovelace] = None


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

    type: Type5
    credential: DigestBlake2b224
    deposit: Optional[Lovelace] = None


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

    retirementEpoch: Epoch
    id: StakePoolId


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

    type: Type7
    stakePool: StakePool2


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

    id: DigestBlake2b224


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

    id: DigestBlake2b224
    vrfVerificationKeyHash: DigestBlake2b256


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

    type: Type8
    delegate: Delegate2
    issuer: Issuer3


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

    type: Type9
    member: ConstitutionalCommitteeMember
    hotKey: DigestBlake2b224


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

    type: Type10
    member: ConstitutionalCommitteeMember


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

    type: Type11
    delegateRepresentative: DelegateRepresentative
    deposit: Lovelace


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

    type: Type12
    delegateRepresentative: DelegateRepresentative
    deposit: Lovelace


class CostModel(BaseModel):
    __root__: List[Int64] = Field(..., title='CostModel')


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] = None
    parameters: EraParameters


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

    memory: UInt64
    cpu: UInt64


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

    issuer: Issuer4
    delegate: GenesisDelegate


class InitialDelegates(BaseModel):
    __root__: List[InitialDelegate] = Field(..., title='InitialDelegates')


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

    id: StakePoolId
    vrfVerificationKeyHash: DigestBlake2b256
    owners: List[DigestBlake2b224]
    cost: Lovelace
    margin: Ratio
    pledge: Lovelace
    rewardAccount: RewardAccount
    metadata: Optional[Anchor] = None
    relays: List[Relay]


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

    type: Type17
    version: ProtocolVersion


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

    type: Type18
    source: Source
    target: Target
    value: Lovelace


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

    type: Type19
    withdrawals: RewardTransfer


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

    transaction: Transaction4
    index: UInt32


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

    issuer: GovernanceVoter
    anchor: Optional[Anchor] = None
    vote: Vote
    proposal: Optional[GovernanceProposalReference] = None


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

    cbor: Optional[constr(regex=r'^[0-9a-f]*$')] = None
    json_: Optional[Metadatum] = Field(None, alias='json')


class MetadataLabels(BaseModel):
    __root__: Optional[Dict[str, MetadataLabels1]] = Field(
        None,
        description="An associated metadatum, as a CBOR bytestring or a JSON object if possible. Some binary representations cannot be represented in plain JSON and the 'json' field is therefore omitted.",
    )


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

    redeemer: RedeemerData
    executionUnits: ExecutionUnits


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

    purpose: Purpose
    outputReference: TransactionOutputReference


class ScriptExecutionFailure(BaseModel):
    __root__: Union[
        ScriptExecutionFailureItem,
        ScriptExecutionFailureItem1,
        ScriptExecutionFailureItem2,
        SubmitTransactionFailureExtraneousRedeemers,
        SubmitTransactionFailureMissingDatums,
        SubmitTransactionFailureUnknownOutputReference,
        SubmitTransactionFailureMissingCostModels,
        SubmitTransactionFailureInternalLedgerTypeConversionError,
    ]


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

    desiredNumberOfStakePools: conint(ge=0, le=18446744073709552999) = Field(
        ..., description='Desired number of stake pools.'
    )
    stakePoolPledgeInfluence: 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'],
    )
    totalRewardsInEpoch: TotalRewardsInEpoch = Field(
        ..., description='Total rewards available for the given epoch.'
    )
    activeStakeInEpoch: ActiveStakeInEpoch = Field(
        ..., description='The total amount of staked Lovelace during this epoch.'
    )
    stakePools: Dict[str, StakePoolSummary]


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

    providedExecutionUnits: ExecutionUnits
    maximumExecutionUnits: ExecutionUnits


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

    code: Code49
    message: str
    data: Data36


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

    proposal: GovernanceProposalReference
    voter: GovernanceVoter


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

    unauthorizedVotes: List[UnauthorizedVote]


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

    code: Code52
    message: str
    data: Data39


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

    unknownProposal: GovernanceProposalReference


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

    code: Code53
    message: str
    data: Data40


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

    points: Optional[List[PointOrOrigin]] = None


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

    jsonrpc: Jsonrpc
    method: Method
    params: Params
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    intersection: PointOrOrigin
    tip: TipOrOrigin


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

    jsonrpc: Jsonrpc
    method: Method
    result: Result
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    direction: Direction1
    tip: TipOrOrigin
    point: PointOrOrigin


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

    validator: RedeemerPointer
    budget: ExecutionUnits


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

    jsonrpc: Jsonrpc
    method: Method10
    result: List[ResultItem2]
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    point: PointOrOrigin


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

    jsonrpc: Jsonrpc
    method: Method14
    params: Params3
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    acquired: Acquired
    point: PointOrOrigin


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

    jsonrpc: Jsonrpc
    method: Method14
    result: Result2
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method24
    result: Bound
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method26
    result: List[EraSummary]
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method38
    result: RewardsProvenance
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method40
    result: Dict[str, StakePoolModel]
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method42
    result: PointOrOrigin
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method52
    result: PointOrOrigin
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    version: ProtocolVersion


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

    verificationKey: VerificationKey
    vrfVerificationKey: VerificationKey
    operationalCertificate: OperationalCertificate
    leaderValue: CertifiedVrf


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

    version: ProtocolVersion
    software: SoftwareVersion
    parameters: BootstrapProtocolParameters
    metadata: Dict[str, str]


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

    proposal: Optional[Proposal] = None
    votes: List[BootstrapVote]


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

    type: Type6
    stakePool: StakePoolModel


class Certificate(BaseModel):
    __root__: Union[
        CertificateItem,
        CertificateItem1,
        CertificateItem2,
        CertificateItem3,
        CertificateItem4,
        CertificateItem5,
        CertificateItem6,
        CertificateItem7,
        CertificateItem8,
        CertificateItem9,
    ] = Field(..., title='Certificate')


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


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

    minUtxoDepositCoefficient: UInt64
    collateralPercentage: UInt64
    plutusCostModels: CostModels
    maxCollateralInputs: UInt64
    maxExecutionUnitsPerBlock: ExecutionUnits
    maxExecutionUnitsPerTransaction: ExecutionUnits
    maxValueSize: NumberOfBytes
    scriptExecutionPrices: ScriptExecutionPrices


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

    era: Era6
    initialParameters: InitialParameters


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

    era: Era7
    initialDelegates: InitialDelegates


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

    stakePools: Dict[str, StakePoolModel]
    delegators: Dict[str, StakePoolId]


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

    minFeeCoefficient: Optional[UInt64] = None
    minFeeConstant: Optional[Lovelace] = None
    minUtxoDepositCoefficient: Optional[UInt64] = None
    minUtxoDepositConstant: Optional[Lovelace] = None
    maxBlockBodySize: Optional[NumberOfBytes] = None
    maxBlockHeaderSize: Optional[NumberOfBytes] = None
    maxTransactionSize: Optional[NumberOfBytes] = None
    maxValueSize: Optional[NumberOfBytes] = None
    extraEntropy: Optional[Nonce] = None
    stakeCredentialDeposit: Optional[Lovelace] = None
    stakePoolDeposit: Optional[Lovelace] = None
    stakePoolRetirementEpochBound: Optional[UInt64] = None
    stakePoolPledgeInfluence: Optional[Ratio] = None
    minStakePoolCost: Optional[Lovelace] = None
    desiredNumberOfStakePools: Optional[UInt64] = None
    federatedBlockProductionRatio: Optional[Ratio] = None
    monetaryExpansion: Optional[Ratio] = None
    treasuryExpansion: Optional[Ratio] = None
    collateralPercentage: Optional[UInt64] = None
    maxCollateralInputs: Optional[UInt64] = None
    plutusCostModels: Optional[CostModels] = None
    scriptExecutionPrices: Optional[ScriptExecutionPrices] = None
    maxExecutionUnitsPerTransaction: Optional[ExecutionUnits] = None
    maxExecutionUnitsPerBlock: Optional[ExecutionUnits] = None
    version: Optional[ProtocolVersion] = None


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

    hash: DigestBlake2b256
    labels: MetadataLabels


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

    minFeeCoefficient: UInt64
    minFeeConstant: Lovelace
    minUtxoDepositCoefficient: UInt64
    minUtxoDepositConstant: Lovelace
    maxBlockBodySize: NumberOfBytes
    maxBlockHeaderSize: NumberOfBytes
    maxTransactionSize: Optional[NumberOfBytes] = None
    maxValueSize: Optional[NumberOfBytes] = None
    extraEntropy: Optional[Nonce] = None
    stakeCredentialDeposit: Lovelace
    stakePoolDeposit: Lovelace
    stakePoolRetirementEpochBound: UInt64
    stakePoolPledgeInfluence: Ratio
    minStakePoolCost: Lovelace
    desiredNumberOfStakePools: UInt64
    federatedBlockProductionRatio: Optional[Ratio] = None
    monetaryExpansion: Ratio
    treasuryExpansion: Ratio
    collateralPercentage: Optional[UInt64] = None
    maxCollateralInputs: Optional[UInt64] = None
    plutusCostModels: Optional[CostModels] = None
    scriptExecutionPrices: Optional[ScriptExecutionPrices] = None
    maxExecutionUnitsPerTransaction: Optional[ExecutionUnits] = None
    maxExecutionUnitsPerBlock: Optional[ExecutionUnits] = None
    version: ProtocolVersion


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

    purpose: Purpose2
    certificate: Certificate


class ScriptPurpose(BaseModel):
    __root__: Union[
        ScriptPurposeItem, ScriptPurposeItem1, ScriptPurposeItem2, ScriptPurposeItem3
    ] = Field(..., title='ScriptPurpose')


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

    validator: RedeemerPointer
    error: ScriptExecutionFailure


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

    code: Code13
    message: str
    data: List[Datum1]


class EvaluateTransactionFailure(BaseModel):
    __root__: Union[
        EvaluateTransactionFailureItem,
        EvaluateTransactionFailureItem1,
        EvaluateTransactionFailureItem2,
        EvaluateTransactionFailureItem3,
        EvaluateTransactionFailureItem4,
        EvaluateTransactionFailureItem5,
    ]


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

    missingRedeemers: List[ScriptPurpose]


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

    code: Code28
    message: str
    data: Data19


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

    jsonrpc: Jsonrpc
    method: Method10
    error: EvaluateTransactionFailure
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method32
    result: List[ProposedProtocolParameters]
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method34
    result: ProtocolParameters
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    id: BootstrapProtocolId
    version: ProtocolVersion
    software: SoftwareVersion
    update: Optional[BootstrapProtocolUpdate] = None


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

    era: Era4
    genesisKeyHashes: List[DigestBlake2b224]
    genesisDelegations: Dict[str, BootstrapOperationalCertificate]
    startTime: UtcTime
    initialFunds: Dict[str, Lovelace]
    initialVouchers: Dict[str, Lovelace]
    securityParameter: UInt64
    networkMagic: NetworkMagic
    updatableParameters: Optional[BootstrapProtocolParameters] = None  # Edited


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

    era: Era5
    startTime: UtcTime
    networkMagic: NetworkMagic
    network: Network
    activeSlotsCoefficient: Ratio
    securityParameter: UInt64
    epochLength: Epoch
    slotsPerKesPeriod: UInt64
    maxKesEvolutions: UInt64
    slotLength: SlotLength
    updateQuorum: UInt64
    maxLovelaceSupply: UInt64
    initialParameters: ProtocolParameters
    initialDelegates: InitialDelegates
    initialFunds: Dict[str, Lovelace] = Field(..., title='InitialFunds')
    initialStakePools: GenesisStakePools


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

    type: Type16
    parameters: ProposedProtocolParameters


class GovernanceAction(BaseModel):
    __root__: Union[
        GovernanceActionItem,
        GovernanceActionItem1,
        GovernanceActionItem2,
        GovernanceActionItem3,
        GovernanceActionItem4,
        GovernanceActionItem5,
        GovernanceActionItem6,
        GovernanceActionItem7,
    ]


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

    deposit: Optional[Lovelace] = None
    returnAccount: Optional[DigestBlake2b224] = None
    anchor: Optional[Anchor] = None
    action: GovernanceAction


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

    jsonrpc: Jsonrpc
    method: Method48
    result: Union[GenesisByron, GenesisShelley, GenesisAlonzo, GenesisConway]
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    direction: Direction
    tip: Tip
    block: Block


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

    jsonrpc: Jsonrpc
    method: Method4
    result: Union[ResultItem, ResultItem1]
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    jsonrpc: Jsonrpc
    method: Method6
    error: SubmitTransactionFailure
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    transaction: Transaction
    additionalUtxo: Optional[Utxo] = None


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

    jsonrpc: Jsonrpc
    method: Method10
    params: Params2
    id: Optional[Any] = Field(
        None, description='An arbitrary JSON value that will be mirrored back in the response.'
    )


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

    jsonrpc: Jsonrpc
    method: Method44
    result: Utxo
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    transaction: Optional[Union[TransactionItem, TransactionModel]]


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

    jsonrpc: Jsonrpc
    method: Method58
    result: Result5 = Field(
        ..., description="A transaction (or id) or an empty object if there's no more transactions."
    )
    id: Optional[Any] = Field(
        None, description="Any value that was set by a client request in the 'id' field."
    )


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

    FindIntersection: FindIntersection = Field(
        ...,
        description='Ask cardano-node to find an intersection between its local chain and the given points.',
        title='FindIntersection',
    )
    FindIntersectionResponse: Union[
        FindIntersectionResponseItem, FindIntersectionResponseItem1, FindIntersectionResponseItem2
    ]
    NextBlock: NextBlock = Field(
        ...,
        description="Request next block from the current cardano-node's cursor.",
        title='NextBlock',
    )
    NextBlockResponse: NextBlockResponse = Field(
        ..., description="Response to a 'nextBlock' request.", title='NextBlockResponse'
    )
    SubmitTransaction: SubmitTransaction = Field(
        ...,
        description='Submit a signed and serialized transaction to the network.',
        title='SubmitTransaction',
    )
    SubmitTransactionResponse: Union[
        SubmitTransactionResponseItem,
        SubmitTransactionResponseItem1,
        SubmitTransactionResponseItem2,
    ]
    EvaluateTransaction: EvaluateTransaction = Field(
        ...,
        description="Evaluate execution units for which redeemers's budget hasn't yet been set.",
        title='EvaluateTransaction',
    )
    EvaluateTransactionResponse: Union[
        EvaluateTransactionResponseItem,
        EvaluateTransactionResponseItem1,
        EvaluateTransactionResponseItem2,
    ]
    AcquireLedgerState: AcquireLedgerState = Field(
        ...,
        description='Acquire a point on chain from which to run ledger-state queries.',
        title='AcquireLedgerState',
    )
    AcquireLedgerStateFailure: Optional[AcquireLedgerStateFailure] = Field(
        None, title='AcquireLedgerStateFailure'
    )
    AcquireLedgerStateResponse: Union[
        AcquireLedgerStateResponseItem, AcquireLedgerStateFailureModel
    ]
    ReleaseLedgerState: ReleaseLedgerState = Field(
        ..., description='Release a previously acquired ledger state.', title='ReleaseLedgerState'
    )
    ReleaseLedgerStateResponse: ReleaseLedgerStateResponse = Field(
        ...,
        description="Response to a 'releaseLedgerState' request.",
        title='ReleaseLedgerStateResponse',
    )
    QueryLedgerStateEraMismatch: Optional[QueryLedgerStateEraMismatchModel] = Field(
        None, title='QueryLedgerStateEraMismatch'
    )
    QueryLedgerStateUnavailableInCurrentEra: Optional[
        QueryLedgerStateUnavailableInCurrentEra
    ] = Field(None, title='QueryLedgerStateUnavailableInCurrentEra')
    QueryLedgerStateAcquiredExpire: Optional[QueryLedgerStateAcquiredExpire] = Field(
        None, title='QueryLedgerStateAcquiredExpired'
    )
    QueryLedgerStateEpoch: QueryLedgerStateEpoch = Field(
        ...,
        description='Query the current epoch number the ledger is at.',
        title='QueryLedgerStateEpoch',
    )
    QueryLedgerStateEpochResponse: Union[
        QueryLedgerStateEpochResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateEraStart: QueryLedgerStateEraStart = Field(
        ...,
        description='Query the start of the current ledger era.',
        title='QueryLedgerStateEraStart',
    )
    QueryLedgerStateEraStartResponse: Union[
        QueryLedgerStateEraStartResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateEraSummaries: QueryLedgerStateEraSummaries = Field(
        ...,
        description='Query a summary of the slotting parameters and boundaries for each known era. Useful for doing slot-arithmetic and time conversions.',
        title='QueryLedgerStateEraSummaries',
    )
    QueryLedgerStateEraSummariesResponse: Union[
        QueryLedgerStateEraSummariesResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateLiveStakeDistribution: QueryLedgerStateLiveStakeDistribution = Field(
        ...,
        description='Query the current distribution of the stake across all known stake pools, relative to the TOTAL stake in the network.',
        title='QueryLedgerStateLiveStakeDistribution',
    )
    QueryLedgerStateLiveStakeDistributionResponse: Union[
        QueryLedgerStateLiveStakeDistributionResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateProjectedRewards: QueryLedgerStateProjectedRewards = Field(
        ...,
        description='Query the projected rewards of an account in a context where the top stake pools are fully saturated. This projection gives, in principle, a ranking of stake pools that maximizes delegator rewards.',
        title='QueryLedgerStateProjectedRewards',
    )
    QueryLedgerStateProjectedRewardsResponse: Union[
        QueryLedgerStateProjectedRewardsResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateProposedProtocolParameters: QueryLedgerStateProposedProtocolParameters = Field(
        ...,
        description='Query the last update proposal w.r.t. protocol parameters, if any.',
        title='QueryLedgerStateProposedProtocolParameters',
    )
    QueryLedgerStateProposedProtocolParametersResponse: Union[
        QueryLedgerStateProposedProtocolParametersResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateProtocolParameters: QueryLedgerStateProtocolParameters = Field(
        ...,
        description='Query the current protocol parameters.',
        title='QueryLedgerStateProtocolParameters',
    )
    QueryLedgerStateProtocolParametersResponse: Union[
        QueryLedgerStateProtocolParametersResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateRewardAccountSummaries: QueryLedgerStateRewardAccountSummaries = Field(
        ...,
        description='Query current delegation settings and rewards of some given reward accounts.',
        title='QueryLedgerStateRewardAccountSummaries',
    )
    QueryLedgerStateRewardAccountSummariesResponse: Union[
        QueryLedgerStateRewardAccountSummariesResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateRewardsProvenance: QueryLedgerStateRewardsProvenance = Field(
        ...,
        description='Query details about rewards calculation for the ongoing epoch.',
        title='QueryLedgerStateRewardsProvenance',
    )
    QueryLedgerStateRewardsProvenanceResponse: Union[
        QueryLedgerStateRewardsProvenanceResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateStakePools: QueryLedgerStateStakePools = Field(
        ...,
        description='Query the list of all stake pools currently registered and active, optionally filtered by ids.',
        title='QueryLedgerStateStakePools',
    )
    QueryLedgerStateStakePoolsResponse: Union[
        QueryLedgerStateStakePoolsResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateTip: QueryLedgerStateTip = Field(
        ...,
        description='Query the current tip the ledger is at. Said differently, the slot number and header hash of the last block that has been processed by the ledger.',
        title='QueryLedgerStateTip',
    )
    QueryLedgerStateTipResponse: Union[
        QueryLedgerStateTipResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryLedgerStateUtxo: QueryLedgerStateUtxo = Field(
        ...,
        description='Query the current Utxo set, restricted to some output references or addresses.',
        title='QueryLedgerStateUtxo',
    )
    QueryLedgerStateUtxoResponse: Union[
        QueryLedgerStateUtxoResponseItem,
        QueryLedgerStateEraMismatch,
        QueryLedgerStateUnavailableInCurrentEraModel,
        QueryLedgerStateAcquiredExpireModel,
    ]
    QueryNetworkBlockHeight: QueryNetworkBlockHeight = Field(
        ...,
        description='Query the network’s highest block number.',
        title='QueryNetworkBlockHeight',
    )
    QueryNetworkBlockHeightResponse: QueryNetworkBlockHeightResponse = Field(
        ..., title='QueryNetworkBlockHeightResponse'
    )
    QueryNetworkGenesisConfiguration: QueryNetworkGenesisConfiguration = Field(
        ...,
        description='Query the genesis configuration of a given era.',
        title='QueryNetworkGenesisConfiguration',
    )
    QueryNetworkGenesisConfigurationResponse: QueryNetworkGenesisConfigurationResponse = Field(
        ..., title='QueryNetworkGenesisConfigurationResponse'
    )
    QueryNetworkStartTime: QueryNetworkStartTime = Field(
        ..., description='Query the network start time.', title='QueryNetworkStartTime'
    )
    QueryNetworkStartTimeResponse: QueryNetworkStartTimeResponse = Field(
        ..., title='QueryNetworkStartTimeResponse'
    )
    QueryNetworkTip: QueryNetworkTip = Field(
        ...,
        description='Get the current network tip. Said differently, this is the most recent slot and block header hash that the node it aware of.',
        title='QueryNetworkTip',
    )
    QueryNetworkTipResponse: QueryNetworkTipResponse = Field(..., title='QueryNetworkTipResponse')
    AcquireMempool: AcquireMempool = Field(
        ...,
        description='Acquire a mempool snapshot. This is blocking until a new (i.e different) snapshot is available.',
        title='AcquireMempool',
    )
    AcquireMempoolResponse: AcquireMempoolResponse = Field(
        ..., description="Response to a 'acquireMempool' request.", title='AcquireMempoolResponse'
    )
    NextTransaction: NextTransaction = Field(
        ...,
        description='Request the next transaction from an acquired mempools napshot.',
        title='NextTransaction',
    )
    MustAcquireMempoolFirst: Optional[MustAcquireMempoolFirst] = Field(
        None, title='MustAcquireMempoolFirst'
    )
    NextTransactionResponse: Union[NextTransactionResponseItem, MustAcquireMempoolFirstModel]
    HasTransaction: HasTransaction = Field(
        ...,
        description='Ask whether a given transaction is present in the acquired mempool snapshot.',
        title='HasTransaction',
    )
    HasTransactionResponse: Union[HasTransactionResponseItem, MustAcquireMempoolFirstModel]
    SizeOfMempool: SizeOfMempool = Field(
        ...,
        description='Get size and capacities of the mempool (acquired snapshot).',
        title='SizeOfMempool',
    )
    SizeOfMempoolResponse: Optional[
        Union[SizeOfMempoolResponseItem, MustAcquireMempoolFirstModel]
    ] = None
    ReleaseMempool: ReleaseMempool = Field(
        ..., description='Release a previously acquired mempool snapshot.', title='ReleaseMempool'
    )
    ReleaseMempoolResponse: Union[ReleaseMempoolResponseItem, MustAcquireMempoolFirstModel]
    RpcError: RpcError = Field(
        ...,
        description='A generic error in the JSON-RPC 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=[
            {
                'jsonrpc': '2.0',
                'error': {'message': 'Invalid request: invalid query.', 'code': '-32601'},
            }
        ],
        title='RpcError',
    )


class Block(BaseModel):
    __root__: Union[BlockEBB, BlockBFT, BlockPraos] = Field(..., title='Block')


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

    type: Type1
    era: Era
    id: DigestBlake2b256
    ancestor: DigestBlake2b256
    height: BlockHeight
    slot: Slot
    size: NumberOfBytes
    transactions: Optional[List[TransactionModel]] = None
    operationalCertificates: Optional[List[BootstrapOperationalCertificate]] = None
    protocol: Protocol
    issuer: Issuer
    delegate: Delegate


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

    type: Type2
    era: Era2
    id: DigestBlake2b256
    ancestor: Union[DigestBlake2b256, AncestorEnum]
    nonce: Optional[CertifiedVrf] = None
    height: BlockHeight
    size: NumberOfBytes
    slot: Slot
    transactions: Optional[List[TransactionModel]] = None
    protocol: Protocol1
    issuer: Issuer1


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

    language: Language1
    json_: ScriptNative = Field(..., alias='json')
    cbor: Optional[str] = None


class Script(BaseModel):
    __root__: Union[ScriptItem, ScriptItem1] = Field(..., title='Script')


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

    clause: Clause1
    from_: List[ScriptNative] = Field(..., alias='from')


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

    clause: Clause2
    from_: List[ScriptNative] = Field(..., alias='from')


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

    clause: Clause3
    atLeast: int
    from_: List[ScriptNative] = Field(..., alias='from')


class ScriptNative(BaseModel):
    __root__: Union[
        ScriptNativeItem,
        ScriptNativeItem1,
        ScriptNativeItem2,
        ScriptNativeItem3,
        ScriptNativeItem4,
        ScriptNativeItem5,
    ] = Field(
        ...,
        description='A phase-1 monetary script. Timelocks constraints are only supported since Allegra.',
        examples=[
            {
                'clause': 'signature',
                'from': '3c07030e36bfff7cd2f004356ef320f3fe3c07030e7cd2f004356437',
            },
            {
                'clause': 'all',
                'from': [
                    {
                        'clause': 'signature',
                        'from': 'ec09e5293d384637cd2f004356ef320f3fe3c07030e36bfffe67e2e2',
                    },
                    {
                        'clause': 'signature',
                        'from': '3c07030e36bfff7cd2f004356ef320f3fe3c07030e7cd2f004356437',
                    },
                ],
            },
            {
                'clause': 'some',
                'atLeast': 2,
                'from': [
                    {
                        'clause': 'signature',
                        'from': 'ec09e5293d384637cd2f004356ef320f3fe3c07030e36bfffe67e2e2',
                    },
                    {
                        'clause': 'signature',
                        'from': '3c07030e36bfff7cd2f004356ef320f3fe3c07030e7cd2f004356437',
                    },
                    {'clause': 'after', 'slot': 42},
                ],
            },
        ],
        title='Script<Native>',
    )


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

    id: DigestBlake2b256
    spends: InputSource
    inputs: List[TransactionOutputReference]
    references: Optional[List[TransactionOutputReference]] = None
    collaterals: Optional[List[TransactionOutputReference]] = None
    totalCollateral: Optional[Lovelace] = None
    collateralReturn: Optional[TransactionOutput] = None
    outputs: List[TransactionOutput]
    certificates: Optional[List[Certificate]] = None
    withdrawals: Optional[Withdrawals] = None
    fee: Optional[Lovelace] = None
    validityInterval: Optional[ValidityInterval] = None
    mint: Optional[Assets] = None
    network: Optional[Network] = None
    scriptIntegrityHash: Optional[DigestBlake2b256] = None
    requiredExtraSignatories: Optional[List[DigestBlake2b224]] = None
    requiredExtraScripts: Optional[List[DigestBlake2b224]] = None
    proposals: Optional[List[GovernanceProposal]] = None
    votes: Optional[List[GovernanceVote]] = None
    metadata: Optional[Metadata] = None
    signatories: List[Signatory]
    scripts: Optional[Dict[str, Script]] = None
    datums: Optional[Dict[str, Datum]] = None
    redeemers: Optional[Dict[str, Redeemer]] = None
    cbor: Optional[str] = Field(
        None, description='The raw serialized (CBOR) transaction, as found on-chain.'
    )


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

    address: Address
    value: Value
    datumHash: Optional[DigestBlake2b256] = None
    datum: Optional[Datum] = None
    script: Optional[Script] = None


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

    transaction: Transaction4
    index: UInt32
    address: Address
    value: Value
    datumHash: Optional[DigestBlake2b256] = None
    datum: Optional[Datum] = None
    script: Optional[Script] = None


class Utxo(BaseModel):
    __root__: List[UtxoItem] = Field(..., title='Utxo')


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

    excessivelyLargeOutputs: List[TransactionOutput]


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

    code: Code35
    message: str
    data: Data26


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

    output: TransactionOutput
    minimumRequiredValue: Optional[Lovelace] = None


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

    insufficientlyFundedOutputs: List[InsufficientlyFundedOutput]


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

    code: Code40
    message: str
    data: Data29


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

    bootstrapOutputs: List[TransactionOutput]


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

    code: Code41
    message: str
    data: Data30


class SubmitTransactionFailure(BaseModel):
    __root__: Union[
        SubmitTransactionFailureItem,
        SubmitTransactionFailureItem1,
        SubmitTransactionFailureItem2,
        SubmitTransactionFailureItem3,
        SubmitTransactionFailureItem4,
        SubmitTransactionFailureItem5,
        SubmitTransactionFailureItem6,
        SubmitTransactionFailureItem7,
        SubmitTransactionFailureItem8,
        SubmitTransactionFailureItem9,
        SubmitTransactionFailureItem10,
        SubmitTransactionFailureExtraneousRedeemers,
        SubmitTransactionFailureMissingDatums,
        SubmitTransactionFailureItem11,
        SubmitTransactionFailureItem12,
        SubmitTransactionFailureItem13,
        SubmitTransactionFailureMissingCostModels,
        SubmitTransactionFailureItem14,
        SubmitTransactionFailureUnknownOutputReference,
        SubmitTransactionFailureItem15,
        SubmitTransactionFailureItem16,
        SubmitTransactionFailureItem17,
        SubmitTransactionFailureItem18,
        SubmitTransactionFailureItem19,
        SubmitTransactionFailureItem20,
        SubmitTransactionFailureItem21,
        SubmitTransactionFailureItem22,
        SubmitTransactionFailureItem23,
        SubmitTransactionFailureItem24,
        SubmitTransactionFailureItem25,
        SubmitTransactionFailureItem26,
        SubmitTransactionFailureItem27,
        SubmitTransactionFailureItem28,
        SubmitTransactionFailureItem29,
        SubmitTransactionFailureItem30,
        SubmitTransactionFailureItem31,
        SubmitTransactionFailureItem32,
        SubmitTransactionFailureItem33,
        SubmitTransactionFailureItem34,
        SubmitTransactionFailureItem35,
        SubmitTransactionFailureItem36,
        SubmitTransactionFailureItem37,
        SubmitTransactionFailureItem38,
        SubmitTransactionFailureItem39,
        SubmitTransactionFailureItem40,
        SubmitTransactionFailureItem41,
        SubmitTransactionFailureItem42,
        SubmitTransactionFailureItem43,
        SubmitTransactionFailureItem44,
        SubmitTransactionFailureItem45,
        SubmitTransactionFailureItem46,
        SubmitTransactionFailureItem47,
        SubmitTransactionFailureItem48,
        SubmitTransactionFailureItem49,
        SubmitTransactionFailureItem50,
        SubmitTransactionFailureItem51,
        SubmitTransactionFailureItem52,
        SubmitTransactionFailureInternalLedgerTypeConversionError,
    ]


Metadatum.update_forward_refs()
ResultItem.update_forward_refs()
SubmitTransactionResponseItem1.update_forward_refs()
Params2.update_forward_refs()
QueryLedgerStateUtxoResponseItem.update_forward_refs()
Result5.update_forward_refs()
Block.update_forward_refs()
BlockBFT.update_forward_refs()
BlockPraos.update_forward_refs()
ScriptItem.update_forward_refs()
ScriptNativeItem1.update_forward_refs()
ScriptNativeItem2.update_forward_refs()
ScriptNativeItem3.update_forward_refs()
TransactionModel.update_forward_refs()
