fix(@desktop/wallet): send transaction to address UI is broken

Fixes #4623
This commit is contained in:
Sale Djenic 2022-02-07 15:28:19 +01:00 committed by saledjenic
parent e3b349fe51
commit 4341d12efc
2 changed files with 13 additions and 3 deletions

View File

@ -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)

View File

@ -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;
}