We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7810b12 commit 817cb7aCopy full SHA for 817cb7a
src/models/avatar.rs
@@ -1,10 +1,12 @@
1
use alloy::primitives::{Address, U256};
2
-use serde::Serialize;
+use serde::{Serialize, Serializer};
3
+
4
use crate::services;
5
6
#[derive(Serialize)]
7
pub struct Avatar {
8
pub token_address: Address,
9
+ #[serde(serialize_with = "serialize_u256_as_decimal")]
10
pub token_id: U256
11
}
12
@@ -17,6 +19,13 @@ impl From<services::rpc::AvatarService::Avatar> for Avatar {
17
19
18
20
21
22
+fn serialize_u256_as_decimal<S>(value: &U256, serializer: S) -> Result<S::Ok, S::Error>
23
+ where
24
+ S: Serializer,
25
+{
26
+ serializer.serialize_str(&value.to_string())
27
+}
28
29
#[allow(clippy::module_name_repetitions)]
30
31
pub struct AvatarInfo {
0 commit comments