Skip to content

Commit bd36026

Browse files
committed
fix: allow parsing single-address filters
1 parent 691ffcb commit bd36026

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/api/toncenter_v3/models.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,8 @@ mod option_tonlib_address_list {
11461146
}
11471147

11481148
mod tonlib_address_list {
1149+
use tycho_types::models::StdAddrFormat;
1150+
11491151
use super::*;
11501152

11511153
pub fn deserialize<'de, D>(deserializer: D) -> Result<Vec<StdAddr>, D::Error>
@@ -1170,6 +1172,15 @@ mod tonlib_address_list {
11701172
f.write_str("address list of at most 1024 items")
11711173
}
11721174

1175+
fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
1176+
where
1177+
E: serde::de::Error,
1178+
{
1179+
StdAddr::from_str_ext(v, StdAddrFormat::any())
1180+
.map(|(addr, _)| vec![addr])
1181+
.map_err(E::custom)
1182+
}
1183+
11731184
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
11741185
where
11751186
A: serde::de::SeqAccess<'de>,

0 commit comments

Comments
 (0)