pub async fn submit_tx(
tx_cbor: String,
network_flag: bool,
) -> Result<Value, Error>
Expand description
Submits a CBOR-encoded transaction to the Koios API.
This function decodes the provided CBOR-encoded transaction from a hex string into binary
data and sends it to the Koios API for submission. The target network (Preprod or Mainnet)
is determined by the network_flag
.
§Arguments
tx_cbor
- A string containing the hex-encoded CBOR transaction.network_flag
- A boolean flag specifying the network:true
for Preprod.false
for Mainnet.
§Returns
Ok(Value)
- A JSON response from the API indicating the result of the transaction submission.Err(Error)
- If the API request fails or the response JSON parsing fails.
§Behavior
- Decodes the transaction CBOR hex string into raw binary data.
- Sends the binary data as the body of a POST request with
Content-Type: application/cbor
.