From 4341d12efc7df225951f6a7b7b4bf840c23149f5 Mon Sep 17 00:00:00 2001 From: Sale Djenic Date: Mon, 7 Feb 2022 15:28:19 +0100 Subject: [PATCH] fix(@desktop/wallet): send transaction to address UI is broken Fixes #4623 --- src/app_service/service/contacts/async_tasks.nim | 13 +++++++++++-- .../shared/controls/ContactsListAndSearch.qml | 3 ++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app_service/service/contacts/async_tasks.nim b/src/app_service/service/contacts/async_tasks.nim index c88692b271..0ac32516c1 100644 --- a/src/app_service/service/contacts/async_tasks.nim +++ b/src/app_service/service/contacts/async_tasks.nim @@ -1,4 +1,4 @@ -import os +import os, parseutils import ../ens/utils as ens_utils include ../../common/json_utils @@ -8,6 +8,8 @@ include ../../../app/core/tasks/common # Async lookup ENS contact ################################################# +const PK_LENGTH_0X_INCLUDED = 132 + type LookupContactTaskArg = ref object of QObjectTaskArg value: string @@ -17,7 +19,14 @@ const lookupContactTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} = let arg = decode[LookupContactTaskArg](argEncoded) var pubkey = arg.value var address = "" - if not pubkey.startsWith("0x"): + + if (pubkey.startsWith("0x")): + var num64: int64 + let parsedChars = parseHex(pubkey, num64) + if(parsedChars != PK_LENGTH_0X_INCLUDED): + pubkey = "" + address = "" + else: # TODO refactor those calls to use the new backend and also do it in a signle call pubkey = ens_utils.pubkey(arg.value) address = ens_utils.address(arg.value) diff --git a/ui/imports/shared/controls/ContactsListAndSearch.qml b/ui/imports/shared/controls/ContactsListAndSearch.qml index 2e99c2c369..eef716d564 100644 --- a/ui/imports/shared/controls/ContactsListAndSearch.qml +++ b/ui/imports/shared/controls/ContactsListAndSearch.qml @@ -68,9 +68,10 @@ Item { Keys.onReleased: { successMessage = ""; searchResults.pubKey = ""; + root.validationError = ""; + searchResults.showProfileNotFoundMessage = false; if (chatKey.text !== "") { if (!validate()) { - searchResults.showProfileNotFoundMessage = false; noContactsRect.visible = false; return; }