From 7475e09526ee7c0e64127ee5999ff6ed950286d2 Mon Sep 17 00:00:00 2001 From: MishkaRogachev Date: Fri, 12 Jul 2024 20:04:46 +0200 Subject: [PATCH] feat: handle connector's asignals in nim --- .../core/signals/remote_signals/connector.nim | 28 +++++++++++++++++++ .../signals/remote_signals/signal_type.nim | 2 ++ src/app/core/signals/signals_manager.nim | 2 ++ src/app/core/signals/types.nim | 4 +-- vendor/status-go | 2 +- 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 src/app/core/signals/remote_signals/connector.nim diff --git a/src/app/core/signals/remote_signals/connector.nim b/src/app/core/signals/remote_signals/connector.nim new file mode 100644 index 0000000000..d81302115d --- /dev/null +++ b/src/app/core/signals/remote_signals/connector.nim @@ -0,0 +1,28 @@ +import json, tables, chronicles +import base + +include app_service/common/json_utils + +type ConnectorSendRequestAccountsSignal* = ref object of Signal + dAppUrl*: string + dAppName*: string + dAppIconUrl*: string + +type ConnectorSendTransactionSignal* = ref object of Signal + dAppUrl*: string + chainID*: int + txArgsJson: string + +proc fromEvent*(T: type ConnectorSendRequestAccountsSignal, event: JsonNode): ConnectorSendRequestAccountsSignal = + result = ConnectorSendRequestAccountsSignal() + result.dAppUrl = event["event"]{"dAppUrl"}.getStr() + result.dAppName = event["event"]{"dAppName"}.getStr() + result.dAppIconUrl = event["event"]{"dAppIconUrl"}.getStr() + echo "--------> ConnectorSendRequestAccountsSignal: ", result.dAppUrl, " ", result.dAppName, " ", result.dAppIconUrl + +proc fromEvent*(T: type ConnectorSendTransactionSignal, event: JsonNode): ConnectorSendTransactionSignal = + result = ConnectorSendTransactionSignal() + result.dAppUrl = event["event"]{"dAppUrl"}.getStr() + result.chainID = event["event"]{"chainID"}.getInt() + result.txArgsJson = event["event"]{"txArgsJson"}.getStr() + echo "--------> ConnectorSendTransactionSignal: ", result.dAppUrl, " ", result.chainID, " ", result.txArgsJson diff --git a/src/app/core/signals/remote_signals/signal_type.nim b/src/app/core/signals/remote_signals/signal_type.nim index da35daad41..97fd3bdbc7 100644 --- a/src/app/core/signals/remote_signals/signal_type.nim +++ b/src/app/core/signals/remote_signals/signal_type.nim @@ -66,6 +66,8 @@ type SignalType* {.pure.} = enum DBReEncryptionFinished = "db.reEncryption.finished" CommunityTokenTransactionStatusChanged = "communityToken.communityTokenTransactionStatusChanged" CommunityTokenAction = "communityToken.communityTokenAction" + ConnectorSendRequestAccounts = "connector.sendRequestAccounts" + ConnectorSendTransaction = "connector.sendTransaction" Unknown proc event*(self:SignalType):string = diff --git a/src/app/core/signals/signals_manager.nim b/src/app/core/signals/signals_manager.nim index ee0577b48c..9f5eff5e7a 100644 --- a/src/app/core/signals/signals_manager.nim +++ b/src/app/core/signals/signals_manager.nim @@ -135,6 +135,8 @@ QtObject: of SignalType.LocalPairing: LocalPairingSignal.fromEvent(jsonSignal) of SignalType.CommunityTokenTransactionStatusChanged: CommunityTokenTransactionStatusChangedSignal.fromEvent(jsonSignal) of SignalType.CommunityTokenAction: CommunityTokenActionSignal.fromEvent(jsonSignal) + of SignalType.ConnectorSendRequestAccounts: ConnectorSendRequestAccountsSignal.fromEvent(jsonSignal) + of SignalType.ConnectorSendTransaction: ConnectorSendTransactionSignal.fromEvent(jsonSignal) else: Signal() result.signalType = signalType diff --git a/src/app/core/signals/types.nim b/src/app/core/signals/types.nim index d481aa7e8a..6c3c6fed2c 100644 --- a/src/app/core/signals/types.nim +++ b/src/app/core/signals/types.nim @@ -1,11 +1,11 @@ {.used.} -import ./remote_signals/[base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages, +import ./remote_signals/[base, chronicles_logs, community, connector, discovery_summary, envelope, expired, mailserver, messages, peerstats, signal_type, stats, wallet, whisper_filter, update_available, status_updates, waku_backed_up_profile, waku_backed_up_settings, waku_backed_up_keypair, waku_backed_up_watch_only_account, waku_fetching_backup_progress, pairing, node] -export base, chronicles_logs, community, discovery_summary, envelope, expired, mailserver, messages, peerstats, +export base, chronicles_logs, community, connector, discovery_summary, envelope, expired, mailserver, messages, peerstats, signal_type, stats, wallet, whisper_filter, update_available, status_updates, waku_backed_up_profile, waku_backed_up_settings, waku_backed_up_keypair, waku_backed_up_watch_only_account, waku_fetching_backup_progress, pairing, node \ No newline at end of file diff --git a/vendor/status-go b/vendor/status-go index 5336c47f1b..9ab1d7f480 160000 --- a/vendor/status-go +++ b/vendor/status-go @@ -1 +1 @@ -Subproject commit 5336c47f1b28b1d1ee8ef5e2b1bbf9bdc479f409 +Subproject commit 9ab1d7f48019ed2241d08806f17efad9a18f3fd8