Ledger State Mini-Protocol

class ogmios.statequery.AcquireLedgerState(client: Client)

Bases: object

Ogmios method to acquire the ledger state at a given point.

NOTE: This class is not intended to be used directly. Instead, use the Client.acquire_ledger_state method.

Parameters:

client (Client) – The client to use for the request.

execute(point: Point | Origin, id: Any | None = None)

Send and receive the request.

Parameters:
  • point (Point | Origin) – The point at which to acquire the ledger state.

  • id (Any) – The ID of the request.

Returns:

The point or origin and ID of the response.

Return type:

(Point | Origin, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The point or origin and ID of the response.

Return type:

(Point | Origin, Optional[Any])

send(point: Point | Origin, id: Any | None = None) None

Send the request.

Parameters:
  • point (Point | Origin) – The point at which to acquire the ledger state.

  • id (Any) – The ID of the request.

class ogmios.statequery.QueryBlockHeight(client: Client)

Bases: object

Ogmios method to query the chain’s highest block number.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_block_height method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

The block height or origin and ID of the response.

Return type:

(int | Origin, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The block height or origin and ID of the response.

Return type:

(int | Origin, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryEpoch(client: Client)

Bases: object

Ogmios method to query the ledger’s current epoch.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_epoch method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

The chain’s current epoch and ID of the response.

Return type:

(int, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The chain’s current epoch and ID of the response.

Return type:

(int, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryEraStart(client: Client)

Bases: object

Ogmios method to query information regarding the beginning of the ledger’s current era.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_era_start method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

The era’s start time (in seconds, relative to the network start), slot, epoch, and ID of the response.

Return type:

(int, int, int, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The era’s start time (in seconds, relative to the network start), slot, epoch, and ID of the response.

Return type:

(int, int, int, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryEraSummaries(client: Client)

Bases: object

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

NOTE: This class is not intended to be used directly. Instead, use the Client.query_era_summaries method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

List of era summaries and ID of the response.

Return type:

(list[EraSummary], Optional[Any])

receive()

Receive a previously requested response.

Returns:

List of era summaries and ID of the response.

Return type:

(list[eraSummary], Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryGenesisConfiguration(client: Client)

Bases: object

Ogmios method to query the genesis configuration of a specific era.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_genesis_configuration method.

Parameters:

client (Client) – The client to use for the request.

execute(era: mm.Era, id: Any | None = None)

Send and receive the request.

Parameters:
  • era (mm.Era) – The era at which to query the genesis configuration.

  • id (Any) – The ID of the request.

Returns:

The GenesisConfiguration at the specified era and ID of the response.

Return type:

(GenesisConfiguration, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The GenesisConfiguration at the specified era and ID of the response.

Return type:

(GenesisConfiguration, Optional[Any])

send(era: mm.Era, id: Any | None = None) None

Send the request.

Parameters:
  • era (mm.Era) – The era at which to query the genesis configuration.

  • id (Any) – The ID of the request.

class ogmios.statequery.QueryLedgerTip(client: Client)

Bases: object

Ogmios method to query the point of the ledger’s latest block.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_ledger_tip method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

The tip or origin and ID of the response.

Return type:

(Tip | Origin, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The tip or origin and ID of the response.

Return type:

(Tip | Origin, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryLiveStakeDistribution(client: Client)

Bases: object

Ogmios method to query distribution of the stake across all known stake pools, relative to the total stake in the network.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_live_stake_distribution method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

A dict of stake distributions and ID of the response. Dict is of the format {<Blake2b_pool_id>: {“stake”: stake_pct_str, “vrf”: vrf_str}

Return type:

(dict, Optional[Any])

receive()

Receive a previously requested response.

Returns:

A dict of stake distributions and ID of the response. Dict is of the format {<Blake2b_pool_id>: {“stake”: stake_pct_str, “vrf”: vrf_str}

Return type:

(dict, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryNetworkTip(client: Client)

Bases: object

Ogmios method to query the point of the network’s latest block.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_network_tip method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

The tip or origin and ID of the response.

Return type:

(Tip | Origin, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The tip or origin and ID of the response.

Return type:

(Tip | Origin, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryProjectedRewards(client: Client)

Bases: object

Ogmios method to 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.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_projected_rewards method.

Parameters:

client (Client) – The client to use for the request.

execute(stake: Ada, scripts: list[str] = [], keys: list[str] = [], id: Any | None = None)

Send and receive the request.

Parameters:
  • stake (Ada) – The amount of staked lovelace to query

  • scripts (list[str]) – The scripts to query - can be a base16/bech32 script hash or a stake address

  • keys (list[str]) – The keys to query - can be a base16/bech32 stake key hash or a stake address

  • id (Any) – The ID of the request.

Returns:

Rewards that can be expected assuming a pool is fully saturated. Such rewards are said non-myopic, in opposition to short-sighted rewards looking at immediate benefits. Keys of the map can be either Ada amounts or account credentials depending on the query. Additionally returns the ID of the response.

Return type:

(dict, Optional[Any])

receive()

Receive the response.

Returns:

Rewards that can be expected assuming a pool is fully saturated. Such rewards are said non-myopic, in opposition to short-sighted rewards looking at immediate benefits. Keys of the map can be either Ada amounts or account credentials depending on the query. Additionally returns the ID of the response.

Return type:

(dict, Optional[Any])

send(stake: list[Ada], scripts: list[str] = [], keys: list[str] = [], id: Any | None = None) None

Send the request.

Parameters:
  • stake (list[Ada]) – The amounts of staked lovelace to query

  • scripts (list[str]) – The scripts to query - can be a base16/bech32 script hash or a stake address

  • keys (list[str]) – The keys to query - can be a base16/bech32 stake key hash or a stake address

  • id (Any) – The ID of the request.

class ogmios.statequery.QueryProposedProtocolParameters(client: Client)

Bases: object

Ogmios method to query the current protocol parameters.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_protocol_parameters method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

Current protocol parameters.

Return type:

(ProtocolParameters, Optional[Any])

receive()

Receive a previously requested response.

Returns:

Current protocol parameters.

Return type:

(ProtocolParameters, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryProtocolParameters(client: Client)

Bases: object

Ogmios method to query the current protocol parameters.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_protocol_parameters method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

Current protocol parameters.

Return type:

(ProtocolParameters, Optional[Any])

receive()

Receive a previously requested response.

Returns:

Current protocol parameters.

Return type:

(ProtocolParameters, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryRewardAccountSummaries(client: Client)

Bases: object

Ogmios method to query current delegation settings and rewards of chosen reward accounts.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_reward_account_summaries method.

Parameters:

client (Client) – The client to use for the request.

execute(scripts: list[str] = [], keys: list[str] = [], id: Any | None = None)

Send and receive the request.

Parameters:
  • scripts (list[str]) – The scripts to query - can be a base16/bech32 script hash or a stake address

  • keys (list[str]) – The keys to query - can be a base16/bech32 stake key hash or a stake address

  • id (Any) – The ID of the request.

Returns:

Current delegation settings and rewards of chosen reward accounts.

Return type:

(dict, Optional[Any])

receive()

Receive the response.

Returns:

Current delegation settings and rewards of chosen reward accounts.

Return type:

(dict, Optional[Any])

send(scripts: list[str] = [], keys: list[str] = [], id: Any | None = None) None

Send the request.

Parameters:
  • scripts (list[str]) – The scripts to query - can be a base16/bech32 script hash or a stake address

  • keys (list[str]) – The keys to query - can be a base16/bech32 stake key hash or a stake address

  • id (Any) – The ID of the request.

class ogmios.statequery.QueryRewardsProvenance(client: Client)

Bases: object

Ogmios method to query details about rewards calculation for the ongoing epoch.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_rewards_provenance method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

Details about rewards calculation for the ongoing epoch.

Return type:

(dict, Optional[Any])

receive()

Receive a previously requested response.

Returns:

Details about rewards calculation for the ongoing epoch.

Return type:

(dict, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryStakePools(client: Client)

Bases: object

Ogmios method to list of all stake pool identifiers currently registered and active.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_stake_pools method.

Parameters:

client (Client) – The client to use for the request.

execute(stake_pools: list[str], id: Any | None = None)

Send and receive the request.

Parameters:
  • stake_pools – The list of stake pool bech32 IDs to query.

  • id (Any) – The ID of the request.

Returns:

Dict of stake pool summaries and ID of the response.

Return type:

(dict, Optional[Any])

receive()

Receive the response.

Returns:

Dict of stake pool summaries and ID of the response.

Return type:

(dict, Optional[Any])

send(stake_pools: list[str], id: Any | None = None) None

Send the request.

Parameters:
  • stake_pools – The list of stake pool bech32 IDs to query.

  • id (Any) – The ID of the request.

class ogmios.statequery.QueryStartTime(client: Client)

Bases: object

Ogmios method to query the chain’s start time (UTC).

NOTE: This class is not intended to be used directly. Instead, use the Client.query_start_time method.

Parameters:

client (Client) – The client to use for the request.

execute(id: Any | None = None)

Send and receive the request.

Parameters:

id (Any) – The ID of the request.

Returns:

The chain start time (UTC) and ID of the response.

Return type:

(datetime, Optional[Any])

receive()

Receive a previously requested response.

Returns:

The chain start time (UTC) and ID of the response.

Return type:

(datetime, Optional[Any])

send(id: Any | None = None) None

Send the request.

Parameters:

id (Any) – The ID of the request.

class ogmios.statequery.QueryUtxo(client: Client)

Bases: object

Ogmios method to query the current UTxO set, restricted to some output references or addresses.

NOTE: This class is not intended to be used directly. Instead, use the Client.query_utxo method.

Parameters:

client (Client) – The client to use for the request.

execute(output_ref: list[TxOutputReference] | list[Address], id: Any | None = None)

Send and receive the request.

Parameters:
  • output_ref (list[TxOutputReference] | list[Address]) – The output reference to query. Can be a list of TxOutputReference or a list of Address.

  • id (Any) – The ID of the request.

Returns:

List of Utxo’s and ID of the response.

Return type:

(list[Utxo], Optional[Any])

receive()

Receive the response.

Returns:

List of Utxo’s and ID of the response.

Return type:

(list[Utxo], Optional[Any])

send(output_ref: list[TxOutputReference] | list[Address], id: Any | None = None) None

Send the request.

Parameters:
  • output_ref – The output reference to query. Can be a list of TxOutputReference or a list of Address.

  • id (Any) – The ID of the request.