Skip to content

Commit

Permalink
fix(legacy): fix OK-25071 & OK-25056 & OK-25057 & OK-25054 & OK-25053 (
Browse files Browse the repository at this point in the history
  • Loading branch information
lyxyx authored Dec 21, 2023
1 parent 2e43c22 commit a516200
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
5 changes: 2 additions & 3 deletions legacy/firmware/fsm_msg_nostr.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ void fsm_msgNostrGetPublicKey(const NostrGetPublicKey *msg) {
strcat(desc, "Nostr");
strcat(desc, " ");
strcat(desc, _("Address:"));
if (!fsm_layoutAddress(resp->publickey, NULL, desc, false, 0,
msg->address_n, msg->address_n_count, true, NULL, 0,
0, NULL)) {
if (!fsm_layoutAddress(resp->npub, NULL, desc, false, 0, msg->address_n,
msg->address_n_count, true, NULL, 0, 0, NULL)) {
return;
}
}
Expand Down
4 changes: 3 additions & 1 deletion legacy/firmware/language.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ const char *languages[][2] = {
{"Next screen will show the\npassphrase!",
"接下来, 将在屏幕中展示输\n入的 Passphrase"},
{"Next, Follow the onscreen\ninstructions to set up your\nOneKey Classic.",
"接下来,请按照屏幕上\n的指令开始设置您的 \nOneKey Classic"},
"接下来, 请按照屏幕上的指令\n开始设置 OneKey Classic"},
{"Next, check the written ", "接下来, 请再次检查刚刚抄写\n的 "},
{"Next, follow the guide and\ncheck words one by one.",
"接下来, 请跟随引导, 逐一核\n对单词."},
Expand Down Expand Up @@ -721,6 +721,7 @@ const char *languages[][2] = {
{"Sign at you own risk", "签名可能存在安全风险,请谨慎操作"},
// layout2.c
{"Sign message?", "签名消息"},
{"Signed by:", "签名者:"},
{"Signer:", "签名者:"},
// ethereum.c ethereum.c ethereum.c ethereum.c lisk.c
{"Signing", "签名中"},
Expand Down Expand Up @@ -974,6 +975,7 @@ const char *languages[][2] = {
{"lock your Trezor?", "锁定设备"},
// ethereum.c ethereum.c
{"message", "消息"},
{"message?", "消息吗?"},
// layout2.c
{"mine", "我的"},
{"minute", "分钟"},
Expand Down
6 changes: 3 additions & 3 deletions legacy/firmware/layout2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5126,7 +5126,7 @@ bool layoutSignMessage(const char *chain_name, bool verify, const char *signer,
uint8_t max_index = 3;
uint8_t key = KEY_NULL;
char title[64] = {0};
char title_tx[64] = {0};
char title_tx[128] = {0};
char lines[21] = {0};
uint32_t rowlen = 21;
const char **str;
Expand All @@ -5149,8 +5149,8 @@ bool layoutSignMessage(const char *chain_name, bool verify, const char *signer,
strcat(title, chain_name);
strcat(title, " ");
strcat(title, _("Message"));
snprintf(title_tx, 64, "%s%s %s?", _("Do you want to sign this\n"),
chain_name, _("message"));
snprintf(title_tx, 128, "%s%s %s", _("Do you want to sign this\n"),
chain_name, _("message?"));
}

ButtonRequest resp = {0};
Expand Down
12 changes: 9 additions & 3 deletions legacy/firmware/polkadot.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void polkadot_get_address_from_public_key(const uint8_t *public_key,
crypto_SS58EncodePubkey((uint8_t *)address, 64, addressType, public_key);
}

static bool layoutPolkadotSign(void) {
static bool layoutPolkadotSign(char *signer) {
bool result = false;
int index = 1;
int y = 0;
Expand All @@ -60,7 +60,7 @@ static bool layoutPolkadotSign(void) {
msg_write(MessageType_MessageType_ButtonRequest, &resp);

polkadot_tx_getNumItems(&numItems);
max_index = numItems;
max_index = numItems + 1;
refresh_menu:
oledClear();
y = 13;
Expand All @@ -75,6 +75,12 @@ static bool layoutPolkadotSign(void) {
oledDrawStringAdapter(0, y + 10, token_val, FONT_STANDARD);
layoutButtonNoAdapter(NULL, &bmp_bottom_left_close);
layoutButtonYesAdapter(NULL, &bmp_bottom_right_arrow);
} else if ((max_index - 1) == index) {
layoutHeader(tx_msg[0]);
oledDrawStringAdapter(0, y, _("Signed by:"), FONT_STANDARD);
oledDrawStringAdapter(0, y + 10, signer, FONT_STANDARD);
layoutButtonNoAdapter(NULL, &bmp_bottom_left_arrow);
layoutButtonYesAdapter(NULL, &bmp_bottom_right_arrow);
} else if (max_index == index) {
layoutHeader(_("Sign Transaction"));
oledDrawStringAdapter(0, y, tx_msg[1], FONT_STANDARD);
Expand Down Expand Up @@ -166,7 +172,7 @@ bool polkadot_sign_tx(const PolkadotSignTx *msg, const HDNode *node,
layoutHome();
return false;
} else {
if (!layoutPolkadotSign()) {
if (!layoutPolkadotSign(signer)) {
fsm_sendFailure(FailureType_Failure_ActionCancelled, "Signing cancelled");
layoutHome();
return false;
Expand Down
6 changes: 3 additions & 3 deletions legacy/firmware/polkadot/substrate/substrate_dispatch_V18.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ parser_error_t _readMethod_V18(parser_context_t* c, uint8_t moduleIdx,
uint16_t callPrivIdx = ((uint16_t)moduleIdx << 8u) + callIdx;

switch (callPrivIdx) {
case 1280: /* module 5 call 0 */
case 1287: /* module 5 call 0 */
CHECK_ERROR(_readMethod_balances_transfer_V18(
c, &method->nested.balances_transfer_V18))
break;
Expand Down Expand Up @@ -106,7 +106,7 @@ parser_error_t _readMethod_V18_kusama(parser_context_t* c, uint8_t moduleIdx,
pd_Method_V18_t* method) {
uint16_t callPrivIdx = ((uint16_t)moduleIdx << 8u) + callIdx;
switch (callPrivIdx) {
case 1024: /* module 4 call 0 */
case 1031: /* module 4 call 0 */
CHECK_ERROR(_readMethod_balances_transfer_V18(
c, &method->nested.balances_transfer_V18))
break;
Expand Down Expand Up @@ -161,7 +161,7 @@ parser_error_t _readMethod_astar(parser_context_t* c, uint8_t moduleIdx,
uint8_t callIdx, pd_Method_V18_t* method) {
uint16_t callPrivIdx = ((uint16_t)moduleIdx << 8u) + callIdx;
switch (callPrivIdx) {
case 7936: /* module 31 call 0 */
case 7943: /* module 31 call 0 */
CHECK_ERROR(_readMethod_balances_transfer_V18(
c, &method->nested.balances_transfer_V18))
break;
Expand Down

0 comments on commit a516200

Please sign in to comment.