Skip to content

Commit 87f5640

Browse files
committed
fix: testing errors
1 parent 11e50c8 commit 87f5640

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

crates/algokit_transact/src/test_utils/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,17 @@ fn normalise_json(value: serde_json::Value) -> serde_json::Value {
553553
"num_uints",
554554
];
555555

556+
// Boolean fields that should always be included, even when false
557+
const BOOLEAN_FIELDS_TO_KEEP: &[&str] = &["frozen", "default_frozen"];
558+
556559
match value {
557560
serde_json::Value::Object(map) => serde_json::Value::Object(
558561
map.into_iter()
559562
.filter(|(k, v)| {
560563
!(v.is_null()
561-
|| v.is_boolean() && v.as_bool() == Some(false)
564+
|| v.is_boolean()
565+
&& v.as_bool() == Some(false)
566+
&& !BOOLEAN_FIELDS_TO_KEEP.contains(&k.to_case(Case::Snake).as_str())
562567
|| v.is_number()
563568
&& v.as_u64() == Some(0)
564569
&& !ZERO_VALUE_EXCLUDED_FIELDS

crates/algokit_transact_ffi/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,18 @@ impl TryFrom<Transaction> for algokit_transact::Transaction {
243243
TransactionType::AssetTransfer => {
244244
Ok(algokit_transact::Transaction::AssetTransfer(tx.try_into()?))
245245
}
246+
246247
TransactionType::AssetConfig => {
247248
Ok(algokit_transact::Transaction::AssetConfig(tx.try_into()?))
248249
}
250+
249251
TransactionType::ApplicationCall => Ok(algokit_transact::Transaction::ApplicationCall(
250252
tx.try_into()?,
251253
)),
252254
TransactionType::AssetFreeze => {
253255
Ok(algokit_transact::Transaction::AssetFreeze(tx.try_into()?))
254256
}
257+
255258
_ => Err(Self::Error::DecodingError(
256259
"Transaction type is not implemented".to_string(),
257260
)),

crates/algokit_transact_ffi/test_data.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38780,6 +38780,7 @@
3878038780
94
3878138781
]
3878238782
},
38783+
"defaultFrozen": false,
3878338784
"freeze": {
3878438785
"address": "KPVZ66IFE7KHQ6623XHTPVS3IL7BXBE3HXQG35J65CVDA54VLRPP4SVOU4",
3878538786
"pubKey": [
@@ -46845,7 +46846,8 @@
4684546846
201,
4684646847
123
4684746848
]
46848-
}
46849+
},
46850+
"frozen": false
4684946851
},
4685046852
"fee": 1000,
4685146853
"firstValid": 50659540,

0 commit comments

Comments
 (0)