Skip to content

Commit 71e583a

Browse files
authored
QA improvements (#268)
* fix(subaccounts): Handle the case where subaccounts are shorter than expected * fix(subaccounts) Increase testing coverage for the new subaccount formatting * showe(token): Update token information * bump app version and update snapshots * Reduce From/To title to fit into nanos screen
1 parent 18f7887 commit 71e583a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+108
-16
lines changed

app/Makefile.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ APPVERSION_M=3
33
# This is the minor version of this release
44
APPVERSION_N=2
55
# This is the patch version of this release
6-
APPVERSION_P=6
6+
APPVERSION_P=7

app/src/parser_print_candid.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,13 @@ static parser_error_t parser_getItemCandidTransfer(
10551055
}
10561056

10571057
if (displayIdx == 1) {
1058+
// The "From account" title might be truncated on Nano devices
1059+
// due to the device's limited screen space.
1060+
#if defined(TARGET_NANOS)
1061+
snprintf(outKey, outKeyLen, "From ");
1062+
#else
10581063
snprintf(outKey, outKeyLen, "From account ");
1064+
#endif
10591065
return print_accountBytes(fields->sender, &fields->data.candid_transfer,
10601066
outVal, outValLen, pageIdx, pageCount);
10611067
}
@@ -1065,7 +1071,13 @@ static parser_error_t parser_getItemCandidTransfer(
10651071
}
10661072

10671073
if (displayIdx == 2) {
1074+
// The "To account" title might be truncated on Nano devices
1075+
// due to the device's limited screen space.
1076+
#if defined(TARGET_NANOS)
1077+
snprintf(outKey, outKeyLen, "To ");
1078+
#else
10681079
snprintf(outKey, outKeyLen, "To account ");
1080+
#endif
10691081
return page_hexstring_with_delimiters(fields->data.candid_transfer.to,
10701082
DFINITY_ADDR_LEN, outVal, outValLen,
10711083
pageIdx, pageCount);
@@ -1152,7 +1164,13 @@ parser_getItemICRCTransfer(uint8_t displayIdx, char *outKey, uint16_t outKeyLen,
11521164
}
11531165

11541166
if (displayIdx == 2) {
1167+
// The "From account" title might be truncated on Nano devices
1168+
// due to the device's limited screen space.
1169+
#if defined(TARGET_NANOS)
1170+
snprintf(outKey, outKeyLen, "From ");
1171+
#else
11551172
snprintf(outKey, outKeyLen, "From account ");
1173+
#endif
11561174
const uint8_t *sender = (uint8_t *)call->sender.data;
11571175
const uint16_t senderLen = (uint16_t)call->sender.len;
11581176
const uint8_t *fromSubaccount = call->data.icrcTransfer.from_subaccount.p;
@@ -1167,8 +1185,15 @@ parser_getItemICRCTransfer(uint8_t displayIdx, char *outKey, uint16_t outKeyLen,
11671185
if (is_stake_tx) {
11681186
displayIdx++; // skip field To account
11691187
}
1188+
11701189
if (displayIdx == 3) {
1190+
// The "To account" title might be truncated on Nano devices
1191+
// due to the device's limited screen space.
1192+
#if defined(TARGET_NANOS)
1193+
snprintf(outKey, outKeyLen, "To ");
1194+
#else
11711195
snprintf(outKey, outKeyLen, "To account ");
1196+
#endif
11721197
const candid_Principal_t *owner = &call->data.icrcTransfer.account.owner;
11731198
const uint8_t *subaccount = call->data.icrcTransfer.account.subaccount.p;
11741199
const uint16_t subaccountLen =
@@ -1613,10 +1638,9 @@ parser_error_t parser_getItemCandid(const parser_context_t *ctx,
16131638
return parser_getItemCandidTransfer(displayIdx, outKey, outKeyLen, outVal,
16141639
outValLen, pageIdx, pageCount);
16151640

1616-
case candid_icrc_transfer: {
1641+
case candid_icrc_transfer:
16171642
return parser_getItemICRCTransfer(displayIdx, outKey, outKeyLen, outVal,
16181643
outValLen, pageIdx, pageCount);
1619-
}
16201644

16211645
default:
16221646
zemu_log("Candid type not supported\n");

app/src/parser_print_helper.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -306,19 +306,17 @@ parser_error_t page_principal_with_subaccount(
306306

307307
const uint8_t FIRST_BLOCK = 7;
308308
const uint8_t OTHER_BLOCKS = 8;
309-
// Add boundary check before inserting spaces
310-
if (subaccountTextLen < FIRST_BLOCK) {
311-
return parser_unexpected_error;
312-
}
313309

314-
for (uint8_t i = 0, pos = FIRST_BLOCK; i < 3 && pos < subaccountTextLen;
315-
i++) {
316-
err = inplace_insert_char(text_ptr, sizeof(text), pos, ' ');
317-
if (err != zxerr_ok) {
318-
return parser_unexpected_error;
310+
if (subaccountTextLen >= FIRST_BLOCK) {
311+
for (uint8_t i = 0, pos = FIRST_BLOCK; i < 3 && pos < subaccountTextLen;
312+
i++) {
313+
err = inplace_insert_char(text_ptr, sizeof(text), pos, ' ');
314+
if (err != zxerr_ok) {
315+
return parser_unexpected_error;
316+
}
317+
// +1 for the space we just inserted
318+
pos += OTHER_BLOCKS + 1;
319319
}
320-
// +1 for the space we just inserted
321-
pos += OTHER_BLOCKS + 1;
322320
}
323321

324322
uint8_t finalStrLen = (uint8_t)strnlen(text, sizeof(text));

app/src/token_info.c

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ static const token_info_t TOKEN_REGISTRY[] = {
2424
{.canister_id = "ryjl3-tyaaa-aaaaa-aaaba-cai",
2525
.token_symbol = "ICP",
2626
.decimals = 8},
27+
{.canister_id = "mxzaz-hqaaa-aaaar-qaada-cai",
28+
.token_symbol = "ckBTC",
29+
.decimals = 8},
2730
{.canister_id = "ss2fx-dyaaa-aaaar-qacoq-cai",
2831
.token_symbol = "ckETH",
2932
.decimals = 18},
@@ -75,21 +78,39 @@ static const token_info_t TOKEN_REGISTRY[] = {
7578
{.canister_id = "2ouva-viaaa-aaaaq-aaamq-cai",
7679
.token_symbol = "CHAT",
7780
.decimals = 8},
81+
{.canister_id = "7ajy4-sqaaa-aaaaq-aaaqa-cai",
82+
.token_symbol = "SOC",
83+
.decimals = 8},
7884
{.canister_id = "73mez-iiaaa-aaaaq-aaasq-cai",
7985
.token_symbol = "KINIC",
8086
.decimals = 8},
8187
{.canister_id = "6rdgd-kyaaa-aaaaq-aaavq-cai",
8288
.token_symbol = "DOLR",
8389
.decimals = 8},
90+
{.canister_id = "4q2s2-oqaaa-aaaaq-aaaya-cai",
91+
.token_symbol = "GHOST",
92+
.decimals = 8},
8493
{.canister_id = "4c4fd-caaaa-aaaaq-aaa3a-cai",
8594
.token_symbol = "GHOST",
8695
.decimals = 8},
96+
{.canister_id = "5bqmf-wyaaa-aaaaq-aaa5q-cai",
97+
.token_symbol = "CAT",
98+
.decimals = 8},
99+
{.canister_id = "wedc6-xiaaa-aaaaq-aabaq-cai",
100+
.token_symbol = "EMC",
101+
.decimals = 8},
102+
{.canister_id = "wrett-waaaa-aaaaq-aabda-cai",
103+
.token_symbol = "MOD",
104+
.decimals = 8},
87105
{.canister_id = "xsi2v-cyaaa-aaaaq-aabfq-cai",
88106
.token_symbol = "DCD",
89107
.decimals = 8},
90108
{.canister_id = "vtrom-gqaaa-aaaaq-aabia-cai",
91109
.token_symbol = "BOOM",
92110
.decimals = 8},
111+
{.canister_id = "viusj-4iaaa-aaaaq-aabkq-cai",
112+
.token_symbol = "SEER",
113+
.decimals = 8},
93114
{.canister_id = "uf2wh-taaaa-aaaaq-aabna-cai",
94115
.token_symbol = "CTZ",
95116
.decimals = 8},
@@ -102,8 +123,14 @@ static const token_info_t TOKEN_REGISTRY[] = {
102123
{.canister_id = "qbizb-wiaaa-aaaaq-aabwq-cai",
103124
.token_symbol = "SONIC",
104125
.decimals = 8},
126+
{.canister_id = "sotaq-jqaaa-aaaaq-aab2a-cai",
127+
.token_symbol = "QRO",
128+
.decimals = 8},
129+
{.canister_id = "tn7jw-5iaaa-aaaaq-aab4q-cai",
130+
.token_symbol = "TRAX",
131+
.decimals = 8},
105132
{.canister_id = "tyyy3-4aaaa-aaaaq-aab7a-cai",
106-
.token_symbol = "GLDGov",
133+
.token_symbol = "GOLDAO",
107134
.decimals = 8},
108135
{.canister_id = "emww2-4yaaa-aaaaq-aacbq-cai",
109136
.token_symbol = "TRAX",
@@ -121,7 +148,7 @@ static const token_info_t TOKEN_REGISTRY[] = {
121148
.token_symbol = "ELNA",
122149
.decimals = 8},
123150
{.canister_id = "ddsp7-7iaaa-aaaaq-aacqq-cai",
124-
.token_symbol = "FPL",
151+
.token_symbol = "ICFC",
125152
.decimals = 8},
126153
{.canister_id = "druyg-tyaaa-aaaaq-aactq-cai",
127154
.token_symbol = "PANDA",
@@ -135,6 +162,9 @@ static const token_info_t TOKEN_REGISTRY[] = {
135162
{.canister_id = "bliq2-niaaa-aaaaq-aac4q-cai",
136163
.token_symbol = "EST",
137164
.decimals = 8},
165+
{.canister_id = "bzohd-byaaa-aaaaq-aac7q-cai",
166+
.token_symbol = "MORA",
167+
.decimals = 8},
138168
{.canister_id = "k45jy-aiaaa-aaaaq-aadcq-cai",
139169
.token_symbol = "MOTOKO",
140170
.decimals = 8},
@@ -155,6 +185,42 @@ static const token_info_t TOKEN_REGISTRY[] = {
155185
.decimals = 8},
156186
{.canister_id = "m6xut-mqaaa-aaaaq-aadua-cai",
157187
.token_symbol = "ICVC",
188+
.decimals = 8},
189+
{.canister_id = "mmrdk-aaaaa-aaaaq-aadxa-cai",
190+
.token_symbol = "JUNOBUILD",
191+
.decimals = 8},
192+
{.canister_id = "o7oak-iyaaa-aaaaq-aadzq-cai",
193+
.token_symbol = "KONG",
194+
.decimals = 8},
195+
{.canister_id = "p3dpy-ryaaa-aaaaq-aad7q-cai",
196+
.token_symbol = "ICTO",
197+
.decimals = 8},
198+
{.canister_id = "p7vqo-eyaaa-aaaaq-aaeca-cai",
199+
.token_symbol = "CANI",
200+
.decimals = 8},
201+
{.canister_id = "o4zzi-qaaaa-aaaaq-aaeeq-cai",
202+
.token_symbol = "WELL",
203+
.decimals = 8},
204+
{.canister_id = "oj6if-riaaa-aaaaq-aaeha-cai",
205+
.token_symbol = "ALICE",
206+
.decimals = 8},
207+
{.canister_id = "mih44-vaaaa-aaaaq-aaekq-cai",
208+
.token_symbol = "NFIDW",
209+
.decimals = 8},
210+
{.canister_id = "nfjys-2iaaa-aaaaq-aaena-cai",
211+
.token_symbol = "FUEL",
212+
.decimals = 8},
213+
{.canister_id = "ifwyg-gaaaa-aaaaq-aaeqq-cai",
214+
.token_symbol = "ICE",
215+
.decimals = 8},
216+
{.canister_id = "ixqp7-kqaaa-aaaaq-aaetq-cai",
217+
.token_symbol = "DAO",
218+
.decimals = 8},
219+
{.canister_id = "jg2ra-syaaa-aaaaq-aaewa-cai",
220+
.token_symbol = "CECIL",
221+
.decimals = 8},
222+
{.canister_id = "lvfsa-2aaaa-aaaaq-aaeyq-cai",
223+
.token_symbol = "ICX",
158224
.decimals = 8}};
159225

160226
static const size_t NUM_TOKENS = sizeof(TOKEN_REGISTRY) / sizeof(token_info_t);
-167 Bytes
8.77 KB
18 KB
20.4 KB
5.61 KB
9.42 KB

0 commit comments

Comments
 (0)