-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(walletconnect): initial code organization
Closes #14395
- Loading branch information
1 parent
d0658fe
commit dfc7bec
Showing
51 changed files
with
992 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
...let_section/wallet_connect/controller.nim → ...section/poc_wallet_connect/controller.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...wallet_section/wallet_connect/helpers.nim → ...et_section/poc_wallet_connect/helpers.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...ection/wallet_connect/tx_response_dto.nim → ...on/poc_wallet_connect/tx_response_dto.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/app/modules/shared_modules/wallet_connect/controller.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import chronicles | ||
import io_interface | ||
|
||
import app/core/eventemitter | ||
import app_service/service/wallet_account/service as wallet_account_service | ||
import app_service/service/wallet_connect/service as wallet_connect_service | ||
|
||
logScope: | ||
topics = "wallet-connect-controller" | ||
|
||
type | ||
Controller* = ref object of RootObj | ||
delegate: io_interface.AccessInterface | ||
events: EventEmitter | ||
walletAccountService: wallet_account_service.Service | ||
walletConnectService: wallet_connect_service.Service | ||
|
||
proc newController*(delegate: io_interface.AccessInterface, | ||
events: EventEmitter, | ||
walletAccountService: wallet_account_service.Service, | ||
walletConnectService: wallet_connect_service.Service): Controller = | ||
result = Controller() | ||
result.delegate = delegate | ||
result.events = events | ||
result.walletAccountService = walletAccountService | ||
result.walletConnectService = walletConnectService | ||
|
||
proc delete*(self: Controller) = | ||
self.disconnectAll() | ||
|
||
proc init*(self: Controller) = | ||
discard |
14 changes: 14 additions & 0 deletions
14
src/app/modules/shared_modules/wallet_connect/io_interface.nim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import NimQml | ||
|
||
type | ||
AccessInterface* {.pure inheritable.} = ref object of RootObj | ||
|
||
method delete*(self: AccessInterface) {.base.} = | ||
raise newException(ValueError, "No implementation available") | ||
|
||
method getModuleAsVariant*(self: AccessInterface): QVariant {.base.} = | ||
raise newException(ValueError, "No implementation available") | ||
|
||
|
||
type | ||
DelegateInterface* = concept c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import NimQml, chronicles | ||
|
||
import io_interface | ||
import view, controller | ||
import app/core/eventemitter | ||
|
||
import app_service/service/wallet_account/service as wallet_account_service | ||
import app_service/service/wallet_connect/service as wallet_connect_service | ||
import app_service/service/keychain/service as keychain_service | ||
|
||
export io_interface | ||
|
||
logScope: | ||
topics = "wallet-connect-module" | ||
|
||
type | ||
Module*[T: io_interface.DelegateInterface] = ref object of io_interface.AccessInterface | ||
delegate: T | ||
view: View | ||
viewVariant: QVariant | ||
controller: Controller | ||
|
||
proc newModule*[T](delegate: T, | ||
uniqueIdentifier: string, | ||
events: EventEmitter, | ||
walletAccountService: wallet_account_service.Service, | ||
walletConnectService: wallet_connect_service.Service): | ||
Module[T] = | ||
result = Module[T]() | ||
result.delegate = delegate | ||
result.view = view.newView(result) | ||
result.viewVariant = newQVariant(result.view) | ||
result.controller = controller.newController(result, walletAccountService, walletConnectService) | ||
|
||
{.push warning[Deprecated]: off.} | ||
|
||
method delete*[T](self: Module[T]) = | ||
self.view.delete | ||
self.viewVariant.delete | ||
self.controller.delete | ||
|
||
proc init[T](self: Module[T], fullConnect = true) = | ||
self.controller.init() | ||
|
||
method getModuleAsVariant*[T](self: Module[T]): QVariant = | ||
return self.viewVariant | ||
|
||
|
||
{.pop.} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import NimQml | ||
import io_interface | ||
|
||
QtObject: | ||
type | ||
View* = ref object of QObject | ||
delegate: io_interface.AccessInterface | ||
|
||
proc delete*(self: View) = | ||
self.QObject.delete | ||
|
||
proc newView*(delegate: io_interface.AccessInterface): View = | ||
new(result, delete) | ||
result.QObject.setup | ||
result.delegate = delegate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
################################################# | ||
# Async | ||
################################################# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import NimQml, chronicles | ||
|
||
# import backend/wallet_connect as status_go_wallet_connect | ||
|
||
import app/global/global_singleton | ||
|
||
import app/core/eventemitter | ||
import app/core/signals/types | ||
import app/core/tasks/[threadpool] | ||
|
||
logScope: | ||
topics = "wallet-connect-service" | ||
|
||
# include async_tasks | ||
|
||
QtObject: | ||
type Service* = ref object of QObject | ||
events: EventEmitter | ||
threadpool: ThreadPool | ||
|
||
proc delete*(self: Service) = | ||
self.QObject.delete | ||
|
||
proc newService*( | ||
events: EventEmitter, | ||
threadpool: ThreadPool, | ||
): Service = | ||
new(result, delete) | ||
result.QObject.setup | ||
result.events = events | ||
result.threadpool = threadpool | ||
|
||
proc init*(self: Service) = | ||
discard |
Oops, something went wrong.