diff --git a/src/app/boot/app_controller.nim b/src/app/boot/app_controller.nim index baeea8ea64..80d8b172a2 100644 --- a/src/app/boot/app_controller.nim +++ b/src/app/boot/app_controller.nim @@ -122,11 +122,12 @@ proc newAppController*(appService: AppService): AppController = result.chatService = chat_service.newService() result.communityService = community_service.newService(result.chatService) result.tokenService = token_service.newService(result.settingService) - result.transactionService = transaction_service.newService() result.collectibleService = collectible_service.newService() result.walletAccountService = wallet_account_service.newService( result.settingService, result.tokenService ) + result.transactionService = transaction_service.newService(result.walletAccountService) + # Core result.localAccountSettingsVariant = newQVariant( @@ -218,6 +219,7 @@ proc load*(self: AppController) = self.communityService.init() self.tokenService.init() self.walletAccountService.init() + self.transactionService.init() self.mainModule.load() diff --git a/src/app/modules/main/wallet_section/transactions/controller.nim b/src/app/modules/main/wallet_section/transactions/controller.nim index 1570a50ef0..94d4d936a0 100644 --- a/src/app/modules/main/wallet_section/transactions/controller.nim +++ b/src/app/modules/main/wallet_section/transactions/controller.nim @@ -10,7 +10,7 @@ type proc newController*[T]( delegate: T, - transactionService: transaction_service.ServiceInterface + transactionService: transaction_service.ServiceInterface, ): Controller[T] = result = Controller[T]() result.delegate = delegate @@ -20,4 +20,7 @@ method delete*[T](self: Controller[T]) = discard method init*[T](self: Controller[T]) = - discard \ No newline at end of file + discard + +method checkRecentHistory*[T](self: Controller[T]) = + self.transactionService.checkRecentHistory() \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/transactions/controller_interface.nim b/src/app/modules/main/wallet_section/transactions/controller_interface.nim index c88ce57e45..624595f7eb 100644 --- a/src/app/modules/main/wallet_section/transactions/controller_interface.nim +++ b/src/app/modules/main/wallet_section/transactions/controller_interface.nim @@ -1,5 +1,3 @@ -import ../../../../../app_service/service/token/service_interface as token_service - type AccessInterface* {.pure inheritable.} = ref object of RootObj ## Abstract class for any input/interaction with this module. @@ -10,6 +8,9 @@ method delete*(self: AccessInterface) {.base.} = method init*(self: AccessInterface) {.base.} = raise newException(ValueError, "No implementation available") +method checkRecentHistory*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + type ## Abstract class (concept) which must be implemented by object/s used in this ## module. diff --git a/src/app/modules/main/wallet_section/transactions/module.nim b/src/app/modules/main/wallet_section/transactions/module.nim index aec259b4d1..e190a9f607 100644 --- a/src/app/modules/main/wallet_section/transactions/module.nim +++ b/src/app/modules/main/wallet_section/transactions/module.nim @@ -28,6 +28,8 @@ method delete*[T](self: Module[T]) = self.controller.delete method load*[T](self: Module[T]) = + self.controller.checkRecentHistory() + self.moduleLoaded = true method isLoaded*[T](self: Module[T]): bool = diff --git a/src/app_service/service/transaction/service.nim b/src/app_service/service/transaction/service.nim index 9ec68402d3..dc38927d65 100644 --- a/src/app_service/service/transaction/service.nim +++ b/src/app_service/service/transaction/service.nim @@ -1,6 +1,7 @@ -import chronicles +import chronicles, sequtils, sugar import status/statusgo_backend_new/transactions as transactions +import ../wallet_account/service as wallet_account_service import ./service_interface, ./dto export service_interface @@ -9,22 +10,24 @@ logScope: topics = "transaction-service" type - Service* = ref object of ServiceInterface + Service* = ref object of service_interface.ServiceInterface + walletAccountService: wallet_account_service.ServiceInterface method delete*(self: Service) = discard -proc newService*(): Service = +proc newService*(walletAccountService: wallet_account_service.ServiceInterface): Service = result = Service() + result.walletAccountService = walletAccountService method init*(self: Service) = discard -method checkRecentHistory*(self: Service, addresses: seq[string]) = +method checkRecentHistory*(self: Service) = try: + let addresses = self.walletAccountService.getWalletAccounts().map(a => a.address) transactions.checkRecentHistory(addresses) except Exception as e: let errDesription = e.msg error "error: ", errDesription - return - + return \ No newline at end of file diff --git a/src/app_service/service/transaction/service_interface.nim b/src/app_service/service/transaction/service_interface.nim index dc76933661..975f35e3e0 100644 --- a/src/app_service/service/transaction/service_interface.nim +++ b/src/app_service/service/transaction/service_interface.nim @@ -12,5 +12,5 @@ method delete*(self: ServiceInterface) {.base.} = method init*(self: ServiceInterface) {.base.} = raise newException(ValueError, "No implementation available") -method checkRecentHistory*(self: ServiceInterface, addresses: seq[string]) {.base.} = - raise newException(ValueError, "No implementation available") +method checkRecentHistory*(self: ServiceInterface) {.base.} = + raise newException(ValueError, "No implementation available") \ No newline at end of file diff --git a/vendor/status-lib b/vendor/status-lib index 5de6e894a5..ce0314edda 160000 --- a/vendor/status-lib +++ b/vendor/status-lib @@ -1 +1 @@ -Subproject commit 5de6e894a57eaa2665d0d3c2207f9bd836ac82ff +Subproject commit ce0314eddaf9ce414b99abafc0b3e564ec1e1c88