refactor(@desktop/wallet): enable check recent history
This commit is contained in:
parent
b7eaef8a84
commit
142d2a9188
|
@ -122,11 +122,12 @@ proc newAppController*(appService: AppService): AppController =
|
||||||
result.chatService = chat_service.newService()
|
result.chatService = chat_service.newService()
|
||||||
result.communityService = community_service.newService(result.chatService)
|
result.communityService = community_service.newService(result.chatService)
|
||||||
result.tokenService = token_service.newService(result.settingService)
|
result.tokenService = token_service.newService(result.settingService)
|
||||||
result.transactionService = transaction_service.newService()
|
|
||||||
result.collectibleService = collectible_service.newService()
|
result.collectibleService = collectible_service.newService()
|
||||||
result.walletAccountService = wallet_account_service.newService(
|
result.walletAccountService = wallet_account_service.newService(
|
||||||
result.settingService, result.tokenService
|
result.settingService, result.tokenService
|
||||||
)
|
)
|
||||||
|
result.transactionService = transaction_service.newService(result.walletAccountService)
|
||||||
|
|
||||||
|
|
||||||
# Core
|
# Core
|
||||||
result.localAccountSettingsVariant = newQVariant(
|
result.localAccountSettingsVariant = newQVariant(
|
||||||
|
@ -218,6 +219,7 @@ proc load*(self: AppController) =
|
||||||
self.communityService.init()
|
self.communityService.init()
|
||||||
self.tokenService.init()
|
self.tokenService.init()
|
||||||
self.walletAccountService.init()
|
self.walletAccountService.init()
|
||||||
|
self.transactionService.init()
|
||||||
self.mainModule.load()
|
self.mainModule.load()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ type
|
||||||
|
|
||||||
proc newController*[T](
|
proc newController*[T](
|
||||||
delegate: T,
|
delegate: T,
|
||||||
transactionService: transaction_service.ServiceInterface
|
transactionService: transaction_service.ServiceInterface,
|
||||||
): Controller[T] =
|
): Controller[T] =
|
||||||
result = Controller[T]()
|
result = Controller[T]()
|
||||||
result.delegate = delegate
|
result.delegate = delegate
|
||||||
|
@ -21,3 +21,6 @@ method delete*[T](self: Controller[T]) =
|
||||||
|
|
||||||
method init*[T](self: Controller[T]) =
|
method init*[T](self: Controller[T]) =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
method checkRecentHistory*[T](self: Controller[T]) =
|
||||||
|
self.transactionService.checkRecentHistory()
|
|
@ -1,5 +1,3 @@
|
||||||
import ../../../../../app_service/service/token/service_interface as token_service
|
|
||||||
|
|
||||||
type
|
type
|
||||||
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
AccessInterface* {.pure inheritable.} = ref object of RootObj
|
||||||
## Abstract class for any input/interaction with this module.
|
## Abstract class for any input/interaction with this module.
|
||||||
|
@ -10,6 +8,9 @@ method delete*(self: AccessInterface) {.base.} =
|
||||||
method init*(self: AccessInterface) {.base.} =
|
method init*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method checkRecentHistory*(self: AccessInterface) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
type
|
type
|
||||||
## Abstract class (concept) which must be implemented by object/s used in this
|
## Abstract class (concept) which must be implemented by object/s used in this
|
||||||
## module.
|
## module.
|
||||||
|
|
|
@ -28,6 +28,8 @@ method delete*[T](self: Module[T]) =
|
||||||
self.controller.delete
|
self.controller.delete
|
||||||
|
|
||||||
method load*[T](self: Module[T]) =
|
method load*[T](self: Module[T]) =
|
||||||
|
self.controller.checkRecentHistory()
|
||||||
|
|
||||||
self.moduleLoaded = true
|
self.moduleLoaded = true
|
||||||
|
|
||||||
method isLoaded*[T](self: Module[T]): bool =
|
method isLoaded*[T](self: Module[T]): bool =
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import chronicles
|
import chronicles, sequtils, sugar
|
||||||
import status/statusgo_backend_new/transactions as transactions
|
import status/statusgo_backend_new/transactions as transactions
|
||||||
|
|
||||||
|
import ../wallet_account/service as wallet_account_service
|
||||||
import ./service_interface, ./dto
|
import ./service_interface, ./dto
|
||||||
|
|
||||||
export service_interface
|
export service_interface
|
||||||
|
@ -9,22 +10,24 @@ logScope:
|
||||||
topics = "transaction-service"
|
topics = "transaction-service"
|
||||||
|
|
||||||
type
|
type
|
||||||
Service* = ref object of ServiceInterface
|
Service* = ref object of service_interface.ServiceInterface
|
||||||
|
walletAccountService: wallet_account_service.ServiceInterface
|
||||||
|
|
||||||
method delete*(self: Service) =
|
method delete*(self: Service) =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
proc newService*(): Service =
|
proc newService*(walletAccountService: wallet_account_service.ServiceInterface): Service =
|
||||||
result = Service()
|
result = Service()
|
||||||
|
result.walletAccountService = walletAccountService
|
||||||
|
|
||||||
method init*(self: Service) =
|
method init*(self: Service) =
|
||||||
discard
|
discard
|
||||||
|
|
||||||
method checkRecentHistory*(self: Service, addresses: seq[string]) =
|
method checkRecentHistory*(self: Service) =
|
||||||
try:
|
try:
|
||||||
|
let addresses = self.walletAccountService.getWalletAccounts().map(a => a.address)
|
||||||
transactions.checkRecentHistory(addresses)
|
transactions.checkRecentHistory(addresses)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
let errDesription = e.msg
|
let errDesription = e.msg
|
||||||
error "error: ", errDesription
|
error "error: ", errDesription
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,5 @@ method delete*(self: ServiceInterface) {.base.} =
|
||||||
method init*(self: ServiceInterface) {.base.} =
|
method init*(self: ServiceInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method checkRecentHistory*(self: ServiceInterface, addresses: seq[string]) {.base.} =
|
method checkRecentHistory*(self: ServiceInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5de6e894a57eaa2665d0d3c2207f9bd836ac82ff
|
Subproject commit ce0314eddaf9ce414b99abafc0b3e564ec1e1c88
|
Loading…
Reference in New Issue