feat(@wallet): Integrate api to check service up or down
This commit is contained in:
parent
e08fdcb78c
commit
66c62e472f
|
@ -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
|
||||
|
|
|
@ -77,6 +77,9 @@ rpc(deleteSavedAddress, "wakuext"):
|
|||
rpc(getSavedAddresses, "wallet"):
|
||||
discard
|
||||
|
||||
rpc(checkConnected, "wallet"):
|
||||
discard
|
||||
|
||||
rpc(getTokens, "wallet"):
|
||||
chainId: int
|
||||
|
||||
|
|
Loading…
Reference in New Issue