refactor(@desktop/general): remove interfaces for services

Fixes #5093
This commit is contained in:
Sale Djenic 2022-03-22 14:35:00 +01:00 committed by saledjenic
parent e74de32296
commit 1bf5882f25
125 changed files with 661 additions and 1299 deletions

View File

@ -10,10 +10,10 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
bookmarkService: bookmark_service.ServiceInterface
bookmarkService: bookmark_service.Service
proc newController*(delegate: io_interface.AccessInterface,
bookmarkService: bookmark_service.ServiceInterface):
bookmarkService: bookmark_service.Service):
Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/bookmarks/service_interface as bookmark_service
import ../../../../../app_service/service/bookmarks/service as bookmark_service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/bookmarks/service_interface as bookmark_service
import ../../../../../app_service/service/bookmarks/service as bookmark_service
# Defines how parent module accesses this module
include ./private_interfaces/module_base_interface

View File

@ -17,7 +17,7 @@ type
moduleLoaded: bool
controller: controller.AccessInterface
proc newModule*(delegate: delegate_interface.AccessInterface, bookmarkService: bookmark_service.ServiceInterface): Module =
proc newModule*(delegate: delegate_interface.AccessInterface, bookmarkService: bookmark_service.Service): Module =
result = Module()
result.delegate = delegate
result.view = view.newView(result)

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -18,7 +18,7 @@ type
proc newModule*(
delegate: delegate_interface.AccessInterface,
walletAccountService: wallet_account_service.ServiceInterface,
walletAccountService: wallet_account_service.Service,
): Module =
result = Module()
result.delegate = delegate

View File

@ -27,10 +27,10 @@ type
currentAccountModule: current_account_module.AccessInterface
proc newModule*(delegate: delegate_interface.AccessInterface,
bookmarkService: bookmark_service.ServiceInterface,
settingsService: settings_service.ServiceInterface,
bookmarkService: bookmark_service.Service,
settingsService: settings_service.Service,
dappPermissionsService: dapp_permissions_service.Service,
providerService: provider_service.ServiceInterface,
providerService: provider_service.Service,
walletAccountService: wallet_account_service.Service): Module =
result = Module()
result.delegate = delegate

View File

@ -2,19 +2,19 @@ import strutils
import controller_interface
import io_interface
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/provider/service_interface as provider_service
import ../../../../../app_service/service/settings/service as settings_service
import ../../../../../app_service/service/provider/service as provider_service
export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
settingsService: settings_service.ServiceInterface
providerService: provider_service.ServiceInterface
settingsService: settings_service.Service
providerService: provider_service.Service
proc newController*(delegate: io_interface.AccessInterface,
settingsService: settings_service.ServiceInterface,
providerService: provider_service.ServiceInterface):
settingsService: settings_service.Service,
providerService: provider_service.Service):
Controller =
result = Controller()
result.delegate = delegate

View File

@ -3,8 +3,8 @@ import io_interface
import view
import controller
import ../io_interface as delegate_interface
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/provider/service_interface as provider_service
import ../../../../../app_service/service/settings/service as settings_service
import ../../../../../app_service/service/provider/service as provider_service
import ../../../../global/global_singleton
export io_interface
@ -17,8 +17,8 @@ type
controller: controller.AccessInterface
proc newModule*(delegate: delegate_interface.AccessInterface,
settingsService: settings_service.ServiceInterface,
providerService: provider_service.ServiceInterface): Module =
settingsService: settings_service.Service,
providerService: provider_service.Service): Module =
result = Module()
result.delegate = delegate
result.view = newView(result)

View File

@ -3,7 +3,7 @@ import Tables
import controller_interface
import io_interface
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/settings/service 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
@ -24,14 +24,14 @@ type
chatId: string
belongsToCommunity: bool
isUsersListAvailable: bool #users list is not available for 1:1 chat
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
contactService: contact_service.Service
chatService: chat_service.Service
communityService: community_service.Service
messageService: message_service.Service
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
belongsToCommunity: bool, isUsersListAvailable: bool, settingsService: settings_service.ServiceInterface,
belongsToCommunity: bool, isUsersListAvailable: bool, settingsService: settings_service.Service,
contactService: contact_service.Service, chatService: chat_service.Service,
communityService: community_service.Service, messageService: message_service.Service): Controller =
result = Controller()

View File

@ -13,7 +13,7 @@ import input_area/module as input_area_module
import messages/module as messages_module
import users/module as users_module
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/settings/service 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
@ -38,7 +38,7 @@ type
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter, sectionId: string, chatId: string,
belongsToCommunity: bool, isUsersListAvailable: bool, settingsService: settings_service.ServiceInterface,
belongsToCommunity: bool, isUsersListAvailable: bool, settingsService: settings_service.Service,
contactService: contact_service.Service, chatService: chat_service.Service,
communityService: community_service.Service, messageService: message_service.Service, gifService: gif_service.Service,
mailserversService: mailservers_service.Service):

View File

@ -3,7 +3,7 @@ import Tables
import controller_interface
import io_interface
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/settings/service 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
@ -25,7 +25,7 @@ type
activeItemId: string
activeSubItemId: string
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
contactService: contact_service.Service
chatService: chat_service.Service
communityService: community_service.Service
@ -34,7 +34,7 @@ type
mailserversService: mailservers_service.Service
proc newController*(delegate: io_interface.AccessInterface, sectionId: string, isCommunity: bool, events: EventEmitter,
settingsService: settings_service.ServiceInterface, contactService: contact_service.Service,
settingsService: settings_service.Service, contactService: contact_service.Service,
chatService: chat_service.Service, communityService: community_service.Service,
messageService: message_service.Service, gifService: gif_service.Service,
mailserversService: mailservers_service.Service): Controller =

View File

@ -12,7 +12,7 @@ import chat_content/module as chat_content_module
import ../../../global/app_sections_config as conf
import ../../../global/global_singleton
import ../../../core/eventemitter
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/settings/service 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
@ -40,7 +40,7 @@ proc newModule*(
events: EventEmitter,
sectionId: string,
isCommunity: bool,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -79,7 +79,7 @@ proc amIMarkedAsAdminUser(self: Module, members: seq[ChatMember]): bool =
return false
proc addSubmodule(self: Module, chatId: string, belongToCommunity: bool, isUsersListAvailable: bool, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -96,7 +96,7 @@ proc removeSubmodule(self: Module, chatId: string) =
self.chatContentModules.del(chatId)
proc buildChatUI(self: Module, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -139,7 +139,7 @@ proc buildChatUI(self: Module, events: EventEmitter,
self.setActiveItemSubItem(selectedItemId, "")
proc buildCommunityUI(self: Module, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -256,7 +256,7 @@ method clearListOfMyContacts*(self: Module) =
method load*(self: Module, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -393,7 +393,7 @@ method addNewChat*(
chatDto: ChatDto,
belongsToCommunity: bool,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -765,7 +765,7 @@ method addChatIfDontExist*(self: Module,
chat: ChatDto,
belongsToCommunity: bool,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,

View File

@ -1,6 +1,6 @@
import NimQml
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/settings/service 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
@ -16,7 +16,7 @@ method delete*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method load*(self: AccessInterface, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,

View File

@ -5,7 +5,7 @@ method makeChatWithIdActive*(self: AccessInterface, chatId: string) {.base.} =
raise newException(ValueError, "No implementation available")
method addNewChat*(self: AccessInterface, chatDto: ChatDto, belongsToCommunity: bool, events: EventEmitter,
settingsService: settings_service.ServiceInterface, contactService: contact_service.Service,
settingsService: settings_service.Service, contactService: contact_service.Service,
chatService: chat_service.Service, communityService: community_service.Service,
messageService: message_service.Service, gifService: gif_service.Service,
mailserversService: mailservers_service.Service, setChatAsActive: bool = true) {.base.} =
@ -21,7 +21,7 @@ method addChatIfDontExist*(self: AccessInterface,
chat: ChatDto,
belongsToCommunity: bool,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactService: contact_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,

View File

@ -5,9 +5,9 @@ import ../../global/app_signals
import ../../core/signals/types
import ../../core/eventemitter
import ../../core/notifications/notifications_manager
import ../../../app_service/service/settings/service_interface as settings_service
import ../../../app_service/service/settings/service as settings_service
import ../../../app_service/service/keychain/service as keychain_service
import ../../../app_service/service/accounts/service_interface as accounts_service
import ../../../app_service/service/accounts/service as accounts_service
import ../../../app_service/service/chat/service as chat_service
import ../../../app_service/service/community/service as community_service
import ../../../app_service/service/contacts/service as contacts_service
@ -26,9 +26,9 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
keychainService: keychain_service.Service
accountsService: accounts_service.ServiceInterface
accountsService: accounts_service.Service
chatService: chat_service.Service
communityService: community_service.Service
messageService: message_service.Service
@ -41,9 +41,9 @@ type
proc newController*(delegate: io_interface.AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
keychainService: keychain_service.Service,
accountsService: accounts_service.ServiceInterface,
accountsService: accounts_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
contactsService: contacts_service.Service,

View File

@ -34,16 +34,16 @@ import ../../../app_service/service/dapp_permissions/service as dapp_permissions
import ../../../app_service/service/provider/service as provider_service
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
import ../../../app_service/service/settings/service as settings_service
import ../../../app_service/service/contacts/service as contacts_service
import ../../../app_service/service/about/service as about_service
import ../../../app_service/service/language/service_interface as language_service
import ../../../app_service/service/language/service as language_service
import ../../../app_service/service/privacy/service as privacy_service
import ../../../app_service/service/stickers/service as stickers_service
import ../../../app_service/service/activity_center/service as activity_center_service
import ../../../app_service/service/saved_address/service as saved_address_service
import ../../../app_service/service/node/service as node_service
import ../../../app_service/service/node_configuration/service_interface as node_configuration_service
import ../../../app_service/service/node_configuration/service as node_configuration_service
import ../../../app_service/service/devices/service as devices_service
import ../../../app_service/service/mailservers/service as mailservers_service
import ../../../app_service/service/gif/service as gif_service
@ -81,7 +81,7 @@ proc newModule*[T](
delegate: T,
events: EventEmitter,
keychainService: keychain_service.Service,
accountsService: accounts_service.ServiceInterface,
accountsService: accounts_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
messageService: message_service.Service,
@ -89,19 +89,19 @@ proc newModule*[T](
transactionService: transaction_service.Service,
collectibleService: collectible_service.Service,
walletAccountService: wallet_account_service.Service,
bookmarkService: bookmark_service.ServiceInterface,
profileService: profile_service.ServiceInterface,
settingsService: settings_service.ServiceInterface,
bookmarkService: bookmark_service.Service,
profileService: profile_service.Service,
settingsService: settings_service.Service,
contactsService: contacts_service.Service,
aboutService: about_service.Service,
dappPermissionsService: dapp_permissions_service.Service,
languageService: language_service.ServiceInterface,
languageService: language_service.Service,
privacyService: privacy_service.Service,
providerService: provider_service.ServiceInterface,
providerService: provider_service.Service,
stickersService: stickers_service.Service,
activityCenterService: activity_center_service.Service,
savedAddressService: saved_address_service.ServiceInterface,
nodeConfigurationService: node_configuration_service.ServiceInterface,
savedAddressService: saved_address_service.Service,
nodeConfigurationService: node_configuration_service.Service,
devicesService: devices_service.Service,
mailserversService: mailservers_service.Service,
nodeService: node_service.Service,
@ -225,7 +225,7 @@ proc createCommunityItem[T](self: Module[T], c: CommunityDto): SectionItem =
method load*[T](
self: Module[T],
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactsService: contacts_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -569,7 +569,7 @@ method communityJoined*[T](
self: Module[T],
community: CommunityDto,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactsService: contacts_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,
@ -648,7 +648,7 @@ method getContactDetailsAsJson*[T](self: Module[T], publicKey: string): string =
method resolveENS*[T](self: Module[T], ensName: string, uuid: string) =
if ensName.len == 0:
error "error: cannot do a lookup for empty ens name"
echo "error: cannot do a lookup for empty ens name"
return
self.controller.resolveENS(ensName, uuid)
@ -686,7 +686,7 @@ method osNotificationClicked*[T](self: Module[T], details: NotificationDetails)
elif(details.notificationType == NotificationType.MyRequestToJoinCommunityAccepted):
self.controller.switchTo(details.sectionId, "", "")
elif(details.notificationType == NotificationType.MyRequestToJoinCommunityRejected):
info "There is no particular action clicking on a notification informing you about rejection to join community"
echo "There is no particular action clicking on a notification informing you about rejection to join community"
method newCommunityMembershipRequestReceived*[T](self: Module[T], membershipRequest: CommunityMembershipRequestDto) =
let (contactName, _, _) = self.controller.getContactNameAndImage(membershipRequest.publicKey)

View File

@ -2,7 +2,7 @@ import json, strutils
import controller_interface
import io_interface
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/settings/service as settings_service
import ../../../../app_service/service/node/service as node_service
import ../../../../app_service/service/node_configuration/service as node_configuration_service
@ -16,16 +16,16 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
nodeService: node_service.Service
nodeConfigurationService: node_configuration_service.ServiceInterface
nodeConfigurationService: node_configuration_service.Service
isWakuV2: bool
proc newController*(delegate: io_interface.AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
nodeService: node_service.Service,
nodeConfigurationService: node_configuration_service.ServiceInterface
nodeConfigurationService: node_configuration_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -7,7 +7,7 @@ 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/settings/service as settings_service
import ../../../../app_service/service/node/service as node_service
import ../../../../app_service/service/node_configuration/service as node_configuration_service
@ -23,9 +23,9 @@ type
proc newModule*(delegate: delegate_interface.AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
nodeService: node_service.Service,
nodeConfigurationService: node_configuration_service.ServiceInterface
nodeConfigurationService: node_configuration_service.Service
): Module =
result = Module()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/settings/service as settings_service
import ../../../../app_service/service/contacts/service as contacts_service
import ../../../../app_service/service/chat/service as chat_service
import ../../../../app_service/service/community/service as community_service
@ -14,7 +14,7 @@ method delete*(self: AccessInterface) {.base.} =
method load*(
self: AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactsService: contacts_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,

View File

@ -17,7 +17,7 @@ method toggleSection*(self: AccessInterface, sectionType: SectionType) {.base.}
raise newException(ValueError, "No implementation available")
method communityJoined*(self: AccessInterface, community: CommunityDto, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
contactsService: contacts_service.Service,
chatService: chat_service.Service,
communityService: community_service.Service,

View File

@ -5,9 +5,9 @@ import io_interface
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/settings/service as settings_service
import ../../../../../app_service/service/stickers/service as stickers_service
import ../../../../../app_service/service/node_configuration/service_interface as node_configuration_service
import ../../../../../app_service/service/node_configuration/service as node_configuration_service
export controller_interface
@ -18,14 +18,14 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
stickersService: stickers_service.Service
nodeConfigurationService: node_configuration_service.ServiceInterface
nodeConfigurationService: node_configuration_service.Service
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
stickersService: stickers_service.Service,
nodeConfigurationService: node_configuration_service.ServiceInterface): Controller =
nodeConfigurationService: node_configuration_service.Service): Controller =
result = Controller()
result.delegate = delegate
result.events = events

View File

@ -6,9 +6,9 @@ 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/settings/service as settings_service
import ../../../../../app_service/service/stickers/service as stickers_service
import ../../../../../app_service/service/node_configuration/service_interface as node_configuration_service
import ../../../../../app_service/service/node_configuration/service as node_configuration_service
export io_interface
@ -24,9 +24,9 @@ type
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
stickersService: stickers_service.Service,
nodeConfigurationService: node_configuration_service.ServiceInterface): Module =
nodeConfigurationService: node_configuration_service.Service): Module =
result = Module()
result.delegate = delegate
result.view = view.newView(result)

View File

@ -3,7 +3,7 @@ import controller_interface
import io_interface
import ../../../../core/eventemitter
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/settings/service as settings_service
import ../../../../../app_service/service/devices/service as devices_service
export controller_interface
@ -15,12 +15,12 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
devicesService: devices_service.Service
proc newController*(delegate: io_interface.AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
devicesService: devices_service.Service): Controller =
result = Controller()
result.delegate = delegate

View File

@ -4,7 +4,7 @@ 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/settings/service as settings_service
import ../../../../../app_service/service/devices/service as devices_service
export io_interface
@ -22,7 +22,7 @@ type
proc newModule*(delegate: delegate_interface.AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
devicesService: devices_service.Service): Module =
result = Module()
result.delegate = delegate

View File

@ -4,9 +4,9 @@ import io_interface
import ../../../../global/global_singleton
import ../../../../core/eventemitter
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/settings/service as settings_service
import ../../../../../app_service/service/ens/service as ens_service
import ../../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
export controller_interface
@ -17,13 +17,13 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
ensService: ens_service.Service
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter,
settingsService: settings_service.ServiceInterface, ensService: ens_service.Service,
walletAccountService: wallet_account_service.ServiceInterface): Controller =
settingsService: settings_service.Service, ensService: ens_service.Service,
walletAccountService: wallet_account_service.Service): Controller =
result = Controller()
result.delegate = delegate
result.events = events

View File

@ -6,10 +6,10 @@ import view, controller, model
import ../../../../core/eventemitter
import ../../../../../app_service/common/conversion as service_conversion
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/settings/service as settings_service
import ../../../../../app_service/service/ens/service as ens_service
import ../../../../../app_service/service/ens/utils as ens_utils
import ../../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
export io_interface
@ -27,8 +27,8 @@ type
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter,
settingsService: settings_service.ServiceInterface, ensService: ens_service.Service,
walletAccountService: wallet_account_service.ServiceInterface): Module =
settingsService: settings_service.Service, ensService: ens_service.Service,
walletAccountService: wallet_account_service.Service): Module =
result = Module()
result.delegate = delegate
result.view = view.newView(result)

View File

@ -1,18 +1,18 @@
import ./controller_interface
import io_interface
import ../../../../../app_service/service/language/service_interface as language_service
import ../../../../../app_service/service/language/service as language_service
export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
languageService: language_service.ServiceInterface
languageService: language_service.Service
method init*(self: Controller) =
discard
proc newController*(delegate: io_interface.AccessInterface, languageService: language_service.ServiceInterface):
proc newController*(delegate: io_interface.AccessInterface, languageService: language_service.Service):
Controller =
result = Controller()
result.delegate = delegate

View File

@ -4,7 +4,7 @@ import ./io_interface, ./view, ./controller
import ../io_interface as delegate_interface
import ../../../../global/global_singleton
import ../../../../../app_service/service/language/service_interface as language_service
import ../../../../../app_service/service/language/service as language_service
export io_interface
@ -16,7 +16,7 @@ type
viewVariant: QVariant
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, languageService: language_service.ServiceInterface): Module =
proc newModule*(delegate: delegate_interface.AccessInterface, languageService: language_service.Service): Module =
result = Module()
result.delegate = delegate
result.view = newView(result)

View File

@ -4,18 +4,18 @@ 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
import ../../../../app_service/service/settings/service as settings_service
import ../../../../app_service/service/contacts/service as contacts_service
import ../../../../app_service/service/about/service as about_service
import ../../../../app_service/service/language/service_interface as language_service
import ../../../../app_service/service/language/service as language_service
import ../../../../app_service/service/privacy/service as privacy_service
import ../../../../app_service/service/node_configuration/service_interface as node_configuration_service
import ../../../../app_service/service/node_configuration/service as node_configuration_service
import ../../../../app_service/service/devices/service as devices_service
import ../../../../app_service/service/mailservers/service as mailservers_service
import ../../../../app_service/service/chat/service as chat_service
import ../../../../app_service/service/stickers/service as stickersService
import ../../../../app_service/service/ens/service as ens_service
import ../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ./profile/module as profile_module
import ./contacts/module as contacts_module
@ -51,20 +51,20 @@ type
proc newModule*[T](delegate: T,
events: EventEmitter,
accountsService: accounts_service.ServiceInterface,
settingsService: settings_service.ServiceInterface,
accountsService: accounts_service.Service,
settingsService: settings_service.Service,
stickersService: stickers_service.Service,
profileService: profile_service.ServiceInterface,
profileService: profile_service.Service,
contactsService: contacts_service.Service,
aboutService: about_service.Service,
languageService: language_service.ServiceInterface,
languageService: language_service.Service,
privacyService: privacy_service.Service,
nodeConfigurationService: node_configuration_service.ServiceInterface,
nodeConfigurationService: node_configuration_service.Service,
devicesService: devices_service.Service,
mailserversService: mailservers_service.Service,
chatService: chat_service.Service,
ensService: ens_service.Service,
walletAccountService: wallet_account_service.ServiceInterface,
walletAccountService: wallet_account_service.Service,
): Module[T] =
result = Module[T]()
result.delegate = delegate

View File

@ -2,7 +2,7 @@ import ./controller_interface
import io_interface
import ../../../../core/eventemitter
import ../../../../../app_service/service/settings/service_interface as settings_service
import ../../../../../app_service/service/settings/service as settings_service
import ../../../../../app_service/service/privacy/service as privacy_service
export controller_interface
@ -11,11 +11,11 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
privacyService: privacy_service.Service
proc newController*(delegate: io_interface.AccessInterface, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
privacyService: privacy_service.Service): Controller =
result = Controller()
result.delegate = delegate

View File

@ -4,7 +4,7 @@ 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/settings/service as settings_service
import ../../../../../app_service/service/privacy/service as privacy_service
export io_interface
@ -18,7 +18,7 @@ type
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
privacyService: privacy_service.Service):
Module =
result = Module()

View File

@ -1,17 +1,17 @@
import ./controller_interface
import io_interface
import ../../../../../app_service/service/profile/service_interface as profile_service
import ../../../../../app_service/service/profile/service as profile_service
export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
profileService: profile_service.ServiceInterface
profileService: profile_service.Service
proc newController*(delegate: io_interface.AccessInterface,
profileService: profile_service.ServiceInterface): Controller =
profileService: profile_service.Service): Controller =
result = Controller()
result.delegate = delegate
result.profileService = profileService

View File

@ -4,7 +4,7 @@ import ./io_interface, ./view, ./controller
import ../io_interface as delegate_interface
import ../../../../global/global_singleton
import ../../../../../app_service/service/profile/service_interface as profile_service
import ../../../../../app_service/service/profile/service as profile_service
export io_interface
@ -20,7 +20,7 @@ type
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface,
profileService: profile_service.ServiceInterface): Module =
profileService: profile_service.Service): Module =
result = Module()
result.delegate = delegate
result.view = view.newView(result)

View File

@ -4,7 +4,7 @@ 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/settings/service as settings_service
import ../../../../../app_service/service/mailservers/service as mailservers_service
export controller_interface
@ -16,12 +16,12 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
mailserversService: mailservers_service.Service
proc newController*(delegate: io_interface.AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
mailserversService: mailservers_service.Service): Controller =
result = Controller()
result.delegate = delegate

View File

@ -4,7 +4,7 @@ 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/settings/service as settings_service
import ../../../../../app_service/service/mailservers/service as mailservers_service
export io_interface
@ -22,7 +22,7 @@ type
proc newModule*(delegate: delegate_interface.AccessInterface,
events: EventEmitter,
settingsService: settings_service.ServiceInterface,
settingsService: settings_service.Service,
mailserversService: mailservers_service.Service): Module =
result = Module()
result.delegate = delegate

View File

@ -6,9 +6,9 @@ import ./io_interface
import ../../../core/eventemitter
import ../../../../app_service/service/node/service as node_service
import ../../../../app_service/service/stickers/service as stickers_service
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/settings/service as settings_service
import ../../../../app_service/service/eth/utils as eth_utils
import ../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
export controller_interface
@ -17,8 +17,8 @@ type
delegate: io_interface.AccessInterface
events: EventEmitter
stickerService: stickers_service.Service
settingsService: settings_service.ServiceInterface
walletAccountService: wallet_account_service.ServiceInterface
settingsService: settings_service.Service
walletAccountService: wallet_account_service.Service
disconnected: bool
# Forward declaration
@ -29,8 +29,8 @@ proc newController*[T](
delegate: io_interface.AccessInterface,
events: EventEmitter,
stickerService: stickers_service.Service,
settingsService: settings_service.ServiceInterface,
walletAccountService: wallet_account_service.ServiceInterface
settingsService: settings_service.Service,
walletAccountService: wallet_account_service.Service
): Controller[T] =
result = Controller[T]()
result.delegate = delegate

View File

@ -3,9 +3,9 @@ import ./io_interface, ./view, ./controller, ./item, ./models/sticker_pack_list
import ../../../global/global_singleton
import ../../../core/eventemitter
import ../../../../app_service/service/stickers/service as stickers_service
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/settings/service as settings_service
import ../../../../app_service/common/conversion as service_conversion
import ../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
export io_interface
@ -21,8 +21,8 @@ proc newModule*[T](
delegate: T,
events: EventEmitter,
stickersService: stickers_service.Service,
settingsService: settings_Service.ServiceInterface,
walletAccountService: wallet_account_service.ServiceInterface
settingsService: settings_Service.Service,
walletAccountService: wallet_account_service.Service
): Module[T] =
result = Module[T]()
result.delegate = delegate
@ -146,7 +146,7 @@ method getGasEthValue*[T](self: Module[T], gweiValue: string, gasLimit: string):
var gasLimitInt:int
if(gasLimit.parseInt(gasLimitInt) == 0):
info "an error occurred parsing gas limit", methodName="getGasEthValue"
echo "an error occurred parsing gas limit, methodName=getGasEthValue"
return ""
# The following check prevents app crash, cause we're trying to promote

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -20,7 +20,7 @@ type
proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Module =
result = Module()
result.delegate = delegate

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -21,7 +21,7 @@ type
proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
walletAccountService: wallet_account_service.ServiceInterface,
walletAccountService: wallet_account_service.Service,
): Module =
result = Module()
result.delegate = delegate

View File

@ -13,13 +13,13 @@ type
delegate: io_interface.AccessInterface
events: EventEmitter
tokenService: token_service.Service
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
events: EventEmitter,
tokenService: token_service.Service,
walletAccountService: wallet_account_service.ServiceInterface,
walletAccountService: wallet_account_service.Service,
): Controller =
result = Controller()
result.events = events

View File

@ -22,7 +22,7 @@ proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
tokenService: token_service.Service,
walletAccountService: wallet_account_service.ServiceInterface,
walletAccountService: wallet_account_service.Service,
): Module =
result = Module()
result.delegate = delegate

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
collectibleService: collectible_service.ServiceInterface
collectibleService: collectible_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
collectibleService: collectible_service.ServiceInterface
collectibleService: collectible_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -13,7 +13,7 @@ type
controller: controller.AccessInterface
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, collectibleService: collectible_service.ServiceInterface):
proc newModule*(delegate: delegate_interface.AccessInterface, collectibleService: collectible_service.Service):
Module =
result = Module()
result.delegate = delegate

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
collectibleService: collectible_service.ServiceInterface
collectibleService: collectible_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
collectibleService: collectible_service.ServiceInterface
collectibleService: collectible_service.Service
): Controller =
result = Controller()
result.delegate = delegate
@ -24,4 +24,4 @@ method init*(self: Controller) =
discard
method fetch*(self: Controller, address: string, collectionSlug: string): seq[collectible_service.CollectibleDto] =
return self.collectible_service.getCollectibles(address, collectionSlug)
return self.collectibleService.getCollectibles(address, collectionSlug)

View File

@ -1,4 +1,4 @@
import ../../../../../../app_service/service/collectible/service_interface as collectible_service
import ../../../../../../app_service/service/collectible/service as collectible_service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -15,7 +15,7 @@ type
moduleLoaded: bool
currentAddress: string
proc newModule*(delegate: delegate_interface.AccessInterface, collectibleService: collectible_service.ServiceInterface):
proc newModule*(delegate: delegate_interface.AccessInterface, collectibleService: collectible_service.Service):
Module =
result = Module()
result.delegate = delegate

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
collectibleService: collectible_service.ServiceInterface
collectibleService: collectible_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
collectibleService: collectible_service.ServiceInterface
collectibleService: collectible_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -14,7 +14,7 @@ type
controller: controller.AccessInterface
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, collectibleService: collectible_service.ServiceInterface):
proc newModule*(delegate: delegate_interface.AccessInterface, collectibleService: collectible_service.Service):
Module =
result = Module()
result.delegate = delegate

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -23,8 +23,8 @@ type
proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
collectibleService: collectible_service.ServiceInterface,
walletAccountService: wallet_account_service.ServiceInterface
collectibleService: collectible_service.Service,
walletAccountService: wallet_account_service.Service
): Module =
result = Module()
result.delegate = delegate

View File

@ -1,5 +1,5 @@
import ./controller_interface
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/settings/service as settings_service
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../app_service/service/network/service as network_service
@ -8,15 +8,15 @@ export controller_interface
type
Controller*[T: controller_interface.DelegateInterface] = ref object of controller_interface.AccessInterface
delegate: T
settingsService: settings_service.ServiceInterface
walletAccountService: wallet_account_service.ServiceInterface
networkService: network_service.ServiceInterface
settingsService: settings_service.Service
walletAccountService: wallet_account_service.Service
networkService: network_service.Service
proc newController*[T](
delegate: T,
settingsService: settings_service.ServiceInterface,
walletAccountService: wallet_account_service.ServiceInterface,
networkService: network_service.ServiceInterface,
settingsService: settings_service.Service,
walletAccountService: wallet_account_service.Service,
networkService: network_service.Service,
): Controller[T] =
result = Controller[T]()
result.delegate = delegate

View File

@ -7,11 +7,11 @@ export controller_interface
type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/wallet_account/service_interface as wallet_account_service
import ../../../../../app_service/service/wallet_account/service as wallet_account_service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -21,7 +21,7 @@ type
proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
walletAccountService: wallet_account_service.ServiceInterface,
walletAccountService: wallet_account_service.Service,
): Module =
result = Module()
result.delegate = delegate

View File

@ -18,9 +18,9 @@ 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
import ../../../../app_service/service/wallet_account/service as wallet_account_service
import ../../../../app_service/service/settings/service_interface as settings_service
import ../../../../app_service/service/saved_address/service_interface as saved_address_service
import ../../../../app_service/service/network/service_interface as network_service
import ../../../../app_service/service/settings/service as settings_service
import ../../../../app_service/service/saved_address/service as saved_address_service
import ../../../../app_service/service/network/service as network_service
import io_interface
export io_interface
@ -47,11 +47,11 @@ proc newModule*[T](
events: EventEmitter,
tokenService: token_service.Service,
transactionService: transaction_service.Service,
collectibleService: collectible_service.ServiceInterface,
walletAccountService: wallet_account_service.ServiceInterface,
settingsService: settings_service.ServiceInterface,
savedAddressService: saved_address_service.ServiceInterface,
networkService: network_service.ServiceInterface,
collectibleService: collectible_service.Service,
walletAccountService: wallet_account_service.Service,
settingsService: settings_service.Service,
savedAddressService: saved_address_service.Service,
networkService: network_service.Service,
): Module[T] =
result = Module[T]()
result.delegate = delegate

View File

@ -9,12 +9,12 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
savedAddressService: saved_address_service.ServiceInterface
savedAddressService: saved_address_service.Service
proc newController*(
delegate: io_interface.AccessInterface,
events: EventEmitter,
savedAddressService: saved_address_service.ServiceInterface
savedAddressService: saved_address_service.Service
): Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/saved_address/service_interface as saved_address_service
import ../../../../../app_service/service/saved_address/service as saved_address_service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -19,7 +19,7 @@ type
proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
savedAddressService: saved_address_service.ServiceInterface,
savedAddressService: saved_address_service.Service,
): Module =
result = Module()
result.delegate = delegate

View File

