feat(@wallet): Integrate api to check service up or down

This commit is contained in:
Anthony Laibe 2023-01-17 10:59:25 +01:00 committed by Anthony Laibe
parent e08fdcb78c
commit 66c62e472f
2 changed files with 19 additions and 0 deletions

View File

@ -124,6 +124,7 @@ QtObject:
# Forward declaration
proc buildAllTokens(self: Service, accounts: seq[string])
proc checkRecentHistory*(self: Service)
proc checkConnected(self: Service)
proc startWallet(self: Service)
proc delete*(self: Service) =
@ -231,6 +232,8 @@ QtObject:
of "wallet-tick-reload":
self.buildAllTokens(self.getAddresses())
self.checkRecentHistory()
of "wallet-tick-check-connected":
self.checkConnected()
proc getWalletAccount*(self: Service, accountIndex: int): WalletAccountDto =
let accounts = self.getWalletAccounts()
@ -250,6 +253,19 @@ QtObject:
discard backend.startWallet()
proc checkConnected(self: Service) =
if(not singletonInstance.localAccountSensitiveSettings.getIsWalletEnabled()):
return
try:
# TODO: add event for UI (Waiting for design)
discard backend.checkConnected()
except Exception as e:
let errDescription = e.msg
error "error: ", errDescription
return
proc checkRecentHistory*(self: Service) =
if(not singletonInstance.localAccountSensitiveSettings.getIsWalletEnabled()):
return

View File

@ -77,6 +77,9 @@ rpc(deleteSavedAddress, "wakuext"):
rpc(getSavedAddresses, "wallet"):
discard
rpc(checkConnected, "wallet"):
discard
rpc(getTokens, "wallet"):
chainId: int