fix(@desktop/wallet): let user add a new account even address' activity details are not fully fetched

Fixes: #10800
This commit is contained in:
Sale Djenic 2023-05-25 11:55:36 +02:00 committed by Anthony Laibe
parent 36ca4cd8f9
commit ea068e4dab
3 changed files with 31 additions and 15 deletions

View File

@ -54,11 +54,23 @@ const fetchDetailsForAddressesTask*: Task = proc(argEncoded: string) {.gcsafe, n
"details": "",
"error": ""
}
var jsonReponse = %* {
"address": address,
"alreadyCreated": false,
"path": "",
"hasActivity": false
}
try:
let response = status_go_accounts.getAddressDetails(arg.chainId, address)
var response = status_go_accounts.addressExists(address)
if response.result.getBool:
jsonReponse["alreadyCreated"] = %*true
else:
response = status_go_accounts.getAddressDetails(arg.chainId, address)
jsonReponse = response.result
sleep(250)
data["details"] = response.result
data["details"] = jsonReponse
except Exception as e:
if not jsonReponse["alreadyCreated"].getBool:
let err = fmt"Error fetching details for an address: {e.msg}"
data["error"] = %* err
arg.finish(data)

View File

@ -438,6 +438,10 @@ proc getAddressDetails*(chainId: int, address: string): RpcResponse[JsonNode] {.
let payload = %* [chainId, address]
result = core.callPrivateRPC("wallet_getAddressDetails", payload)
proc addressExists*(address: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [address]
result = core.callPrivateRPC("wallet_addressExists", payload)
proc verifyPassword*(password: string): RpcResponse[JsonNode] {.raises: [Exception].} =
let payload = %* [password]
return core.callPrivateRPC("accounts_verifyPassword", payload)

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 0eca7f5088b6a0b09ae7c8f755eedeec244a2928
Subproject commit 03d9af0b958279ddf13cb4e748e5aa01e8cd8105