pub struct LedgerStateQueryClient { /* private fields */ }Expand description
A ledger state query client for querying blockchain state.
This client provides methods for querying various aspects of the Cardano ledger state, such as UTXOs, stake pools, protocol parameters, and governance proposals.
§Example
use ogmios_client::ledger_state_query::LedgerStateQueryClient;
use ogmios_client::connection::ConnectionConfig;
let client = LedgerStateQueryClient::connect(
ConnectionConfig::default(),
None
).await?;
// Get current epoch
let epoch = client.epoch().await?;
println!("Current epoch: {}", epoch);
// Get protocol parameters
let params = client.protocol_parameters().await?;
println!("Min fee coefficient: {}", params.min_fee_coefficient);
// Query UTXOs for an address
let utxos = client.utxo_by_addresses(vec!["addr_test1...".to_string()]).await?;
println!("Found {} UTXOs", utxos.len());
client.shutdown().await?;Implementations§
Source§impl LedgerStateQueryClient
impl LedgerStateQueryClient
Sourcepub fn new(context: InteractionContext) -> Self
pub fn new(context: InteractionContext) -> Self
Create a new ledger state query client from an existing context.
Sourcepub async fn connect(
connection: ConnectionConfig,
options: Option<LedgerStateQueryClientOptions>,
) -> Result<Self>
pub async fn connect( connection: ConnectionConfig, options: Option<LedgerStateQueryClientOptions>, ) -> Result<Self>
Connect to Ogmios and create a new ledger state query client.
§Arguments
connection- Connection configuration.options- Optional client options.
Sourcepub fn context(&self) -> &InteractionContext
pub fn context(&self) -> &InteractionContext
Get a reference to the interaction context.
Sourcepub async fn acquire_ledger_state(&self, point: Option<Point>) -> Result<Slot>
pub async fn acquire_ledger_state(&self, point: Option<Point>) -> Result<Slot>
Acquire a ledger state at a specific point.
Sourcepub async fn release_ledger_state(&self) -> Result<()>
pub async fn release_ledger_state(&self) -> Result<()>
Release the acquired ledger state.
Sourcepub async fn constitution(&self) -> Result<Constitution>
pub async fn constitution(&self) -> Result<Constitution>
Query the current constitution.
Sourcepub async fn era_summaries(&self) -> Result<Vec<EraSummary>>
pub async fn era_summaries(&self) -> Result<Vec<EraSummary>>
Query era summaries.
Sourcepub async fn genesis_configuration(
&self,
era: EraWithGenesis,
) -> Result<GenesisConfiguration>
pub async fn genesis_configuration( &self, era: EraWithGenesis, ) -> Result<GenesisConfiguration>
Query genesis configuration for a specific era.
Sourcepub async fn governance_proposals(
&self,
filter: Option<GovernanceProposalFilter>,
) -> Result<Vec<GovernanceProposalState>>
pub async fn governance_proposals( &self, filter: Option<GovernanceProposalFilter>, ) -> Result<Vec<GovernanceProposalState>>
Query governance proposals.
Sourcepub async fn ledger_tip(&self) -> Result<Point>
pub async fn ledger_tip(&self) -> Result<Point>
Query the ledger tip.
Sourcepub async fn network_tip(&self) -> Result<Tip>
pub async fn network_tip(&self) -> Result<Tip>
Query the network tip.
Sourcepub async fn network_block_height(&self) -> Result<BlockHeight>
pub async fn network_block_height(&self) -> Result<BlockHeight>
Query the network block height.
Sourcepub async fn live_stake_distribution(
&self,
) -> Result<HashMap<StakePoolId, LiveStakeDistributionEntry>>
pub async fn live_stake_distribution( &self, ) -> Result<HashMap<StakePoolId, LiveStakeDistributionEntry>>
Query live stake distribution.
Sourcepub async fn network_start_time(&self) -> Result<UtcTime>
pub async fn network_start_time(&self) -> Result<UtcTime>
Query the network start time.
Sourcepub async fn projected_rewards(
&self,
stake_addresses: Vec<StakeAddress>,
) -> Result<Vec<ProjectedRewards>>
pub async fn projected_rewards( &self, stake_addresses: Vec<StakeAddress>, ) -> Result<Vec<ProjectedRewards>>
Query projected rewards.
Sourcepub async fn protocol_parameters(&self) -> Result<ProtocolParameters>
pub async fn protocol_parameters(&self) -> Result<ProtocolParameters>
Query protocol parameters.
Sourcepub async fn reward_account_summaries(
&self,
keys: Vec<StakeAddress>,
) -> Result<HashMap<RewardAccount, RewardAccountSummary>>
pub async fn reward_account_summaries( &self, keys: Vec<StakeAddress>, ) -> Result<HashMap<RewardAccount, RewardAccountSummary>>
Query reward account summaries.
Sourcepub async fn stake_pools(
&self,
filter: Option<StakePoolsFilter>,
include_stake: bool,
) -> Result<HashMap<StakePoolId, StakePoolView>>
pub async fn stake_pools( &self, filter: Option<StakePoolsFilter>, include_stake: bool, ) -> Result<HashMap<StakePoolId, StakePoolView>>
Query stake pools.
Sourcepub async fn stake_pools_performances(
&self,
) -> Result<HashMap<StakePoolId, StakePoolPerformance>>
pub async fn stake_pools_performances( &self, ) -> Result<HashMap<StakePoolId, StakePoolPerformance>>
Query stake pool performances.
Sourcepub async fn utxo_by_addresses(
&self,
addresses: Vec<Address>,
) -> Result<Vec<Utxo>>
pub async fn utxo_by_addresses( &self, addresses: Vec<Address>, ) -> Result<Vec<Utxo>>
Query UTXOs by addresses.
Sourcepub async fn utxo_by_output_references(
&self,
output_references: Vec<TransactionOutputReference>,
) -> Result<Vec<Utxo>>
pub async fn utxo_by_output_references( &self, output_references: Vec<TransactionOutputReference>, ) -> Result<Vec<Utxo>>
Query UTXOs by output references.