seedelf_cli::koios

Function witness_collateral

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

Submits a transaction body to witness collateral using a specified API endpoint.

This function sends a CBOR-encoded transaction body to the collateral witnessing endpoint. The target network (Preprod or Mainnet) is determined by the network_flag.

§Arguments

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

§Returns

  • Ok(Value) - A JSON response from the API, containing collateral witnessing results.
  • Err(Error) - If the API request fails or the response JSON parsing fails.

§Behavior

The function constructs a JSON payload containing the transaction body and sends it to the specified API endpoint using a POST request.