Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
bugfix: compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
akorchyn committed Sep 12, 2024
1 parent da9ce45 commit 0059799
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/types/storage.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use serde::de::{Deserialize, Deserializer};

// Taken from https://github.com/bos-cli-rs/near-socialdb-client-rs/blob/main/src/lib.rs
#[derive(Debug, Clone, serde::Deserialize)]
pub struct StorageBalance {
Expand All @@ -6,3 +8,12 @@ pub struct StorageBalance {
#[serde(deserialize_with = "parse_u128_string")]
pub total: u128,
}

fn parse_u128_string<'de, D>(deserializer: D) -> Result<u128, D::Error>
where
D: Deserializer<'de>,
{
<std::string::String as Deserialize>::deserialize(deserializer)?
.parse::<u128>()
.map_err(serde::de::Error::custom)
}

0 comments on commit 0059799

Please sign in to comment.