Skip to content

Commit 7158893

Browse files
committed
fix: allow parsing comma-separated address lists
1 parent bd36026 commit 7158893

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ tycho-vm = "0.2.0"
5252
[dev-dependencies]
5353
tycho-util = { version = "0.2.11", features = ["cli", "test"] }
5454
tycho-storage = { version = "0.2.11", features = ["test"] }
55+
serde_urlencoded = "0.7.1"
5556

5657
[patch.crates-io]
5758
tycho-block-util = { git = "https://github.com/broxus/tycho.git", rev = "c8805e86e4f787744ef08705797cebc9ce840afe" }

src/api/toncenter_v3/models.rs

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,9 +1176,13 @@ mod tonlib_address_list {
11761176
where
11771177
E: serde::de::Error,
11781178
{
1179-
StdAddr::from_str_ext(v, StdAddrFormat::any())
1180-
.map(|(addr, _)| vec![addr])
1181-
.map_err(E::custom)
1179+
let mut result = Vec::new();
1180+
for v in v.split(',') {
1181+
let (addr, _) =
1182+
StdAddr::from_str_ext(v, StdAddrFormat::any()).map_err(E::custom)?;
1183+
result.push(addr);
1184+
}
1185+
Ok(result)
11821186
}
11831187

11841188
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error>
@@ -1199,3 +1203,14 @@ mod tonlib_address_list {
11991203
deserializer.deserialize_seq(ListVisitor)
12001204
}
12011205
}
1206+
1207+
#[cfg(test)]
1208+
mod tests {
1209+
use super::*;
1210+
1211+
#[test]
1212+
fn parse_wallets_request() {
1213+
let parsed: JettonWalletsRequest = serde_urlencoded::from_str("owner_address=0:21fc9cf9b5f7ebfb16ac172a70b052dedd7bdd60199c3632eb336192f7d9f9b3,0:56a4f5a8a42fd45d0beedb0fa08ebb98a9a55720dccb9986e4a62e79d3f993b4").unwrap();
1214+
println!("{parsed:#?}");
1215+
}
1216+
}

0 commit comments

Comments
 (0)