From fc78fa46faac236b4429ead76796414df289cb08 Mon Sep 17 00:00:00 2001 From: Nagaprasadvr Date: Thu, 28 Nov 2024 11:33:36 +0530 Subject: [PATCH] resolve commenst and add token_accounts for indexing in test fixtures --- digital_asset_types/src/dapi/common/asset.rs | 5 ++--- .../8myaCN6KcKVkMqroXuLJq6QsqRcPbvme4wV5Ubfr5mDC | Bin 0 -> 312 bytes .../8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti | Bin 0 -> 312 bytes .../integration_tests/show_fungible_flag_tests.rs | 2 ++ ...__get_asset_with_show_fungible_scenario_1.snap | 4 ++-- ...__get_asset_with_show_fungible_scenario_2.snap | 8 ++++---- 6 files changed, 10 insertions(+), 9 deletions(-) create mode 100644 integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_1/8myaCN6KcKVkMqroXuLJq6QsqRcPbvme4wV5Ubfr5mDC create mode 100644 integration_tests/tests/data/accounts/get_asset_with_show_fungible_scenario_2/8Xv3SpX94HHf32Apg4TeSeS3i2p6wuXeE8FBZr168Hti 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 0000000000000000000000000000000000000000..69f99d0d50f77ef379f58d19ca2340073a73c8a0 GIT binary patch literal 312 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQEN%~3GNbAH;+aogZ9KWl@&9$DY#+N1 z@wJ8K8#tv-`zN#A{r2#B>cYu4Pd{`!_quY8%$C--@zLfJt$Mz;*8OK#sR1X CX;jDn literal 0 HcmV?d00001 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 0000000000000000000000000000000000000000..3ffe5ac43105262bc1150bf5b3c911ed3ad51384 GIT binary patch literal 312 zcmY#jfB*@G90nE!4+a$=H-NzfNJap00)qsQ%ztaDbFVke^QO+S9HEuhcs#SZ6V6T8 z_;3DN6VAv9PV?FBetUR5b>ZZjryshVdtJFkW=rea_-ONqRy|)^>;5yW)Bu|CK~^3} zGBEsyf|b|hg+Tn5!Lfyt89^)thNVE)Cj;lzOB@gH%w+;u3Ii~WFg^hq09DUno&W#< literal 0 HcmV?d00001 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,