Now shows the network name in the Stax public address UI flow
This commit is contained in:
@@ -21,9 +21,11 @@ void handleGetPublicKey(uint8_t p1,
|
||||
}
|
||||
|
||||
if ((p1 != P1_CONFIRM) && (p1 != P1_NON_CONFIRM)) {
|
||||
PRINTF("Error: Unexpected P1 (%u)!\n", p1);
|
||||
THROW(APDU_RESPONSE_INVALID_P1_P2);
|
||||
}
|
||||
if ((p2 != P2_CHAINCODE) && (p2 != P2_NO_CHAINCODE)) {
|
||||
PRINTF("Error: Unexpected P2 (%u)!\n", p2);
|
||||
THROW(APDU_RESPONSE_INVALID_P1_P2);
|
||||
}
|
||||
|
||||
@@ -61,6 +63,7 @@ void handleGetPublicKey(uint8_t p1,
|
||||
|
||||
(void) dataBuffer; // to prevent dead increment warning
|
||||
if (dataLength > 0) {
|
||||
PRINTF("Error: Leftover unwanted data (%u bytes long)!\n", dataLength);
|
||||
THROW(APDU_RESPONSE_INVALID_DATA);
|
||||
}
|
||||
|
||||
@@ -78,7 +81,8 @@ void handleGetPublicKey(uint8_t p1,
|
||||
"0x%.*s",
|
||||
40,
|
||||
tmpCtx.publicKeyContext.address);
|
||||
ui_display_public_key();
|
||||
// don't unnecessarily pass the current app's chain ID
|
||||
ui_display_public_key(chainConfig->chainId == chain_id ? NULL : &chain_id);
|
||||
|
||||
*flags |= IO_ASYNCH_REPLY;
|
||||
}
|
||||
|
||||
@@ -266,6 +266,7 @@ static void nonce_to_string(const txInt256_t *nonce, char *out, size_t out_size)
|
||||
static void get_network_as_string(char *out, size_t out_size) {
|
||||
uint64_t chain_id = get_tx_chain_id();
|
||||
const char *name = get_network_name_from_chain_id(&chain_id);
|
||||
|
||||
if (name == NULL) {
|
||||
// No network name found so simply copy the chain ID as the network name.
|
||||
u64_to_string(chain_id, out, out_size);
|
||||
@@ -504,7 +505,7 @@ void finalizeParsing(bool direct) {
|
||||
sizeof(strings.common.nonce));
|
||||
PRINTF("Nonce: %s\n", strings.common.nonce);
|
||||
|
||||
// Prepare chainID field
|
||||
// Prepare network field
|
||||
get_network_as_string(strings.common.network_name, sizeof(strings.common.network_name));
|
||||
PRINTF("Network: %s\n", strings.common.network_name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user