Skip to content

Commit 73e0dab

Browse files
Fallback to string if bytevector decoding fails
1 parent 9b8f0c0 commit 73e0dab

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/model/transaction/invoke_script_transaction.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,13 @@ fn map_args(value: &Value) -> Result<Vec<Arg>> {
225225
"integer" | "Int" => {
226226
Arg::Integer(JsonDeserializer::safe_to_int_from_field(&arg, "value")?)
227227
}
228-
"binary" | "ByteVector" => Arg::Binary(Base64String::from_string(
229-
&JsonDeserializer::safe_to_string_from_field(&arg, "value")?,
230-
)?),
228+
"binary" | "ByteVector" => {
229+
let val = JsonDeserializer::safe_to_string_from_field(&arg, "value")?;
230+
match Base64String::from_string(&val) {
231+
Ok(b) => Arg::Binary(b),
232+
Err(_) => Arg::String(val),
233+
}
234+
}
231235
"list" | "List" | "Array" => {
232236
let result = map_args(&arg["value"])?;
233237
Arg::List(result)

0 commit comments

Comments
 (0)