From 8bb2dbb82a5530b8bd90dac9df9f70f5d118d8a9 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 8 Jun 2021 15:14:07 -0400 Subject: [PATCH] remove references to libstatus constants from src/app --- src/app/chat/view.nim | 2 +- src/app/profile/core.nim | 5 +++-- src/app/profile/view.nim | 2 +- src/app/utilsView/view.nim | 1 - src/app/wallet/view.nim | 3 ++- src/nim_status_client.nim | 2 +- src/status/accounts.nim | 5 +++-- src/status/chat.nim | 6 +++--- src/status/constants.nim | 6 ++++++ 9 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 src/status/constants.nim diff --git a/src/app/chat/view.nim b/src/app/chat/view.nim index 0a38e53868..18a309fcbb 100644 --- a/src/app/chat/view.nim +++ b/src/app/chat/view.nim @@ -1,7 +1,7 @@ import NimQml, Tables, json, sequtils, chronicles, times, re, sugar, strutils, os, strformat, algorithm import ../../status/[status, mailservers] import ../../status/libstatus/chat as libstatus_chat -import ../../status/libstatus/accounts/constants +import ../../status/constants import ../../status/libstatus/chat as core_chat import ../../status/utils as status_utils import ../../status/chat as status_chat diff --git a/src/app/profile/core.nim b/src/app/profile/core.nim index 562775cea9..c0da39bdfc 100644 --- a/src/app/profile/core.nim +++ b/src/app/profile/core.nim @@ -1,7 +1,6 @@ import NimQml, json, strutils, sugar, sequtils, tables import json_serialization import ../../status/signals/types -import ../../status/libstatus/accounts/constants import ../../status/types as status_types import ../../status/profile/[profile, mailserver] import ../../status/[status, settings] @@ -17,6 +16,8 @@ import ../chat/views/channels_list import chronicles import ../../status/tasks/marathon/mailserver/events +const DEFAULT_NETWORK_NAME* = "mainnet_rpc" + type ProfileController* = ref object view*: ProfileView variant*: QVariant @@ -36,7 +37,7 @@ proc init*(self: ProfileController, account: Account) = let profile = account.toProfileModel() let pubKey = self.status.settings.getSetting[:string](Setting.PublicKey, "0x0") - let network = self.status.settings.getSetting[:string](Setting.Networks_CurrentNetwork, constants.DEFAULT_NETWORK_NAME) + let network = self.status.settings.getSetting[:string](Setting.Networks_CurrentNetwork, DEFAULT_NETWORK_NAME) let appearance = self.status.settings.getSetting[:int](Setting.Appearance) let messagesFromContactsOnly = self.status.settings.getSetting[:bool](Setting.MessagesFromContactsOnly) profile.appearance = appearance diff --git a/src/app/profile/view.nim b/src/app/profile/view.nim index faa95ffb58..474ca59a3b 100644 --- a/src/app/profile/view.nim +++ b/src/app/profile/view.nim @@ -9,7 +9,7 @@ import ../../status/status import ../../status/ens as status_ens import ../../status/chat/chat import ../../status/types -import ../../status/libstatus/accounts/constants as accountConstants +import ../../status/constants as accountConstants import qrcode/qrcode import ../utils/image_utils diff --git a/src/app/utilsView/view.nim b/src/app/utilsView/view.nim index a15b6af597..76b6b68f71 100644 --- a/src/app/utilsView/view.nim +++ b/src/app/utilsView/view.nim @@ -2,7 +2,6 @@ import NimQml, os, strformat, strutils, parseUtils, chronicles import stint import ../../status/[status, wallet] import ../../status/stickers -import ../../status/libstatus/accounts/constants as accountConstants import ../../status/libstatus/tokens import ../../status/types import ../../status/libstatus/settings diff --git a/src/app/wallet/view.nim b/src/app/wallet/view.nim index 35092e9ac8..4fbae622f0 100644 --- a/src/app/wallet/view.nim +++ b/src/app/wallet/view.nim @@ -8,7 +8,6 @@ import # vendor libs import # status-desktop libs ../../status/[status, wallet, settings], ../../status/wallet/collectibles as status_collectibles, - ../../status/libstatus/accounts/constants, ../../status/libstatus/wallet as status_wallet, ../../status/libstatus/tokens, ../../status/types, ../../status/utils as status_utils, @@ -16,6 +15,8 @@ import # status-desktop libs views/[asset_list, account_list, account_item, token_list, transaction_list, collectibles_list], ../../status/tasks/[qt, task_runner_impl], ../../status/signals/types as signal_types +const ZERO_ADDRESS* = "0x0000000000000000000000000000000000000000" + type SendTransactionTaskArg = ref object of QObjectTaskArg from_addr: string diff --git a/src/nim_status_client.nim b/src/nim_status_client.nim index 1b63651dc6..15e97dad48 100644 --- a/src/nim_status_client.nim +++ b/src/nim_status_client.nim @@ -11,7 +11,7 @@ import app/login/core as login import app/provider/core as provider import status/signals/core as signals import status/types -import status/libstatus/accounts/constants +import status/constants import status_go import status/status as statuslib import ./eventemitter diff --git a/src/status/accounts.nim b/src/status/accounts.nim index 7d5960fd15..d99c10b371 100644 --- a/src/status/accounts.nim +++ b/src/status/accounts.nim @@ -1,11 +1,12 @@ import options, chronicles, json, json_serialization, sequtils, sugar import libstatus/accounts as status_accounts import libstatus/settings as status_settings -import libstatus/accounts/constants import types import utils import ../eventemitter +const DEFAULT_NETWORK_NAME* = "mainnet_rpc" + type AccountModel* = ref object generatedAddresses*: seq[GeneratedAccount] @@ -92,5 +93,5 @@ proc changeNetwork*(self: AccountModel, fleetConfig: FleetConfig, network: strin proc getNodeConfig*(self: AccountModel, fleetConfig: FleetConfig, installationId: string, networkConfig: JsonNode, fleet: Fleet = Fleet.PROD): JsonNode = result = status_accounts.getNodeConfig(fleetConfig, installationId, networkConfig, fleet) -proc getNodeConfig*(self: AccountModel, fleetConfig: FleetConfig, installationId: string, currentNetwork: string = constants.DEFAULT_NETWORK_NAME, fleet: Fleet = Fleet.PROD): JsonNode = +proc getNodeConfig*(self: AccountModel, fleetConfig: FleetConfig, installationId: string, currentNetwork: string = DEFAULT_NETWORK_NAME, fleet: Fleet = Fleet.PROD): JsonNode = result = status_accounts.getNodeConfig(fleetConfig, installationId, currentNetwork, fleet) diff --git a/src/status/chat.nim b/src/status/chat.nim index 96509e145e..18e5d9754e 100644 --- a/src/status/chat.nim +++ b/src/status/chat.nim @@ -2,7 +2,6 @@ import json, strutils, sequtils, tables, chronicles, times, sugar import libstatus/chat as status_chat import libstatus/mailservers as status_mailservers import libstatus/chatCommands as status_chat_commands -import libstatus/accounts/constants as constants import types import utils as status_utils import libstatus/contacts as status_contacts @@ -19,6 +18,7 @@ logScope: topics = "chat-model" const backToFirstChat* = "__goBackToFirstChat" +const ZERO_ADDRESS* = "0x0000000000000000000000000000000000000000" type ChatUpdateArgs* = ref object of Args @@ -440,12 +440,12 @@ proc declineRequestTransaction*(self: ChatModel, messageId: string) = self.processUpdateForTransaction(messageId, response) proc requestAddressForTransaction*(self: ChatModel, chatId: string, fromAddress: string, amount: string, tokenAddress: string) = - let address = if (tokenAddress == constants.ZERO_ADDRESS): "" else: tokenAddress + let address = if (tokenAddress == ZERO_ADDRESS): "" else: tokenAddress let response = status_chat_commands.requestAddressForTransaction(chatId, fromAddress, amount, address) discard self.processMessageUpdateAfterSend(response) proc requestTransaction*(self: ChatModel, chatId: string, fromAddress: string, amount: string, tokenAddress: string) = - let address = if (tokenAddress == constants.ZERO_ADDRESS): "" else: tokenAddress + let address = if (tokenAddress == ZERO_ADDRESS): "" else: tokenAddress let response = status_chat_commands.requestTransaction(chatId, fromAddress, amount, address) discard self.processMessageUpdateAfterSend(response) diff --git a/src/status/constants.nim b/src/status/constants.nim new file mode 100644 index 0000000000..df5d05c056 --- /dev/null +++ b/src/status/constants.nim @@ -0,0 +1,6 @@ +import libstatus/accounts/constants + +export DATADIR +export STATUSGODIR +export KEYSTOREDIR +export TMPDIR