Skip to content

Commit 3c3410d

Browse files
Merge pull request #964 from LedgerHQ/feat/apa/712_empty_calldata_trusted_name_matching
EIP-712 empty calldata trusted name matching
2 parents d7a7b30 + 225591d commit 3c3410d

17 files changed

Lines changed: 37 additions & 8 deletions

File tree

src/features/signMessageEIP712/ui_logic.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,28 @@ static bool handle_fallback_empty_calldata(const s_eip712_calldata_info *calldat
732732
} else {
733733
ui_712_set_intent_field("Empty transaction");
734734
}
735-
if (!getEthDisplayableAddress((uint8_t *) calldata_info->callee,
736-
buf,
737-
buf_size,
738-
chainConfig->chainId)) {
739-
return false;
740-
}
735+
736+
e_name_type types[] = {TN_TYPE_ACCOUNT};
737+
e_name_source sources[] = {TN_SOURCE_ENS, TN_SOURCE_LAB, TN_SOURCE_MAB};
738+
const s_trusted_name *trusted_name;
739+
741740
ui_712_set_title("To", 2);
742-
ui_712_set_value(buf, strlen(buf));
741+
if ((trusted_name = get_trusted_name(ARRAYLEN(types),
742+
types,
743+
ARRAYLEN(sources),
744+
sources,
745+
&calldata_info->chain_id,
746+
calldata_info->callee)) != NULL) {
747+
ui_712_set_value(trusted_name->name, strlen(trusted_name->name));
748+
} else {
749+
if (!getEthDisplayableAddress(calldata_info->callee,
750+
buf,
751+
buf_size,
752+
calldata_info->chain_id)) {
753+
return false;
754+
}
755+
ui_712_set_value(buf, strlen(buf));
756+
}
743757
return true;
744758
}
745759

16 Bytes
Loading
374 Bytes
Loading
-703 Bytes
Loading
-957 Bytes
Loading
1.1 KB
Loading
Binary file not shown.
86 Bytes
Loading
1.91 KB
Loading
-2.37 KB
Loading

0 commit comments

Comments
 (0)