Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(asset-cfg-tx): allow params to be optional in that #16

Merged
merged 2 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rust-algorand"
version = "1.8.1"
version = "1.8.2"
edition = "2021"

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion src/algorand_transactions/asset_config_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
pub struct AssetConfigTransactionJson {
#[serde(rename = "asset-id")]
pub asset_id: u64,
pub params: AssetParametersJson,
pub params: Option<AssetParametersJson>,
}

impl AssetConfigTransactionJson {
Expand Down
16 changes: 15 additions & 1 deletion src/algorand_transactions/test_utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ write_paths_and_getter_fxn!(
2 => "src/algorand_transactions/test_utils/sample-transactions-block-21516112.json",
3 => "src/algorand_transactions/test_utils/sample-transactions-block-21595839.json",
4 => "src/algorand_transactions/test_utils/sample-transactions-block-29285129.json",
5 => "src/algorand_transactions/test_utils/sample-transactions-block-29620737.json"
5 => "src/algorand_transactions/test_utils/sample-transactions-block-29620737.json",
6 => "src/algorand_transactions/test_utils/sample-block-with-no-params-in-asset-cfg-tx-34866583.json"
);

pub fn get_sample_txs_json_strs_n(n: usize) -> Vec<String> {
Expand Down Expand Up @@ -110,6 +111,7 @@ pub fn get_sample_asset_parameters_json_str() -> String {

mod tests {
use super::*;
use crate::{AlgorandBlock, AlgorandHash};

#[test]
fn should_get_sample_txs_json_strs_n() {
Expand All @@ -125,4 +127,16 @@ mod tests {
fn should_get_sample_acfg_tx_json_string() {
get_sample_acfg_tx_json_string();
}

#[test]
fn should_get_sample_block_with_no_params_in_asset_cfg_tx() {
let block =
AlgorandBlock::from_str(&read_to_string(&get_path_n(6).unwrap()).unwrap()).unwrap();
let hash = block.hash().unwrap();
// NOTE: See: https://algoexplorer.io/block/34866583
let expected_hash =
AlgorandHash::from_base_32("BNAZSMQLCEPRIUTYE44Q6I2XGAAVAOAU3X45VQEYRGIXJVWEKBPQ")
.unwrap();
assert_eq!(hash, expected_hash);
gskapka marked this conversation as resolved.
Show resolved Hide resolved
}
}
Loading
Loading