ogmios::Client class

The Ogmios Client.

Constructors, destructors, conversion operators

Client()
Create a new Ogmios Client using the default URL.
Client(const std::string& url, uint32_t timeout_ms = 1000)
Create a new Ogmios Client.
~Client()
Destroy the Ogmios Client.

Public functions

auto acquireLedgerState(const json& point) -> std::future<json>
Aquire the ledger state at the given point.
auto acquireMempool() -> std::future<json>
Acquire a mempool snapshot for running queries.
auto evaluateTransaction(const json& params) -> std::future<json>
Evaluate script execution units without submitting the tx.
auto evaluateTransactionCbor(std::string_view cbor) -> std::future<json>
Evaluate script execution units without submitting the tx.
auto findIntersection(const json& points) -> std::future<json>
Set the intersection of the client and node at the given point.
auto findIntersectionOrigin() -> std::future<json>
Set the intersection of the client and node at the origin.
auto hasTransaction(std::string_view txid) -> std::future<json>
Query for a specific transaction in the mempool.
auto nextBlock() -> std::future<json>
Ask the node for the next block from the current cusor position.
auto nextTransaction(bool full = false) -> std::future<json>
Query for the next transaction in the mempool.
auto queryBlockHeight() -> std::future<json>
Query the chain’s highest block number.
auto queryEpoch() -> std::future<json>
Query the current epoch of the ledger.
auto queryEraStart() -> std::future<json>
Query information regarding the beginning of the current ledger era.
auto queryEraSummaries() -> std::future<json>
Query era bounds and slot parameters details, required for proper slotting arithmetic.
auto queryGenesisConfiguration(const std::string& era) -> std::future<json>
Query the genesis configuration of a specific era.
auto queryLedgerTip() -> std::future<json>
Query the ledger tip.
auto queryLiveStakeDistribution() -> std::future<json>
Query theistribution of the stake across all known stake pools, relative to the total stake in the network.
auto queryNetworkTip() -> std::future<json>
Query the network’s current tip.
auto queryProjectedRewards(const json& params) -> std::future<json>
Query the projected rewards of an account in a context where the top stake pools are fully saturated.
auto queryProjectedRewards(std::span<const size_t> stake_balances, const std::vector<std::string>& stake_keys, const std::vector<std::string>& stake_scripts) -> std::future<json>
Query the projected rewards of an account in a context where the top stake pools are fully saturated.
auto queryProposedProtocolParameters() -> std::future<json>
Query the last update proposal w.r.t. protocol parameters, if any.
auto queryProtocolParameters() -> std::future<json>
Query the current protocol parameters.
auto queryRewardAccountSummaries(const json& params) -> std::future<json>
Query the current delegation settings and rewards of chosen reward accounts.
auto queryRewardsProvenance() -> std::future<json>
Query details about rewards calculation for the ongoing epoch.
auto queryStakePools(const std::vector<std::string>& ids = {}) -> std::future<json>
Query the list of all currently registered and active stake pools with their current parameters.
auto queryStartTime() -> std::future<json>
Query the chain’s start time (UTC).
auto queryUtxo(const json& params = {}) -> std::future<json>
Query the current UTXO, possibly filtered by output reference.
auto releaseMempool() -> std::future<json>
Release a previously acquired a mempool snapshot.
auto rpcSend(json msg) -> std::future<json>
Send the JSON-RPC message to the Ogmios server via websocket.
void setLoggerCallback(std::function<void(int, const std::string&)> callback)
Set the logger callback.
auto sizeOfMempool() -> std::future<json>
Return size information about the mempool.
auto submitTransaction(const json& params) -> std::future<json>
Submit a transaction to the node.
auto submitTransactionCbor(const std::string& cbor) -> std::future<json>
Submit a transaction to the node.

Function documentation

ogmios::Client::Client()

Create a new Ogmios Client using the default URL.

ogmios::Client::Client(const std::string& url, uint32_t timeout_ms = 1000)

Create a new Ogmios Client.

Parameters
url The URL of the Ogmios server.
timeout_ms Time to wait for the connection to open.

ogmios::Client::~Client()

Destroy the Ogmios Client.

std::future<json> ogmios::Client::acquireLedgerState(const json& point)

Aquire the ledger state at the given point.

Parameters
point The point to get the ledger state at.
Returns The future result as a std::future<json> object.

std::future<json> ogmios::Client::acquireMempool()

Acquire a mempool snapshot for running queries.

