seedelf_cli::koios

Function evaluate_transaction

Source
pub async fn evaluate_transaction(
    tx_cbor: String,
    network_flag: bool,
) -> Result<Value, Error>
Expand description

Evaluates a transaction using the Koios API.

This function sends a CBOR-encoded transaction to the Koios API for evaluation. The API uses Ogmios to validate and evaluate the transaction. The target network is determined by the network_flag.

§Arguments

  • tx_cbor - A string containing the CBOR-encoded transaction.
  • network_flag - A boolean flag specifying the network:
    • true for Preprod/Testnet.
    • false for Mainnet.

§Returns

  • Ok(Value) - A JSON response containing the evaluation result.
  • Err(Error) - If the API request fails or the JSON parsing fails.

§Behavior

The function constructs a JSON-RPC request payload and sends a POST request to the Koios Ogmios endpoint.