mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 07:18:09 +00:00
legacy: use 2 page pagination to show xpubs in multisig get_address
This commit is contained in:
parent
5c01a9459c
commit
ec199b19a9
@ -237,7 +237,7 @@ static bool fsm_layoutAddress(const char *address, const char *desc,
|
|||||||
int multisig_index, const CoinInfo *coin) {
|
int multisig_index, const CoinInfo *coin) {
|
||||||
int screen = 0, screens = 2;
|
int screen = 0, screens = 2;
|
||||||
if (multisig) {
|
if (multisig) {
|
||||||
screens += cryptoMultisigPubkeyCount(multisig);
|
screens += 2 * cryptoMultisigPubkeyCount(multisig);
|
||||||
}
|
}
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (screen) {
|
switch (screen) {
|
||||||
@ -257,7 +257,8 @@ static bool fsm_layoutAddress(const char *address, const char *desc,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: { // show XPUBs
|
default: { // show XPUBs
|
||||||
int index = (screen - 2);
|
int index = (screen - 2) / 2;
|
||||||
|
int page = (screen - 2) % 2;
|
||||||
char xpub[112] = {0};
|
char xpub[112] = {0};
|
||||||
const HDNodeType *node_ptr = NULL;
|
const HDNodeType *node_ptr = NULL;
|
||||||
if (multisig->nodes_count) { // use multisig->nodes
|
if (multisig->nodes_count) { // use multisig->nodes
|
||||||
@ -280,7 +281,7 @@ static bool fsm_layoutAddress(const char *address, const char *desc,
|
|||||||
coin->xpub_magic, xpub, sizeof(xpub));
|
coin->xpub_magic, xpub, sizeof(xpub));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
layoutXPUB(xpub, index, multisig_index == index);
|
layoutXPUB(xpub, index, page, multisig_index == index);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,14 +653,14 @@ void layoutPublicKey(const uint8_t *pubkey) {
|
|||||||
str[1], str[2], str[3], NULL);
|
str[1], str[2], str[3], NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void layoutXPUB(const char *xpub, int index, bool ours) {
|
void layoutXPUB(const char *xpub, int index, int page, bool ours) {
|
||||||
if (layoutLast != layoutAddress && layoutLast != layoutXPUB) {
|
if (layoutLast != layoutAddress && layoutLast != layoutXPUB) {
|
||||||
layoutSwipe();
|
layoutSwipe();
|
||||||
} else {
|
} else {
|
||||||
oledClear();
|
oledClear();
|
||||||
}
|
}
|
||||||
layoutLast = layoutXPUB;
|
layoutLast = layoutXPUB;
|
||||||
char desc[] = "XPUB #__ (______)";
|
char desc[] = "XPUB #__ _/2 (______)";
|
||||||
if (index + 1 >= 10) {
|
if (index + 1 >= 10) {
|
||||||
desc[6] = '0' + (((index + 1) / 10) % 10);
|
desc[6] = '0' + (((index + 1) / 10) % 10);
|
||||||
desc[7] = '0' + ((index + 1) % 10);
|
desc[7] = '0' + ((index + 1) % 10);
|
||||||
@ -668,23 +668,27 @@ void layoutXPUB(const char *xpub, int index, bool ours) {
|
|||||||
desc[6] = '0' + ((index + 1) % 10);
|
desc[6] = '0' + ((index + 1) % 10);
|
||||||
desc[7] = ' ';
|
desc[7] = ' ';
|
||||||
}
|
}
|
||||||
|
desc[9] = '1' + page;
|
||||||
if (ours) {
|
if (ours) {
|
||||||
desc[10] = 'y';
|
desc[14] = 'y';
|
||||||
desc[11] = 'o';
|
desc[15] = 'o';
|
||||||
desc[12] = 'u';
|
desc[16] = 'u';
|
||||||
desc[13] = 'r';
|
desc[17] = 'r';
|
||||||
desc[14] = 's';
|
desc[18] = 's';
|
||||||
desc[15] = ')';
|
desc[19] = ')';
|
||||||
desc[16] = 0;
|
desc[20] = 0;
|
||||||
} else {
|
} else {
|
||||||
desc[10] = 'o';
|
desc[14] = 'o';
|
||||||
desc[11] = 't';
|
desc[15] = 't';
|
||||||
desc[12] = 'h';
|
desc[16] = 'h';
|
||||||
desc[13] = 'e';
|
desc[17] = 'e';
|
||||||
desc[14] = 'r';
|
desc[18] = 'r';
|
||||||
desc[15] = 's';
|
desc[19] = 's';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 21 characters per line, 4 lines, minus 3 chars for "..." = 81
|
||||||
|
// skip 81 characters per page
|
||||||
|
xpub += page * 81;
|
||||||
const char **str = split_message((const uint8_t *)xpub, strlen(xpub), 21);
|
const char **str = split_message((const uint8_t *)xpub, strlen(xpub), 21);
|
||||||
oledDrawString(0, 0 * 9, desc, FONT_STANDARD);
|
oledDrawString(0, 0 * 9, desc, FONT_STANDARD);
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
|
@ -64,7 +64,7 @@ void layoutAddress(const char *address, const char *desc, bool qrcode,
|
|||||||
bool ignorecase, const uint32_t *address_n,
|
bool ignorecase, const uint32_t *address_n,
|
||||||
size_t address_n_count, bool address_is_account);
|
size_t address_n_count, bool address_is_account);
|
||||||
void layoutPublicKey(const uint8_t *pubkey);
|
void layoutPublicKey(const uint8_t *pubkey);
|
||||||
void layoutXPUB(const char *xpub, int index, bool ours);
|
void layoutXPUB(const char *xpub, int index, int page, bool ours);
|
||||||
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
|
void layoutSignIdentity(const IdentityType *identity, const char *challenge);
|
||||||
void layoutDecryptIdentity(const IdentityType *identity);
|
void layoutDecryptIdentity(const IdentityType *identity);
|
||||||
void layoutU2FDialog(const char *verb, const char *appname);
|
void layoutU2FDialog(const char *verb, const char *appname);
|
||||||
|
Loading…
Reference in New Issue
Block a user