Skip to content

Commit

Permalink
feat(@wallet): Integrate api to check service up or down
Browse files Browse the repository at this point in the history
  • Loading branch information
alaibe committed Jan 24, 2023
1 parent e08fdcb commit 66c62e4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/app_service/service/wallet_account/service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down Expand Up @@ -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()
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/backend/backend.nim
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ rpc(deleteSavedAddress, "wakuext"):
rpc(getSavedAddresses, "wallet"):
discard

rpc(checkConnected, "wallet"):
discard

rpc(getTokens, "wallet"):
chainId: int

Expand Down

0 comments on commit 66c62e4

Please sign in to comment.