diff --git a/digital_asset_types/src/dapi/common/asset.rs b/digital_asset_types/src/dapi/common/asset.rs index 74c86862a..da82aa9aa 100644 --- a/digital_asset_types/src/dapi/common/asset.rs +++ b/digital_asset_types/src/dapi/common/asset.rs @@ -379,9 +379,8 @@ pub fn asset_to_rpc(asset: FullAsset, options: &Options) -> Result None, }; - let token_info = if options.show_fungible && token_info.is_some() { - let token_info = token_info.unwrap(); - Some(TokenInfo { + let token_info = if options.show_fungible { + token_info.map(|token_info| TokenInfo { supply: token_info.supply.try_into().unwrap_or(0), decimals: token_info.decimals as u8, mint_authority: token_info diff --git a/integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_1/8myaCN6KcKVkMqroXuLJq6QsqRcPbvme4wV5Ubfr5mDC b/integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_1/8myaCN6KcKVkMqroXuLJq6QsqRcPbvme4wV5Ubfr5mDC new file mode 100644 index 000000000..69f99d0d5 Binary files /dev/null and b/integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_1/8myaCN6KcKVkMqroXuLJq6QsqRcPbvme4wV5Ubfr5mDC differ diff --git a/integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_2/8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti b/integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_2/8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti new file mode 100644 index 000000000..3ffe5ac43 Binary files /dev/null and b/integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_2/8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti differ diff --git a/integration_tests/tests/integration_tests/show_fungible_flag_tests.rs b/integration_tests/tests/integration_tests/show_fungible_flag_tests.rs index 4fb2bf636..113e4ab22 100644 --- a/integration_tests/tests/integration_tests/show_fungible_flag_tests.rs +++ b/integration_tests/tests/integration_tests/show_fungible_flag_tests.rs @@ -24,6 +24,7 @@ async fn test_get_asset_with_show_fungible_scenario_1() { let seeds: Vec = seed_accounts([ "Ca84nWhQu41DMRnjdhRrLZty1i9txepMhAhz5qLLGcBw", "7z6b5TE4WX4mgcQjuNBTDxK4SE75sbgEg5WWJwoUeie8", + "8myaCN6KcKVkMqroXuLJq6QsqRcPbvme4wV5Ubfr5mDC", ]); apply_migrations_and_delete_data(setup.db.clone()).await; @@ -61,6 +62,7 @@ async fn test_get_asset_with_show_fungible_scenario_2() { let seeds: Vec = seed_accounts([ "AH6wj7T8Ke5nbukjtcobjjs1CDWUcQxndtnLkKAdrSrM", "7fXKY9tPpvYsdbSNyesUqo27WYC6ZsBEULdtngGHqLCK", + "8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti", ]); apply_migrations_and_delete_data(setup.db.clone()).await; diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_1.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_1.snap index feef27799..3af1b4d31 100644 --- a/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_1.snap +++ b/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_1.snap @@ -62,11 +62,11 @@ snapshot_kind: text } ], "ownership": { - "frozen": false, + "frozen": true, "delegated": false, "delegate": null, "ownership_model": "single", - "owner": "" + "owner": "J1ep1LizHMU3Bf1GKkWePGHU3Qwwzw6FvwW5ySFWdCkn" }, "supply": null, "mutable": true, diff --git a/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_2.snap b/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_2.snap index f8e438126..c2d2edaba 100644 --- a/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_2.snap +++ b/integration_tests/tests/integration_tests/snapshots/integration_tests__show_fungible_flag_tests__get_asset_with_show_fungible_scenario_2.snap @@ -62,11 +62,11 @@ snapshot_kind: text } ], "ownership": { - "frozen": false, - "delegated": false, - "delegate": null, + "frozen": true, + "delegated": true, + "delegate": "BPB5idZgbA1DG4XEmnKs62AADRZFf3jY7Kr9mpMGyKPi", "ownership_model": "single", - "owner": "" + "owner": "GqPnSDXwp4JFtKS7YZ2HERgBbYLKpKVYy9TpVunzLRa9" }, "supply": null, "mutable": true,