clean up imports
This commit is contained in:
parent
74cb71295e
commit
8915230cd8
|
@ -1,14 +1,10 @@
|
||||||
import NimQml
|
import NimQml, eventemitter, chronicles
|
||||||
import eventemitter, chronicles
|
|
||||||
import ../../status/chat as chat_model
|
import ../../status/chat as chat_model
|
||||||
import ../../status/mailservers as mailserver_model
|
import ../../status/mailservers as mailserver_model
|
||||||
import ../../signals/types
|
import ../../signals/types
|
||||||
import ../../status/libstatus/types as status_types
|
import ../../status/libstatus/types as status_types
|
||||||
import ../../status/chat
|
import ../../status/[chat, contacts, status]
|
||||||
import ../../status/contacts
|
import view, views/channels_list
|
||||||
import ../../status/status
|
|
||||||
import views/channels_list
|
|
||||||
import view
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "chat-controller"
|
topics = "chat-controller"
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import NimQml
|
import NimQml, Tables, json, sequtils, chronicles
|
||||||
import Tables
|
|
||||||
import json, sequtils
|
|
||||||
import chronicles
|
|
||||||
|
|
||||||
import ../../status/status
|
import ../../status/status
|
||||||
import ../../status/chat as status_chat
|
import ../../status/chat as status_chat
|
||||||
|
@ -9,9 +6,7 @@ import ../../status/contacts as status_contacts
|
||||||
import ../../status/chat/[chat, message]
|
import ../../status/chat/[chat, message]
|
||||||
import ../../status/profile/profile
|
import ../../status/profile/profile
|
||||||
|
|
||||||
import views/channels_list
|
import views/channels_list, views/message_list, views/chat_item
|
||||||
import views/message_list
|
|
||||||
import views/chat_item
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "chats-view"
|
topics = "chats-view"
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import NimQml
|
import NimQml, std/wrapnils
|
||||||
import std/wrapnils
|
import ../../../status/[chat/chat, status]
|
||||||
import ../../../status/chat/chat
|
|
||||||
import ../../../status/status
|
|
||||||
import chat_members
|
import chat_members
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
import NimQml, Tables
|
import NimQml, Tables, json, nimcrypto, strformat, json_serialization
|
||||||
|
|
||||||
import json
|
|
||||||
import nimcrypto
|
|
||||||
import strformat
|
|
||||||
import json_serialization
|
|
||||||
|
|
||||||
import ../../signals/types
|
import ../../signals/types
|
||||||
import ../../status/libstatus/types as status_types
|
import ../../status/libstatus/types as status_types
|
||||||
import ../../status/libstatus/accounts as status_accounts
|
import ../../status/libstatus/accounts as status_accounts
|
||||||
|
@ -106,4 +100,4 @@ QtObject:
|
||||||
proc setLastLoginResponse*(self: LoginView, loginResponse: StatusGoError) =
|
proc setLastLoginResponse*(self: LoginView, loginResponse: StatusGoError) =
|
||||||
self.loginResponseChanged(loginResponse.error)
|
self.loginResponseChanged(loginResponse.error)
|
||||||
|
|
||||||
proc onLoggedOut*(self: LoginView) {.signal.}
|
proc onLoggedOut*(self: LoginView) {.signal.}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import NimQml
|
import NimQml, chronicles
|
||||||
import chronicles
|
|
||||||
import ../../signals/types
|
import ../../signals/types
|
||||||
import ../../status/node
|
import ../../status/[status, node]
|
||||||
import ../../status/status
|
|
||||||
import view
|
import view
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import NimQml
|
import NimQml
|
||||||
import ../../status/node
|
import ../../status/[status, node]
|
||||||
import ../../status/status
|
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type NodeView* = ref object of QObject
|
type NodeView* = ref object of QObject
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
import NimQml
|
import NimQml, eventemitter, chronicles, std/wrapnils
|
||||||
import ../../status/libstatus/types as status_types
|
import ../../status/libstatus/types as status_types
|
||||||
import ../../status/libstatus/accounts as status_accounts
|
import ../../status/libstatus/accounts as status_accounts
|
||||||
import ../../status/accounts as AccountModel
|
import ../../status/accounts as AccountModel
|
||||||
import eventemitter
|
|
||||||
import view
|
|
||||||
import chronicles
|
|
||||||
import ../../signals/types
|
|
||||||
import std/wrapnils
|
|
||||||
import ../../status/status
|
import ../../status/status
|
||||||
|
import ../../signals/types
|
||||||
|
import view
|
||||||
|
|
||||||
type OnboardingController* = ref object of SignalSubscriber
|
type OnboardingController* = ref object of SignalSubscriber
|
||||||
view*: OnboardingView
|
view*: OnboardingView
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
import NimQml, Tables
|
import NimQml, Tables, json, nimcrypto, strformat, json_serialization, strutils
|
||||||
import json
|
|
||||||
import nimcrypto
|
|
||||||
import ../../status/libstatus/types as status_types
|
import ../../status/libstatus/types as status_types
|
||||||
import ../../signals/types
|
import ../../signals/types
|
||||||
import strformat
|
|
||||||
import json_serialization
|
|
||||||
import ../../status/accounts as AccountModel
|
import ../../status/accounts as AccountModel
|
||||||
import views/account_info
|
|
||||||
import strutils
|
|
||||||
import ../../status/status
|
import ../../status/status
|
||||||
|
import views/account_info
|
||||||
|
|
||||||
type
|
type
|
||||||
AccountRoles {.pure.} = enum
|
AccountRoles {.pure.} = enum
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
import NimQml
|
import NimQml, json, eventemitter, strutils
|
||||||
import json, eventemitter
|
|
||||||
import strutils
|
|
||||||
import ../../status/libstatus/mailservers as status_mailservers
|
import ../../status/libstatus/mailservers as status_mailservers
|
||||||
import ../../signals/types
|
import ../../signals/types
|
||||||
import "../../status/libstatus/types" as status_types
|
import ../../status/libstatus/types as status_types
|
||||||
import ../../status/libstatus/settings as status_settings
|
import ../../status/libstatus/settings as status_settings
|
||||||
import ../../status/profile/[profile, mailserver]
|
import ../../status/profile/[profile, mailserver]
|
||||||
import ../../status/contacts
|
import ../../status/[status, contacts]
|
||||||
import ../../status/status
|
|
||||||
import ../../status/chat as status_chat
|
import ../../status/chat as status_chat
|
||||||
import ../../status/chat/chat
|
import ../../status/chat/chat
|
||||||
import view
|
import view
|
||||||
|
|
|
@ -1,58 +1,58 @@
|
||||||
import NimQml
|
# import NimQml
|
||||||
import mailserversList
|
# import mailserversList
|
||||||
|
|
||||||
QtObject:
|
# QtObject:
|
||||||
type ProfileView* = ref object of QObject
|
# type ProfileView* = ref object of QObject
|
||||||
username*, identicon*, id*: string
|
# username*, identicon*, id*: string
|
||||||
mailserversList*: MailServersList
|
# mailserversList*: MailServersList
|
||||||
|
|
||||||
proc setup(self: ProfileView) =
|
# proc setup(self: ProfileView) =
|
||||||
self.QObject.setup
|
# self.QObject.setup
|
||||||
|
|
||||||
proc delete*(self: ProfileView) =
|
# proc delete*(self: ProfileView) =
|
||||||
self.mailserversList.delete
|
# self.mailserversList.delete
|
||||||
self.QObject.delete
|
# self.QObject.delete
|
||||||
|
|
||||||
proc newProfileView*(): ProfileView =
|
# proc newProfileView*(): ProfileView =
|
||||||
new(result, delete)
|
# new(result, delete)
|
||||||
result.username = ""
|
# result.username = ""
|
||||||
result.identicon = ""
|
# result.identicon = ""
|
||||||
result.mailserversList = newMailServersList()
|
# result.mailserversList = newMailServersList()
|
||||||
result.setup
|
# result.setup
|
||||||
|
|
||||||
proc username*(self: ProfileView): string {.slot.} =
|
# proc username*(self: ProfileView): string {.slot.} =
|
||||||
result = self.username
|
# result = self.username
|
||||||
|
|
||||||
proc receivedUsername*(self: ProfileView, username: string) {.signal.}
|
# proc receivedUsername*(self: ProfileView, username: string) {.signal.}
|
||||||
|
|
||||||
proc addMailserverToList*(self: ProfileView, name: string, endpoint: string) {.slot.} =
|
# proc addMailserverToList*(self: ProfileView, name: string, endpoint: string) {.slot.} =
|
||||||
self.mailserversList.add(name, endpoint)
|
# self.mailserversList.add(name, endpoint)
|
||||||
|
|
||||||
proc setUsername*(self: ProfileView, username: string) {.slot.} =
|
# proc setUsername*(self: ProfileView, username: string) {.slot.} =
|
||||||
self.username = username
|
# self.username = username
|
||||||
self.receivedUsername(username)
|
# self.receivedUsername(username)
|
||||||
|
|
||||||
QtProperty[string] username:
|
# QtProperty[string] username:
|
||||||
read = username
|
# read = username
|
||||||
write = setUsername
|
# write = setUsername
|
||||||
notify = receivedUsername
|
# notify = receivedUsername
|
||||||
|
|
||||||
proc identicon*(self: ProfileView): string {.slot.} =
|
# proc identicon*(self: ProfileView): string {.slot.} =
|
||||||
result = self.identicon
|
# result = self.identicon
|
||||||
|
|
||||||
proc getMailserversList(self: ProfileView): QVariant {.slot.} =
|
# proc getMailserversList(self: ProfileView): QVariant {.slot.} =
|
||||||
return newQVariant(self.mailserversList)
|
# return newQVariant(self.mailserversList)
|
||||||
|
|
||||||
QtProperty[QVariant] mailserversList:
|
# QtProperty[QVariant] mailserversList:
|
||||||
read = getMailserversList
|
# read = getMailserversList
|
||||||
|
|
||||||
proc receivedIdenticon*(self: ProfileView, identicon: string) {.signal.}
|
# proc receivedIdenticon*(self: ProfileView, identicon: string) {.signal.}
|
||||||
|
|
||||||
proc setIdenticon*(self: ProfileView, identicon: string) {.slot.} =
|
# proc setIdenticon*(self: ProfileView, identicon: string) {.slot.} =
|
||||||
self.identicon = identicon
|
# self.identicon = identicon
|
||||||
self.receivedIdenticon(identicon)
|
# self.receivedIdenticon(identicon)
|
||||||
|
|
||||||
QtProperty[string] identicon:
|
# QtProperty[string] identicon:
|
||||||
read = identicon
|
# read = identicon
|
||||||
write = setIdenticon
|
# write = setIdenticon
|
||||||
notify = receivedIdenticon
|
# notify = receivedIdenticon
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import NimQml
|
import NimQml, sequtils
|
||||||
import sequtils
|
import views/[mailservers_list, contact_list, profile_info]
|
||||||
import views/mailservers_list
|
|
||||||
import views/contact_list
|
|
||||||
import views/profile_info
|
|
||||||
import ../../status/profile/[mailserver, profile]
|
import ../../status/profile/[mailserver, profile]
|
||||||
import ../../status/profile as status_profile
|
import ../../status/profile as status_profile
|
||||||
import ../../status/contacts as status_contacts
|
import ../../status/contacts as status_contacts
|
||||||
|
|
|
@ -1,19 +1,12 @@
|
||||||
import NimQml
|
import NimQml, eventemitter, strformat, strutils, chronicles
|
||||||
import eventemitter
|
|
||||||
import strformat
|
|
||||||
import strutils
|
|
||||||
import chronicles
|
|
||||||
|
|
||||||
import view
|
import view
|
||||||
import views/asset_list
|
import views/[asset_list, account_list, account_item]
|
||||||
import views/account_list
|
|
||||||
import views/account_item
|
|
||||||
import ../../status/libstatus/wallet as status_wallet
|
import ../../status/libstatus/wallet as status_wallet
|
||||||
import ../../signals/types
|
import ../../signals/types
|
||||||
|
|
||||||
import ../../status/wallet
|
import ../../status/[status, wallet]
|
||||||
import ../../status/wallet/account as WalletTypes
|
import ../../status/wallet/account as WalletTypes
|
||||||
import ../../status/status
|
|
||||||
|
|
||||||
type WalletController* = ref object of SignalSubscriber
|
type WalletController* = ref object of SignalSubscriber
|
||||||
status: Status
|
status: Status
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
import NimQml
|
import NimQml, Tables, strformat, strutils, chronicles
|
||||||
import Tables
|
import ../../status/[status, wallet]
|
||||||
import strformat
|
import views/[asset_list, account_list, account_item, transaction_list, collectibles_list]
|
||||||
import strutils
|
|
||||||
import views/asset_list
|
|
||||||
import views/account_list
|
|
||||||
import views/account_item
|
|
||||||
import views/transaction_list
|
|
||||||
import views/collectibles_list
|
|
||||||
import ../../status/wallet
|
|
||||||
import ../../status/status
|
|
||||||
import chronicles
|
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import NimQml
|
import NimQml, std/wrapnils
|
||||||
import std/wrapnils
|
from ../../../status/wallet import WalletAccount
|
||||||
import ../../../status/wallet
|
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type AccountItemView* = ref object of QObject
|
type AccountItemView* = ref object of QObject
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
import NimQml
|
import NimQml, Tables, random
|
||||||
import Tables
|
|
||||||
import sequtils as sequtils
|
import sequtils as sequtils
|
||||||
import random
|
import account_item
|
||||||
import ./account_item
|
from ../../../status/wallet import WalletAccount
|
||||||
import ../../../status/wallet
|
|
||||||
|
|
||||||
const accountColors* = ["#9B832F", "#D37EF4", "#1D806F", "#FA6565", "#7CDA00", "#887af9", "#8B3131"]
|
const accountColors* = ["#9B832F", "#D37EF4", "#1D806F", "#FA6565", "#7CDA00", "#887af9", "#8B3131"]
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import NimQml
|
import NimQml, tables
|
||||||
import tables
|
from ../../../status/wallet import Asset
|
||||||
import ../../../status/wallet
|
|
||||||
|
|
||||||
type
|
type
|
||||||
AssetRoles {.pure.} = enum
|
AssetRoles {.pure.} = enum
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import NimQml
|
import NimQml, tables
|
||||||
import tables
|
from ../../../status/wallet import Collectible
|
||||||
import ../../../status/wallet
|
|
||||||
|
|
||||||
type
|
type
|
||||||
CollectiblesRoles {.pure.} = enum
|
CollectiblesRoles {.pure.} = enum
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import NimQml
|
import NimQml, tables
|
||||||
import tables
|
from ../../../status/wallet import Transaction
|
||||||
import ../../../status/wallet
|
|
||||||
|
|
||||||
type
|
type
|
||||||
TransactionRoles {.pure.} = enum
|
TransactionRoles {.pure.} = enum
|
||||||
|
@ -86,4 +85,3 @@ QtObject:
|
||||||
proc forceUpdate*(self: TransactionList) =
|
proc forceUpdate*(self: TransactionList) =
|
||||||
self.beginResetModel()
|
self.beginResetModel()
|
||||||
self.endResetModel()
|
self.endResetModel()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import NimQml
|
import NimQml, eventemitter, chronicles
|
||||||
import eventemitter
|
|
||||||
import chronicles
|
|
||||||
|
|
||||||
import app/chat/core as chat
|
import app/chat/core as chat
|
||||||
import app/wallet/core as wallet
|
import app/wallet/core as wallet
|
||||||
|
@ -10,8 +8,7 @@ import app/onboarding/core as onboarding
|
||||||
import app/login/core as login
|
import app/login/core as login
|
||||||
import signals/core as signals
|
import signals/core as signals
|
||||||
|
|
||||||
import status/libstatus/types
|
import status/libstatus/[types, libstatus]
|
||||||
import status/libstatus/libstatus
|
|
||||||
import status/status as statuslib
|
import status/status as statuslib
|
||||||
|
|
||||||
var signalsQObjPointer: pointer
|
var signalsQObjPointer: pointer
|
||||||
|
@ -27,8 +24,6 @@ proc mainProc() =
|
||||||
let engine = newQQmlApplicationEngine()
|
let engine = newQQmlApplicationEngine()
|
||||||
let signalController = signals.newController(app)
|
let signalController = signals.newController(app)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# We need this global variable in order to be able to access the application
|
# We need this global variable in order to be able to access the application
|
||||||
# from the non-closure callback passed to `libstatus.setSignalEventCallback`
|
# from the non-closure callback passed to `libstatus.setSignalEventCallback`
|
||||||
signalsQObjPointer = cast[pointer](signalController.vptr)
|
signalsQObjPointer = cast[pointer](signalController.vptr)
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
import NimQml
|
import NimQml, tables, json, chronicles, strutils, json_serialization
|
||||||
import ../status/libstatus/types as status_types
|
import ../status/libstatus/types as status_types
|
||||||
import tables
|
import types, messages, discovery, whisperFilter
|
||||||
import json
|
|
||||||
import types
|
|
||||||
import messages
|
|
||||||
import discovery
|
|
||||||
import chronicles
|
|
||||||
import whisperFilter
|
|
||||||
import strutils
|
|
||||||
import json_serialization
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "signals"
|
topics = "signals"
|
||||||
|
@ -20,7 +12,6 @@ QtObject:
|
||||||
signalSubscribers*: Table[SignalType, seq[SignalSubscriber]]
|
signalSubscribers*: Table[SignalType, seq[SignalSubscriber]]
|
||||||
variant*: QVariant
|
variant*: QVariant
|
||||||
|
|
||||||
# Constructor
|
|
||||||
proc newController*(app: QApplication): SignalsController =
|
proc newController*(app: QApplication): SignalsController =
|
||||||
new(result)
|
new(result)
|
||||||
result.app = app
|
result.app = app
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import json
|
import json, random
|
||||||
import types
|
|
||||||
import ../status/libstatus/accounts as status_accounts
|
import ../status/libstatus/accounts as status_accounts
|
||||||
import ../status/chat/[chat, message]
|
import ../status/chat/[chat, message]
|
||||||
import ../status/profile/profile
|
import ../status/profile/profile
|
||||||
import random
|
import types
|
||||||
|
|
||||||
proc toMessage*(jsonMsg: JsonNode): Message
|
proc toMessage*(jsonMsg: JsonNode): Message
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
import json
|
import json, chronicles, json_serialization, tables
|
||||||
import chronicles
|
|
||||||
import ../status/libstatus/types
|
import ../status/libstatus/types
|
||||||
import ../status/chat/[chat, message]
|
import ../status/chat/[chat, message]
|
||||||
import ../status/profile/profile
|
import ../status/profile/profile
|
||||||
import json_serialization
|
|
||||||
import tables
|
|
||||||
|
|
||||||
type SignalSubscriber* = ref object of RootObj
|
type SignalSubscriber* = ref object of RootObj
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
import eventemitter, options
|
||||||
import libstatus/accounts as status_accounts
|
import libstatus/accounts as status_accounts
|
||||||
import libstatus/types
|
import libstatus/types
|
||||||
import options
|
|
||||||
import eventemitter
|
|
||||||
|
|
||||||
type
|
type
|
||||||
AccountModel* = ref object
|
AccountModel* = ref object
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import eventemitter, json, strutils, sequtils, tables
|
import eventemitter, json, strutils, sequtils, tables, chronicles
|
||||||
import libstatus/chat as status_chat
|
import libstatus/chat as status_chat
|
||||||
import chronicles
|
|
||||||
import profile/profile
|
import profile/profile
|
||||||
import chat/[chat, message]
|
import chat/[chat, message]
|
||||||
import ../signals/messages
|
import ../signals/messages
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import message
|
import strformat, json, sequtils
|
||||||
import strformat
|
from message import Message
|
||||||
import json
|
|
||||||
import sequtils
|
|
||||||
|
|
||||||
type ChatType* {.pure.}= enum
|
type ChatType* {.pure.}= enum
|
||||||
Unknown = 0,
|
Unknown = 0,
|
||||||
|
@ -110,4 +108,3 @@ proc isAdmin*(self: Chat, pubKey: string): bool =
|
||||||
for member in self.members:
|
for member in self.members:
|
||||||
if member.id == pubKey and member.joined and member.admin: return true
|
if member.id == pubKey and member.joined and member.admin: return true
|
||||||
return false
|
return false
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import chronicles
|
import chronicles
|
||||||
import libp2p/[multihash, multicodec, cid]
|
import libp2p/[multihash, multicodec, cid]
|
||||||
from strutils import parseHexInt, removePrefix
|
from strutils import parseHexInt
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "sticker-decoding"
|
topics = "sticker-decoding"
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import eventemitter
|
import eventemitter, json, sequtils
|
||||||
import json
|
|
||||||
import libstatus/contacts as status_contacts
|
import libstatus/contacts as status_contacts
|
||||||
import profile/profile
|
import profile/profile
|
||||||
import sequtils
|
|
||||||
|
|
||||||
type
|
type
|
||||||
ContactModel* = ref object
|
ContactModel* = ref object
|
||||||
|
|
|
@ -16,4 +16,4 @@ proc userNameOrAlias*(contact: Profile): string =
|
||||||
if(contact.ensName != "" and contact.ensVerified):
|
if(contact.ensName != "" and contact.ensVerified):
|
||||||
result = "@" & userName(contact.ensName, true)
|
result = "@" & userName(contact.ensName, true)
|
||||||
else:
|
else:
|
||||||
result = contact.alias
|
result = contact.alias
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
import libstatus
|
import json, os, nimcrypto, uuids, json_serialization, chronicles
|
||||||
import core
|
|
||||||
import json
|
import libstatus, core
|
||||||
import utils as utils
|
import utils as utils
|
||||||
import accounts/constants
|
|
||||||
import nimcrypto
|
|
||||||
import os
|
|
||||||
import uuids
|
|
||||||
import types as types
|
import types as types
|
||||||
import json_serialization
|
import accounts/constants
|
||||||
import chronicles
|
|
||||||
import ../../signals/types as signal_types
|
import ../../signals/types as signal_types
|
||||||
import ../wallet/account
|
import ../wallet/account
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,19 @@
|
||||||
import core
|
import json, times, strutils, sequtils, chronicles
|
||||||
import json
|
import core, utils
|
||||||
import utils
|
|
||||||
import times
|
|
||||||
import strutils
|
|
||||||
import sequtils
|
|
||||||
import chronicles
|
|
||||||
import ../chat/[chat, message]
|
import ../chat/[chat, message]
|
||||||
import ../../signals/messages
|
import ../../signals/messages
|
||||||
|
|
||||||
proc buildFilter*(chat: Chat):JsonNode =
|
proc buildFilter*(chat: Chat):JsonNode =
|
||||||
if chat.chatType == ChatType.PrivateGroupChat:
|
if chat.chatType == ChatType.PrivateGroupChat:
|
||||||
return newJNull()
|
return newJNull()
|
||||||
result = %* {
|
result = %* { "ChatID": chat.id, "OneToOne": chat.chatType == ChatType.OneToOne }
|
||||||
"ChatID": chat.id,
|
|
||||||
"OneToOne": chat.chatType == ChatType.OneToOne
|
|
||||||
}
|
|
||||||
|
|
||||||
proc loadFilters*(filters: seq[JsonNode]): string =
|
proc loadFilters*(filters: seq[JsonNode]): string =
|
||||||
result = callPrivateRPC("loadFilters".prefix, %* [filter(filters, proc(x:JsonNode):bool = x.kind != JNull)])
|
result = callPrivateRPC("loadFilters".prefix, %* [filter(filters, proc(x:JsonNode):bool = x.kind != JNull)])
|
||||||
|
|
||||||
proc removeFilters*(chatId: string, filterId: string) =
|
proc removeFilters*(chatId: string, filterId: string) =
|
||||||
discard callPrivateRPC("removeFilters".prefix, %* [
|
discard callPrivateRPC("removeFilters".prefix, %* [
|
||||||
[{
|
[{ "ChatID": chatId, "FilterID": filterId }]
|
||||||
"ChatID": chatId,
|
|
||||||
"FilterID": filterId
|
|
||||||
}]
|
|
||||||
])
|
])
|
||||||
|
|
||||||
proc saveChat*(chatId: string, oneToOne: bool = false, active: bool = true, color: string) =
|
proc saveChat*(chatId: string, oneToOne: bool = false, active: bool = true, color: string) =
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import core
|
|
||||||
import json
|
import json
|
||||||
import utils
|
import core, utils
|
||||||
import ../profile/profile
|
from ../profile/profile import Profile
|
||||||
|
|
||||||
# TODO: remove Profile from here
|
# TODO: remove Profile from here
|
||||||
proc blockContact*(contact: Profile): string =
|
proc blockContact*(contact: Profile): string =
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import sequtils, strformat, sugar, macros, tables
|
import sequtils, strformat, sugar, macros, tables, eth/common/eth_types, stew/byteutils, nimcrypto
|
||||||
import eth/common/eth_types, stew/byteutils, nimcrypto
|
|
||||||
from eth/common/utils import parseAddress
|
from eth/common/utils import parseAddress
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import json
|
import json, nimcrypto, chronicles
|
||||||
import libstatus
|
import libstatus, utils
|
||||||
import nimcrypto
|
|
||||||
import utils
|
|
||||||
import chronicles
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "rpc"
|
topics = "rpc"
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
import core
|
import json, times
|
||||||
import json
|
import core, utils
|
||||||
import utils
|
|
||||||
import times
|
|
||||||
|
|
||||||
proc getMailservers*(): array[0..8, (string, string)] =
|
proc getMailservers*(): array[0..8, (string, string)] =
|
||||||
result = [
|
result = [
|
||||||
|
@ -48,10 +46,7 @@ proc ping*(timeoutMs: int): string =
|
||||||
for mailserver in getMailservers():
|
for mailserver in getMailservers():
|
||||||
addresses.add(mailserver[1])
|
addresses.add(mailserver[1])
|
||||||
result = callPrivateRPC("mailservers_ping", %* [
|
result = callPrivateRPC("mailservers_ping", %* [
|
||||||
{
|
{ "addresses": addresses, "timeoutMs": timeoutMs }
|
||||||
"addresses": addresses,
|
|
||||||
"timeoutMs": timeoutMs
|
|
||||||
}
|
|
||||||
])
|
])
|
||||||
|
|
||||||
proc update*(peer: string) =
|
proc update*(peer: string) =
|
||||||
|
@ -60,7 +55,6 @@ proc update*(peer: string) =
|
||||||
proc delete*(peer: string) =
|
proc delete*(peer: string) =
|
||||||
discard callPrivateRPC("mailservers_deleteMailserver".prefix, %* [[peer]])
|
discard callPrivateRPC("mailservers_deleteMailserver".prefix, %* [[peer]])
|
||||||
|
|
||||||
|
|
||||||
proc requestMessages*(topics: seq[string], symKeyID: string, peer: string, numberOfMessages: int) =
|
proc requestMessages*(topics: seq[string], symKeyID: string, peer: string, numberOfMessages: int) =
|
||||||
echo callPrivateRPC("requestMessages".prefix, %* [
|
echo callPrivateRPC("requestMessages".prefix, %* [
|
||||||
{
|
{
|
||||||
|
@ -72,4 +66,4 @@ proc requestMessages*(topics: seq[string], symKeyID: string, peer: string, numbe
|
||||||
"cursor": nil,
|
"cursor": nil,
|
||||||
"from": (times.toUnix(times.getTime()) - 86400) # Unhardcode this. Need to keep the last fetch in a DB
|
"from": (times.toUnix(times.getTime()) - 86400) # Unhardcode this. Need to keep the last fetch in a DB
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import core
|
|
||||||
import json
|
import json
|
||||||
|
import core
|
||||||
|
|
||||||
proc saveSettings*(key: string, value: string): string =
|
proc saveSettings*(key: string, value: string): string =
|
||||||
callPrivateRPC("settings_saveSetting", %* [
|
callPrivateRPC("settings_saveSetting", %* [
|
||||||
|
|
|
@ -1,32 +1,27 @@
|
||||||
import core as status
|
import json, chronicles, strformat, stint, strutils
|
||||||
import json
|
import core, wallet
|
||||||
import chronicles
|
|
||||||
import strformat
|
|
||||||
import stint
|
|
||||||
import strutils
|
|
||||||
import wallet
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "wallet"
|
topics = "wallet"
|
||||||
|
|
||||||
proc getCustomTokens*(): JsonNode =
|
proc getCustomTokens*(): JsonNode =
|
||||||
let payload = %* []
|
let payload = %* []
|
||||||
let response = status.callPrivateRPC("wallet_getCustomTokens", payload).parseJson
|
let response = callPrivateRPC("wallet_getCustomTokens", payload).parseJson
|
||||||
if response["result"].kind == JNull:
|
if response["result"].kind == JNull:
|
||||||
return %* []
|
return %* []
|
||||||
return response["result"]
|
return response["result"]
|
||||||
|
|
||||||
proc addCustomToken*(address: string, name: string, symbol: string, decimals: int, color: string) =
|
proc addCustomToken*(address: string, name: string, symbol: string, decimals: int, color: string) =
|
||||||
let payload = %* [{"address": address, "name": name, "symbol": symbol, "decimals": decimals, "color": color}]
|
let payload = %* [{"address": address, "name": name, "symbol": symbol, "decimals": decimals, "color": color}]
|
||||||
discard status.callPrivateRPC("wallet_addCustomToken", payload)
|
discard callPrivateRPC("wallet_addCustomToken", payload)
|
||||||
|
|
||||||
proc removeCustomToken*(address: string) =
|
proc removeCustomToken*(address: string) =
|
||||||
let payload = %* [address]
|
let payload = %* [address]
|
||||||
discard status.callPrivateRPC("wallet_deleteCustomToken", payload)
|
discard callPrivateRPC("wallet_deleteCustomToken", payload)
|
||||||
|
|
||||||
proc getTokensBalances*(accounts: openArray[string], tokens: openArray[string]): JsonNode =
|
proc getTokensBalances*(accounts: openArray[string], tokens: openArray[string]): JsonNode =
|
||||||
let payload = %* [accounts, tokens]
|
let payload = %* [accounts, tokens]
|
||||||
let response = status.callPrivateRPC("wallet_getTokensBalances", payload).parseJson
|
let response = callPrivateRPC("wallet_getTokensBalances", payload).parseJson
|
||||||
if response["result"].kind == JNull:
|
if response["result"].kind == JNull:
|
||||||
return %* {}
|
return %* {}
|
||||||
response["result"]
|
response["result"]
|
||||||
|
@ -37,7 +32,7 @@ proc getTokenBalance*(tokenAddress: string, account: string): string =
|
||||||
let payload = %* [{
|
let payload = %* [{
|
||||||
"to": tokenAddress, "from": account, "data": fmt"0x70a08231000000000000000000000000{postfixedAccount}"
|
"to": tokenAddress, "from": account, "data": fmt"0x70a08231000000000000000000000000{postfixedAccount}"
|
||||||
}, "latest"]
|
}, "latest"]
|
||||||
let response = status.callPrivateRPC("eth_call", payload)
|
let response = callPrivateRPC("eth_call", payload)
|
||||||
let balance = response.parseJson["result"].getStr
|
let balance = response.parseJson["result"].getStr
|
||||||
result = $hex2Eth(balance)
|
result = $hex2Eth(balance)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import eventemitter
|
import eventemitter, json_serialization
|
||||||
import json_serialization
|
|
||||||
import accounts/constants
|
import accounts/constants
|
||||||
|
|
||||||
type SignalCallback* = proc(eventMessage: cstring): void {.cdecl.}
|
type SignalCallback* = proc(eventMessage: cstring): void {.cdecl.}
|
||||||
|
@ -91,4 +90,3 @@ type
|
||||||
value*: string
|
value*: string
|
||||||
fromAddress*: string
|
fromAddress*: string
|
||||||
to*: string
|
to*: string
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import json
|
import json, types, random, strutils
|
||||||
import types
|
|
||||||
import random
|
|
||||||
from times import getTime, toUnix, nanosecond
|
from times import getTime, toUnix, nanosecond
|
||||||
import strutils
|
|
||||||
import accounts/signing_phrases
|
import accounts/signing_phrases
|
||||||
|
|
||||||
proc isWakuEnabled(): bool =
|
proc isWakuEnabled(): bool =
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
import core as status
|
import json, httpclient, json, strformat, stint, strutils, sequtils, chronicles
|
||||||
import json
|
import core, types
|
||||||
# import utils
|
|
||||||
import httpclient, json
|
|
||||||
import strformat
|
|
||||||
import stint
|
|
||||||
import strutils, sequtils
|
|
||||||
import chronicles
|
|
||||||
import types
|
|
||||||
import ../wallet/account
|
import ../wallet/account
|
||||||
|
|
||||||
proc getWalletAccounts*(): seq[WalletAccount] =
|
proc getWalletAccounts*(): seq[WalletAccount] =
|
||||||
|
@ -35,10 +28,10 @@ proc getWalletAccounts*(): seq[WalletAccount] =
|
||||||
|
|
||||||
proc getTransfersByAddress*(address: string): seq[Transaction] =
|
proc getTransfersByAddress*(address: string): seq[Transaction] =
|
||||||
try:
|
try:
|
||||||
let response = status.getBlockByNumber("latest")
|
let response = getBlockByNumber("latest")
|
||||||
let latestBlock = parseJson(response)["result"]
|
let latestBlock = parseJson(response)["result"]
|
||||||
|
|
||||||
let transactionsResponse = status.getTransfersByAddress(address, latestBlock["number"].getStr, "0x14")
|
let transactionsResponse = getTransfersByAddress(address, latestBlock["number"].getStr, "0x14")
|
||||||
let transactions = parseJson(transactionsResponse)["result"]
|
let transactions = parseJson(transactionsResponse)["result"]
|
||||||
var accountTransactions: seq[Transaction] = @[]
|
var accountTransactions: seq[Transaction] = @[]
|
||||||
|
|
||||||
|
@ -70,12 +63,12 @@ proc sendTransaction*(from_address: string, to: string, value: string, password:
|
||||||
"from": from_address,
|
"from": from_address,
|
||||||
"to": to
|
"to": to
|
||||||
}
|
}
|
||||||
var response = status.sendTransaction($args, password)
|
var response = sendTransaction($args, password)
|
||||||
result = response
|
result = response
|
||||||
|
|
||||||
proc getBalance*(address: string): string =
|
proc getBalance*(address: string): string =
|
||||||
let payload = %* [address, "latest"]
|
let payload = %* [address, "latest"]
|
||||||
parseJson(status.callPrivateRPC("eth_getBalance", payload))["result"].str
|
parseJson(callPrivateRPC("eth_getBalance", payload))["result"].str
|
||||||
|
|
||||||
proc hex2Eth*(input: string): string =
|
proc hex2Eth*(input: string): string =
|
||||||
var value = fromHex(Stuint[256], input)
|
var value = fromHex(Stuint[256], input)
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
import algorithm, json, random, math, os
|
import algorithm, json, random, math, os, tables, sets, chronicles, eventemitter, sequtils, locks
|
||||||
|
|
||||||
import libstatus/core as status_core
|
import libstatus/core as status_core
|
||||||
import libstatus/chat as status_chat
|
import libstatus/chat as status_chat
|
||||||
import libstatus/mailservers as status_mailservers
|
import libstatus/mailservers as status_mailservers
|
||||||
import tables
|
|
||||||
import sets
|
|
||||||
import chronicles
|
|
||||||
import eventemitter
|
|
||||||
import sequtils
|
|
||||||
import locks
|
|
||||||
|
|
||||||
logScope:
|
logScope:
|
||||||
topics = "mailserver-model"
|
topics = "mailserver-model"
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
import eventemitter
|
import eventemitter
|
||||||
# import json
|
|
||||||
# import strformat
|
|
||||||
# import strutils
|
|
||||||
import libstatus/core as status
|
import libstatus/core as status
|
||||||
|
|
||||||
type NodeModel* = ref object
|
type NodeModel* = ref object
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import json
|
import json, eventemitter
|
||||||
import eventemitter
|
|
||||||
import libstatus/types
|
import libstatus/types
|
||||||
import profile/profile
|
import profile/profile
|
||||||
import libstatus/core as libstatus_core
|
import libstatus/core as libstatus_core
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
type
|
type
|
||||||
MailServer* = ref object
|
MailServer* = ref object
|
||||||
name*, endpoint*: string
|
name*, endpoint*: string
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ import ../libstatus/types
|
||||||
type Profile* = ref object
|
type Profile* = ref object
|
||||||
id*, alias*, username*, identicon*, address*, ensName*: string
|
id*, alias*, username*, identicon*, address*, ensName*: string
|
||||||
ensVerified*: bool
|
ensVerified*: bool
|
||||||
ensVerifiedAt*: int
|
ensVerifiedAt*, ensVerificationRetries*: int
|
||||||
ensVerificationRetries*: int
|
|
||||||
systemTags*: seq[string]
|
systemTags*: seq[string]
|
||||||
|
|
||||||
proc isContact*(self: Profile): bool =
|
proc isContact*(self: Profile): bool =
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import eventemitter, json, strformat, strutils, chronicles, sequtils
|
import eventemitter, json, strformat, strutils, chronicles, sequtils
|
||||||
|
from eth/common/utils import parseAddress
|
||||||
import libstatus/accounts as status_accounts
|
import libstatus/accounts as status_accounts
|
||||||
import libstatus/tokens as status_tokens
|
import libstatus/tokens as status_tokens
|
||||||
import libstatus/settings as status_settings
|
import libstatus/settings as status_settings
|
||||||
|
@ -8,7 +9,6 @@ from libstatus/types import GeneratedAccount, DerivedAccount, Transaction
|
||||||
import wallet/balance_manager
|
import wallet/balance_manager
|
||||||
import wallet/account
|
import wallet/account
|
||||||
import wallet/collectibles
|
import wallet/collectibles
|
||||||
from eth/common/utils import parseAddress
|
|
||||||
export account, collectibles
|
export account, collectibles
|
||||||
export Transaction
|
export Transaction
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import eventemitter
|
from eventemitter import Args
|
||||||
|
|
||||||
type Collectible* = ref object
|
type Collectible* = ref object
|
||||||
name*, image*, id*: string
|
name*, image*, id*: string
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import strformat, httpclient, json, chronicles, sequtils, strutils, tables
|
import strformat, httpclient, json, chronicles, sequtils, strutils, tables
|
||||||
import ../libstatus/core as status
|
import ../libstatus/[core, contracts]
|
||||||
import ../libstatus/contracts as contracts
|
|
||||||
import eth/common/eth_types
|
import eth/common/eth_types
|
||||||
import account
|
import account
|
||||||
|
|
||||||
|
@ -10,7 +9,7 @@ proc getTokenUri(contract: Contract, tokenId: int): string =
|
||||||
"to": $contract.address,
|
"to": $contract.address,
|
||||||
"data": contract.methods["tokenURI"].encodeAbi(tokenId)
|
"data": contract.methods["tokenURI"].encodeAbi(tokenId)
|
||||||
}, "latest"]
|
}, "latest"]
|
||||||
let response = status.callPrivateRPC("eth_call", payload)
|
let response = callPrivateRPC("eth_call", payload)
|
||||||
var postfixedResult: string = parseJson($response)["result"].str
|
var postfixedResult: string = parseJson($response)["result"].str
|
||||||
postfixedResult.removeSuffix('0')
|
postfixedResult.removeSuffix('0')
|
||||||
postfixedResult.removePrefix("0x")
|
postfixedResult.removePrefix("0x")
|
||||||
|
@ -28,7 +27,7 @@ proc tokenOfOwnerByIndex(contract: Contract, address: EthAddress, index: int): i
|
||||||
"to": $contract.address,
|
"to": $contract.address,
|
||||||
"data": contract.methods["tokenOfOwnerByIndex"].encodeAbi(address, index)
|
"data": contract.methods["tokenOfOwnerByIndex"].encodeAbi(address, index)
|
||||||
}, "latest"]
|
}, "latest"]
|
||||||
let response = status.callPrivateRPC("eth_call", payload)
|
let response = callPrivateRPC("eth_call", payload)
|
||||||
let res = parseJson($response)["result"].str
|
let res = parseJson($response)["result"].str
|
||||||
if (res == "0x"):
|
if (res == "0x"):
|
||||||
return -1
|
return -1
|
||||||
|
@ -68,7 +67,7 @@ proc getCryptoKitties*(address: EthAddress): seq[Collectible] =
|
||||||
proc getEthermons*(address: EthAddress): seq[Collectible] =
|
proc getEthermons*(address: EthAddress): seq[Collectible] =
|
||||||
result = @[]
|
result = @[]
|
||||||
try:
|
try:
|
||||||
let contract = contracts.getContract(Network.Mainnet, "ethermon")
|
let contract = getContract(Network.Mainnet, "ethermon")
|
||||||
let tokens = tokensOfOwnerByIndex(contract, address)
|
let tokens = tokensOfOwnerByIndex(contract, address)
|
||||||
|
|
||||||
if (tokens.len == 0):
|
if (tokens.len == 0):
|
||||||
|
@ -92,7 +91,7 @@ proc getEthermons*(address: EthAddress): seq[Collectible] =
|
||||||
proc getKudos*(address: EthAddress): seq[Collectible] =
|
proc getKudos*(address: EthAddress): seq[Collectible] =
|
||||||
result = @[]
|
result = @[]
|
||||||
try:
|
try:
|
||||||
let contract = contracts.getContract(Network.Mainnet, "kudos")
|
let contract = getContract(Network.Mainnet, "kudos")
|
||||||
let tokens = tokensOfOwnerByIndex(contract, address)
|
let tokens = tokensOfOwnerByIndex(contract, address)
|
||||||
|
|
||||||
if (tokens.len == 0):
|
if (tokens.len == 0):
|
||||||
|
@ -114,7 +113,5 @@ proc getKudos*(address: EthAddress): seq[Collectible] =
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "Error getting Kudos", msg = e.msg
|
error "Error getting Kudos", msg = e.msg
|
||||||
|
|
||||||
|
|
||||||
proc getAllCollectibles*(address: EthAddress): seq[Collectible] =
|
proc getAllCollectibles*(address: EthAddress): seq[Collectible] =
|
||||||
result = concat(getCryptoKitties(address), getEthermons(address), getKudos(address))
|
result = concat(getCryptoKitties(address), getEthermons(address), getKudos(address))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue