feat: handle connector's asignals in nim
This commit is contained in:
parent
158ad76354
commit
7475e09526
|
@ -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
|
|
@ -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 =
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -1 +1 @@
|
|||
Subproject commit 5336c47f1b28b1d1ee8ef5e2b1bbf9bdc479f409
|
||||
Subproject commit 9ab1d7f48019ed2241d08806f17efad9a18f3fd8
|
Loading…
Reference in New Issue