Skip to content

Commit

Permalink
fix amount showing
Browse files Browse the repository at this point in the history
  • Loading branch information
chcmedeiros committed Oct 14, 2024
1 parent 2e56f82 commit 7d4922d
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 4 deletions.
8 changes: 5 additions & 3 deletions app/src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,18 @@ parser_error_t parser_getItem(const parser_context_t *ctx, uint8_t displayIdx, c
return parser_ok;
case 2:
snprintf(outKey, outKeyLen, "Amount %d", out_idx);
snprintf(outVal, outValLen, "%d", (uint8_t)ctx->tx_obj->outputs.decrypted_note.value);
uint64_to_str(buf, sizeof(buf), ctx->tx_obj->outputs.decrypted_note.value);
pageString(outVal, outValLen, buf, pageIdx, pageCount);
return parser_ok;
case 3:
snprintf(outKey, outKeyLen, "Fee");
snprintf(outVal, outValLen, "%d", (uint8_t)ctx->tx_obj->fee);
uint64_to_str(buf, sizeof(buf), ctx->tx_obj->fee);
pageString(outVal, outValLen, buf, pageIdx, pageCount);
return parser_ok;
case 4:
snprintf(outKey, outKeyLen, "Expiration");
snprintf(outVal, outValLen, "%d", ctx->tx_obj->expiration);
uint32_to_str(buf, sizeof(buf), ctx->tx_obj->expiration);
pageString(outVal, outValLen, buf, pageIdx, pageCount);
return parser_ok;
default:
break;
Expand Down
45 changes: 45 additions & 0 deletions tests/testcases.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,50 @@
"10 | Fee : 1",
"11 | Expiration : 0"
]
},
{
"index": 2,
"name": "2_ore_send_biger_amount",
"blob": "0101000000000000000300000000000000010000000000000000000000000000000100000000000000550000006c636ab46d0b2151580bba045c5e555c1d5a1318fb26c75ba2d5073d5e693e130d3283a9925dbde668353c7236a19cd2024094a38e7954adfbe4c2f69653b2000d3283a9925dbde668353c7236a19cd2024094a38e7954adfbe4c2f69653b200b10cc4d0b4c4becc68715ae4aa5453a234f989455d87cc54f14bf5d71ced41fc065050c33e37b08ac425a9125e390592a62ba9feab4a1bdbcf6311ed505e960c0496a837e61b802aea21ecd08ba76b53bc409cf43536cced3c79df677285ff3c0c5379a7b4f9ede10084b5ec76ba36aeabf882f2b5ece440fa7b239f8dab164db761b7e0c7071cf52211035482de30e8aaf5a2896e7df1dfa8079e458172ebfc824ec2a5ff1b80f29fdba92fb95f1ee7ab3467f41df427d519b332519e72cf3cb2c68eca60d78761350753bfa18b9867c7ffa8c3f83468dbc761137deb8ef2a11821d13c8ff4cfef584831211bc60e80c0bdf422438027e0b660dbdc619f872d000000008fbf7ae75c398cb702b309c812e743e9600e409f4d7bf6a1a12b74e06f0631d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b7e2f9b4a725957f10230896786eae9ff51f7f0293cbc252e4310fbdb4aeb5185828c019dd63c21ee20930bfd88e7249afd35b6c0974856d55a56a151ce586f27ded9ad661b8cde859dc76eb45645f5847fd9b959e4d8504f90534245cd313ca169419823800b11311c74555d914ca887a7cef5e2ec111d11c47e11a399c66714b6951aea8a1eb4f70b55f8a026a9b3e812847925072c7b46e284dced72d275e64faec299ef4dd370ed28d3f88b4d9e72cd15004d0092b8d9104327b707a7c4b804e81e4cd1de9cc3495c0bb73d9b1040e10af9f2a20559d4883fca4cebc348a2d7f3bf6bf32482180ac24bafd9ec2732d974eef0cc0fde34d672ddb7d7067481c0874ca991d31ca5b0ade9ef3464b5223d52900a443afc8cd64dadfa82d4ed0acdb22cf43276dbcc95e587077152f90df579b73ba543d7e79519ded7a9e652704d060f7e236f1bd5804ba08e717af9b70410061c170a462ec9aa854ff9bbe36d8d332c4fbdf37192970c29c44e88dfb7c3e5950be35e44ecdbbd5389162e7e79061f2630dc7938db34d35e357162265d22d3f018d959706205ec2c90e82013227ac6c66dfc23febf056d94dbace1dbf6b6641ab97a9ac422bd5191acbd8c2ae213e0ecda9907eb70a9798c5f783b748971993f4ba6b7c8931e125c143041abc4923b48bc309d1a6f2845664c73a4846b5ca5e18aa708314d0ebc067c1b5ba82831b8fe365463933a7a129ed5c18e055a32793b86b11052ba8bf3492c477bc80e24697e0cd4f0ed8239037971806ff5fa6768cfe70e50cdeb20340675382f8de37b4e8f3929153bb5815c5a16a78cbcd5a976b34f351c9db37ea5e708c9086bd599356295cd44fbc00a8c15128808ba88b9150404aabd2bdbeb83c039106cde728eec3459ef473236f7a32b281a2de480460313ed64118498c7fc7a70a9b4bd66845d2835020ec48e718ad306e4ceab1897876d648f0c1d3edc45475e3011ae180b07884d9f0b05cb108d2724b81540d0ec4269aaec617ab6b2c3982776f5fc7b650ab5bdca56650e7f97fdd609a9f01cf7beb409457b04ebea6501667b62ed84e77c643ebbe312ad4d957425f2a163b342b719dd806a22bf0bd2c4628ceb33b3cf39e393924264d8bac5bb3da174a32f4ed263102115583e72729286937a227f1eb3723b1ff07470de98ebee829d564ee0549c1ffd8a3d9f5187ae80e0a0f5bfa60778fd484bb7efb9b821215895a3fef58585b62fcbbc7198f947edfbc794a60f3fa18e98bc747ace026f03db7fbc15c4ce1d18111303f8aff1fff5065aefe92997a4ef4beb2932383f9257b5769df33a837388a122edee64c0db7487c154dc41826715817391c6e4c7dc3a6e0b06db8974329f051edfb58a2756957c18dcf43eb22df7b3925c943060b6c1c0d0eb03f0330b6812737951609908b6e23827caee06a2a49258ae5e9a24f3dbf3759b6a062628f29c4c7812294357ac3b4d45377176c0967228ba70e10360397ab141a8c629330d6eed4b3456419757fce360388eca7b7e5ba00ae284f99194f5e3752b99d8cb57b5ad62ea37188c5486c7650b089996ffc23b7453e33916bc55fad7d023893c8f403c71dd3724cf50542541bd8a7e825a853f9b99b59bc4dce2b8623b8bb653c01c37325f5bda408bc45dc59aef2b215b72d96f17372a8f7222e44b036289d430715fe6332cc8228f224044b3b29fdb6ab30bb843755d0e70d0cd80d3a9650a0a2bef96a775790a301722332c0e32d7d00b8534430ccfdbcc5db4bd9295f1ed4124d64e5d1590746849374fb7a29409f2c861d1547e368a77f34b462dd365db4e50fcfedfd22fe876971f3ad12ff49fa9ac49795648f3e4a96586816c757ccd7fcb2347a8d1b25a143d2f2373d4219669967edc8d3cc4f15663f76aac41630bdcfcdfb8ee39f98b2078ddd0a02a4db28eec6ef779bc74b158372470cfb093fa20b81dff2637d5dc588769c9289314277825bacc3e8088de9b8fa6bb9fb1ecd5ed612e0ea08acc397ff8247f45997700b7cf1b8d1122f0f61028f912ebfa9fa568ba43bc875005282bbcef616b1bbe7d61aa9fd181fbb874dceb471ac0821542ee3bc095fd111126a886bf1af722ef7a9652e6e7f17ac01a0d0b12f089136694ada6482a66dc7172d2a5d2742705966d98d458429e3a517432d7a1131ca5afd8a4f38e9b80d3283a9925dbde668353c7236a19cd2024094a38e7954adfbe4c2f69653b200a0930bfac1d7abf2d8fb96954259700ba13d9e7ccb89f196e3e48b14e92dc5221f85cfd7e65b645ae1c64e4200300b80842749b6c0ca5e18ec211a1f3efabb9f075d8ccfe8b448ab4bb86857c7fbd9f069b6c8bcbb88124f4ef92170183b164201390c08418836a383d6a111aee2a6767e25282270c949dbfad221383ea6363957fb12c8b7e37f537c5461704a6ee8c083a8f31ca4b3a040beac7fbe9705a2454fea4e45fe1cc935bd12716aa60485cb68ab82ab775eef395a29dbf2b703397440fae059d8ee3361b7a08429867254523f937c7654ae6fe7b188c1f0da57e9cd54657374636f696e00000000000000000000000000000000000000000000000041207265616c6c7920636f6f6c20636f696e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b1adf46b40dc8411eb74acb000cc7a69b8dd10aa181d42535c827292ccd1fc18b518389495998cbc06263de032d34a400de199cd7f1d7d08843999f42915909",
"output": [
"0 | Tx Version : V1",
"1 | Owner 1 [1/2] : 40fae059d8ee3361b7a08429867254523f937c",
"1 | Owner 1 [2/2] : 7654ae6fe7b188c1f0da57e9cd",
"2 | Amount 1 : 40",
"3 | AssetID 1 [1/2] : 51f33a2f14f92735e562dc658a5639279ddca3",
"3 | AssetID 1 [2/2] : d5079a6d1242b2a588a9cbf44c",
"4 | Owner 2 [1/2] : 40fae059d8ee3361b7a08429867254523f937c",
"4 | Owner 2 [2/2] : 7654ae6fe7b188c1f0da57e9cd",
"5 | Amount 2 : 256",
"6 | AssetID 2 [1/2] : da40fc530a12327a1c1c367b8bd66ada351005",
"6 | AssetID 2 [2/2] : 01228cdb355b8fb6c40d048a64",
"7 | Owner 3 [1/2] : 40fae059d8ee3361b7a08429867254523f937c",
"7 | Owner 3 [2/2] : 7654ae6fe7b188c1f0da57e9cd",
"8 | Amount 3 : 1",
"9 | AssetID 3 [1/2] : 51f33a2f14f92735e562dc658a5639279ddca3",
"9 | AssetID 3 [2/2] : d5079a6d1242b2a588a9cbf44c",
"10 | Fee : 1",
"11 | Expiration : 85"
],
"output_expert": [
"0 | Tx Version : V1",
"1 | Owner 1 [1/2] : 40fae059d8ee3361b7a08429867254523f937c",
"1 | Owner 1 [2/2] : 7654ae6fe7b188c1f0da57e9cd",
"2 | Amount 1 : 40",
"3 | AssetID 1 [1/2] : 51f33a2f14f92735e562dc658a5639279ddca3",
"3 | AssetID 1 [2/2] : d5079a6d1242b2a588a9cbf44c",
"4 | Owner 2 [1/2] : 40fae059d8ee3361b7a08429867254523f937c",
"4 | Owner 2 [2/2] : 7654ae6fe7b188c1f0da57e9cd",
"5 | Amount 2 : 256",
"6 | AssetID 2 [1/2] : da40fc530a12327a1c1c367b8bd66ada351005",
"6 | AssetID 2 [2/2] : 01228cdb355b8fb6c40d048a64",
"7 | Owner 3 [1/2] : 40fae059d8ee3361b7a08429867254523f937c",
"7 | Owner 3 [2/2] : 7654ae6fe7b188c1f0da57e9cd",
"8 | Amount 3 : 1",
"9 | AssetID 3 [1/2] : 51f33a2f14f92735e562dc658a5639279ddca3",
"9 | AssetID 3 [2/2] : d5079a6d1242b2a588a9cbf44c",
"10 | Fee : 1",
"11 | Expiration : 85"
]
}
]
2 changes: 1 addition & 1 deletion tests/ui_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void check_testcase(const testcase_t &tc, bool expert_mode) {
}

INSTANTIATE_TEST_SUITE_P

// Testcases generated from ironfish dkg app, using BuildTx() from utils.tx in zemu_tests
(JsonTestCasesCurrentTxVer, JsonTestsA, ::testing::ValuesIn(GetJsonTestCases("testcases.json")),
JsonTestsA::PrintToStringParamName());
TEST_P(JsonTestsA, CheckUIOutput_CurrentTX_Expert) {
Expand Down

0 comments on commit 7d4922d

Please sign in to comment.