From 4d042f80aa2f95498aa302876e3757e3a81fccc9 Mon Sep 17 00:00:00 2001
From: Sale Djenic <aleksandardjenic@status.im>
Date: Mon, 10 Jan 2022 12:03:28 +0100
Subject: [PATCH] refactor(@desktop/general): dependencies to the `status-lib`
 removed

Fixes #4395
---
 src/app/boot/app_controller.nim               | 53 +++++-----
 src/app/core/eventemitter.nim                 | 60 ++++++++++++
 src/app/core/main.nim                         | 19 ++--
 src/app/core/signals/remote_signals/base.nim  |  3 +-
 .../core/signals/remote_signals/messages.nim  | 14 +--
 src/app/core/signals/signals_manager.nim      |  2 +-
 .../tasks/marathon/mailserver/controller.nim  |  3 +-
 .../core/tasks/marathon/mailserver/events.nim |  6 +-
 src/app/core/tasks/marathon/worker.nim        |  3 -
 src/app/global/app_signals.nim                |  2 +-
 .../main/activity_center/controller.nim       |  4 +-
 .../modules/main/activity_center/module.nim   |  2 +-
 .../modules/main/app_search/controller.nim    |  2 +-
 src/app/modules/main/app_search/module.nim    |  3 +-
 .../chat_section/chat_content/controller.nim  |  2 +-
 .../chat_content/messages/controller.nim      |  2 +-
 .../chat_content/messages/module.nim          |  4 +-
 .../main/chat_section/chat_content/module.nim |  3 +-
 .../chat_content/users/controller.nim         |  2 +-
 .../chat_content/users/module.nim             |  4 +-
 .../modules/main/chat_section/controller.nim  |  2 +-
 src/app/modules/main/chat_section/module.nim  |  3 +-
 .../module_access_interface.nim               |  2 +-
 .../modules/main/communities/controller.nim   |  4 +-
 src/app/modules/main/communities/module.nim   |  2 +-
 src/app/modules/main/controller.nim           |  5 +-
 src/app/modules/main/module.nim               |  2 +-
 .../modules/main/node_section/controller.nim  |  2 +-
 src/app/modules/main/node_section/module.nim  |  7 +-
 .../module_access_interface.nim               |  2 +-
 .../main/profile_section/about/controller.nim |  2 +-
 .../main/profile_section/about/module.nim     |  3 +-
 .../profile_section/advanced/controller.nim   |  5 +-
 .../main/profile_section/advanced/module.nim  |  3 +-
 .../profile_section/contacts/controller.nim   |  3 +-
 .../main/profile_section/contacts/module.nim  |  3 +-
 .../profile_section/devices/controller.nim    |  3 +-
 .../main/profile_section/devices/module.nim   |  3 +-
 .../modules/main/profile_section/module.nim   |  4 +-
 .../notifications/controller.nim              |  3 +-
 .../profile_section/notifications/module.nim  |  3 +-
 .../profile_section/privacy/controller.nim    |  3 +-
 .../main/profile_section/privacy/module.nim   |  3 +-
 .../main/profile_section/sync/controller.nim  |  3 +-
 .../main/profile_section/sync/module.nim      |  3 +-
 src/app/modules/main/stickers/controller.nim  |  4 +-
 src/app/modules/main/stickers/module.nim      |  2 +-
 .../wallet_section/account_tokens/module.nim  |  3 +-
 .../main/wallet_section/accounts/module.nim   |  2 +-
 .../wallet_section/all_tokens/controller.nim  |  3 +-
 .../main/wallet_section/all_tokens/module.nim |  4 +-
 .../wallet_section/collectibles/module.nim    |  3 +-
 .../wallet_section/current_account/module.nim |  3 +-
 .../modules/main/wallet_section/module.nim    |  5 +-
 .../saved_addresses/controller.nim            |  2 +-
 .../wallet_section/saved_addresses/module.nim |  3 +-
 .../transactions/controller.nim               |  7 +-
 .../wallet_section/transactions/model.nim     |  4 +-
 .../wallet_section/transactions/module.nim    |  3 +-
 src/app/modules/startup/controller.nim        |  5 +-
 src/app/modules/startup/login/controller.nim  |  6 +-
 src/app/modules/startup/login/module.nim      |  4 +-
 src/app/modules/startup/module.nim            |  4 +-
 .../modules/startup/onboarding/controller.nim |  5 +-
 src/app/modules/startup/onboarding/module.nim |  4 +-
 src/app_service/service/about/service.nim     |  2 +-
 src/app_service/service/about/update.nim      | 11 +--
 .../service/activity_center/service.nim       |  2 +-
 src/app_service/service/chat/service.nim      |  7 +-
 src/app_service/service/community/service.nim |  8 +-
 .../service/contacts/async_tasks.nim          |  6 +-
 src/app_service/service/contacts/service.nim  |  3 +-
 src/app_service/service/devices/service.nim   |  6 +-
 src/app_service/service/ens/utils.nim         | 98 ++++++++++++++++++-
 src/app_service/service/eth/dto/contract.nim  | 37 +++++++
 .../service/eth/dto/method_dto.nim            | 16 ++-
 .../service/eth/dto/transaction.nim           | 47 ++-------
 src/app_service/service/eth/service.nim       |  7 +-
 src/app_service/service/eth/utils.nim         |  8 ++
 src/app_service/service/general/service.nim   | 43 ++++++++
 .../service/general/service_interface.nim     | 12 +++
 src/app_service/service/keychain/service.nim  |  2 +-
 .../service/mailservers/service.nim           |  2 -
 .../service/message/dto/removed_message.nim   | 14 +++
 src/app_service/service/message/service.nim   |  3 +-
 src/app_service/service/node/service.nim      |  3 +-
 .../service/os_notification/service.nim       |  3 +-
 src/app_service/service/privacy/service.nim   |  4 +-
 .../service/saved_address/service.nim         |  4 +-
 src/app_service/service/stickers/service.nim  |  2 +-
 src/app_service/service/token/async_tasks.nim |  3 +-
 src/app_service/service/token/service.nim     |  4 +-
 .../service/transaction/async_tasks.nim       |  4 +-
 src/app_service/service/transaction/dto.nim   |  8 ++
 .../service/transaction/service.nim           | 18 +++-
 .../service/wallet_account/service.nim        |  3 +-
 96 files changed, 466 insertions(+), 271 deletions(-)
 create mode 100644 src/app/core/eventemitter.nim
 create mode 100644 src/app_service/service/general/service.nim
 create mode 100644 src/app_service/service/general/service_interface.nim
 create mode 100644 src/app_service/service/message/dto/removed_message.nim

diff --git a/src/app/boot/app_controller.nim b/src/app/boot/app_controller.nim
index 5681ded9bb..1a3a92ddf1 100644
--- a/src/app/boot/app_controller.nim
+++ b/src/app/boot/app_controller.nim
@@ -1,5 +1,6 @@
 import NimQml
 
+import ../../app_service/service/general/service as general_service
 import ../../app_service/service/os_notification/service as os_notification_service
 import ../../app_service/service/eth/service as eth_service
 import ../../app_service/service/keychain/service as keychain_service
@@ -49,6 +50,7 @@ type
     globalUtilsVariant: QVariant
 
     # Services
+    generalService: general_service.Service
     osNotificationService: os_notification_service.Service
     keychainService: keychain_service.Service
     ethService: eth_service.Service
@@ -98,9 +100,9 @@ proc mainDidLoad*(self: AppController)
 #################################################
 
 proc connect(self: AppController) =
-  self.statusFoundation.status.events.once("nodeStopped") do(a: Args):
-    # TODO: remove this once accounts are not tracked in the AccountsModel
-    self.statusFoundation.status.reset()
+  self.statusFoundation.events.once("nodeStopped") do(a: Args):
+    # not sure, but maybe we should take some actions when node stops
+    discard
 
 proc newAppController*(statusFoundation: StatusFoundation): AppController =
   result = AppController()
@@ -114,31 +116,32 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
   result.globalUtilsVariant = newQVariant(singletonInstance.utils)
 
   # Services
+  result.generalService = general_service.newService()
   result.settingsService = settings_service.newService()
   result.nodeConfigurationService = node_configuration_service.newService(statusFoundation.fleetConfiguration, 
   result.settingsService)
-  result.osNotificationService = os_notification_service.newService(statusFoundation.status.events)
-  result.keychainService = keychain_service.newService(statusFoundation.status.events)
+  result.osNotificationService = os_notification_service.newService(statusFoundation.events)
+  result.keychainService = keychain_service.newService(statusFoundation.events)
   result.ethService = eth_service.newService()
   result.accountsService = accounts_service.newService(statusFoundation.fleetConfiguration)
   result.networkService = network_service.newService()
