MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / decode_data

Function decode_data

fendermint/rpc/src/response.rs:15–21  ·  view source on GitHub ↗

Parse what Tendermint returns in the `data` field of [`DeliverTx`] into bytes. Somewhere along the way it replaces them with the bytes of a Base64 encoded string, and `tendermint_rpc` does not undo that wrapping.

(data: &Bytes)

Source from the content-addressed store, hash-verified

13/// Somewhere along the way it replaces them with the bytes of a Base64 encoded string,
14/// and `tendermint_rpc` does not undo that wrapping.
15pub fn decode_data(data: &Bytes) -> anyhow::Result<RawBytes> {
16 let b64 = String::from_utf8(data.to_vec()).context("error parsing data as base64 string")?;
17 let data = base64::engine::general_purpose::STANDARD
18 .decode(b64)
19 .context("error parsing base64 to bytes")?;
20 Ok(RawBytes::from(data))
21}
22
23/// Apply the encoding that Tendermint does to the bytes inside [`DeliverTx`].
24pub fn encode_data(data: &[u8]) -> Bytes {

Callers 10

send_raw_transactionFunction · 0.85
callFunction · 0.85
decode_bytesFunction · 0.85
decode_fevm_createFunction · 0.85
decode_fevm_invokeFunction · 0.85
decode_os_getFunction · 0.85
decode_blob_getFunction · 0.85
query_added_blobsMethod · 0.85
get_operator_infoMethod · 0.85

Calls 2

contextMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected