Skip to content

Commit

Permalink
fix: optimized NEAR decode
Browse files Browse the repository at this point in the history
  • Loading branch information
alenmestrov committed Dec 18, 2024
1 parent 76d7078 commit 5d26a65
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ impl Method<Near> for ContextStorageEntriesRequest {

fn decode(response: Vec<u8>) -> eyre::Result<Self::Returns> {
// Decode the response as Vec of tuples with boxed slices
let entries: Vec<(Box<[u8]>, Box<[u8]>)> = serde_json::from_slice(&response)
let entries: Vec<(Vec<u8>, Vec<u8>)> = serde_json::from_slice(&response)
.map_err(|e| eyre::eyre!("Failed to decode response: {}", e))?;

// Convert to ContextStorageEntry
Ok(entries
.into_iter()
.map(|(key, value)| ContextStorageEntry {
key: key.to_vec(),
value: value.to_vec(),
key,
value
})
.collect())
}
Expand Down

0 comments on commit 5d26a65

Please sign in to comment.