-  result.contactsService = contacts_service.newService(statusFoundation.status.events, statusFoundation.threadpool)
-  result.chatService = chat_service.newService(statusFoundation.status.events, result.contactsService)
-  result.communityService = community_service.newService(statusFoundation.status.events, result.chatService)
-  result.messageService = message_service.newService(statusFoundation.status.events, statusFoundation.threadpool)
-  result.activityCenterService = activity_center_service.newService(statusFoundation.status.events, 
+  result.contactsService = contacts_service.newService(statusFoundation.events, statusFoundation.threadpool)
+  result.chatService = chat_service.newService(statusFoundation.events, result.contactsService)
+  result.communityService = community_service.newService(statusFoundation.events, result.chatService)
+  result.messageService = message_service.newService(statusFoundation.events, statusFoundation.threadpool)
+  result.activityCenterService = activity_center_service.newService(statusFoundation.events,
   statusFoundation.threadpool, result.chatService)
-  result.tokenService = token_service.newService(statusFoundation.status.events, statusFoundation.threadpool, 
+  result.tokenService = token_service.newService(statusFoundation.events, statusFoundation.threadpool, 
   result.settingsService)
   result.collectibleService = collectible_service.newService(result.settingsService)
-  result.walletAccountService = wallet_account_service.newService(statusFoundation.status.events, result.settingsService, 
+  result.walletAccountService = wallet_account_service.newService(statusFoundation.events, result.settingsService, 
   result.accountsService, result.tokenService)
-  result.transactionService = transaction_service.newService(statusFoundation.status.events, statusFoundation.threadpool, 
+  result.transactionService = transaction_service.newService(statusFoundation.events, statusFoundation.threadpool, 
   result.walletAccountService)
   result.bookmarkService = bookmark_service.newService()
   result.profileService = profile_service.newService()
   result.stickersService = stickers_service.newService(
-    statusFoundation.status.events,
+    statusFoundation.events,
     statusFoundation.threadpool,
     result.ethService,
     result.settingsService,
@@ -147,31 +150,31 @@ proc newAppController*(statusFoundation: StatusFoundation): AppController =
     result.networkService,
     result.chatService
   )
-  result.aboutService = about_service.newService(statusFoundation.status.events, statusFoundation.threadpool, 
+  result.aboutService = about_service.newService(statusFoundation.events, statusFoundation.threadpool, 
   result.settingsService)
   result.dappPermissionsService = dapp_permissions_service.newService()
   result.languageService = language_service.newService()
   # result.mnemonicService = mnemonic_service.newService()
-  result.privacyService = privacy_service.newService(statusFoundation.status.events, result.settingsService, 
+  result.privacyService = privacy_service.newService(statusFoundation.events, result.settingsService, 
   result.accountsService)
   result.providerService = provider_service.newService(result.dappPermissionsService, result.settingsService)
-  result.savedAddressService = saved_address_service.newService(statusFoundation.status.events)
-  result.devicesService = devices_service.newService(statusFoundation.status.events, result.settingsService)
-  result.mailserversService = mailservers_service.newService(statusFoundation.status.events, statusFoundation.marathon,
+  result.savedAddressService = saved_address_service.newService(statusFoundation.events)
+  result.devicesService = devices_service.newService(statusFoundation.events, result.settingsService)
+  result.mailserversService = mailservers_service.newService(statusFoundation.events, statusFoundation.marathon,
   result.settingsService, result.nodeConfigurationService, statusFoundation.fleetConfiguration)
-  result.nodeService = node_service.newService(statusFoundation.status.events, statusFoundation.threadpool, 
+  result.nodeService = node_service.newService(statusFoundation.events, statusFoundation.threadpool, 
   result.settingsService)
 
   # Modules
   result.startupModule = startup_module.newModule[AppController](
     result,
-    statusFoundation.status.events,
+    statusFoundation.events,
     result.keychainService, 
     result.accountsService
   )
   result.mainModule = main_module.newModule[AppController](
     result,
-    statusFoundation.status.events,
+    statusFoundation.events,
     result.keychainService,
     result.accountsService,
     result.chatService,
@@ -241,6 +244,7 @@ proc delete*(self: AppController) =
   self.messageService.delete
   self.privacyService.delete
   self.profileService.delete
+  self.generalService.delete
 
 proc startupDidLoad*(self: AppController) =
   singletonInstance.engine.setRootContextProperty("localAppSettings", self.localAppSettingsVariant)
@@ -257,6 +261,7 @@ proc mainDidLoad*(self: AppController) =
   self.mainModule.checkForStoringPassword()
 
 proc start*(self: AppController) =
+  self.generalService.init()
   self.ethService.init()
   self.accountsService.init()
   
@@ -294,7 +299,7 @@ proc load(self: AppController) =
 
   # load main module
   self.mainModule.load(
-    self.statusFoundation.status.events,
+    self.statusFoundation.events,
     self.settingsService,
     self.contactsService,
     self.chatService,
@@ -303,7 +308,7 @@ proc load(self: AppController) =
   )
 
 proc userLoggedIn*(self: AppController) =
-  self.statusFoundation.status.startMessenger()
+  self.generalService.startMessenger()
   self.load()
 
   # Once user is logged in and main module is loaded we need to check if it gets here importing mnemonic or not
diff --git a/src/app/core/eventemitter.nim b/src/app/core/eventemitter.nim
new file mode 100644
index 0000000000..6db028fad8
--- /dev/null
+++ b/src/app/core/eventemitter.nim
@@ -0,0 +1,60 @@
+import # system libs
+  tables
+
+import # deps
+  uuids
+
+type 
+  Args* = ref object of RootObj # ...args
+  Handler* = proc (args: Args) {.closure.} # callback function type
+  EventEmitter* = ref object
+    events: Table[string, Table[UUID, Handler]]
+
+proc createEventEmitter*(): EventEmitter = 
+  result.new
+  result.events = initTable[string, Table[UUID, Handler]]()
+
+
+proc on(this: EventEmitter, name: string, handlerId: UUID, handler: Handler): void =
+  if this.events.hasKey(name):
+    this.events[name].add handlerId, handler
+    return
+  
+  this.events[name] = [(handlerId, handler)].toTable
+
+proc on*(this: EventEmitter, name: string, handler: Handler): void = 
+  var uuid: UUID
+  this.on(name, uuid, handler)
+
+proc once*(this:EventEmitter, name:string, handler:Handler): void =
+  var handlerId = genUUID()
+  this.on(name, handlerId) do(a: Args):
+    handler(a)
+    this.events[name].del handlerId
+
+proc emit*(this:EventEmitter, name:string, args:Args): void  =
+  if this.events.hasKey(name):
+    # collect the handlers before executing them
+    # because of 'once' proc, we also mutate
+    # this.events. This can cause unexpected behaviour
+    # while having an iterator on this.events
+    var handlers: seq[Handler] = @[]
+    for (id, handler) in this.events[name].pairs:
+      handlers.add(handler)
+
+    for i in 0..len(handlers)-1:
+      handlers[i](args)
+
+when isMainModule:
+  block:
+    type ReadyArgs = ref object of Args
+      text: string
+    var evts = createEventEmitter()
+    evts.on("ready") do(a: Args):
+      var args = ReadyArgs(a)
+      echo args.text, ": from [1st] handler"
+    evts.once("ready") do(a: Args):
+      var args = ReadyArgs(a)
+      echo args.text, ": from [2nd] handler"
+    evts.emit("ready", ReadyArgs(text:"Hello, World"))
+    evts.emit("ready", ReadyArgs(text:"Hello, World"))
diff --git a/src/app/core/main.nim b/src/app/core/main.nim
index bf6a3ed06e..9f31c75294 100644
--- a/src/app/core/main.nim
+++ b/src/app/core/main.nim
@@ -1,7 +1,6 @@
 import NimQml, chronicles, task_runner
-import ../../constants
-import status/status as status_lib_status
-import 
+import
+  eventemitter,
   ./fleets/fleet_configuration,
   ./tasks/marathon,
   ./tasks/marathon/mailserver/controller,
@@ -9,11 +8,11 @@ import
   ./tasks/threadpool,
   ./signals/signals_manager
 
-export status_lib_status
+export eventemitter
 export marathon, task_runner, signals_manager, fleet_configuration
 
 type StatusFoundation* = ref object
-  status*: Status # in one point of time this should be completely removed
+  events*: EventEmitter
   fleetConfiguration*: FleetConfiguration
   threadpool*: ThreadPool
   marathon*: Marathon
@@ -23,16 +22,13 @@ type StatusFoundation* = ref object
 
 proc newStatusFoundation*(fleetConfig: string): StatusFoundation =
   result = StatusFoundation()
-  
-  result.status = newStatusInstance()
-  result.status.initNode(STATUSGODIR, KEYSTOREDIR)
-
+  result.events = createEventEmitter()  
   result.fleetConfiguration = newFleetConfiguration(fleetConfig)
-  result.mailserverController = newMailserverController(result.status.events)
+  result.mailserverController = newMailserverController(result.events)
   result.mailserverWorker = newMailserverWorker(cast[ByteAddress](result.mailserverController.vptr))
   result.threadpool = newThreadPool()
   result.marathon = newMarathon(result.mailserverWorker)
-  result.signalsManager = newSignalsManager(result.status.events)
+  result.signalsManager = newSignalsManager(result.events)
 
 proc delete*(self: StatusFoundation) =
   self.threadpool.teardown()
@@ -41,7 +37,6 @@ proc delete*(self: StatusFoundation) =
   self.mailserverController.delete()
   self.fleetConfiguration.delete()
   self.signalsManager.delete()
-  self.status.reset()
 
 proc onLoggedIn*(self: StatusFoundation) =
   self.marathon.onLoggedIn()
diff --git a/src/app/core/signals/remote_signals/base.nim b/src/app/core/signals/remote_signals/base.nim
index 795509eec8..bc7624adf3 100644
--- a/src/app/core/signals/remote_signals/base.nim
+++ b/src/app/core/signals/remote_signals/base.nim
@@ -1,8 +1,7 @@
-import json
 import json_serialization
 import signal_type
 
-import eventemitter
+import ../../eventemitter
 
 export signal_type
 
diff --git a/src/app/core/signals/remote_signals/messages.nim b/src/app/core/signals/remote_signals/messages.nim
index 11580b0216..c2e349144f 100644
--- a/src/app/core/signals/remote_signals/messages.nim
+++ b/src/app/core/signals/remote_signals/messages.nim
@@ -2,11 +2,7 @@ import json
 
 import base
 
-# Step by step we should remove all these types from `status-lib`
-import status/types/[activity_center_notification, removed_message]
-import status/types/community as old_community
-
-import ../../../../app_service/service/message/dto/[message, pinned_message_update, reaction]
+import ../../../../app_service/service/message/dto/[message, pinned_message_update, reaction, removed_message]
 import ../../../../app_service/service/chat/dto/[chat]
 import ../../../../app_service/service/community/dto/[community]
 import ../../../../app_service/service/activity_center/dto/[notification]
@@ -21,10 +17,10 @@ type MessageSignal* = ref object of Signal
   devices*: seq[DeviceDto]
   emojiReactions*: seq[ReactionDto]
   communities*: seq[CommunityDto]
-  membershipRequests*: seq[old_community.CommunityMembershipRequest]
+  membershipRequests*: seq[CommunityMembershipRequestDto]
   activityCenterNotifications*: seq[ActivityCenterNotificationDto]
   statusUpdates*: seq[StatusUpdateDto]
-  deletedMessages*: seq[RemovedMessage]
+  deletedMessages*: seq[RemovedMessageDto]
 
 proc fromEvent*(T: type MessageSignal, event: JsonNode): MessageSignal = 
   var signal:MessageSignal = MessageSignal()
@@ -64,11 +60,11 @@ proc fromEvent*(T: type MessageSignal, event: JsonNode): MessageSignal =
 
   if event["event"]{"requestsToJoinCommunity"} != nil:
     for jsonCommunity in event["event"]["requestsToJoinCommunity"]:
-      signal.membershipRequests.add(jsonCommunity.toCommunityMembershipRequest)
+      signal.membershipRequests.add(jsonCommunity.toCommunityMembershipRequestDto())
 
   if event["event"]{"removedMessages"} != nil:
     for jsonRemovedMessage in event["event"]["removedMessages"]:
-      signal.deletedMessages.add(jsonRemovedMessage.toRemovedMessage)
+      signal.deletedMessages.add(jsonRemovedMessage.toRemovedMessageDto())
 
   if event["event"]{"activityCenterNotifications"} != nil:
     for jsonNotification in event["event"]["activityCenterNotifications"]:
diff --git a/src/app/core/signals/signals_manager.nim b/src/app/core/signals/signals_manager.nim
index 165c498f81..e73fe7aace 100644
--- a/src/app/core/signals/signals_manager.nim
+++ b/src/app/core/signals/signals_manager.nim
@@ -1,5 +1,5 @@
 import NimQml, json, strutils, chronicles, json_serialization
-import eventemitter
+import ../eventemitter
 
 include types
 
diff --git a/src/app/core/tasks/marathon/mailserver/controller.nim b/src/app/core/tasks/marathon/mailserver/controller.nim
index 1c7bd3688d..2479173ab1 100644
--- a/src/app/core/tasks/marathon/mailserver/controller.nim
+++ b/src/app/core/tasks/marathon/mailserver/controller.nim
@@ -1,5 +1,6 @@
 import NimQml, times, strutils, json, json_serialization, chronicles
 
+import ../../../eventemitter
 import ../../../fleets/fleet_configuration
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/node_configuration/service_interface as node_config_service
@@ -12,8 +13,6 @@ import status/statusgo_backend_new/general as status_general
 import events
 import ../../common as task_runner_common
 
-import eventemitter
-
 logScope:
   topics = "mailserver controller"
 
diff --git a/src/app/core/tasks/marathon/mailserver/events.nim b/src/app/core/tasks/marathon/mailserver/events.nim
index 9d94768f89..23d2f72150 100644
--- a/src/app/core/tasks/marathon/mailserver/events.nim
+++ b/src/app/core/tasks/marathon/mailserver/events.nim
@@ -1,8 +1,6 @@
-import # vendor libs
-  NimQml, json_serialization
+import NimQml, json_serialization
 
-import # status-desktop libs
-  eventemitter
+import ../../../eventemitter
 
 type
   MailserverEvents* = ref object
diff --git a/src/app/core/tasks/marathon/worker.nim b/src/app/core/tasks/marathon/worker.nim
index 1e40196be4..5d529846a6 100644
--- a/src/app/core/tasks/marathon/worker.nim
+++ b/src/app/core/tasks/marathon/worker.nim
@@ -1,6 +1,3 @@
-import # std libs
-  json
-
 import # vendor libs
   chronicles, chronos, json_serialization, task_runner
 
diff --git a/src/app/global/app_signals.nim b/src/app/global/app_signals.nim
index 7c0b80dac0..8d9d960674 100644
--- a/src/app/global/app_signals.nim
+++ b/src/app/global/app_signals.nim
@@ -1,6 +1,6 @@
 from  ../modules/shared_models/section_item import SectionType
 
-import eventemitter
+import ../core/eventemitter
 
 export SectionType
 
diff --git a/src/app/modules/main/activity_center/controller.nim b/src/app/modules/main/activity_center/controller.nim
index 57e925a635..7bce1bdb16 100644
--- a/src/app/modules/main/activity_center/controller.nim
+++ b/src/app/modules/main/activity_center/controller.nim
@@ -1,9 +1,9 @@
 import Tables, stint
-import eventemitter
 import ./controller_interface
 import ./io_interface
 
-import ../../../../app/core/signals/types
+import ../../../core/eventemitter
+import ../../../core/signals/types
 import ../../../../app_service/service/activity_center/service as activity_center_service
 import ../../../../app_service/service/contacts/service as contacts_service
 import ../../../../app_service/service/chat/service as chat_service
diff --git a/src/app/modules/main/activity_center/module.nim b/src/app/modules/main/activity_center/module.nim
index 4b6a9d8bc2..01e43406be 100644
--- a/src/app/modules/main/activity_center/module.nim
+++ b/src/app/modules/main/activity_center/module.nim
@@ -1,11 +1,11 @@
 import NimQml, Tables, stint, sugar, sequtils
 
-import eventemitter
 import ./io_interface, ./view, ./controller
 import ./item as notification_item
 import ../../shared_models/message_item as message_item
 import ../../shared_models/message_item_qobject as message_item_qobject
 import ../../../global/global_singleton
+import ../../../core/eventemitter
 import ../../../../app_service/service/activity_center/service as activity_center_service
 import ../../../../app_service/service/contacts/service as contacts_service
 
diff --git a/src/app/modules/main/app_search/controller.nim b/src/app/modules/main/app_search/controller.nim
index e699f5da6d..bcbc3c103e 100644
--- a/src/app/modules/main/app_search/controller.nim
+++ b/src/app/modules/main/app_search/controller.nim
@@ -8,7 +8,7 @@ import ../../../../app_service/service/community/service as community_service
 import ../../../../app_service/service/message/service as message_service
 
 import ../../../core/signals/types
-import eventemitter
+import ../../../core/eventemitter
 
 export controller_interface
 
diff --git a/src/app/modules/main/app_search/module.nim b/src/app/modules/main/app_search/module.nim
index ec532f991a..bbdadd6142 100644
--- a/src/app/modules/main/app_search/module.nim
+++ b/src/app/modules/main/app_search/module.nim
@@ -10,13 +10,12 @@ import ../../shared_models/message_item
 
 import ../../../global/global_singleton
 import ../../../global/app_sections_config as conf
+import ../../../core/eventemitter
 import ../../../../app_service/service/contacts/service as contact_service
 import ../../../../app_service/service/chat/service as chat_service
 import ../../../../app_service/service/community/service as community_service
 import ../../../../app_service/service/message/service as message_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/chat_section/chat_content/controller.nim b/src/app/modules/main/chat_section/chat_content/controller.nim
index 7daf10bf1d..ed59672655 100644
--- a/src/app/modules/main/chat_section/chat_content/controller.nim
+++ b/src/app/modules/main/chat_section/chat_content/controller.nim
@@ -10,7 +10,7 @@ import ../../../../../app_service/service/community/service as community_service
 import ../../../../../app_service/service/message/service as message_service
 
 import ../../../../core/signals/types
-import eventemitter
+import ../../../../core/eventemitter
 
 export controller_interface
 
diff --git a/src/app/modules/main/chat_section/chat_content/messages/controller.nim b/src/app/modules/main/chat_section/chat_content/messages/controller.nim
index 181ec832e6..9e505ea9ab 100644
--- a/src/app/modules/main/chat_section/chat_content/messages/controller.nim
+++ b/src/app/modules/main/chat_section/chat_content/messages/controller.nim
@@ -7,7 +7,7 @@ import ../../../../../../app_service/service/community/service as community_serv
 import ../../../../../../app_service/service/chat/service as chat_service
 import ../../../../../../app_service/service/message/service as message_service
 
-import eventemitter
+import ../../../../../core/eventemitter
 
 export controller_interface
 
diff --git a/src/app/modules/main/chat_section/chat_content/messages/module.nim b/src/app/modules/main/chat_section/chat_content/messages/module.nim
index cd7efbb293..38e20afee9 100644
--- a/src/app/modules/main/chat_section/chat_content/messages/module.nim
+++ b/src/app/modules/main/chat_section/chat_content/messages/module.nim
@@ -6,14 +6,12 @@ import ../../../../shared_models/message_model
 import ../../../../shared_models/message_item
 import ../../../../shared_models/message_reaction_item
 import ../../../../../global/global_singleton
-
+import ../../../../../core/eventemitter
 import ../../../../../../app_service/service/contacts/service as contact_service
 import ../../../../../../app_service/service/community/service as community_service
 import ../../../../../../app_service/service/chat/service as chat_service
 import ../../../../../../app_service/service/message/service as message_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/chat_section/chat_content/module.nim b/src/app/modules/main/chat_section/chat_content/module.nim
index eb3f400e01..9d07488b80 100644
--- a/src/app/modules/main/chat_section/chat_content/module.nim
+++ b/src/app/modules/main/chat_section/chat_content/module.nim
@@ -6,6 +6,7 @@ import ../../../shared_models/message_model as pinned_msg_model
 import ../../../shared_models/message_item as pinned_msg_item
 import ../../../shared_models/message_reaction_item as pinned_msg_reaction_item
 import ../../../../global/global_singleton
+import ../../../../core/eventemitter
 
 import input_area/module as input_area_module
 import messages/module as messages_module
@@ -17,8 +18,6 @@ import ../../../../../app_service/service/chat/service as chat_service
 import ../../../../../app_service/service/community/service as community_service
 import ../../../../../app_service/service/message/service as message_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/chat_section/chat_content/users/controller.nim b/src/app/modules/main/chat_section/chat_content/users/controller.nim
index 8d90e857ee..c6c99a6d86 100644
--- a/src/app/modules/main/chat_section/chat_content/users/controller.nim
+++ b/src/app/modules/main/chat_section/chat_content/users/controller.nim
@@ -6,7 +6,7 @@ import ../../../../../../app_service/service/contacts/service as contact_service
 import ../../../../../../app_service/service/community/service as community_service
 import ../../../../../../app_service/service/message/service as message_service
 
-import eventemitter
+import ../../../../../core/eventemitter
 
 export controller_interface
 
diff --git a/src/app/modules/main/chat_section/chat_content/users/module.nim b/src/app/modules/main/chat_section/chat_content/users/module.nim
index 8c9126b403..ea6138cdf1 100644
--- a/src/app/modules/main/chat_section/chat_content/users/module.nim
+++ b/src/app/modules/main/chat_section/chat_content/users/module.nim
@@ -3,13 +3,11 @@ import io_interface
 import ../io_interface as delegate_interface
 import view, item, model, controller
 import ../../../../../global/global_singleton
-
+import ../../../../../core/eventemitter
 import ../../../../../../app_service/service/contacts/service as contact_service
 import ../../../../../../app_service/service/community/service as community_service
 import ../../../../../../app_service/service/message/service as message_service
 
-import eventemitter
-
 export io_interface
 
 type 
diff --git a/src/app/modules/main/chat_section/controller.nim b/src/app/modules/main/chat_section/controller.nim
index ea6430eb3b..531e0c0678 100644
--- a/src/app/modules/main/chat_section/controller.nim
+++ b/src/app/modules/main/chat_section/controller.nim
@@ -9,7 +9,7 @@ import ../../../../app_service/service/chat/service as chat_service
 import ../../../../app_service/service/community/service as community_service
 import ../../../../app_service/service/message/service as message_service
 
-import eventemitter
+import ../../../core/eventemitter
 
 export controller_interface
 
diff --git a/src/app/modules/main/chat_section/module.nim b/src/app/modules/main/chat_section/module.nim
index 023be408bd..e6266ac7a8 100644
--- a/src/app/modules/main/chat_section/module.nim
+++ b/src/app/modules/main/chat_section/module.nim
@@ -8,14 +8,13 @@ import ../../shared_models/contacts_model as contacts_model
 import chat_content/module as chat_content_module
 
 import ../../../global/global_singleton
+import ../../../core/eventemitter
 import ../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../app_service/service/contacts/service as contact_service
 import ../../../../app_service/service/chat/service as chat_service
 import ../../../../app_service/service/community/service as community_service
 import ../../../../app_service/service/message/service as message_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/chat_section/private_interfaces/module_access_interface.nim b/src/app/modules/main/chat_section/private_interfaces/module_access_interface.nim
index e23b812a4d..3d03a51357 100644
--- a/src/app/modules/main/chat_section/private_interfaces/module_access_interface.nim
+++ b/src/app/modules/main/chat_section/private_interfaces/module_access_interface.nim
@@ -6,7 +6,7 @@ import ../../../../../app_service/service/chat/service as chat_service
 import ../../../../../app_service/service/community/service as community_service
 import ../../../../../app_service/service/message/service as message_service
 
-import eventemitter
+import ../../../../core/eventemitter
 
 method delete*(self: AccessInterface) {.base.} =
   raise newException(ValueError, "No implementation available")
diff --git a/src/app/modules/main/communities/controller.nim b/src/app/modules/main/communities/controller.nim
index 04d1691df9..377c81e050 100644
--- a/src/app/modules/main/communities/controller.nim
+++ b/src/app/modules/main/communities/controller.nim
@@ -1,9 +1,9 @@
 import Tables, stint
-import eventemitter
 import ./controller_interface
 import ./io_interface
 
-import ../../../../app/core/signals/types
+import ../../../core/signals/types
+import ../../../core/eventemitter
 import ../../../../app_service/service/community/service as community_service
 
 export controller_interface
diff --git a/src/app/modules/main/communities/module.nim b/src/app/modules/main/communities/module.nim
index 165852dde1..42b2628808 100644
--- a/src/app/modules/main/communities/module.nim
+++ b/src/app/modules/main/communities/module.nim
@@ -1,12 +1,12 @@
 import NimQml, json, sequtils, sugar
 
-import eventemitter
 import ./io_interface
 import ../io_interface as delegate_interface
 import ./view, ./controller
 import ../../shared_models/section_item
 import ../../shared_models/member_item
 import ../../../global/global_singleton
+import ../../../core/eventemitter
 import ../../../../app_service/service/community/service as community_service
 
 export io_interface
diff --git a/src/app/modules/main/controller.nim b/src/app/modules/main/controller.nim
index c1a7432612..2949999a67 100644
--- a/src/app/modules/main/controller.nim
+++ b/src/app/modules/main/controller.nim
@@ -1,6 +1,8 @@
 import ../shared_models/section_item, controller_interface, io_interface, chronicles
 import ../../global/global_singleton
 import ../../global/app_signals
+import ../../core/signals/types
+import ../../core/eventemitter
 import ../../../app_service/service/settings/service_interface as settings_service
 import ../../../app_service/service/keychain/service as keychain_service
 import ../../../app_service/service/accounts/service_interface as accounts_service
@@ -9,9 +11,6 @@ import ../../../app_service/service/community/service as community_service
 import ../../../app_service/service/contacts/service as contacts_service
 import ../../../app_service/service/message/service as message_service
 
-import ../../core/signals/types
-import eventemitter
-
 export controller_interface
 
 logScope:
diff --git a/src/app/modules/main/module.nim b/src/app/modules/main/module.nim
index 9de6158f1f..c980bffaa0 100644
--- a/src/app/modules/main/module.nim
+++ b/src/app/modules/main/module.nim
@@ -42,7 +42,7 @@ import ../../../app_service/service/node_configuration/service_interface as node
 import ../../../app_service/service/devices/service as devices_service
 import ../../../app_service/service/mailservers/service as mailservers_service
 
-import eventemitter
+import ../../core/eventemitter
 
 export io_interface
 
diff --git a/src/app/modules/main/node_section/controller.nim b/src/app/modules/main/node_section/controller.nim
index 20b847577c..2b26168736 100644
--- a/src/app/modules/main/node_section/controller.nim
+++ b/src/app/modules/main/node_section/controller.nim
@@ -6,8 +6,8 @@ import ../../../../app_service/service/settings/service_interface as settings_se
 import ../../../../app_service/service/node/service as node_service
 import ../../../../app_service/service/node_configuration/service as node_configuration_service
 
-import eventemitter
 import ../../../core/signals/types
+import ../../../core/eventemitter
 import ../../../core/fleets/fleet_configuration
 
 export controller_interface
diff --git a/src/app/modules/main/node_section/module.nim b/src/app/modules/main/node_section/module.nim
index a26bfa2c6b..b982e16dd8 100644
--- a/src/app/modules/main/node_section/module.nim
+++ b/src/app/modules/main/node_section/module.nim
@@ -5,15 +5,12 @@ import ../io_interface as delegate_interface
 import view, controller
 
 import ../../../global/global_singleton
-
+import ../../../core/signals/types
+import ../../../core/eventemitter
 import ../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../app_service/service/node/service as node_service
 import ../../../../app_service/service/node_configuration/service as node_configuration_service
 
-import ../../../core/signals/types
-
-import eventemitter
-
 export io_interface
 
 type
diff --git a/src/app/modules/main/private_interfaces/module_access_interface.nim b/src/app/modules/main/private_interfaces/module_access_interface.nim
index b1ecab566a..454dcee665 100644
--- a/src/app/modules/main/private_interfaces/module_access_interface.nim
+++ b/src/app/modules/main/private_interfaces/module_access_interface.nim
@@ -4,7 +4,7 @@ import ../../../../app_service/service/chat/service as chat_service
 import ../../../../app_service/service/community/service as community_service
 import ../../../../app_service/service/message/service as message_service
 
-import eventemitter
+import ../../../core/eventemitter
 
 method delete*(self: AccessInterface) {.base.} =
   raise newException(ValueError, "No implementation available")
diff --git a/src/app/modules/main/profile_section/about/controller.nim b/src/app/modules/main/profile_section/about/controller.nim
index abb17695a7..880dd20b8a 100644
--- a/src/app/modules/main/profile_section/about/controller.nim
+++ b/src/app/modules/main/profile_section/about/controller.nim
@@ -1,7 +1,7 @@
 import ./controller_interface
-import eventemitter
 import io_interface
 import ../../../../../app_service/service/about/service as about_service
+import ../../../../core/eventemitter
 
 export controller_interface
 
diff --git a/src/app/modules/main/profile_section/about/module.nim b/src/app/modules/main/profile_section/about/module.nim
index 2b24f5fe5a..e704502897 100644
--- a/src/app/modules/main/profile_section/about/module.nim
+++ b/src/app/modules/main/profile_section/about/module.nim
@@ -1,10 +1,9 @@
 import NimQml
-import eventemitter
 
 import ./io_interface, ./view, ./controller
 import ../io_interface as delegate_interface
 import ../../../../global/global_singleton
-
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/about/service as about_service
 
 export io_interface
diff --git a/src/app/modules/main/profile_section/advanced/controller.nim b/src/app/modules/main/profile_section/advanced/controller.nim
index e8a031a571..52f6f01b7f 100644
--- a/src/app/modules/main/profile_section/advanced/controller.nim
+++ b/src/app/modules/main/profile_section/advanced/controller.nim
@@ -2,13 +2,12 @@ import Tables, chronicles
 import controller_interface
 import io_interface
 
-import ../../../../core/fleets/fleet_configuration
 import ../../../../global/app_signals
+import ../../../../core/eventemitter
+import ../../../../core/fleets/fleet_configuration
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/node_configuration/service_interface as node_configuration_service
 
-import eventemitter
-
 export controller_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/advanced/module.nim b/src/app/modules/main/profile_section/advanced/module.nim
index e52b3cae71..61faa1fb93 100644
--- a/src/app/modules/main/profile_section/advanced/module.nim
+++ b/src/app/modules/main/profile_section/advanced/module.nim
@@ -4,12 +4,11 @@ import ../io_interface as delegate_interface
 import view, controller, custom_networks_model
 
 import ../../../../../constants
+import ../../../../core/eventemitter
 import ../../../../global/global_singleton
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/node_configuration/service_interface as node_configuration_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/contacts/controller.nim b/src/app/modules/main/profile_section/contacts/controller.nim
index e242aa7d9f..61c11853f9 100644
--- a/src/app/modules/main/profile_section/contacts/controller.nim
+++ b/src/app/modules/main/profile_section/contacts/controller.nim
@@ -1,10 +1,9 @@
 import ./controller_interface
 import io_interface
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/contacts/service as contacts_service
 
-import eventemitter
-
 export controller_interface
 
 type 
diff --git a/src/app/modules/main/profile_section/contacts/module.nim b/src/app/modules/main/profile_section/contacts/module.nim
index c2e020c509..c6a5aa0529 100644
--- a/src/app/modules/main/profile_section/contacts/module.nim
+++ b/src/app/modules/main/profile_section/contacts/module.nim
@@ -5,10 +5,9 @@ import ../../../shared_models/contacts_item
 import ../../../shared_models/contacts_model
 import ../io_interface as delegate_interface
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/contacts/service as contacts_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/devices/controller.nim b/src/app/modules/main/profile_section/devices/controller.nim
index 90414d3f06..d192e6d263 100644
--- a/src/app/modules/main/profile_section/devices/controller.nim
+++ b/src/app/modules/main/profile_section/devices/controller.nim
@@ -2,11 +2,10 @@ import Tables, chronicles
 import controller_interface
 import io_interface
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/devices/service as devices_service
 
-import eventemitter
-
 export controller_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/devices/module.nim b/src/app/modules/main/profile_section/devices/module.nim
index ae43838382..c87ad93b35 100644
--- a/src/app/modules/main/profile_section/devices/module.nim
+++ b/src/app/modules/main/profile_section/devices/module.nim
@@ -3,11 +3,10 @@ import io_interface
 import ../io_interface as delegate_interface
 import view, controller, model, item
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/devices/service as devices_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/module.nim b/src/app/modules/main/profile_section/module.nim
index b14cbc85d9..7ddd75cf48 100644
--- a/src/app/modules/main/profile_section/module.nim
+++ b/src/app/modules/main/profile_section/module.nim
@@ -1,7 +1,7 @@
 import NimQml
 import io_interface, view, controller
 import ../../../global/global_singleton
-
+import ../../../core/eventemitter
 import ../../../../app_service/service/profile/service as profile_service
 import ../../../../app_service/service/accounts/service as accounts_service
 import ../../../../app_service/service/settings/service_interface as settings_service
@@ -24,8 +24,6 @@ import ./devices/module as devices_module
 import ./sync/module as sync_module
 import ./notifications/module as notifications_module
 
-import eventemitter
-
 export io_interface
 
 type 
diff --git a/src/app/modules/main/profile_section/notifications/controller.nim b/src/app/modules/main/profile_section/notifications/controller.nim
index ed695ca3fe..db58dfca7f 100644
--- a/src/app/modules/main/profile_section/notifications/controller.nim
+++ b/src/app/modules/main/profile_section/notifications/controller.nim
@@ -2,10 +2,9 @@ import Tables, chronicles
 import controller_interface
 import io_interface
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/chat/service as chat_service
 
-import eventemitter
-
 export controller_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/notifications/module.nim b/src/app/modules/main/profile_section/notifications/module.nim
index db473e0ab5..6d4ffa858d 100644
--- a/src/app/modules/main/profile_section/notifications/module.nim
+++ b/src/app/modules/main/profile_section/notifications/module.nim
@@ -3,10 +3,9 @@ import io_interface
 import ../io_interface as delegate_interface
 import view, controller, model, item
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/chat/service as chat_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/privacy/controller.nim b/src/app/modules/main/profile_section/privacy/controller.nim
index 96f26a538d..d98653211f 100644
--- a/src/app/modules/main/profile_section/privacy/controller.nim
+++ b/src/app/modules/main/profile_section/privacy/controller.nim
@@ -1,11 +1,10 @@
 import ./controller_interface
 import io_interface
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/privacy/service as privacy_service
 
-import eventemitter
-
 export controller_interface
 
 type 
diff --git a/src/app/modules/main/profile_section/privacy/module.nim b/src/app/modules/main/profile_section/privacy/module.nim
index cdf628cb70..26999b7e73 100644
--- a/src/app/modules/main/profile_section/privacy/module.nim
+++ b/src/app/modules/main/profile_section/privacy/module.nim
@@ -3,11 +3,10 @@ import NimQml, chronicles
 import ./io_interface, ./view, ./controller
 import ../io_interface as delegate_interface
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/privacy/service as privacy_service
 
-import eventemitter
-
 export io_interface
 
 type 
diff --git a/src/app/modules/main/profile_section/sync/controller.nim b/src/app/modules/main/profile_section/sync/controller.nim
index a654f016ba..c09cddaf75 100644
--- a/src/app/modules/main/profile_section/sync/controller.nim
+++ b/src/app/modules/main/profile_section/sync/controller.nim
@@ -2,12 +2,11 @@ import Tables, chronicles
 import controller_interface
 import io_interface
 
+import ../../../../core/eventemitter
 import ../../../../core/fleets/fleet_configuration
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/mailservers/service as mailservers_service
 
-import eventemitter
-
 export controller_interface
 
 logScope:
diff --git a/src/app/modules/main/profile_section/sync/module.nim b/src/app/modules/main/profile_section/sync/module.nim
index 627993ad4f..b0a1a6d4b3 100644
--- a/src/app/modules/main/profile_section/sync/module.nim
+++ b/src/app/modules/main/profile_section/sync/module.nim
@@ -3,11 +3,10 @@ import io_interface
 import ../io_interface as delegate_interface
 import view, controller, model, item
 
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/settings/service_interface as settings_service
 import ../../../../../app_service/service/mailservers/service as mailservers_service
 
-import eventemitter
-
 export io_interface
 
 logScope:
diff --git a/src/app/modules/main/stickers/controller.nim b/src/app/modules/main/stickers/controller.nim
index 04bd055529..e7e7051332 100644
--- a/src/app/modules/main/stickers/controller.nim
+++ b/src/app/modules/main/stickers/controller.nim
@@ -1,7 +1,9 @@
 import Tables, stint
-import eventemitter
+
 import ./controller_interface
 import ./io_interface
+
+import ../../../core/eventemitter
 import ../../../../app_service/service/stickers/service as stickers_service
 import ../../../../app_service/service/eth/utils as eth_utils
 
diff --git a/src/app/modules/main/stickers/module.nim b/src/app/modules/main/stickers/module.nim
index 2daa7fbe7b..9541228f6a 100644
--- a/src/app/modules/main/stickers/module.nim
+++ b/src/app/modules/main/stickers/module.nim
@@ -1,8 +1,8 @@
 import NimQml, Tables, stint, sugar, sequtils
 
-import eventemitter
 import ./io_interface, ./view, ./controller, ./item
 import ../../../global/global_singleton
+import ../../../core/eventemitter
 import ../../../../app_service/service/stickers/service as stickers_service
 
 export io_interface
diff --git a/src/app/modules/main/wallet_section/account_tokens/module.nim b/src/app/modules/main/wallet_section/account_tokens/module.nim
index b7e663ed65..729c86bc6d 100644
--- a/src/app/modules/main/wallet_section/account_tokens/module.nim
+++ b/src/app/modules/main/wallet_section/account_tokens/module.nim
@@ -1,8 +1,9 @@
 import NimQml, sequtils, sugar
-import eventemitter
+
 import ./io_interface, ./view, ./controller, ./item
 import ../io_interface as delegate_interface
 import ../../../../global/global_singleton
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 
 export io_interface
diff --git a/src/app/modules/main/wallet_section/accounts/module.nim b/src/app/modules/main/wallet_section/accounts/module.nim
index 2844f1a143..7deb1b3251 100644
--- a/src/app/modules/main/wallet_section/accounts/module.nim
+++ b/src/app/modules/main/wallet_section/accounts/module.nim
@@ -1,9 +1,9 @@
 import NimQml, sequtils, sugar
-import eventemitter
 
 import ./io_interface, ./view, ./item, ./controller
 import ../io_interface as delegate_interface
 import ../../../../global/global_singleton
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 import ../account_tokens/model as account_tokens
 import ../account_tokens/item as account_tokens_item
diff --git a/src/app/modules/main/wallet_section/all_tokens/controller.nim b/src/app/modules/main/wallet_section/all_tokens/controller.nim
index 0156ce96a1..c8cc86048d 100644
--- a/src/app/modules/main/wallet_section/all_tokens/controller.nim
+++ b/src/app/modules/main/wallet_section/all_tokens/controller.nim
@@ -1,6 +1,7 @@
 import ./controller_interface
 import ./io_interface
-import eventemitter
+
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/token/service as token_service
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 
diff --git a/src/app/modules/main/wallet_section/all_tokens/module.nim b/src/app/modules/main/wallet_section/all_tokens/module.nim
index 347633060e..a869cd8476 100644
--- a/src/app/modules/main/wallet_section/all_tokens/module.nim
+++ b/src/app/modules/main/wallet_section/all_tokens/module.nim
@@ -1,10 +1,10 @@
 import NimQml, sequtils, sugar
 
-import eventemitter
-
 import ./io_interface, ./view, ./controller, ./item
 import ../io_interface as delegate_interface
+
 import ../../../../global/global_singleton
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/token/service as token_service
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 
diff --git a/src/app/modules/main/wallet_section/collectibles/module.nim b/src/app/modules/main/wallet_section/collectibles/module.nim
index 5d3f066c69..dac8f4d9b8 100644
--- a/src/app/modules/main/wallet_section/collectibles/module.nim
+++ b/src/app/modules/main/wallet_section/collectibles/module.nim
@@ -1,7 +1,6 @@
-import eventemitter
-
 import ./io_interface, ./controller
 import ../io_interface as delegate_interface
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/collectible/service as collectible_service
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 
diff --git a/src/app/modules/main/wallet_section/current_account/module.nim b/src/app/modules/main/wallet_section/current_account/module.nim
index aa9865344a..771c4dec29 100644
--- a/src/app/modules/main/wallet_section/current_account/module.nim
+++ b/src/app/modules/main/wallet_section/current_account/module.nim
@@ -1,6 +1,7 @@
 import NimQml
-import eventemitter
+
 import ../../../../global/global_singleton
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 
 import ./io_interface, ./view, ./controller
diff --git a/src/app/modules/main/wallet_section/module.nim b/src/app/modules/main/wallet_section/module.nim
index 3c6020623f..35f50c820e 100644
--- a/src/app/modules/main/wallet_section/module.nim
+++ b/src/app/modules/main/wallet_section/module.nim
@@ -1,9 +1,7 @@
 import NimQml
-import eventemitter
 
 import ./controller, ./view
 import ./io_interface as io_interface
-import ../../../global/global_singleton
 
 import ./account_tokens/module as account_tokens_module
 import ./accounts/module as accountsModule
@@ -13,7 +11,8 @@ import ./current_account/module as current_account_module
 import ./transactions/module as transactions_module
 import ./saved_addresses/module as saved_addresses_module
 
-
+import ../../../global/global_singleton
+import ../../../core/eventemitter
 import ../../../../app_service/service/token/service as token_service
 import ../../../../app_service/service/transaction/service as transaction_service
 import ../../../../app_service/service/collectible/service as collectible_service
diff --git a/src/app/modules/main/wallet_section/saved_addresses/controller.nim b/src/app/modules/main/wallet_section/saved_addresses/controller.nim
index 68d7a4087c..e0f6e6dc7e 100644
--- a/src/app/modules/main/wallet_section/saved_addresses/controller.nim
+++ b/src/app/modules/main/wallet_section/saved_addresses/controller.nim
@@ -1,6 +1,6 @@
-import eventemitter
 import ./controller_interface
 import io_interface
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/saved_address/service as saved_address_service
 
 export controller_interface
diff --git a/src/app/modules/main/wallet_section/saved_addresses/module.nim b/src/app/modules/main/wallet_section/saved_addresses/module.nim
index 827d238dfd..be7b52119a 100644
--- a/src/app/modules/main/wallet_section/saved_addresses/module.nim
+++ b/src/app/modules/main/wallet_section/saved_addresses/module.nim
@@ -1,7 +1,8 @@
 import NimQml, sugar, sequtils
-import eventemitter
 import ../io_interface as delegate_interface
+
 import ../../../../global/global_singleton
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/saved_address/service as saved_address_service
 
 import ./io_interface, ./view, ./controller, ./item
diff --git a/src/app/modules/main/wallet_section/transactions/controller.nim b/src/app/modules/main/wallet_section/transactions/controller.nim
index fb78eb5671..05f88eeb7b 100644
--- a/src/app/modules/main/wallet_section/transactions/controller.nim
+++ b/src/app/modules/main/wallet_section/transactions/controller.nim
@@ -1,16 +1,11 @@
-import NimQml, json, json_serialization, stint, tables, eventemitter, sugar, sequtils
+import NimQml, json, json_serialization, stint, tables, sugar, sequtils
 import ./controller_interface
 import io_interface
 import ../../../../../app_service/service/transaction/service as transaction_service
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 
-import
-  status/[status, wallet]
-
 export controller_interface
 
-import status/types/transaction
-
 import ../../../../core/[main]
 import ../../../../core/tasks/[qt, threadpool]
 
diff --git a/src/app/modules/main/wallet_section/transactions/model.nim b/src/app/modules/main/wallet_section/transactions/model.nim
index 6b2e2d8ecc..c9cfb07b7f 100644
--- a/src/app/modules/main/wallet_section/transactions/model.nim
+++ b/src/app/modules/main/wallet_section/transactions/model.nim
@@ -1,7 +1,7 @@
 import NimQml, Tables, strutils, strformat, sequtils, tables, sugar, algorithm
 
-import status/utils
 import ./item
+import ../../../../../app_service/service/eth/utils as eth_service_utils
 import ../../../../../app_service/service/transaction/dto
 
 type
@@ -174,7 +174,7 @@ QtObject:
 
       var allTxs = self.items.concat(newTxItems)
       allTxs.sort(cmpTransactions, SortOrder.Descending)
-      allTxs.deduplicate(tx => tx.getId())
+      eth_service_utils.deduplicate(allTxs, tx => tx.getId())
       
       self.setItems(allTxs)
       self.setHasMore(true)
diff --git a/src/app/modules/main/wallet_section/transactions/module.nim b/src/app/modules/main/wallet_section/transactions/module.nim
index 7e881c9ea7..00070fa699 100644
--- a/src/app/modules/main/wallet_section/transactions/module.nim
+++ b/src/app/modules/main/wallet_section/transactions/module.nim
@@ -1,8 +1,9 @@
-import NimQml, eventemitter, stint
+import NimQml, stint
 
 import ./io_interface, ./view, ./controller
 import ../io_interface as delegate_interface
 import ../../../../global/global_singleton
+import ../../../../core/eventemitter
 import ../../../../../app_service/service/transaction/service as transaction_service
 import ../../../../../app_service/service/wallet_account/service as wallet_account_service
 
diff --git a/src/app/modules/startup/controller.nim b/src/app/modules/startup/controller.nim
index 5bc5ea0b12..b7de8c152f 100644
--- a/src/app/modules/startup/controller.nim
+++ b/src/app/modules/startup/controller.nim
@@ -3,12 +3,11 @@ import Tables, chronicles
 import controller_interface
 import io_interface
 
+import ../../core/signals/types
+import ../../core/eventemitter
 import ../../../app_service/service/keychain/service as keychain_service
 import ../../../app_service/service/accounts/service_interface as accounts_service
 
-import ../../core/signals/types
-import eventemitter
-
 export controller_interface
 
 logScope:
diff --git a/src/app/modules/startup/login/controller.nim b/src/app/modules/startup/login/controller.nim
index de18aee8c8..456e352c8e 100644
--- a/src/app/modules/startup/login/controller.nim
+++ b/src/app/modules/startup/login/controller.nim
@@ -3,13 +3,11 @@ import NimQml, Tables
 import controller_interface
 import io_interface
 import ../../../global/global_singleton
-
+import ../../../core/signals/types
+import ../../../core/eventemitter
 import ../../../../app_service/service/keychain/service as keychain_service
 import ../../../../app_service/service/accounts/service_interface as accounts_service
 
-import ../../../core/signals/types
-import eventemitter
-
 export controller_interface
 
 type 
diff --git a/src/app/modules/startup/login/module.nim b/src/app/modules/startup/login/module.nim
index fc39f0f0f9..b443575eb7 100644
--- a/src/app/modules/startup/login/module.nim
+++ b/src/app/modules/startup/login/module.nim
@@ -3,12 +3,10 @@ import io_interface
 import ../io_interface as delegate_interface
 import view, controller, item
 import ../../../global/global_singleton
-
+import ../../../core/eventemitter
 import ../../../../app_service/service/keychain/service as keychain_service
 import ../../../../app_service/service/accounts/service_interface as accounts_service
 
-import eventemitter
-
 export io_interface
 
 type 
diff --git a/src/app/modules/startup/module.nim b/src/app/modules/startup/module.nim
index ed7681ebef..3e1edbbd5d 100644
--- a/src/app/modules/startup/module.nim
+++ b/src/app/modules/startup/module.nim
@@ -3,15 +3,13 @@ import NimQml
 import io_interface
 import view, controller
 import ../../global/global_singleton
-
+import ../../core/eventemitter
 import onboarding/module as onboarding_module
 import login/module as login_module
 
 import ../../../app_service/service/keychain/service as keychain_service
 import ../../../app_service/service/accounts/service_interface as accounts_service
 
-import eventemitter
-
 export io_interface
 
 type 
diff --git a/src/app/modules/startup/onboarding/controller.nim b/src/app/modules/startup/onboarding/controller.nim
index e1c401513e..16cbf5d588 100644
--- a/src/app/modules/startup/onboarding/controller.nim
+++ b/src/app/modules/startup/onboarding/controller.nim
@@ -3,10 +3,9 @@ import Tables, chronicles
 import controller_interface
 import io_interface
 
-import ../../../../app_service/service/accounts/service_interface as accounts_service
-
 import ../../../core/signals/types
-import eventemitter
+import ../../../core/eventemitter
+import ../../../../app_service/service/accounts/service_interface as accounts_service
 
 export controller_interface
 
diff --git a/src/app/modules/startup/onboarding/module.nim b/src/app/modules/startup/onboarding/module.nim
index a71e75fcc8..42cfb00673 100644
--- a/src/app/modules/startup/onboarding/module.nim
+++ b/src/app/modules/startup/onboarding/module.nim
@@ -3,11 +3,9 @@ import io_interface
 import ../io_interface as delegate_interface
 import view, controller, item
 import ../../../global/global_singleton
-
+import ../../../core/eventemitter
 import ../../../../app_service/service/accounts/service_interface as accounts_service
 
-import eventemitter
-
 export io_interface
 
 type 
diff --git a/src/app_service/service/about/service.nim b/src/app_service/service/about/service.nim
index 3fe84310bc..ce2d4b1d19 100644
--- a/src/app_service/service/about/service.nim
+++ b/src/app_service/service/about/service.nim
@@ -1,6 +1,6 @@
 import NimQml, json, chronicles
 
-import eventemitter
+import ../../../app/core/eventemitter
 import ../../../app/core/tasks/[qt, threadpool]
 
 import ../settings/service as settings_service
diff --git a/src/app_service/service/about/update.nim b/src/app_service/service/about/update.nim
index 871ee7d84a..95f8e69144 100644
--- a/src/app_service/service/about/update.nim
+++ b/src/app_service/service/about/update.nim
@@ -1,12 +1,11 @@
 from stew/base32 import nil
 from stew/base58 import nil
-import chronicles, httpclient, net
+import chronicles, httpclient, net, options
 import strutils
 import semver
 
 import ../provider/service as provider_service
 import ../ens/utils as ens_utils
-import status/statusgo_backend_new/ens as status_ens
 
 const APP_UPDATES_ENS* = "desktop.status.eth"
 const CHECK_VERSION_TIMEOUT_MS* = 5000
@@ -17,13 +16,13 @@ type
     url*: string
 
 proc getLatestVersion*(): VersionInfo =
-  let contentHash = contenthash(APP_UPDATES_ENS)
-  if contentHash == "":
+  let contentHash = ens_utils.getContentHash(APP_UPDATES_ENS)
+  if contentHash.isNone():
     raise newException(ValueError, "ENS does not have a content hash")
 
   var url: string = ""
 
-  let decodedHash = contentHash.decodeENSContentHash()
+  let decodedHash = ens_utils.decodeENSContentHash(contentHash.get())
 
   case decodedHash[0]:
     of ENSType.IPFS:
@@ -41,7 +40,7 @@ proc getLatestVersion*(): VersionInfo =
 
     else:
       warn "Unknown content for", contentHash
-      raise newException(ValueError, "Unknown content for " & contentHash)
+      raise newException(ValueError, "Unknown content for " & contentHash.get())
 
   # Read version from folder
   let secureSSLContext = newContext()
diff --git a/src/app_service/service/activity_center/service.nim b/src/app_service/service/activity_center/service.nim
index 5db7654f6b..0745eacd3c 100644
--- a/src/app_service/service/activity_center/service.nim
+++ b/src/app_service/service/activity_center/service.nim
@@ -1,6 +1,6 @@
 import NimQml, json, sequtils, chronicles, strutils, strutils, stint
 
-import eventemitter
+import ../../../app/core/eventemitter
 import ../../../app/core/[main]
 import ../../../app/core/tasks/[qt, threadpool]
 
diff --git a/src/app_service/service/chat/service.nim b/src/app_service/service/chat/service.nim
index 9baf39ca58..2fcc415d3f 100644
--- a/src/app_service/service/chat/service.nim
+++ b/src/app_service/service/chat/service.nim
@@ -7,16 +7,11 @@ import ../contacts/service as contact_service
 import status/statusgo_backend_new/chat as status_chat
 import status/statusgo_backend_new/chatCommands as status_chat_commands
 import ../../../app/global/global_singleton
+import ../../../app/core/eventemitter
 import ../../../constants
 
 from ../../common/account_constants import ZERO_ADDRESS
 
-# TODO: We need to remove these `status-lib` types from here
-import status/types/[message]
-import status/types/chat as chat_type
-
-import eventemitter
-
 export chat_dto
 
 
diff --git a/src/app_service/service/community/service.nim b/src/app_service/service/community/service.nim
index 2c5c1fcbf5..53770f7843 100644
--- a/src/app_service/service/community/service.nim
+++ b/src/app_service/service/community/service.nim
@@ -1,13 +1,15 @@
 import NimQml, Tables, json, sequtils, std/algorithm, strformat, chronicles, json_serialization
 
-import eventemitter
 import ./dto/community as community_dto
-export community_dto
-import ../../../app/global/global_singleton
+
 import ../chat/service as chat_service
 
+import ../../../app/global/global_singleton
+import ../../../app/core/eventemitter
 import status/statusgo_backend_new/communities as status_go
 
+export community_dto
+
 logScope:
   topics = "community-service"
 
diff --git a/src/app_service/service/contacts/async_tasks.nim b/src/app_service/service/contacts/async_tasks.nim
index bbc5be380f..c88692b271 100644
--- a/src/app_service/service/contacts/async_tasks.nim
+++ b/src/app_service/service/contacts/async_tasks.nim
@@ -1,5 +1,5 @@
 import os
-import status/ens as status_ens
+import ../ens/utils as ens_utils
 
 include ../../common/json_utils
 include ../../../app/core/tasks/common
@@ -19,8 +19,8 @@ const lookupContactTask: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
   var address = ""
   if not pubkey.startsWith("0x"):
     # TODO refactor those calls to use the new backend and also do it in a signle call
-    pubkey = status_ens.pubkey(arg.value)
-    address = status_ens.address(arg.value)
+    pubkey = ens_utils.pubkey(arg.value)
+    address = ens_utils.address(arg.value)
   
   let output = %*{
     "id": pubkey,
diff --git a/src/app_service/service/contacts/service.nim b/src/app_service/service/contacts/service.nim
index 52b7254af2..fae388427b 100644
--- a/src/app_service/service/contacts/service.nim
+++ b/src/app_service/service/contacts/service.nim
@@ -2,6 +2,7 @@ import NimQml, Tables, json, sequtils, strformat, chronicles, strutils, times, s
 
 import ../../../app/global/global_singleton
 import ../../../app/core/signals/types
+import ../../../app/core/eventemitter
 import ../../../app/core/tasks/[qt, threadpool]
 
 import ./dto/contacts as contacts_dto
@@ -12,8 +13,6 @@ import status/statusgo_backend_new/accounts as status_accounts
 import status/statusgo_backend_new/chat as status_chat
 import status/statusgo_backend_new/utils as status_utils
 
-import eventemitter
-
 export contacts_dto, status_update_dto, contact_details
 
 include async_tasks
diff --git a/src/app_service/service/devices/service.nim b/src/app_service/service/devices/service.nim
index c9075db0df..9e1d94f0d2 100644
--- a/src/app_service/service/devices/service.nim
+++ b/src/app_service/service/devices/service.nim
@@ -1,11 +1,11 @@
 import NimQml, json, sequtils, system, chronicles
 
-import ../../../app/core/signals/types
 import ./dto/device as device_dto
 import ../settings/service as settings_service
-import status/statusgo_backend_new/installations as status_installations
 
-import eventemitter
+import ../../../app/core/signals/types
+import ../../../app/core/eventemitter
+import status/statusgo_backend_new/installations as status_installations
 
 export device_dto
 
diff --git a/src/app_service/service/ens/utils.nim b/src/app_service/service/ens/utils.nim
index 66fe59a272..5f22265d3b 100644
--- a/src/app_service/service/ens/utils.nim
+++ b/src/app_service/service/ens/utils.nim
@@ -1,14 +1,15 @@
 import Tables, json, chronicles, strutils
-import sets
-import options
+import algorithm, strformat, sets, options
 import chronicles, libp2p/[multihash, multicodec, cid]
-import nimcrypto
+import nimcrypto, stint
 include ../../common/json_utils
-import status/statusgo_backend_new/ens as status_go
+import status/statusgo_backend_new/eth as status_eth
 
 logScope:
   topics = "ens-utils"
 
+const domain* = ".stateofus.eth"
+
 type
   ENSType* {.pure.} = enum
     IPFS,
@@ -16,10 +17,61 @@ type
     IPNS,
     UNKNOWN
 
+proc addDomain(username: string): string =
+  if username.endsWith(".eth"):
+    return username
+  else:
+    return username & domain
+
+proc namehash(ensName:string): string =
+  let name = ensName.toLower()
+  var node:array[32, byte]
+
+  node.fill(0)
+  var parts = name.split(".")
+  for i in countdown(parts.len - 1,0):
+    let elem = keccak_256.digest(parts[i]).data
+    var concatArrays: array[64, byte]
+    concatArrays[0..31] = node
+    concatArrays[32..63] = elem
+    node = keccak_256.digest(concatArrays).data
+
+  result = "0x" & node.toHex()
+
+const registry* = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
+const resolver_signature = "0x0178b8bf"
+proc resolver(usernameHash: string): string =
+  let payload = %* [{
+    "to": registry,
+    "from": "0x0000000000000000000000000000000000000000",
+    "data": fmt"{resolver_signature}{userNameHash}"
+  }, "latest"]
+
+  var resolverAddr = status_eth.doEthCall(payload).result.getStr()
+  resolverAddr.removePrefix("0x000000000000000000000000")
+  result = "0x" & resolverAddr
+
+const contenthash_signature = "0xbc1c58d1" # contenthash(bytes32)
+proc contenthash(ensAddr: string): string =
+  var ensHash = namehash(ensAddr)
+  ensHash.removePrefix("0x")
+  let ensResolver = resolver(ensHash)
+  let payload = %* [{
+    "to": ensResolver,
+    "from": "0x0000000000000000000000000000000000000000",
+    "data": fmt"{contenthash_signature}{ensHash}"
+  }, "latest"]
+
+  let bytesResponse =  status_eth.doEthCall(payload).result.getStr()
+  if bytesResponse == "0x":
+    return ""
+
+  let size = fromHex(Stuint[256], bytesResponse[66..129]).truncate(int)
+  result = bytesResponse[130..129+size*2]
 
 proc getContentHash*(ens: string): Option[string] =
   try:
-    let contentHash = status_go.contenthash(ens)
+    let contentHash = contenthash(ens)
     if contentHash != "":
       return some(contentHash)
   except Exception as e:
@@ -67,3 +119,39 @@ proc decodeENSContentHash*(value: string): tuple[ensType: ENSType, output: strin
     return (ENSType.IPNS, parseHexStr(value[12..value.len-1]))
 
   return (ENSType.UNKNOWN, "")
+
+const pubkey_signature = "0xc8690233" # pubkey(bytes32 node)
+proc pubkey*(username: string): string =
+  var userNameHash = namehash(addDomain(username))
+  userNameHash.removePrefix("0x")
+  let ensResolver = resolver(userNameHash)
+  let payload = %* [{
+    "to": ensResolver,
+    "from": "0x0000000000000000000000000000000000000000",
+    "data": fmt"{pubkey_signature}{userNameHash}"
+  }, "latest"]
+  let response = status_eth.doEthCall(payload)
+  # TODO: error handling
+  var pubkey = response.result.getStr()
+  if pubkey == "0x" or pubkey == "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000":
+    result = ""
+  else:
+    pubkey.removePrefix("0x")
+    result = "0x04" & pubkey
+
+const address_signature = "0x3b3b57de" # addr(bytes32 node)
+proc address*(username: string): string =
+  var userNameHash = namehash(addDomain(username))
+  userNameHash.removePrefix("0x")
+  let ensResolver = resolver(userNameHash)
+  let payload = %* [{
+    "to": ensResolver,
+    "from": "0x0000000000000000000000000000000000000000",
+    "data": fmt"{address_signature}{userNameHash}"
+  }, "latest"]
+  let response = status_eth.doEthCall(payload)
+  # TODO: error handling
+  let address = response.result.getStr()
+  if address == "0x0000000000000000000000000000000000000000000000000000000000000000":
+    return ""
+  result = "0x" & address.substr(26)
\ No newline at end of file
diff --git a/src/app_service/service/eth/dto/contract.nim b/src/app_service/service/eth/dto/contract.nim
index ea0777fb32..1c9e84a557 100644
--- a/src/app_service/service/eth/dto/contract.nim
+++ b/src/app_service/service/eth/dto/contract.nim
@@ -4,8 +4,11 @@ import
 import
   web3/ethtypes, stew/byteutils, nimcrypto, json_serialization, chronicles
 import json, tables, json_serialization
+import web3/[ethtypes, conversions], stint
 import ./method_dto
 
+import status/statusgo_backend_new/eth as status_eth
+
 include  ../../../common/json_utils
 
 type
@@ -33,3 +36,37 @@ proc newErc20Contract*(chainId: int, address: Address): Erc20ContractDto =
 
 proc newErc721Contract*(name: string, chainId: int, address: Address, symbol: string, hasIcon: bool, addlMethods: seq[tuple[name: string, meth: MethodDto]] = @[]): Erc721ContractDto =
   Erc721ContractDto(name: name, chainId: chainId, address: address, symbol: symbol, hasIcon: hasIcon, methods: ERC721_ENUMERABLE_METHODS.concat(addlMethods).toTable)
+
+proc tokenDecimals*(contract: ContractDto): int =
+  let payload = %* [{
+      "to": $contract.address,
+      "data": contract.methods["decimals"].encodeAbi()
+    }, "latest"]
+
+  let response = status_eth.doEthCall(payload)
+  if not response.error.isNil:
+    raise newException(RpcException, "Error getting token decimals: " & response.error.message)
+  if response.result.getStr == "0x":
+    return 0
+  result = parseHexInt(response.result.getStr)
+
+proc getTokenString*(contract: ContractDto, methodName: string): string =
+  let payload = %* [{
+      "to": $contract.address,
+      "data": contract.methods[methodName].encodeAbi()
+    }, "latest"]
+
+  let response = status_eth.doEthCall(payload)
+  if not response.error.isNil:
+    raise newException(RpcException, "Error getting token string - " & methodName & ": " & response.error.message)
+  if response.result.getStr == "0x":
+    return ""
+
+  let size = fromHex(Stuint[256], response.result.getStr[66..129]).truncate(int)
+  result = response.result.getStr[130..129+size*2].parseHexStr
+
+proc tokenName*(contract: ContractDto): string = 
+  getTokenString(contract, "name")
+
+proc tokenSymbol*(contract: ContractDto): string = 
+  getTokenString(contract, "symbol")
\ No newline at end of file
diff --git a/src/app_service/service/eth/dto/method_dto.nim b/src/app_service/service/eth/dto/method_dto.nim
index 3559f78f4c..d77bafecea 100644
--- a/src/app_service/service/eth/dto/method_dto.nim
+++ b/src/app_service/service/eth/dto/method_dto.nim
@@ -6,16 +6,11 @@ import
 
 import status/statusgo_backend_new/eth as status_eth
 
-import 
-  status/types/rpc_response,
-  status/statusgo_backend/eth
-
 import
   ./transaction,
   ./coder
 
 
-
 type MethodDto* = object
   name*: string
   signature*: string
@@ -83,8 +78,9 @@ proc estimateGas*(self: MethodDto, tx: var TransactionDataDto, methodDescriptor:
   success = true
   tx.data = self.encodeAbi(methodDescriptor)
   try:
-    let response = eth.estimateGas(%*[%tx])
-    result = response.result # gas estimate in hex
+    # this call should not be part of this file, we need to move it to appropriate place, or this should not be a DTO class.
+    let response = status_eth.estimateGas(%*[%tx])
+    result = response.result.getStr # gas estimate in hex
   except RpcException as e:
     success = false
     result = e.msg
@@ -95,15 +91,17 @@ proc getEstimateGasData*(self: MethodDto, tx: var TransactionDataDto, methodDesc
 
 proc send*(self: MethodDto, tx: var TransactionDataDto, methodDescriptor: object, password: string, success: var bool): string =
   tx.data = self.encodeAbi(methodDescriptor)
+  # this call should not be part of this file, we need to move it to appropriate place, or this should not be a DTO class.
   let response = status_eth.sendTransaction($(%tx), password)
   return $response.result
 
-proc call*[T](self: MethodDto, tx: var TransactionDataDto, methodDescriptor: object, success: var bool): T =
+proc call[T](self: MethodDto, tx: var TransactionDataDto, methodDescriptor: object, success: var bool): T =
   success = true
   tx.data = self.encodeAbi(methodDescriptor)
   let response: RpcResponse
   try:
-    response = eth.call(tx)
+    # this call should not be part of this file, we need to move it to appropriate place, or this should not be a DTO class.
+    response = status_eth.doEthCall(tx)
   except RpcException as e:
     success = false
     result = e.msg
diff --git a/src/app_service/service/eth/dto/transaction.nim b/src/app_service/service/eth/dto/transaction.nim
index ddab01c550..82b02b0fb1 100644
--- a/src/app_service/service/eth/dto/transaction.nim
+++ b/src/app_service/service/eth/dto/transaction.nim
@@ -1,30 +1,14 @@
 import strutils, json
 import web3/ethtypes, web3/conversions, options, stint
+import ../utils
 
-type
-  TransactionDto* = ref object
-    id*: string
-    typeValue*: string
-    address*: string
-    blockNumber*: string
-    blockHash*: string
-    contract*: string
-    timestamp*: string
-    gasPrice*: string
-    gasLimit*: string
-    gasUsed*: string
-    nonce*: string
-    txStatus*: string
-    value*: string
-    fromAddress*: string
-    to*: string
-  
-type PendingTransactionTypeDto* {.pure.} = enum
-  RegisterENS = "RegisterENS",
-  SetPubKey = "SetPubKey",
-  ReleaseENS = "ReleaseENS",
-  BuyStickerPack = "BuyStickerPack"
-  WalletTransfer = "WalletTransfer" 
+type 
+  PendingTransactionTypeDto* {.pure.} = enum
+    RegisterENS = "RegisterENS",
+    SetPubKey = "SetPubKey",
+    ReleaseENS = "ReleaseENS",
+    BuyStickerPack = "BuyStickerPack"
+    WalletTransfer = "WalletTransfer" 
 
 type 
   TransactionDataDto* = object
@@ -39,21 +23,6 @@ type
     nonce*: Option[Nonce]        # (optional) integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce
     txType*: string
 
-proc cmpTransactions*(x, y: TransactionDto): int =
-  # Sort proc to compare transactions from a single account.
-  # Compares first by block number, then by nonce
-  result = cmp(x.blockNumber.parseHexInt, y.blockNumber.parseHexInt)
-  if result == 0:
-    result = cmp(x.nonce, y.nonce)
-
-# TODO: make this public in nim-web3 lib
-template stripLeadingZeros*(value: string): string =
-  var cidx = 0
-  # ignore the last character so we retain '0' on zero value
-  while cidx < value.len - 1 and value[cidx] == '0':
-    cidx.inc
-  value[cidx .. ^1]
-
 proc `%`*(x: TransactionDataDto): JsonNode =
   result = newJobject()
   result["from"] = %x.source
diff --git a/src/app_service/service/eth/service.nim b/src/app_service/service/eth/service.nim
index d634e620cf..342de1bb03 100644
--- a/src/app_service/service/eth/service.nim
+++ b/src/app_service/service/eth/service.nim
@@ -1,12 +1,9 @@
 import json, sequtils, chronicles, macros, sugar, strutils, stint
-import
-  web3/ethtypes, json_serialization, chronicles, tables
+import web3/ethtypes, json_serialization, chronicles, tables
 
 import status/statusgo_backend_new/eth
 
-# TODO remove those
-import status/utils
-
+import utils
 import ./dto/contract
 import ./dto/method_dto
 import ./dto/network
diff --git a/src/app_service/service/eth/utils.nim b/src/app_service/service/eth/utils.nim
index ef19dd0979..31368d2e4e 100644
--- a/src/app_service/service/eth/utils.nim
+++ b/src/app_service/service/eth/utils.nim
@@ -237,3 +237,11 @@ proc isUnique*[T](key: T, existingKeys: var seq[T]): bool =
 proc deduplicate*[T](txs: var seq[T], key: (T) -> string) =
   var existingKeys: seq[string] = @[]
   txs.keepIf(tx => tx.key().isUnique(existingKeys))
+
+# TODO: make this public in nim-web3 lib
+proc stripLeadingZeros*(value: string): string =
+  var cidx = 0
+  # ignore the last character so we retain '0' on zero value
+  while cidx < value.len - 1 and value[cidx] == '0':
+    cidx.inc
+  value[cidx .. ^1]
\ No newline at end of file
diff --git a/src/app_service/service/general/service.nim b/src/app_service/service/general/service.nim
new file mode 100644
index 0000000000..6806c2cda8
--- /dev/null
+++ b/src/app_service/service/general/service.nim
@@ -0,0 +1,43 @@
+import json, chronicles
+
+import service_interface
+import status/statusgo_backend_new/general as status_general
+import status/statusgo_backend_new/keycard as status_keycard
+
+import ../../../constants as app_constants
+
+export service_interface
+
+logScope:
+  topics = "general-app-service"
+
+type
+  Service* = ref object of service_interface.ServiceInterface
+
+method delete*(self: Service) =
+  discard
+
+proc newService*(): Service =
+  result = Service()
+
+method initKeycard(self: Service) =
+  ## This should not be part of the "general service", but part of the "keystore service", but since we don't have
+  ## keycard in place for the refactored part yet but `status-go` part requires keycard to be initialized on the app 
+  ## start. This call is added as a part of the "global service".
+  try:
+    discard status_keycard.initKeycard(app_constants.KEYSTOREDIR)
+  except Exception as e:
+    let errDesription = e.msg
+    error "error: ", errDesription
+    return
+  
+method init*(self: Service) =
+  self.initKeycard()
+
+method startMessenger*(self: Service) =
+  try:
+    discard status_general.startMessenger()
+  except Exception as e:
+    let errDesription = e.msg
+    error "error: ", errDesription
+    return
\ No newline at end of file
diff --git a/src/app_service/service/general/service_interface.nim b/src/app_service/service/general/service_interface.nim
new file mode 100644
index 0000000000..d523ed030f
--- /dev/null
+++ b/src/app_service/service/general/service_interface.nim
@@ -0,0 +1,12 @@
+type 
+  ServiceInterface* {.pure inheritable.} = ref object of RootObj
+  ## Abstract class for this service access.
+
+method delete*(self: ServiceInterface) {.base.} =
+  raise newException(ValueError, "No implementation available")
+
+method init*(self: ServiceInterface) {.base.} =
+  raise newException(ValueError, "No implementation available")
+
+method startMessenger*(self: ServiceInterface) {.base.} =
+  raise newException(ValueError, "No implementation available")
\ No newline at end of file
diff --git a/src/app_service/service/keychain/service.nim b/src/app_service/service/keychain/service.nim
index e3479c895c..12147a604d 100644
--- a/src/app_service/service/keychain/service.nim
+++ b/src/app_service/service/keychain/service.nim
@@ -1,6 +1,6 @@
 import NimQml, chronicles
 
-import eventemitter
+import ../../../app/core/eventemitter
 
 logScope:
   topics = "keychain-service"
diff --git a/src/app_service/service/mailservers/service.nim b/src/app_service/service/mailservers/service.nim
index 7570ed2673..ce1be9c5f2 100644
--- a/src/app_service/service/mailservers/service.nim
+++ b/src/app_service/service/mailservers/service.nim
@@ -9,8 +9,6 @@ import ../settings/service_interface as settings_service
 import ../node_configuration/service_interface as node_configuration_service
 import status/statusgo_backend_new/mailservers as status_mailservers
 
-import eventemitter
-
 logScope:
   topics = "mailservers-service"
 
diff --git a/src/app_service/service/message/dto/removed_message.nim b/src/app_service/service/message/dto/removed_message.nim
new file mode 100644
index 0000000000..c36488d897
--- /dev/null
+++ b/src/app_service/service/message/dto/removed_message.nim
@@ -0,0 +1,14 @@
+{.used.}
+
+import json
+
+include ../../../common/json_utils
+
+type RemovedMessageDto* = object
+  chatId*: string
+  messageId*: string
+
+proc toRemovedMessageDto*(jsonObj: JsonNode): RemovedMessageDto =
+  result = RemovedMessageDto()
+  discard jsonObj.getProp("chatId", result.chatId)
+  discard jsonObj.getProp("messageId", result.messageId)
\ No newline at end of file
diff --git a/src/app_service/service/message/service.nim b/src/app_service/service/message/service.nim
index 97cbe9c607..04cea37e5e 100644
--- a/src/app_service/service/message/service.nim
+++ b/src/app_service/service/message/service.nim
@@ -1,9 +1,8 @@
 import NimQml, tables, json, sequtils, chronicles
 
-import eventemitter
 import ../../../app/core/tasks/[qt, threadpool]
 import ../../../app/core/signals/types
-
+import ../../../app/core/eventemitter
 import status/statusgo_backend_new/messages as status_go
 
 import ./dto/message as message_dto
diff --git a/src/app_service/service/node/service.nim b/src/app_service/service/node/service.nim
index dc56ef980e..838f46932f 100644
--- a/src/app_service/service/node/service.nim
+++ b/src/app_service/service/node/service.nim
@@ -1,9 +1,8 @@
 import NimQml, chronicles, strutils, json, nimcrypto
-import status/utils
-import eventemitter
 
 import ../settings/service as settings_service
 
+import ../../../app/core/eventemitter
 import ../../../app/core/tasks/[qt, threadpool]
 import ../../../app/core/fleets/fleet_configuration
 
diff --git a/src/app_service/service/os_notification/service.nim b/src/app_service/service/os_notification/service.nim
index d600f6dea9..260593dcab 100644
--- a/src/app_service/service/os_notification/service.nim
+++ b/src/app_service/service/os_notification/service.nim
@@ -1,6 +1,7 @@
 import NimQml, json, chronicles
 import details
-import eventemitter
+
+import ../../../app/core/eventemitter
 
 logScope:
   topics = "os-notification-service"
diff --git a/src/app_service/service/privacy/service.nim b/src/app_service/service/privacy/service.nim
index ec26744b84..5f96999f10 100644
--- a/src/app_service/service/privacy/service.nim
+++ b/src/app_service/service/privacy/service.nim
@@ -3,12 +3,12 @@ import NimQml, json, strutils, chronicles
 import ../settings/service_interface as settings_service
 import ../accounts/service_interface as accounts_service
 
+import ../../../app/core/eventemitter
+
 import status/statusgo_backend_new/accounts as status_account
 import status/statusgo_backend_new/eth as status_eth
 import status/statusgo_backend_new/privacy as status_privacy
 
-import eventemitter
-
 logScope:
   topics = "privacy-service"
 
diff --git a/src/app_service/service/saved_address/service.nim b/src/app_service/service/saved_address/service.nim
index b149fe511d..b474718792 100644
--- a/src/app_service/service/saved_address/service.nim
+++ b/src/app_service/service/saved_address/service.nim
@@ -1,6 +1,8 @@
 import chronicles, sequtils, json
-import eventemitter
+
 import ./service_interface, ./dto
+
+import ../../../app/core/eventemitter
 import status/statusgo_backend_new/saved_addresses as backend
 
 export service_interface
diff --git a/src/app_service/service/stickers/service.nim b/src/app_service/service/stickers/service.nim
index ec60680e0e..451d904b5a 100644
--- a/src/app_service/service/stickers/service.nim
+++ b/src/app_service/service/stickers/service.nim
@@ -1,7 +1,7 @@
 import NimQml, Tables, json, sequtils, chronicles, strutils, atomics, sets, strutils, tables, stint
 
 import httpclient
-import eventemitter
+
 import ../../../app/core/[main]
 import ../../../app/core/tasks/[qt, threadpool]
 
diff --git a/src/app_service/service/token/async_tasks.nim b/src/app_service/service/token/async_tasks.nim
index 26280ef12e..e4c460e369 100644
--- a/src/app_service/service/token/async_tasks.nim
+++ b/src/app_service/service/token/async_tasks.nim
@@ -1,7 +1,8 @@
 # include strformat, json
 include ../../common/json_utils
 include ../../../app/core/tasks/common
-import status/[utils, tokens]
+import ../eth/dto/contract
+import ../eth/utils
 
 #################################################
 # Async load transactions
diff --git a/src/app_service/service/token/service.nim b/src/app_service/service/token/service.nim
index ac145bb569..740b83e616 100644
--- a/src/app_service/service/token/service.nim
+++ b/src/app_service/service/token/service.nim
@@ -1,10 +1,12 @@
 import NimQml, json, sequtils, chronicles, strformat, strutils
-import eventemitter
+
 from sugar import `=>`
 import web3/ethtypes
 from web3/conversions import `$`
 import status/statusgo_backend_new/custom_tokens as custom_tokens
 import ../settings/service_interface as settings_service
+
+import ../../../app/core/eventemitter
 import ../../../app/core/tasks/[qt, threadpool]
 import ./dto, ./static_token
 
diff --git a/src/app_service/service/transaction/async_tasks.nim b/src/app_service/service/transaction/async_tasks.nim
index adfbb0cf95..6959a2d67e 100644
--- a/src/app_service/service/transaction/async_tasks.nim
+++ b/src/app_service/service/transaction/async_tasks.nim
@@ -1,5 +1,6 @@
 include ../../common/json_utils
 include ../../../app/core/tasks/common
+import strutils
 
 #################################################
 # Async load transactions
@@ -15,9 +16,10 @@ type
 const loadTransactionsTask*: Task = proc(argEncoded: string) {.gcsafe, nimcall.} =
   let
     arg = decode[LoadTransactionsTaskArg](argEncoded)
+    limitAsHex = "0x" & eth_utils.stripLeadingZeros(arg.limit.toHex)
     output = %*{
       "address": arg.address,
-      "history": transactions.getTransfersByAddress(arg.address, arg.toBlock, arg.limit, arg.loadMore),
+      "history": transactions.getTransfersByAddress(arg.address, arg.toBlock, limitAsHex, arg.loadMore),
       "loadMore": arg.loadMore
     }
   arg.finish(output)
diff --git a/src/app_service/service/transaction/dto.nim b/src/app_service/service/transaction/dto.nim
index 3d4bfed6ca..b95e7c1492 100644
--- a/src/app_service/service/transaction/dto.nim
+++ b/src/app_service/service/transaction/dto.nim
@@ -36,3 +36,11 @@ proc toTransactionDto*(jsonObj: JsonNode): TransactionDto =
   discard jsonObj.getProp("value", result.value)
   discard jsonObj.getProp("from", result.fromAddress)
   discard jsonObj.getProp("to", result.to)
+
+proc cmpTransactions*(x, y: TransactionDto): int =
+  # Sort proc to compare transactions from a single account.
+  # Compares first by block number, then by nonce
+  result = cmp(x.blockNumber.parseHexInt, y.blockNumber.parseHexInt)
+  if result == 0:
+    result = cmp(x.nonce, y.nonce)
+
diff --git a/src/app_service/service/transaction/service.nim b/src/app_service/service/transaction/service.nim
index 125c725e3a..831c871dd6 100644
--- a/src/app_service/service/transaction/service.nim
+++ b/src/app_service/service/transaction/service.nim
@@ -1,13 +1,12 @@
 import NimQml, chronicles, sequtils, sugar, stint, json
 import status/statusgo_backend_new/transactions as transactions
-import status/statusgo_backend/wallet
-
-import eventemitter
+import status/statusgo_backend_new/wallet as status_wallet
 
 import ../../../app/core/[main]
 import ../../../app/core/tasks/[qt, threadpool]
 import ../wallet_account/service as wallet_account_service
 import ./service_interface, ./dto
+import ../eth/utils as eth_utils
 
 export service_interface
 
@@ -54,11 +53,20 @@ QtObject:
       return
 
   proc getPendingTransactions*(self: Service): string =
-    wallet.getPendingTransactions()
+    try:
+      # this may be improved (need to add some checkings) but due to removing `status-lib` dependencies, channges made
+      # in this go are as minimal as possible
+      let response = status_wallet.getPendingTransactions()
+      return response.result.getStr
+    except Exception as e:
+      let errDesription = e.msg
+      error "error: ", errDesription
+      return
 
   proc getTransfersByAddress*(self: Service, address: string, toBlock: Uint256, limit: int, loadMore: bool = false): seq[TransactionDto] =
     try:
-      let response = transactions.getTransfersByAddress(address, toBlock, limit, loadMore)
+      let limitAsHex = "0x" & eth_utils.stripLeadingZeros(limit.toHex)
+      let response = transactions.getTransfersByAddress(address, toBlock, limitAsHex, loadMore)
 
       result = map(
         response.result.getElems(),
diff --git a/src/app_service/service/wallet_account/service.nim b/src/app_service/service/wallet_account/service.nim
index 184e31dcdb..0e274a00c3 100644
--- a/src/app_service/service/wallet_account/service.nim
+++ b/src/app_service/service/wallet_account/service.nim
@@ -1,6 +1,5 @@
 import Tables, json, sequtils, sugar, chronicles, strformat, stint, httpclient, net, strutils
 import web3/[ethtypes, conversions]
-import eventemitter
 
 import ../settings/service_interface as settings_service
 import ../accounts/service_interface as accounts_service
@@ -8,6 +7,8 @@ import ../token/service as token_service
 import ../../common/account_constants
 
 import ./service_interface, ./dto
+
+import ../../../app/core/eventemitter
 import status/statusgo_backend_new/accounts as status_go_accounts
 import status/statusgo_backend_new/eth as status_go_eth