diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index feef8b3e7a..78c2902a30 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -14,7 +14,10 @@ import ../utils/image_utils import ../../status/tasks/[qt, task_runner_impl] import ../../status/tasks/marathon/mailserver/worker import ../../status/signals/types as signal_types -import ../../status/libstatus/types +import ../../status/types + +# TODO: remove me +import ../../status/libstatus/chat as libstatus_chat logScope: topics = "chats-view" @@ -81,7 +84,7 @@ const asyncActivityNotificationLoadTask: Task = proc(argEncoded: string) {.gcsaf let arg = decode[AsyncActivityNotificationLoadTaskArg](argEncoded) var activityNotifications: JsonNode var activityNotificationsCallSuccess: bool - let activityNotificationsCallResult = rpcActivityCenterNotifications(newJString(""), 20, activityNotificationsCallSuccess) + let activityNotificationsCallResult = libstatus_chat.rpcActivityCenterNotifications(newJString(""), 20, activityNotificationsCallSuccess) if(activityNotificationsCallSuccess): activityNotifications = activityNotificationsCallResult.parseJson()["result"] @@ -687,7 +690,7 @@ QtObject: let messages = rpcResponseObj{"messages"} if(messages != nil and messages.kind != JNull): - let chatMessages = status_chat.parseChatMessagesResponse(chatId, messages) + let chatMessages = libstatus_chat.parseChatMessagesResponse(messages) self.status.chat.chatMessages(chatId, true, chatMessages[0], chatMessages[1]) let rxns = rpcResponseObj{"reactions"} @@ -697,7 +700,7 @@ QtObject: let pinnedMsgs = rpcResponseObj{"pinnedMessages"} if(pinnedMsgs != nil and pinnedMsgs.kind != JNull): - let pinnedMessages = status_chat.parseChatMessagesResponse(chatId, pinnedMsgs, true) + let pinnedMessages = libstatus_chat.parseChatMessagesResponse(pinnedMsgs) self.status.chat.pinnedMessagesByChatID(chatId, pinnedMessages[0], pinnedMessages[1]) proc asyncActivityNotificationLoaded*(self: ChatsView, rpcResponse: string) {.slot.} = diff --git a/src/app/chat/views/chat_item.nim b/src/app/chat/views/chat_item.nim index 59423787e9..69f1419147 100644 --- a/src/app/chat/views/chat_item.nim +++ b/src/app/chat/views/chat_item.nim @@ -2,6 +2,7 @@ import NimQml, Tables, std/wrapnils import ../../../status/[chat/chat, status, ens, accounts, settings] from ../../../status/types import Setting import ../../../status/utils as status_utils +# import ../../../status/settings as status_settings import chat_members @@ -159,7 +160,7 @@ QtObject: proc isMemberButNotJoined*(self: ChatItemView): bool {.slot.} = if self.chatItem.isNil: return false - let pubKey = status_settings.getSetting[string](Setting.PublicKey, "0x0") + let pubKey = self.status.settings.getSetting[:string](Setting.PublicKey, "0x0") return self.chatItem.isMemberButNotJoined(pubKey) QtProperty[bool] isMemberButNotJoined: diff --git a/src/status/chat.nim b/src/status/chat.nim index 3f84f3a3f8..2c0f44a14e 100644 --- a/src/status/chat.nim +++ b/src/status/chat.nim @@ -589,5 +589,5 @@ proc rpcPinnedChatMessages*(chatId: string, cursorVal: JsonNode, limit: int, suc proc parseReactionsResponse*(chatId: string, rpcResult: JsonNode): (string, seq[Reaction]) = result = status_chat.parseReactionsResponse(chatId, rpcResult) -proc parseChatMessagesResponse*(chatId: string, rpcResult: JsonNode, isPin: bool = false): (string, seq[Message]) = - result = status_chat.parseChatMessagesResponse(chatId, rpcResult, isPin) +proc parseChatMessagesResponse*(rpcResult: JsonNode): (string, seq[Message]) = + result = status_chat.parseChatMessagesResponse(rpcResult) diff --git a/src/status/libstatus/wallet.nim b/src/status/libstatus/wallet.nim index 64160c591e..65f0cfbd55 100644 --- a/src/status/libstatus/wallet.nim +++ b/src/status/libstatus/wallet.nim @@ -1,5 +1,5 @@ import json, json, options, json_serialization, stint, chronicles -import core, ../types, ../utils, strutils, strformat +import core, conversions, ../types, ../utils, strutils, strformat from status_go import validateMnemonic#, startWallet import ../wallet/account import web3/ethtypes diff --git a/src/status/types.nim b/src/status/types.nim index 0c325cb1c8..ccf3b402b9 100644 --- a/src/status/types.nim +++ b/src/status/types.nim @@ -1,4 +1,4 @@ -import json, options, typetraits, tables, sequtils +import json, options, typetraits, tables, sequtils, strutils import web3/ethtypes, json_serialization, stint import libstatus/accounts/constants import ../eventemitter diff --git a/src/status/utils.nim b/src/status/utils.nim index 5f4217a7b9..738065e026 100644 --- a/src/status/utils.nim +++ b/src/status/utils.nim @@ -1,4 +1,5 @@ -import json, random, strutils, strformat, tables, chronicles, unicode +import json, random, strutils, strformat, tables, chronicles, unicode, times +from sugar import `=>`, `->` import stint from times import getTime, toUnix, nanosecond import libstatus/accounts/signing_phrases diff --git a/src/status/wallet.nim b/src/status/wallet.nim index 5a51cb6192..4ea74d350f 100644 --- a/src/status/wallet.nim +++ b/src/status/wallet.nim @@ -378,8 +378,11 @@ proc watchTransaction*(self: WalletModel, transactionHash: string): string = proc getPendingTransactions*(self: WalletModel): string = result = status_wallet.getPendingTransactions() -proc getTransfersByAddress*(address: string): seq[types.Transaction] = - result = status_wallet.getTransfersByAddress(address) +# proc getTransfersByAddress*(address: string): seq[types.Transaction] = + # result = status_wallet.getTransfersByAddress(address) + +proc getTransfersByAddress*(address: string, toBlock: Uint256, limit: int, loadMore: bool): seq[Transaction] = + result = status_wallet.getTransfersByAddress(address, toBlock, limit, loadMore) proc watchTransaction*(transactionHash: string): string = result = status_wallet.watchTransaction(transactionHash)