@ -14,7 +14,7 @@ type
delegate: io_interface.AccessInterface
events: EventEmitter
transactionService: transaction_service.Service
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
# Forward declaration
method loadTransactions*(self: Controller, address: string, toBlock: Uint256, limit: int = 20, loadMore: bool = false)
@ -24,7 +24,7 @@ proc newController*(
delegate: io_interface.AccessInterface,
events: EventEmitter,
transactionService: transaction_service.Service,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Controller =
result = Controller()
result.events = events

View File

@ -25,7 +25,7 @@ proc newModule*(
delegate: delegate_interface.AccessInterface,
events: EventEmitter,
transactionService: transaction_service.Service,
walletAccountService: wallet_account_service.ServiceInterface
walletAccountService: wallet_account_service.Service
): Module =
result = Module()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import strformat, sequtils, sugar
import strformat
type
OnlineStatus* {.pure.} = enum

View File

@ -5,7 +5,7 @@ import io_interface
import ../../core/signals/types
import ../../core/eventemitter
import ../../../app_service/service/accounts/service_interface as accounts_service
import ../../../app_service/service/accounts/service as accounts_service
export controller_interface
@ -16,11 +16,11 @@ type
Controller* = ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
accountsService: accounts_service.ServiceInterface
accountsService: accounts_service.Service
proc newController*(delegate: io_interface.AccessInterface,
events: EventEmitter,
accountsService: accounts_service.ServiceInterface):
accountsService: accounts_service.Service):
Controller =
result = Controller()
result.delegate = delegate

View File

@ -6,7 +6,7 @@ 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 ../../../../app_service/service/accounts/service as accounts_service
export controller_interface
@ -15,13 +15,13 @@ type
delegate: io_interface.AccessInterface
events: EventEmitter
keychainService: keychain_service.Service
accountsService: accounts_service.ServiceInterface
accountsService: accounts_service.Service
selectedAccountKeyUid: string
proc newController*(delegate: io_interface.AccessInterface,
events: EventEmitter,
keychainService: keychain_service.Service,
accountsService: accounts_service.ServiceInterface):
accountsService: accounts_service.Service):
Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../app_service/service/accounts/service_interface
import ../../../../app_service/service/accounts/service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -5,7 +5,7 @@ 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 ../../../../app_service/service/accounts/service as accounts_service
export io_interface
@ -20,7 +20,7 @@ type
proc newModule*(delegate: delegate_interface.AccessInterface,
events: EventEmitter,
keychainService: keychain_service.Service,
accountsService: accounts_service.ServiceInterface):
accountsService: accounts_service.Service):
Module =
result = Module()
result.delegate = delegate

View File

@ -8,7 +8,7 @@ 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 ../../../app_service/service/accounts/service as accounts_service
export io_interface
@ -24,7 +24,7 @@ type
proc newModule*[T](delegate: T,
events: EventEmitter,
keychainService: keychain_service.Service,
accountsService: accounts_service.ServiceInterface):
accountsService: accounts_service.Service):
Module[T] =
result = Module[T]()
result.delegate = delegate

View File

@ -5,7 +5,7 @@ import io_interface
import ../../../core/signals/types
import ../../../core/eventemitter
import ../../../../app_service/service/accounts/service_interface as accounts_service
import ../../../../app_service/service/accounts/service as accounts_service
export controller_interface
@ -17,13 +17,13 @@ type
ref object of controller_interface.AccessInterface
delegate: io_interface.AccessInterface
events: EventEmitter
accountsService: accounts_service.ServiceInterface
accountsService: accounts_service.Service
selectedAccountId: string
displayName: string
proc newController*(delegate: io_interface.AccessInterface,
events: EventEmitter,
accountsService: accounts_service.ServiceInterface):
accountsService: accounts_service.Service):
Controller =
result = Controller()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../app_service/service/accounts/service_interface
import ../../../../app_service/service/accounts/service
type
AccessInterface* {.pure inheritable.} = ref object of RootObj

View File

@ -4,7 +4,7 @@ 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 ../../../../app_service/service/accounts/service as accounts_service
export io_interface
@ -17,7 +17,7 @@ type
moduleLoaded: bool
proc newModule*(delegate: delegate_interface.AccessInterface, events: EventEmitter,
accountsService: accounts_service.ServiceInterface):
accountsService: accounts_service.Service):
Module =
result = Module()
result.delegate = delegate

View File

