fix: can't add account when being offline

Fixes #15299
This commit is contained in:
Sale Djenic 2024-08-20 13:22:20 +02:00 committed by Anthony Laibe
parent 49866d631b
commit 09cd02c0f1
4 changed files with 10 additions and 4 deletions

View File

@ -43,7 +43,6 @@ proc fetchDerivedAddressesForMnemonicTask*(argEncoded: string) {.gcsafe, nimcall
type type
FetchDetailsForAddressesTaskArg* = ref object of QObjectTaskArg FetchDetailsForAddressesTaskArg* = ref object of QObjectTaskArg
uniqueId: string uniqueId: string
chainId: int
addresses: seq[string] addresses: seq[string]
proc fetchDetailsForAddressesTask*(argEncoded: string) {.gcsafe, nimcall.} = proc fetchDetailsForAddressesTask*(argEncoded: string) {.gcsafe, nimcall.} =
@ -65,7 +64,7 @@ proc fetchDetailsForAddressesTask*(argEncoded: string) {.gcsafe, nimcall.} =
if response.result.getBool: if response.result.getBool:
jsonReponse["alreadyCreated"] = %*true jsonReponse["alreadyCreated"] = %*true
else: else:
response = status_go_accounts.getAddressDetails(arg.chainId, address) response = status_go_accounts.getAddressDetails(address, chainIds = @[], timeoutInMilliseconds = 3000)
jsonReponse = response.result jsonReponse = response.result
sleep(250) sleep(250)
data["details"] = jsonReponse data["details"] = jsonReponse

View File

@ -718,7 +718,6 @@ proc fetchDetailsForAddresses*(self: Service, uniqueId: string, addresses: seq[s
let network = self.networkService.getAppNetwork() let network = self.networkService.getAppNetwork()
let arg = FetchDetailsForAddressesTaskArg( let arg = FetchDetailsForAddressesTaskArg(
uniqueId: uniqueId, uniqueId: uniqueId,
chainId: network.chainId,
addresses: addresses, addresses: addresses,
tptr: fetchDetailsForAddressesTask, tptr: fetchDetailsForAddressesTask,
vptr: cast[ByteAddress](self.vptr), vptr: cast[ByteAddress](self.vptr),

View File

@ -379,6 +379,14 @@ proc getAddressDetails*(chainId: int, address: string): RpcResponse[JsonNode] =
let payload = %* [chainId, address] let payload = %* [chainId, address]
result = core.callPrivateRPC("wallet_getAddressDetails", payload) result = core.callPrivateRPC("wallet_getAddressDetails", payload)
proc getAddressDetails*(address: string, chainIds: seq[uint64] = @[], timeoutInMilliseconds: int): RpcResponse[JsonNode] =
let payload = %* [{
"address": address,
"chainIds": chainIds,
"timeoutInMilliseconds": timeoutInMilliseconds,
}]
result = core.callPrivateRPC("wallet_addressDetails", payload)
proc addressExists*(address: string): RpcResponse[JsonNode] = proc addressExists*(address: string): RpcResponse[JsonNode] =
let payload = %* [address] let payload = %* [address]
result = core.callPrivateRPC("wallet_addressExists", payload) result = core.callPrivateRPC("wallet_addressExists", payload)

2
vendor/status-go vendored

@ -1 +1 @@
Subproject commit 2c430568b108b5080852dd60e669b92ac5631865 Subproject commit 1418d40a6360b41f25edb4d9fb729bb048949f30