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
¶
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; |
'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; |
'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; |
'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; |
'default'
|
epoch
async
¶
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; |
'default'
|
era_start
async
¶
Query the start of the current ledger era.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float | Literal['default'] | None
|
Seconds to wait for the answer; |
'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; |
'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; |
'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; |
'default'
|
nonces
async
¶
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; |
'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; |
'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; |
'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; |
'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; |
'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; |
'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; |
'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; |
'default'
|
tip
async
¶
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; |
'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; |
'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; |
'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; |
'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; |
'default'
|
start_time
async
¶
Query the network start time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float | Literal['default'] | None
|
Seconds to wait for the answer; |
'default'
|
tip
async
¶
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; |
'default'
|