@ -1,4 +1,4 @@
import ../../../../../app_service/service/accounts/service_interface
import ../../../../../app_service/service/accounts/service
method viewDidLoad*(self: AccessInterface) {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -1,9 +1,8 @@
import json, sequtils, strutils, uuids
import json_serialization, chronicles
import service_interface
import ./dto/accounts
import ./dto/generated_accounts
import ./dto/accounts as dto_accounts
import ./dto/generated_accounts as dto_generated_accounts
import ../../../backend/accounts as status_account
import ../../../backend/general as status_general
@ -11,7 +10,9 @@ import ../../../app/core/fleets/fleet_configuration
import ../../common/[account_constants, network_constants, utils, string_utils]
import ../../../constants as main_constants
export service_interface
export dto_accounts
export dto_generated_accounts
logScope:
topics = "accounts-service"
@ -19,14 +20,14 @@ logScope:
const PATHS = @[PATH_WALLET_ROOT, PATH_EIP_1581, PATH_WHISPER, PATH_DEFAULT_WALLET]
type
Service* = ref object of ServiceInterface
Service* = ref object of RootObj
fleetConfiguration: FleetConfiguration
generatedAccounts: seq[GeneratedAccountDto]
loggedInAccount: AccountDto
importedAccount: GeneratedAccountDto
isFirstTimeAccountLogin: bool
method delete*(self: Service) =
proc delete*(self: Service) =
discard
proc newService*(fleetConfiguration: FleetConfiguration): Service =
@ -34,13 +35,13 @@ proc newService*(fleetConfiguration: FleetConfiguration): Service =
result.fleetConfiguration = fleetConfiguration
result.isFirstTimeAccountLogin = false
method getLoggedInAccount*(self: Service): AccountDto =
proc getLoggedInAccount*(self: Service): AccountDto =
return self.loggedInAccount
method getImportedAccount*(self: Service): GeneratedAccountDto =
proc getImportedAccount*(self: Service): GeneratedAccountDto =
return self.importedAccount
method isFirstTimeAccountLogin*(self: Service): bool =
proc isFirstTimeAccountLogin*(self: Service): bool =
return self.isFirstTimeAccountLogin
proc generateAliasFromPk*(publicKey: string): string =
@ -52,7 +53,7 @@ proc generateIdenticonFromPk*(publicKey: string): string =
proc isAlias*(value: string): bool =
return status_account.isAlias(value)
method init*(self: Service) =
proc init*(self: Service) =
try:
let response = status_account.generateAddresses(PATHS)
@ -64,15 +65,15 @@ method init*(self: Service) =
account.identicon = generateIdenticonFromPk(account.derivedAccounts.whisper.publicKey)
except Exception as e:
error "error: ", methodName="init", errName = e.name, errDesription = e.msg
error "error: ", procName="init", errName = e.name, errDesription = e.msg
method clear*(self: Service) =
proc clear*(self: Service) =
self.generatedAccounts = @[]
self.loggedInAccount = AccountDto()
self.importedAccount = GeneratedAccountDto()
self.isFirstTimeAccountLogin = false
method validateMnemonic*(self: Service, mnemonic: string): string =
proc validateMnemonic*(self: Service, mnemonic: string): string =
try:
let response = status_general.validateMnemonic(mnemonic)
@ -84,16 +85,16 @@ method validateMnemonic*(self: Service, mnemonic: string): string =
return error
except Exception as e:
error "error: ", methodName="validateMnemonic", errName = e.name, errDesription = e.msg
error "error: ", procName="validateMnemonic", errName = e.name, errDesription = e.msg
method generatedAccounts*(self: Service): seq[GeneratedAccountDto] =
proc generatedAccounts*(self: Service): seq[GeneratedAccountDto] =
if(self.generatedAccounts.len == 0):
error "There was some issue initiating account service"
return
result = self.generatedAccounts
method openedAccounts*(self: Service): seq[AccountDto] =
proc openedAccounts*(self: Service): seq[AccountDto] =
try:
let response = status_account.openedAccounts(main_constants.STATUSGODIR)
@ -102,7 +103,7 @@ method openedAccounts*(self: Service): seq[AccountDto] =
return accounts
except Exception as e:
error "error: ", methodName="openedAccounts", errName = e.name, errDesription = e.msg
error "error: ", procName="openedAccounts", errName = e.name, errDesription = e.msg
proc storeDerivedAccounts(self: Service, accountId, hashedPassword: string,
paths: seq[string]): DerivedAccounts =
@ -111,7 +112,7 @@ proc storeDerivedAccounts(self: Service, accountId, hashedPassword: string,
result = toDerivedAccounts(response.result)
except Exception as e:
error "error: ", methodName="storeDerivedAccounts", errName = e.name, errDesription = e.msg
error "error: ", procName="storeDerivedAccounts", errName = e.name, errDesription = e.msg
proc saveAccountAndLogin(self: Service, hashedPassword: string, account,
subaccounts, settings, config: JsonNode): AccountDto =
@ -128,10 +129,10 @@ proc saveAccountAndLogin(self: Service, hashedPassword: string, account,
return
let err = "Error saving account and logging in: " & error
error "error: ", methodName="saveAccountAndLogin", errDesription = err
error "error: ", procName="saveAccountAndLogin", errDesription = err
except Exception as e:
error "error: ", methodName="saveAccountAndLogin", errName = e.name, errDesription = e.msg
error "error: ", procName="saveAccountAndLogin", errName = e.name, errDesription = e.msg
proc prepareAccountJsonObject(self: Service, account: GeneratedAccountDto, displayName: string): JsonNode =
result = %* {
@ -249,7 +250,7 @@ proc getDefaultNodeConfig*(self: Service, installationId: string): JsonNode =
# TODO: commented since it's not necessary (we do the connections thru C bindings). Enable it thru an option once status-nodes are able to be configured in desktop
# result["ListenAddr"] = if existsEnv("STATUS_PORT"): newJString("0.0.0.0:" & $getEnv("STATUS_PORT")) else: newJString("0.0.0.0:30305")
method setupAccount*(self: Service, accountId, password, displayName: string): bool =
proc setupAccount*(self: Service, accountId, password, displayName: string): bool =
try:
let installationId = $genUUID()
let accountDataJson = self.getAccountDataForAccountId(accountId, displayName)
@ -260,7 +261,7 @@ method setupAccount*(self: Service, accountId, password, displayName: string): b
if(accountDataJson.isNil or subaccountDataJson.isNil or settingsJson.isNil or
nodeConfigJson.isNil):
let description = "at least one json object is not prepared well"
error "error: ", methodName="setupAccount", errDesription = description
error "error: ", procName="setupAccount", errDesription = description
return false
let hashedPassword = hashString(password)
@ -272,10 +273,10 @@ method setupAccount*(self: Service, accountId, password, displayName: string): b
return self.getLoggedInAccount.isValid()
except Exception as e:
error "error: ", methodName="setupAccount", errName = e.name, errDesription = e.msg
error "error: ", procName="setupAccount", errName = e.name, errDesription = e.msg
return false
method importMnemonic*(self: Service, mnemonic: string): bool =
proc importMnemonic*(self: Service, mnemonic: string): bool =
try:
let response = status_account.multiAccountImportMnemonic(mnemonic)
self.importedAccount = toGeneratedAccountDto(response.result)
@ -289,10 +290,10 @@ method importMnemonic*(self: Service, mnemonic: string): bool =
return self.importedAccount.isValid()
except Exception as e:
error "error: ", methodName="importMnemonic", errName = e.name, errDesription = e.msg
error "error: ", procName="importMnemonic", errName = e.name, errDesription = e.msg
return false
method login*(self: Service, account: AccountDto, password: string): string =
proc login*(self: Service, account: AccountDto, password: string): string =
try:
let hashedPassword = hashString(password)
var thumbnailImage: string
@ -338,10 +339,10 @@ method login*(self: Service, account: AccountDto, password: string): string =
return error
except Exception as e:
error "error: ", methodName="setupAccount", errName = e.name, errDesription = e.msg
error "error: ", procName="setupAccount", errName = e.name, errDesription = e.msg
return e.msg
method verifyAccountPassword*(self: Service, account: string, password: string): bool =
proc verifyAccountPassword*(self: Service, account: string, password: string): bool =
try:
let response = status_account.verifyAccountPassword(account, password, main_constants.KEYSTOREDIR)
if(response.result.contains("error")):
@ -349,7 +350,7 @@ method verifyAccountPassword*(self: Service, account: string, password: string):
if(errMsg.len == 0):
return true
else:
error "error: ", methodName="verifyAccountPassword", errDesription = errMsg
error "error: ", procName="verifyAccountPassword", errDesription = errMsg
return false
except Exception as e:
error "error: ", methodName="verifyAccountPassword", errName = e.name, errDesription = e.msg
error "error: ", procName="verifyAccountPassword", errName = e.name, errDesription = e.msg

View File

@ -1,54 +0,0 @@
import ./dto/accounts as dto_accounts
import ./dto/generated_accounts as dto_generated_accounts
export dto_accounts
export dto_generated_accounts
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 openedAccounts*(self: ServiceInterface): seq[AccountDto] {.base.} =
raise newException(ValueError, "No implementation available")
method generatedAccounts*(self: ServiceInterface): seq[GeneratedAccountDto] {.base.} =
raise newException(ValueError, "No implementation available")
method setupAccount*(self: ServiceInterface, accountId, password, displayName: string): bool {.base.} =
raise newException(ValueError, "No implementation available")
method getLoggedInAccount*(self: ServiceInterface): AccountDto {.base.} =
raise newException(ValueError, "No implementation available")
method getImportedAccount*(self: ServiceInterface): GeneratedAccountDto {.base.} =
raise newException(ValueError, "No implementation available")
method isFirstTimeAccountLogin*(self: ServiceInterface): bool {.base.} =
raise newException(ValueError, "No implementation available")
method validateMnemonic*(self: ServiceInterface, mnemonic: string): string {.base.} =
raise newException(ValueError, "No implementation available")
method importMnemonic*(self: ServiceInterface, mnemonic: string): bool {.base.} =
raise newException(ValueError, "No implementation available")
method login*(self: ServiceInterface, account: AccountDto, password: string): string {.base.} =
raise newException(ValueError, "No implementation available")
method clear*(self: ServiceInterface) {.base.} =
raise newException(ValueError, "No implementation available")
method generateAlias*(self: ServiceInterface, publicKey: string): string {.base.} =
raise newException(ValueError, "No implementation available")
method isAlias*(self: ServiceInterface, value: string): bool {.base.} =
raise newException(ValueError, "No implementation available")
method verifyAccountPassword*(self: ServiceInterface, account: string, password: string): bool {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -1,28 +1,28 @@
import Tables, json, sequtils, strformat, chronicles
import result
include ../../common/json_utils
import service_interface, dto/bookmark
import ./dto/bookmark as bookmark_dto
import ../../../backend/bookmarks as status_go
export service_interface
export bookmark_dto
logScope:
topics = "bookmarks-service"
type
Service* = ref object of ServiceInterface
Service* = ref object of RootObj
bookmarks: Table[string, BookmarkDto] # [url, BookmarkDto]
type R = Result[BookmarkDto, string]
method delete*(self: Service) =
proc delete*(self: Service) =
discard
proc newService*(): Service =
result = Service()
result.bookmarks = initTable[string, BookmarkDto]()
method init*(self: Service) =
proc init*(self: Service) =
try:
let response = status_go.getBookmarks()
for bookmark in response.result.getElems().mapIt(it.toBookmarkDto()):
@ -32,10 +32,10 @@ method init*(self: Service) =
let errDescription = e.msg
error "error: ", errDescription
method getBookmarks*(self: Service): seq[BookmarkDto] =
proc getBookmarks*(self: Service): seq[BookmarkDto] =
return toSeq(self.bookmarks.values)
method storeBookmark*(self: Service, url, name: string): R =
proc storeBookmark*(self: Service, url, name: string): R =
try:
let response = status_go.storeBookmark(url, name).result
self.bookmarks[url] = BookmarkDto()
@ -48,7 +48,7 @@ method storeBookmark*(self: Service, url, name: string): R =
error "error: ", errDescription
result.err errDescription
method deleteBookmark*(self: Service, url: string): bool =
proc deleteBookmark*(self: Service, url: string): bool =
try:
if not self.bookmarks.hasKey(url):
return
@ -60,7 +60,7 @@ method deleteBookmark*(self: Service, url: string): bool =
return
return true
method updateBookmark*(self: Service, oldUrl, newUrl, newName: string): R =
proc updateBookmark*(self: Service, oldUrl, newUrl, newName: string): R =
try:
if not self.bookmarks.hasKey(oldUrl):
return

View File

@ -1,28 +0,0 @@
import ./dto/bookmark as bookmark_dto
import results
export bookmark_dto
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")
type R = Result[BookmarkDto, string]
method getBookmarks*(self: ServiceInterface): seq[BookmarkDto] {.base.} =
raise newException(ValueError, "No implementation available")
method storeBookmark*(self: ServiceInterface, url, name: string): R {.base.} =
raise newException(ValueError, "No implementation available")
method deleteBookmark*(self: ServiceInterface, url: string): bool {.base.} =
raise newException(ValueError, "No implementation available")
method updateBookmark*(self: ServiceInterface, oldUrl, newUrl, newName: string): R {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -391,7 +391,7 @@ QtObject:
error "error: ", errDesription
return
method clearChatHistory*(self: Service, chatId: string) =
proc clearChatHistory*(self: Service, chatId: string) =
try:
let response = status_chat.deleteMessagesByChatId(chatId)
if(not response.error.isNil):
@ -405,7 +405,7 @@ QtObject:
error "error: ", errDesription
return
method addGroupMembers*(self: Service, communityID: string, chatID: string, members: seq[string]) =
proc addGroupMembers*(self: Service, communityID: string, chatID: string, members: seq[string]) =
try:
let response = status_group_chat.addMembers(communityID, chatId, members)
if (response.error.isNil):
@ -413,7 +413,7 @@ QtObject:
except Exception as e:
error "error while adding group members: ", msg = e.msg
method removeMemberFromGroupChat*(self: Service, communityID: string, chatID: string, member: string) =
proc removeMemberFromGroupChat*(self: Service, communityID: string, chatID: string, member: string) =
try:
let response = status_group_chat.removeMember(communityID, chatId, member)
if (response.error.isNil):
@ -422,7 +422,7 @@ QtObject:
error "error while removing member from group: ", msg = e.msg
method renameGroupChat*(self: Service, communityID: string, chatID: string, name: string) =
proc renameGroupChat*(self: Service, communityID: string, chatID: string, name: string) =
try:
let response = status_group_chat.renameChat(communityID, chatId, name)
if (not response.error.isNil):
@ -435,7 +435,7 @@ QtObject:
error "error while renaming group chat: ", msg = e.msg
method makeAdmin*(self: Service, communityID: string, chatID: string, memberId: string) =
proc makeAdmin*(self: Service, communityID: string, chatID: string, memberId: string) =
try:
let response = status_group_chat.makeAdmin(communityID, chatId, memberId)
for member in self.chats[chatId].members.mitems:
@ -450,21 +450,21 @@ QtObject:
error "error while making user admin: ", msg = e.msg
method confirmJoiningGroup*(self: Service, communityID: string, chatID: string) =
proc confirmJoiningGroup*(self: Service, communityID: string, chatID: string) =
try:
let response = status_group_chat.confirmJoiningGroup(communityID, chatId)
self.emitUpdate(response)
except Exception as e:
error "error while confirmation joining to group: ", msg = e.msg
method createGroupChatFromInvitation*(self: Service, groupName: string, chatId: string, adminPK: string): tuple[chatDto: ChatDto, success: bool] =
proc createGroupChatFromInvitation*(self: Service, groupName: string, chatId: string, adminPK: string): tuple[chatDto: ChatDto, success: bool] =
try:
let response = status_group_chat.createGroupChatFromInvitation(groupName, chatId, adminPK)
result = self.createChatFromResponse(response)
except Exception as e:
error "error while creating group from invitation: ", msg = e.msg
method createGroupChat*(self: Service, communityID: string, name: string, members: seq[string]): tuple[chatDto: ChatDto, success: bool] =
proc createGroupChat*(self: Service, communityID: string, name: string, members: seq[string]): tuple[chatDto: ChatDto, success: bool] =
try:
let response = status_group_chat.createGroupChat(communityID, name, members)
result = self.createChatFromResponse(response)

View File

@ -1,32 +1,32 @@
import chronicles, sequtils, json
import ./service_interface, ./dto
import ../settings/service_interface as settings_service
import dto
import ../settings/service as settings_service
import ../../../backend/collectibles as collectibles
export service_interface
const limit = 200
export dto
logScope:
topics = "collectible-service"
type
Service* = ref object of service_interface.ServiceInterface
settingsService: settings_service.ServiceInterface
const limit = 200
method delete*(self: Service) =
type
Service* = ref object of RootObj
settingsService: settings_service.Service
proc delete*(self: Service) =
discard
proc newService*(settingsService: settings_service.ServiceInterface): Service =
proc newService*(settingsService: settings_service.Service): Service =
result = Service()
result.settingsService = settingsService
method init*(self: Service) =
proc init*(self: Service) =
discard
method getCollections(self: Service, address: string): seq[CollectionDto] =
proc getCollections*(self: Service, address: string): seq[CollectionDto] =
try:
let networkId = self.settingsService.getCurrentNetworkId()
let response = collectibles.getOpenseaCollections(networkId, address)
@ -36,7 +36,7 @@ method getCollections(self: Service, address: string): seq[CollectionDto] =
error "error: ", errDesription
return
method getCollectibles(self: Service, address: string, collectionSlug: string): seq[CollectibleDto] =
proc getCollectibles*(self: Service, address: string, collectionSlug: string): seq[CollectibleDto] =
try:
let networkId = self.settingsService.getCurrentNetworkId()
let response = collectibles.getOpenseaAssets(networkId, address, collectionSlug, limit)

View File

@ -1,19 +0,0 @@
import dto
export dto
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 getCollections*(self: ServiceInterface, address: string): seq[CollectionDto] {.base.} =
raise newException(ValueError, "No implementation available")
method getCollectibles*(self: ServiceInterface, address: string, collectionSlug: string): seq[CollectibleDto] {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -424,7 +424,7 @@ QtObject:
raise newException(RpcException, "Error joining community: " & error.message)
if response.result == nil or response.result.kind == JNull:
error "error: ", methodName="joinCommunity", errDesription = "result is nil"
error "error: ", procName="joinCommunity", errDesription = "result is nil"
return
let updatedCommunity = response.result["communities"][0].toCommunityDto()
@ -494,7 +494,7 @@ QtObject:
raise newException(RpcException, "Error leaving community: " & error.message)
if response.result == nil or response.result.kind == JNull:
error "error: ", methodName="leaveCommunity", errDesription = "result is nil"
error "error: ", procName="leaveCommunity", errDesription = "result is nil"
return
# Update community so that joined, member list and isMember are updated
@ -595,7 +595,7 @@ QtObject:
raise newException(RpcException, "Error creating community channel: " & error.message)
if response.result.isNil or response.result.kind == JNull:
error "response is invalid", methodName="createCommunityChannel"
error "response is invalid", procName="createCommunityChannel"
var chatsJArr: JsonNode
if(not response.result.getProp("chats", chatsJArr)):
@ -607,7 +607,7 @@ QtObject:
let data = CommunityChatArgs(chat: chatDto)
self.events.emit(SIGNAL_COMMUNITY_CHANNEL_CREATED, data)
except Exception as e:
error "Error creating community channel", msg = e.msg, communityId, name, description, methodName="createCommunityChannel"
error "Error creating community channel", msg = e.msg, communityId, name, description, procName="createCommunityChannel"
proc editCommunityChannel*(
self: Service,
@ -635,7 +635,7 @@ QtObject:
raise newException(RpcException, "Error editing community channel: " & error.message)
if response.result.isNil or response.result.kind == JNull:
error "response is invalid", methodName="editCommunityChannel"
error "response is invalid", procName="editCommunityChannel"
var chatsJArr: JsonNode
if(not response.result.getProp("chats", chatsJArr)):
@ -650,7 +650,7 @@ QtObject:
self.events.emit(SIGNAL_COMMUNITY_CHANNEL_EDITED, data)
except Exception as e:
error "Error editing community channel", msg = e.msg, communityId, channelId, methodName="editCommunityChannel"
error "Error editing community channel", msg = e.msg, communityId, channelId, procName="editCommunityChannel"
proc reorderCommunityChat*(
self: Service,
@ -670,7 +670,7 @@ QtObject:
raise newException(RpcException, "Error reordering community channel: " & error.message)
if response.result.isNil or response.result.kind == JNull:
error "response is invalid", methodName="reorderCommunityChat"
error "response is invalid", procName="reorderCommunityChat"
if response.result != nil and response.result.kind != JNull:
let updatedCommunity = response.result["communities"][0].toCommunityDto()
@ -687,7 +687,7 @@ QtObject:
self.events.emit(SIGNAL_COMMUNITY_CHANNEL_REORDERED, CommunityChatOrderArgs(communityId: updatedCommunity.id, chatId: fullChatId, categoryId: chat.categoryId, position: chat.position))
except Exception as e:
error "Error reordering community channel", msg = e.msg, communityId, chatId, position, methodName="reorderCommunityChat"
error "Error reordering community channel", msg = e.msg, communityId, chatId, position, procName="reorderCommunityChat"
proc deleteCommunityChat*(self: Service, communityId: string, chatId: string) =
try:
@ -698,7 +698,7 @@ QtObject:
raise newException(RpcException, "Error deleting community chat: " & error.message)
if response.result.isNil or response.result.kind == JNull:
error "response is invalid", methodName="deleteCommunityChat"
error "response is invalid", procName="deleteCommunityChat"
var shortChatId = chatId.replace(communityId, "")
let idx = findIndexById(shortChatId, self.joinedCommunities[communityId].chats)
@ -708,7 +708,7 @@ QtObject:
self.events.emit(SIGNAL_COMMUNITY_CHANNEL_DELETED, CommunityChatIdArgs(
communityId: communityId, chatId: chatId))
except Exception as e:
error "Error deleting community channel", msg = e.msg, communityId, chatId, methodName="deleteCommunityChat"
error "Error deleting community channel", msg = e.msg, communityId, chatId, procName="deleteCommunityChat"
proc createCommunityCategory*(
self: Service,

View File

@ -238,7 +238,7 @@ QtObject:
self.addContact(result)
proc getStatusForContactWithId*(self: Service, publicKey: string): StatusUpdateDto =
# This method will fetch current accurate status from `status-go` once we add an api point there for it.
# This proc will fetch current accurate status from `status-go` once we add an api point there for it.
if(not self.contactsStatus.hasKey(publicKey)):
# following line ensures that we have added a contact before setting status for it
discard self.getContactById(publicKey)

View File

@ -19,14 +19,14 @@ type
type R = Result[Dapp, string]
method delete*(self: Service) =
proc delete*(self: Service) =
discard
proc newService*(): Service =
result = Service()
result.dapps = initTable[string, Dapp]()
method init*(self: Service) =
proc init*(self: Service) =
try:
let response = status_go.getDappPermissions()
for dapp in response.result.getElems().mapIt(it.toDapp()):
@ -38,17 +38,17 @@ method init*(self: Service) =
let errDescription = e.msg
error "error: ", errDescription
method getDapps*(self: Service): seq[Dapp] =
proc getDapps*(self: Service): seq[Dapp] =
return toSeq(self.dapps.values)
method getDapp*(self: Service, name: string, address: string): Option[Dapp] =
proc getDapp*(self: Service, name: string, address: string): Option[Dapp] =
let key = name & address
if self.dapps.hasKey(key):
return some(self.dapps[key])
return none(Dapp)
method addPermission*(self: Service, name: string, address: string, permission: Permission): R =
proc addPermission*(self: Service, name: string, address: string, permission: Permission): R =
let key = name & address
try:
@ -69,13 +69,13 @@ method addPermission*(self: Service, name: string, address: string, permission:
result.err errDescription
method hasPermission*(self: Service, dapp: string, address: string, permission: Permission): bool =
proc hasPermission*(self: Service, dapp: string, address: string, permission: Permission): bool =
let key = dapp & address
if not self.dapps.hasKey(key):
return false
return self.dapps[key].permissions.contains(permission)
method disconnect*(self: Service, dappName: string): bool =
proc disconnect*(self: Service, dappName: string): bool =
try:
var addresses: seq[string] = @[]
for dapp in self.dapps.values:
@ -93,7 +93,7 @@ method disconnect*(self: Service, dappName: string): bool =
let errDescription = e.msg
error "error: ", errDescription
method disconnectAddress*(self: Service, dappName: string, address: string): bool =
proc disconnectAddress*(self: Service, dappName: string, address: string): bool =
let key = dappName & address
if not self.dapps.hasKey(key):
return
@ -106,7 +106,7 @@ method disconnectAddress*(self: Service, dappName: string, address: string): boo
let errDescription = e.msg
error "error: ", errDescription
method removePermission*(self: Service, name: string, address: string, permission: Permission): bool =
proc removePermission*(self: Service, name: string, address: string, permission: Permission): bool =
let key = name & address
if not self.dapps.hasKey(key):
return

View File

@ -24,7 +24,7 @@ const SIGNAL_UPDATE_DEVICE* = "updateDevice"
QtObject:
type Service* = ref object of QObject
events: EventEmitter
settingsService: settings_service.ServiceInterface
settingsService: settings_service.Service
## Forward declaration
proc isNewDevice(self: Service, device: DeviceDto): bool
@ -32,7 +32,7 @@ QtObject:
proc delete*(self: Service) =
self.QObject.delete
proc newService*(events: EventEmitter, settingsService: settings_service.ServiceInterface): Service =
proc newService*(events: EventEmitter, settingsService: settings_service.Service): Service =
new(result, delete)
result.QObject.setup
result.events = events

View File

@ -13,11 +13,11 @@ import ../network/types as network_types
import ../../common/conversion as common_conversion
import utils as ens_utils
import ../settings/service_interface as settings_service
import ../wallet_account/service_interface as wallet_account_service
import ../settings/service as settings_service
import ../wallet_account/service as wallet_account_service
import ../transaction/service as transaction_service
import ../eth/service_interface as eth_service
import ../network/service_interface as network_service
import ../eth/service as eth_service
import ../network/service as network_service
import ../token/service as token_service
@ -68,11 +68,11 @@ QtObject:
events: EventEmitter
threadpool: ThreadPool
pendingEnsUsernames*: HashSet[string]
settingsService: settings_service.ServiceInterface
walletAccountService: wallet_account_service.ServiceInterface
settingsService: settings_service.Service
walletAccountService: wallet_account_service.Service
transactionService: transaction_service.Service
ethService: eth_service.ServiceInterface
networkService: network_service.ServiceInterface
ethService: eth_service.Service
networkService: network_service.Service
tokenService: token_service.Service
proc delete*(self: Service) =
@ -81,11 +81,11 @@ QtObject:
proc newService*(
events: EventEmitter,
threadpool: ThreadPool,
settingsService: settings_service.ServiceInterface,
walletAccountService: wallet_account_service.ServiceInterface,
settingsService: settings_service.Service,
walletAccountService: wallet_account_service.Service,
transactionService: transaction_service.Service,
ethService: eth_service.ServiceInterface,
networkService: network_service.ServiceInterface,
ethService: eth_service.Service,
networkService: network_service.Service,
tokenService: token_service.Service
): Service =
new(result, delete)
@ -153,7 +153,7 @@ QtObject:
proc onEnsUsernameAvailabilityChecked*(self: Service, response: string) {.slot.} =
let responseObj = response.parseJson
if (responseObj.kind != JObject):
info "expected response is not a json object", methodName="onEnsUsernameAvailabilityChecked"
info "expected response is not a json object", procName="onEnsUsernameAvailabilityChecked"
# notify view, this is important
self.events.emit(SIGNAL_ENS_USERNAME_AVAILABILITY_CHECKED, EnsUsernameAvailabilityArgs())
return
@ -191,7 +191,7 @@ QtObject:
proc onEnsUsernameDetailsFetched*(self: Service, response: string) {.slot.} =
let responseObj = response.parseJson
if (responseObj.kind != JObject):
info "expected response is not a json object", methodName="onEnsUsernameDetailsFetched"
info "expected response is not a json object", procName="onEnsUsernameDetailsFetched"
# notify view, this is important
self.events.emit(SIGNAL_ENS_USERNAME_DETAILS_FETCHED, EnsUsernameDetailsArgs())
return
@ -242,14 +242,14 @@ QtObject:
proc onGasPriceFetched*(self: Service, response: string) {.slot.} =
let responseObj = response.parseJson
if (responseObj.kind != JObject):
info "expected response is not a json object", methodName="onGasPriceFetched"
info "expected response is not a json object", procName="onGasPriceFetched"
# notify view, this is important
self.events.emit(SIGNAL_GAS_PRICE_FETCHED, GasPriceArgs(gasPrice: "0"))
return
var gasPriceHex: string
if(not responseObj.getProp("gasPrice", gasPriceHex)):
info "expected response doesn't contain gas price", methodName="onGasPriceFetched"
info "expected response doesn't contain gas price", procName="onGasPriceFetched"
# notify view, this is important
self.events.emit(SIGNAL_GAS_PRICE_FETCHED, GasPriceArgs(gasPrice: "0"))
return
@ -281,7 +281,7 @@ QtObject:
result = resp.result.getInt
except Exception as e:
result = 80000
error "error occurred", methodName="setPubKeyGasEstimate", msg = e.msg
error "error occurred", procName="setPubKeyGasEstimate", msg = e.msg
proc setPubKey*(
self: Service,
@ -311,7 +311,7 @@ QtObject:
result = $(%* { "result": hash, "success": true })
except Exception as e:
error "error occurred", methodName="setPubKey", msg = e.msg
error "error occurred", procName="setPubKey", msg = e.msg
result = $(%* { "result": e.msg, "success": false })
proc releaseEnsEstimate*(self: Service, ensUsername: string, address: string): int =
@ -323,7 +323,7 @@ QtObject:
let resp = status_ens.releaseEstimate(chainId, %txData, ensUsername)
result = resp.result.getInt
except Exception as e:
error "error occurred", methodName="releaseEnsEstimate", msg = e.msg
error "error occurred", procName="releaseEnsEstimate", msg = e.msg
result = 100000
proc release*(
@ -349,7 +349,7 @@ QtObject:
result = $(%* { "result": hash, "success": true })
except RpcException as e:
error "error occurred", methodName="release", msg = e.msg
error "error occurred", procName="release", msg = e.msg
result = $(%* { "result": e.msg, "success": false })
proc getEnsRegisteredAddress*(self: Service): string =
@ -368,7 +368,7 @@ QtObject:
result = resp.result.getInt
except Exception as e:
result = 380000
error "error occurred", methodName="registerENSGasEstimate", msg = e.msg
error "error occurred", procName="registerENSGasEstimate", msg = e.msg
proc registerEns*(
self: Service,
@ -400,7 +400,7 @@ QtObject:
self.pendingEnsUsernames.incl(ensUsername)
result = $(%* { "result": hash, "success": true })
except Exception as e:
error "error occurred", methodName="registerEns", msg = e.msg
error "error occurred", procName="registerEns", msg = e.msg
result = $(%* { "result": e.msg, "success": false })
proc getSNTBalance*(self: Service): string =

View File

@ -18,7 +18,7 @@ type
name*: string
chainId*: int
address*: Address
methods* {.dontSerialize.}: Table[string, MethodDto]
procs* {.dontSerialize.}: Table[string, MethodDto]
Erc20ContractDto* = ref object of ContractDto
symbol*: string
@ -31,18 +31,18 @@ type
hasIcon*: bool
proc newErc20Contract*(name: string, chainId: int, address: Address, symbol: string, decimals: int, hasIcon: bool): Erc20ContractDto =
Erc20ContractDto(name: name, chainId: chainId, address: address, methods: ERC20_METHODS.toTable, symbol: symbol, decimals: decimals, hasIcon: hasIcon)
Erc20ContractDto(name: name, chainId: chainId, address: address, procs: ERC20_procS.toTable, symbol: symbol, decimals: decimals, hasIcon: hasIcon)
proc newErc20Contract*(chainId: int, address: Address): Erc20ContractDto =
Erc20ContractDto(name: "", chainId: chainId, address: address, methods: ERC20_METHODS.toTable, symbol: "", decimals: 0, hasIcon: false)
Erc20ContractDto(name: "", chainId: chainId, address: address, procs: ERC20_procS.toTable, symbol: "", decimals: 0, hasIcon: false)
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 newErc721Contract*(name: string, chainId: int, address: Address, symbol: string, hasIcon: bool, addlprocs: seq[tuple[name: string, meth: MethodDto]] = @[]): Erc721ContractDto =
Erc721ContractDto(name: name, chainId: chainId, address: address, symbol: symbol, hasIcon: hasIcon, procs: ERC721_ENUMERABLE_procS.concat(addlprocs).toTable)
proc tokenDecimals*(contract: ContractDto): int =
let payload = %* [{
"to": $contract.address,
"data": contract.methods["decimals"].encodeAbi()
"data": contract.procs["decimals"].encodeAbi()
}, "latest"]
let response = status_eth.doEthCall(payload)
@ -52,15 +52,15 @@ proc tokenDecimals*(contract: ContractDto): int =
return 0
result = parseHexInt(response.result.getStr)
proc getTokenString*(contract: ContractDto, methodName: string): string =
proc getTokenString*(contract: ContractDto, procName: string): string =
let payload = %* [{
"to": $contract.address,
"data": contract.methods[methodName].encodeAbi()
"data": contract.procs[procName].encodeAbi()
}, "latest"]
let response = status_eth.doEthCall(payload)
if not response.error.isNil:
raise newException(RpcException, "Error getting token string - " & methodName & ": " & response.error.message)
raise newException(RpcException, "Error getting token string - " & procName & ": " & response.error.message)
if response.result.getStr == "0x":
return ""
@ -73,5 +73,5 @@ proc tokenName*(contract: ContractDto): string =
proc tokenSymbol*(contract: ContractDto): string =
getTokenString(contract, "symbol")
proc getMethod*(contract: ContractDto, methodName: string): MethodDto =
return contract.methods[methodName]
proc getproc*(contract: ContractDto, procName: string): MethodDto =
return contract.procs[procName]

View File

@ -15,7 +15,7 @@ type MethodDto* = object
name*: string
signature*: string
const ERC20_METHODS* = @[
const ERC20_procS* = @[
("name", MethodDto(signature: "name()")),
("symbol", MethodDto(signature: "symbol()")),
("decimals", MethodDto(signature: "decimals()")),
@ -30,7 +30,7 @@ const ERC20_METHODS* = @[
("approveAndCall", MethodDto(signature: "approveAndCall(address,uint256,bytes)"))
]
const ERC721_ENUMERABLE_METHODS* = @[
const ERC721_ENUMERABLE_procS* = @[
("balanceOf", MethodDto(signature: "balanceOf(address)")),
("ownerOf", MethodDto(signature: "ownerOf(uint256)")),
("name", MethodDto(signature: "name()")),
@ -49,11 +49,11 @@ const ERC721_ENUMERABLE_METHODS* = @[
("safeTransferFromWithData", MethodDto(signature: "safeTransferFrom(address,address,uint256,bytes)"))
]
proc encodeMethod(self: MethodDto): string =
proc encodeproc(self: MethodDto): string =
($nimcrypto.keccak256.digest(self.signature))[0..<8].toLower
proc encodeAbi*(self: MethodDto, obj: object = RootObj()): string =
result = "0x" & self.encodeMethod()
result = "0x" & self.encodeproc()
# .fields is an iterator, and there's no way to get a count of an iterator
# in nim, so we have to loop and increment a counter
@ -74,9 +74,9 @@ proc encodeAbi*(self: MethodDto, obj: object = RootObj()): string =
result &= encoded.data
result &= data
proc estimateGas*(self: MethodDto, tx: var TransactionDataDto, methodDescriptor: object, success: var bool): string =
proc estimateGas*(self: MethodDto, tx: var TransactionDataDto, procDescriptor: object, success: var bool): string =
success = true
tx.data = self.encodeAbi(methodDescriptor)
tx.data = self.encodeAbi(procDescriptor)
try:
# 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])
@ -85,20 +85,20 @@ proc estimateGas*(self: MethodDto, tx: var TransactionDataDto, methodDescriptor:
success = false
result = e.msg
proc getEstimateGasData*(self: MethodDto, tx: var TransactionDataDto, methodDescriptor: object): JsonNode =
tx.data = self.encodeAbi(methodDescriptor)
proc getEstimateGasData*(self: MethodDto, tx: var TransactionDataDto, procDescriptor: object): JsonNode =
tx.data = self.encodeAbi(procDescriptor)
return %*[%tx]
proc send*(self: MethodDto, tx: var TransactionDataDto, methodDescriptor: object, password: string, success: var bool): string =
tx.data = self.encodeAbi(methodDescriptor)
proc send*(self: MethodDto, tx: var TransactionDataDto, procDescriptor: object, password: string, success: var bool): string =
tx.data = self.encodeAbi(procDescriptor)
# 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)
success = response.error.isNil
return $response
proc call[T](self: MethodDto, tx: var TransactionDataDto, methodDescriptor: object, success: var bool): T =
proc call[T](self: MethodDto, tx: var TransactionDataDto, procDescriptor: object, success: var bool): T =
success = true
tx.data = self.encodeAbi(methodDescriptor)
tx.data = self.encodeAbi(procDescriptor)
let response: RpcResponse
try:
# 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.

View File

@ -11,7 +11,7 @@ type
maxPriorityFeePerGas*: Option[Uint256]
maxFeePerGas*: Option[Uint256]
value*: Option[Uint256] # (optional) integer of the value sent with this transaction.
data*: string # the compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABI.
data*: string # the compiled code of a contract OR the hash of the invoked proc signature and encoded parameters. For details see Ethereum Contract ABI.
nonce*: Option[Nonce] # (optional) integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce
txType*: string

View File

@ -4,18 +4,28 @@ import web3/ethtypes, json_serialization, chronicles, tables
import ../../../backend/eth
import utils
import ./service_interface
import ./dto/contract
import ./dto/method_dto
import ./dto/network
import ./dto/coder
import ./dto/edn_dto
import ./dto/transaction
export service_interface
export contract
export method_dto
export network
export coder
export edn_dto
export transaction
logScope:
topics = "eth-service"
type
Service* = ref object of service_interface.ServiceInterface
Service* = ref object of RootObj
contracts: seq[ContractDto]
method delete*(self: Service) =
proc delete*(self: Service) =
discard
proc newService*(): Service =
@ -25,7 +35,7 @@ proc newService*(): Service =
# Forward declaration
proc initContracts(self: Service)
method init*(self: Service) =
proc init*(self: Service) =
self.initContracts()
proc initContracts(self: Service) =
@ -136,7 +146,7 @@ proc initContracts(self: Service) =
newErc721Contract("kudos", Mainnet, parseAddress("0x2aea4add166ebf38b63d09a75de1a7b94aa24163"), "KDO", true),
newErc721Contract("crypto-kitties", Mainnet, parseAddress("0x06012c8cf97bead5deae237070f9587f8e7a266d"), "CK", true),
ContractDto(name: "ens-usernames", chainId: Mainnet, address: parseAddress("0xDB5ac1a559b02E12F29fC0eC0e37Be8E046DEF49"),
methods: [
procs: [
("register", MethodDto(signature: "register(bytes32,address,bytes32,bytes32)")),
("getPrice", MethodDto(signature: "getPrice()")),
("getExpirationTime", MethodDto(signature: "getExpirationTime(bytes32)")),
@ -144,7 +154,7 @@ proc initContracts(self: Service) =
].toTable
),
ContractDto(name: "ens-resolver", chainId: Mainnet, address: parseAddress("0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41"),
methods: [
procs: [
("setPubkey", MethodDto(signature: "setPubkey(bytes32,bytes32,bytes32)"))
].toTable
),
@ -160,7 +170,7 @@ proc initContracts(self: Service) =
newErc721Contract("sticker-pack", Ropsten, parseAddress("0xf852198d0385c4b871e0b91804ecd47c6ba97351"), "PACK", false, @[("tokenPackId", MethodDto(signature: "tokenPackId(uint256)"))]),
newErc721Contract("kudos", Ropsten, parseAddress("0xcd520707fc68d153283d518b29ada466f9091ea8"), "KDO", true),
ContractDto(name: "ens-usernames", chainId: Ropsten, address: parseAddress("0xdaae165beb8c06e0b7613168138ebba774aff071"),
methods: [
procs: [
("register", MethodDto(signature: "register(bytes32,address,bytes32,bytes32)")),
("getPrice", MethodDto(signature: "getPrice()")),
("getExpirationTime", MethodDto(signature: "getExpirationTime(bytes32)")),
@ -168,7 +178,7 @@ proc initContracts(self: Service) =
].toTable
),
ContractDto(name: "ens-resolver", chainId: Ropsten, address: parseAddress("0x42D63ae25990889E35F215bC95884039Ba354115"),
methods: [
procs: [
("setPubkey", MethodDto(signature: "setPubkey(bytes32,bytes32,bytes32)"))
].toTable
),
@ -191,33 +201,33 @@ proc initContracts(self: Service) =
proc allContracts(self: Service): seq[ContractDto] =
result = self.contracts
method findByAddress*(self: Service, contracts: seq[Erc20ContractDto], address: Address): Erc20ContractDto =
proc findByAddress*(self: Service, contracts: seq[Erc20ContractDto], address: Address): Erc20ContractDto =
let found = contracts.filter(contract => contract.address == address)
result = if found.len > 0: found[0] else: nil
method findBySymbol*(self: Service, contracts: seq[Erc20ContractDto], symbol: string): Erc20ContractDto =
proc findBySymbol*(self: Service, contracts: seq[Erc20ContractDto], symbol: string): Erc20ContractDto =
let found = contracts.filter(contract => contract.symbol.toLower == symbol.toLower)
result = if found.len > 0: found[0] else: nil
method findContract*(self: Service, chainId: int, name: string): ContractDto =
proc findContract*(self: Service, chainId: int, name: string): ContractDto =
let found = self.allContracts().filter(contract => contract.name == name and contract.chainId == chainId)
result = if found.len > 0: found[0] else: nil
method allErc20Contracts*(self: Service): seq[Erc20ContractDto] =
proc allErc20Contracts*(self: Service): seq[Erc20ContractDto] =
result = self.allContracts().filter(contract => contract of Erc20ContractDto).map(contract => Erc20ContractDto(contract))
method allErc20ContractsByChainId*(self: Service, chainId: int): seq[Erc20ContractDto] =
proc allErc20ContractsByChainId*(self: Service, chainId: int): seq[Erc20ContractDto] =
result = self.allContracts().filter(contract => contract of Erc20ContractDto and contract.chainId == chainId).map(contract => Erc20ContractDto(contract))
method findErc20Contract*(self: Service, chainId: int, symbol: string): Erc20ContractDto =
proc findErc20Contract*(self: Service, chainId: int, symbol: string): Erc20ContractDto =
return self.findBySymbol(self.allErc20ContractsByChainId(chainId), symbol)
method findErc20Contract*(self: Service, chainId: int, address: Address): Erc20ContractDto =
proc findErc20Contract*(self: Service, chainId: int, address: Address): Erc20ContractDto =
return self.findByAddress(self.allErc20ContractsByChainId(chainId), address)
method allErc721ContractsByChainId*(self: Service, chainId: int): seq[Erc721ContractDto] =
proc allErc721ContractsByChainId*(self: Service, chainId: int): seq[Erc721ContractDto] =
result = self.allContracts().filter(contract => contract of Erc721ContractDto and contract.chainId == chainId).map(contract => Erc721ContractDto(contract))
method findErc721Contract*(self: Service, chainId: int, name: string): Erc721ContractDto =
proc findErc721Contract*(self: Service, chainId: int, name: string): Erc721ContractDto =
let found = self.allErc721ContractsByChainId(chainId).filter(contract => contract.name.toLower == name.toLower)
result = if found.len > 0: found[0] else: nil

View File

@ -1,53 +0,0 @@
import web3/ethtypes
import ./dto/contract
import ./dto/method_dto
import ./dto/network
import ./dto/coder
import ./dto/edn_dto
import ./dto/transaction
export contract
export method_dto
export network
export coder
export edn_dto
export transaction
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 findByAddress*(self: ServiceInterface, contracts: seq[Erc20ContractDto], address: Address): Erc20ContractDto
{.base.} =
raise newException(ValueError, "No implementation available")
method findBySymbol*(self: ServiceInterface, contracts: seq[Erc20ContractDto], symbol: string): Erc20ContractDto
{.base.} =
raise newException(ValueError, "No implementation available")
method findContract*(self: ServiceInterface, chainId: int, name: string): ContractDto {.base.} =
raise newException(ValueError, "No implementation available")
method allErc20Contracts*(self: ServiceInterface): seq[Erc20ContractDto] {.base.} =
raise newException(ValueError, "No implementation available")
method allErc20ContractsByChainId*(self: ServiceInterface, chainId: int): seq[Erc20ContractDto] {.base.} =
raise newException(ValueError, "No implementation available")
method findErc20Contract*(self: ServiceInterface, chainId: int, symbol: string): Erc20ContractDto {.base.} =
raise newException(ValueError, "No implementation available")
method findErc20Contract*(self: ServiceInterface, chainId: int, address: Address): Erc20ContractDto {.base.} =
raise newException(ValueError, "No implementation available")
method allErc721ContractsByChainId*(self: ServiceInterface, chainId: int): seq[Erc721ContractDto] {.base.} =
raise newException(ValueError, "No implementation available")
method findErc721Contract*(self: ServiceInterface, chainId: int, name: string): Erc721ContractDto {.base.} =
raise newException(ValueError, "No implementation available")

View File

@ -68,10 +68,10 @@ proc decodeContentHash*(value: string): string =
proc isWakuEnabled(): bool =
true # TODO:
proc prefix*(methodName: string, isExt:bool = true): string =
proc prefix*(procName: string, isExt:bool = true): string =
result = if isWakuEnabled(): "waku" else: "shh"
result = result & (if isExt: "ext_" else: "_")
result = result & methodName
result = result & procName
proc isOneToOneChat*(chatId: string): bool =
result = chatId.startsWith("0x") # There is probably a better way to do this

View File

@ -1,26 +1,24 @@
import json, chronicles
import service_interface
import ../../../backend/general as status_general
import ../../../backend/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
Service* = ref object of RootObj
method delete*(self: Service) =
proc delete*(self: Service) =
discard
proc newService*(): Service =
result = Service()
method initKeycard(self: Service) =
proc 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".
@ -31,10 +29,10 @@ method initKeycard(self: Service) =
error "error: ", errDesription
return
method init*(self: Service) =
proc init*(self: Service) =
self.initKeycard()
method startMessenger*(self: Service) =
proc startMessenger*(self: Service) =
try:
discard status_general.startMessenger()
except Exception as e:

View File

@ -1,12 +0,0 @@
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")

View File

@ -6,10 +6,9 @@ import uri
import chronicles
import sequtils
import ../settings/service_interface as settings_service
import ../settings/service as settings_service
import ../../../backend/gif as status_gif
import ./dto
import ./service_interface
logScope:
topics = "gif-service"
@ -26,16 +25,16 @@ let TENOR_API_KEY_RESOLVED =
TENOR_API_KEY
type
Service* = ref object of service_interface.ServiceInterface
settingsService: settings_service.ServiceInterface
Service* = ref object of RootObj
settingsService: settings_service.Service
client: HttpClient
favorites: seq[GifDto]
recents: seq[GifDto]
method delete*(self: Service) =
proc delete*(self: Service) =
discard
proc newService*(settingsService: settings_service.ServiceInterface): Service =
proc newService*(settingsService: settings_service.Service): Service =
result = Service()
result.settingsService = settingsService
result.client = newHttpClient()
@ -49,7 +48,7 @@ proc setTenorAPIKey(self: Service) =
error "error setTenorAPIKey: ", errDescription = response.error.message
except Exception as e:
error "error: ", methodName="setTenorAPIKey", errName = e.name, errDesription = e.msg
error "error: ", procName="setTenorAPIKey", errName = e.name, errDesription = e.msg
proc getRecentGifs(self: Service) =
try:
@ -61,7 +60,7 @@ proc getRecentGifs(self: Service) =
self.recents = map(response.result.getElems(), settingToGifDto)
except Exception as e:
error "error: ", methodName="getRecentGifs", errName = e.name, errDesription = e.msg
error "error: ", procName="getRecentGifs", errName = e.name, errDesription = e.msg
proc getFavoriteGifs(self: Service) =
try:
@ -73,9 +72,9 @@ proc getFavoriteGifs(self: Service) =
self.favorites = map(response.result.getElems(), settingToGifDto)
except Exception as e:
error "error: ", methodName="getFavoriteGifs", errName = e.name, errDesription = e.msg
error "error: ", procName="getFavoriteGifs", errName = e.name, errDesription = e.msg
method init*(self: Service) =
proc init*(self: Service) =
# set Tenor API Key
self.setTenorAPIKey()

View File

@ -1,6 +0,0 @@
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")

View File

@ -1,7 +0,0 @@
# We cannot have interface defined here, bacause of Nim limitation in terms of
# multiple inheritances, since this service already inherits from QtObject
# Concepts cannot be used also because of other limitation cause we cannot
# forward this class to appropriate submodule, cause Nim doesn't support
# nested types which depends on concepts.

View File

@ -1,26 +1,23 @@
import NimQml
import json, json_serialization, sequtils, chronicles, os, strformat
import ./service_interface
import ../../../app/global/global_singleton
export service_interface
logScope:
topics = "language-service"
type
Service* = ref object of ServiceInterface
Service* = ref object of RootObj
i18nPath: string
shouldRetranslate: bool
method delete*(self: Service) =
proc delete*(self: Service) =
discard
proc newService*(): Service =
result = Service()
result.shouldRetranslate = not defined(linux)
method init*(self: Service) =
proc init*(self: Service) =
try:
self.i18nPath = ""
if defined(development):
@ -40,7 +37,7 @@ method init*(self: Service) =
error "error: ", errDesription
return
method setLanguage*(self: Service, locale: string) =
proc setLanguage*(self: Service, locale: string) =
if (locale == singletonInstance.localAppSettings.getLocale()):
return

Some files were not shown because too many files have changed in this diff Show More