Returns The result information as a std::future<json> object.

std::future<json> ogmios::Client::evaluateTransaction(const json& params)

Evaluate script execution units without submitting the tx.

Parameters
params The JSON parameters for the websocket method.
Returns The result as a std::future<json> object.

std::future<json> ogmios::Client::evaluateTransactionCbor(std::string_view cbor)

Evaluate script execution units without submitting the tx.

Parameters
cbor The transaction serialized to a CBOR base-16 string.
Returns The result as a std::future<json> object.

std::future<json> ogmios::Client::findIntersection(const json& points)

Set the intersection of the client and node at the given point.

Returns The future result as a std::future<json> object.

std::future<json> ogmios::Client::findIntersectionOrigin()

Set the intersection of the client and node at the origin.

Returns The future result as a std::future<json> object.

std::future<json> ogmios::Client::hasTransaction(std::string_view txid)

Query for a specific transaction in the mempool.

Returns The result as a std::future<json> object.

std::future<json> ogmios::Client::nextBlock()

Ask the node for the next block from the current cusor position.

Returns The future result as a std::future<json> object.

std::future<json> ogmios::Client::nextTransaction(bool full = false)

Query for the next transaction in the mempool.

Returns The result as a std::future<json> object.

std::future<json> ogmios::Client::queryBlockHeight()

Query the chain’s highest block number.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryEpoch()

Query the current epoch of the ledger.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryEraStart()

Query information regarding the beginning of the current ledger era.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryEraSummaries()

Query era bounds and slot parameters details, required for proper slotting arithmetic.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryGenesisConfiguration(const std::string& era)

Query the genesis configuration of a specific era.

Parameters
era The era to query the genesis configuration for. Valid options are (currently): "byron", "shelley", "alonzo", and "conway".
Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryLedgerTip()

Query the ledger tip.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryLiveStakeDistribution()

Query theistribution of the stake across all known stake pools, relative to the total stake in the network.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryNetworkTip()

Query the network’s current tip.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryProjectedRewards(const json& params)

Query the projected rewards of an account in a context where the top stake pools are fully saturated.

Parameters
params The pre-constructed query parameters as json object.
Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryProjectedRewards(std::span<const size_t> stake_balances, const std::vector<std::string>& stake_keys, const std::vector<std::string>& stake_scripts)

Query the projected rewards of an account in a context where the top stake pools are fully saturated.

Parameters
stake_balances The stake balances to rank the pools for.
stake_keys The stake keys to rank the pools for.
stake_scripts The stake scripts to rank the pools for.
Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryProposedProtocolParameters()

Query the last update proposal w.r.t. protocol parameters, if any.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryProtocolParameters()

Query the current protocol parameters.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryRewardAccountSummaries(const json& params)

Query the current delegation settings and rewards of chosen reward accounts.

Parameters
params The pre-constructed query parameters as json object.
Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryRewardsProvenance()

Query details about rewards calculation for the ongoing epoch.

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryStakePools(const std::vector<std::string>& ids = {})

Query the list of all currently registered and active stake pools with their current parameters.

Parameters
ids The list of pool IDs to query. If empty, all pools are queried.
Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryStartTime()

Query the chain’s start time (UTC).

Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::queryUtxo(const json& params = {})

Query the current UTXO, possibly filtered by output reference.

Parameters
params The pre-constructed query parameters as json object.
Returns The query result as a std::future<json> object.

std::future<json> ogmios::Client::releaseMempool()

Release a previously acquired a mempool snapshot.

Returns The result information as a std::future<json> object.

std::future<json> ogmios::Client::rpcSend(json msg)

Send the JSON-RPC message to the Ogmios server via websocket.

Parameters
msg The JSON message to send.
Returns The future result as a std::future<json> object.

void ogmios::Client::setLoggerCallback(std::function<void(int, const std::string&)> callback)

Set the logger callback.

Parameters
callback The callback function.

std::future<json> ogmios::Client::sizeOfMempool()

Return size information about the mempool.

Returns The result as a std::future<json> object.

std::future<json> ogmios::Client::submitTransaction(const json& params)

Submit a transaction to the node.

Parameters
params The JSON parameters for the websocket method.
Returns The result as a std::future<json> object.

std::future<json> ogmios::Client::submitTransactionCbor(const std::string& cbor)

Submit a transaction to the node.

Parameters
cbor The transaction serialized to a CBOR base-16 string.
Returns The result as a std::future<json> object.