Skip to content

Queries

client.ledger_state and client.network. These are the async versions (AsyncClient); the sync Client has the same methods, without await.

AsyncLedgerStateQueries

AsyncLedgerStateQueries(client: AsyncClient)

The ledger state queries (queryLedgerState/*).

constitution async

constitution(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> Constitution

Query the current constitution definition (only available from Conway onwards).

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

constitutional_committee async

constitutional_committee(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateConstitutionalCommitteeResult

Get the state of the constitutional committee (only available from Conway onwards).

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

delegate_representatives async

delegate_representatives(
    *,
    scripts: (
        Sequence[AnyDelegateRepresentativeCredential] | None
    ) = None,
    keys: (
        Sequence[AnyDelegateRepresentativeCredential] | None
    ) = None,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateDelegateRepresentativesResult

Query currently registered delegate representatives, their stake (i.e. voting powers) and metadata about them. Note that 'params' is optional and can be used to filter out delegates. When omitted, ALL delegates are returned. Pre-defined options (always abstain and always no confidence) are ALWAYS returned.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

dump async

dump(
    *,
    to: str | None = None,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateDumpResult

Get a dump of the entire Cardano ledger state (CBOR) corresponding to the 'NewEpochState'. Take some time.

Parameters:

Name Type Description Default
to str | None

A filepath to dump the ledger state to disk, relative to the server's location.

None
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

epoch async

epoch(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> Epoch

Query the current epoch number the ledger is at.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

era_start async

era_start(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> Bound

Query the start of the current ledger era.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

era_summaries async

era_summaries(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateEraSummariesResult

Query a summary of the slotting parameters and boundaries for each known era. Useful for doing slot-arithmetic and time conversions.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

governance_proposals async

governance_proposals(
    *,
    proposals: (
        Sequence[
            GovernanceProposalReference | Mapping[str, Any]
        ]
        | None
    ) = None,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateGovernanceProposalsResult

Query currently active governance proposals, optionally restricted to specific governance proposal references.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

live_stake_distribution async

live_stake_distribution(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> LiveStakeDistribution

Query the current distribution of the stake across all known stake pools, relative to the TOTAL stake in the network.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

nonces async

nonces(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> Nonces

Query consensus nonces information used to power randomness for leader election in every epoch.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

operational_certificates async

operational_certificates(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> OperationalCertificates

Query operational certificate counters of all stake pools.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

projected_rewards async

projected_rewards(
    *,
    stake: (
        Sequence[ValueAdaOnly | Mapping[str, Any]] | None
    ) = None,
    scripts: Sequence[AnyStakeCredential] | None = None,
    keys: Sequence[AnyStakeCredential] | None = None,
    timeout: float | Literal["default"] | None = "default"
) -> ProjectedRewards

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.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

protocol_parameters async

protocol_parameters(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> ProtocolParameters

Query the current protocol parameters.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

reward_account_summaries async

reward_account_summaries(
    *,
    scripts: Sequence[AnyStakeCredential] | None = None,
    keys: Sequence[AnyStakeCredential] | None = None,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateRewardAccountSummariesResult

Query current delegation settings and rewards of some given reward accounts.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

rewards_provenance async

rewards_provenance(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> RewardsProvenance

Query details about rewards calculation for the ongoing epoch.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

stake_pools async

stake_pools(
    *,
    include_stake: bool | None = None,
    stake_pools: (
        Sequence[
            QueryLedgerStateStakePoolsParamsStakePoolsItem
            | Mapping[str, Any]
        ]
        | None
    ) = None,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateStakePoolsResult

Query the list of all stake pools currently registered and active, optionally filtered by ids.

Parameters:

Name Type Description Default
include_stake bool | None

When provided and set to 'true', the result will also include the voting stake associated to each pool. This may take some additional time the first time this is queried within an epoch.

None
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

stake_pools_performances async

stake_pools_performances(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> StakePoolsPerformances

Query details about pools performances indicators for the ongoing epoch.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

tip async

tip(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> PointOrOrigin

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.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

treasury_and_reserves async

treasury_and_reserves(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> QueryLedgerStateTreasuryAndReservesResult

Query the Ada value of the treasury and reserves accounts.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

utxo async

utxo(
    *,
    output_references: (
        Sequence[
            TransactionOutputReference | Mapping[str, Any]
        ]
        | None
    ) = None,
    addresses: Sequence[Address] | None = None,
    timeout: float | Literal["default"] | None = "default"
) -> Utxo

Query the current Utxo set, restricted to some output references or addresses.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

AsyncNetworkQueries

AsyncNetworkQueries(client: AsyncClient)

The network queries (queryNetwork/*).

block_height async

block_height(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> QueryNetworkBlockHeightResult

Query the network's highest block number.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

genesis_configuration async

genesis_configuration(
    *,
    era: EraWithGenesis,
    timeout: float | Literal["default"] | None = "default"
) -> QueryNetworkGenesisConfigurationResult

Query the genesis configuration of a given era.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

start_time async

start_time(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> UtcTime

Query the network start time.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'

tip async

tip(
    *,
    timeout: float | Literal["default"] | None = "default"
) -> PointOrOrigin

Get the current network tip. Said differently, this is the most recent slot and block header hash that the node it aware of.

Parameters:

Name Type Description Default
timeout float | Literal['default'] | None

Seconds to wait for the answer; None waits forever. By default, the client's timeout.

'default'