MCPcopy Create free account
hub / github.com/ChainSafe/Delorean-Protocol / decode_data

Function decode_data

fendermint/rpc/src/response.rs:13–19  ·  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

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

Callers 4

send_raw_transactionFunction · 0.85
decode_bytesFunction · 0.85
decode_fevm_createFunction · 0.85
decode_fevm_invokeFunction · 0.85

Calls 3

contextMethod · 0.80
to_vecMethod · 0.80
decodeMethod · 0.80

Tested by

no test coverage detected