rename libstatus to statusgo_backend (#27)

This commit is contained in:
Iuri Matias 2021-09-11 17:50:36 -04:00 committed by GitHub
parent 7e4875a63f
commit 077965bf81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 94 additions and 94 deletions

View File

@ -1,6 +1,6 @@
import options, chronicles, json, json_serialization, sequtils, sugar
import libstatus/accounts as status_accounts
import libstatus/settings as status_settings
import statusgo_backend/accounts as status_accounts
import statusgo_backend/settings as status_settings
import ./types/[account, fleet, sticker, setting]
import utils
import ../eventemitter

View File

@ -1,4 +1,4 @@
import libstatus/browser as status_browser
import statusgo_backend/browser as status_browser
import ../eventemitter
import ./types/[bookmark]

View File

@ -1,6 +1,6 @@
import json, strutils, sequtils, tables, chronicles, times, sugar, algorithm
import libstatus/chat as status_chat
import libstatus/chatCommands as status_chat_commands
import statusgo_backend/chat as status_chat
import statusgo_backend/chatCommands as status_chat_commands
import types/[message, status_update, activity_center_notification,
sticker, removed_message]
import types/chat as chat_type

View File

@ -1,4 +1,4 @@
import libstatus/accounts/constants
import statusgo_backend/accounts/constants
const APP_UPDATES_ENS* = "desktop.status.eth"
const CHECK_VERSION_TIMEOUT_MS* = 5000

View File

@ -1,7 +1,7 @@
import json, sequtils, sugar, chronicles
import libstatus/contacts as status_contacts
import libstatus/accounts as status_accounts
import libstatus/chat as status_chat
import statusgo_backend/contacts as status_contacts
import statusgo_backend/accounts as status_accounts
import statusgo_backend/chat as status_chat
import profile/profile
import ../eventemitter

View File

@ -1,7 +1,7 @@
import system
import libstatus/settings
import statusgo_backend/settings
import types/[setting, installation]
import libstatus/installations
import statusgo_backend/installations
import json
proc setDeviceName*(name: string) =

View File

@ -6,10 +6,10 @@ import json
import json_serialization
import tables
import strformat
import libstatus/core
import statusgo_backend/core
import ./types/[transaction, setting, rpc_response]
import utils
import libstatus/wallet
import statusgo_backend/wallet
import stew/byteutils
import unicode
import transactions

View File

@ -5,7 +5,7 @@ import
web3/ethtypes, stew/byteutils, nimcrypto, json_serialization, chronicles
import
../types/[network_type], ../libstatus/settings, ../libstatus/coder, transactions, methods, ../utils
../types/[network_type], ../statusgo_backend/settings, ../statusgo_backend/coder, transactions, methods, ../utils
export
GetPackData, PackData, BuyToken, ApproveAndCall, Transfer, BalanceOf, Register, SetPubkey,

View File

@ -5,7 +5,7 @@ import
nimcrypto, web3/[encoding, ethtypes]
import
../types/[rpc_response, transaction], ../libstatus/coder, eth, transactions
../types/[rpc_response, transaction], ../statusgo_backend/coder, eth, transactions
export sendTransaction

View File

@ -2,7 +2,7 @@ import
json, json_serialization, chronicles, web3/ethtypes
import
../libstatus/core, ../types/[rpc_response, transaction], ../libstatus/conversions
../statusgo_backend/core, ../types/[rpc_response, transaction], ../statusgo_backend/conversions
proc estimateGas*(tx: TransactionData): RpcResponse =
let response = core.callPrivateRPC("eth_estimateGas", %*[%tx])

View File

@ -4,7 +4,7 @@ import strformat
import os
import sequtils
from libstatus/gif import getRecentGifs, getFavoriteGifs, setFavoriteGifs, setRecentGifs
from statusgo_backend/gif import getRecentGifs, getFavoriteGifs, setFavoriteGifs, setRecentGifs
const MAX_RECENT = 50

View File

@ -1,6 +1,6 @@
import json
import libstatus/mailservers as status_mailservers
import statusgo_backend/mailservers as status_mailservers
import ../eventemitter
type

View File

@ -1,5 +1,5 @@
import tables, sets
import libstatus/chat
import statusgo_backend/chat
import ../eventemitter
type

View File

@ -1,6 +1,6 @@
import chronicles
import ../eventemitter
import libstatus/settings
import statusgo_backend/settings
import json
import uuids
import json_serialization

View File

@ -1,4 +1,4 @@
import libstatus/core as status
import statusgo_backend/core as status
import ../eventemitter
type NodeModel* = ref object

View File

@ -1,7 +1,7 @@
import json
import strutils
import sets
import libstatus/core
import statusgo_backend/core
import chronicles
import ../eventemitter
import sequtils

View File

@ -1,9 +1,9 @@
import json
import ./types/[identity_image]
import profile/profile
import libstatus/core as libstatus_core
import libstatus/accounts as status_accounts
import libstatus/settings as status_settings
import statusgo_backend/core as statusgo_backend_core
import statusgo_backend/accounts as status_accounts
import statusgo_backend/settings as status_settings
import ../eventemitter
type

View File

@ -2,9 +2,9 @@ import ens, wallet, permissions, utils
import ../eventemitter
import ./types/[setting]
import utils
import libstatus/accounts
import libstatus/core
import libstatus/settings as status_settings
import statusgo_backend/accounts
import statusgo_backend/core
import statusgo_backend/settings as status_settings
import json, json_serialization, sets, strutils
import chronicles
import nbaser

View File

@ -3,7 +3,7 @@ import json, json_serialization
import
sugar, sequtils, strutils, atomics
import libstatus/settings as libstatus_settings
import statusgo_backend/settings as statusgo_backend_settings
import ../eventemitter
import ./types/[fleet, network_type, setting, rpc_response]
@ -16,56 +16,56 @@ proc newSettingsModel*(events: EventEmitter): SettingsModel =
result.events = events
proc saveSetting*(self: SettingsModel, key: Setting, value: string | JsonNode | bool): StatusGoError =
result = libstatus_settings.saveSetting(key, value)
result = statusgo_backend_settings.saveSetting(key, value)
proc getSetting*[T](self: SettingsModel, name: Setting, defaultValue: T, useCached: bool = true): T =
result = libstatus_settings.getSetting(name, defaultValue, useCached)
result = statusgo_backend_settings.getSetting(name, defaultValue, useCached)
proc getSetting*[T](self: SettingsModel, name: Setting, useCached: bool = true): T =
result = libstatus_settings.getSetting[T](name, useCached)
result = statusgo_backend_settings.getSetting[T](name, useCached)
# TODO: name with a 2 due to namespace conflicts that need to be addressed in subsquent PRs
proc getSetting2*[T](name: Setting, defaultValue: T, useCached: bool = true): T =
result = libstatus_settings.getSetting(name, defaultValue, useCached)
result = statusgo_backend_settings.getSetting(name, defaultValue, useCached)
proc getSetting2*[T](name: Setting, useCached: bool = true): T =
result = libstatus_settings.getSetting[T](name, useCached)
result = statusgo_backend_settings.getSetting[T](name, useCached)
proc getCurrentNetworkDetails*(self: SettingsModel): NetworkDetails =
result = libstatus_settings.getCurrentNetworkDetails()
result = statusgo_backend_settings.getCurrentNetworkDetails()
proc getMailservers*(self: SettingsModel):JsonNode =
result = libstatus_settings.getMailservers()
result = statusgo_backend_settings.getMailservers()
proc getPinnedMailserver*(self: SettingsModel): string =
result = libstatus_settings.getPinnedMailserver()
result = statusgo_backend_settings.getPinnedMailserver()
proc pinMailserver*(self: SettingsModel, enode: string = "") =
libstatus_settings.pinMailserver(enode)
statusgo_backend_settings.pinMailserver(enode)
proc saveMailserver*(self: SettingsModel, name, enode: string) =
libstatus_settings.saveMailserver(name, enode)
statusgo_backend_settings.saveMailserver(name, enode)
proc getFleet*(self: SettingsModel): Fleet =
result = libstatus_settings.getFleet()
result = statusgo_backend_settings.getFleet()
proc getCurrentNetwork*(): NetworkType =
result = libstatus_settings.getCurrentNetwork()
result = statusgo_backend_settings.getCurrentNetwork()
proc getCurrentNetwork*(self: SettingsModel): NetworkType =
result = getCurrentNetwork()
proc setWakuVersion*(self: SettingsModel, newVersion: int) =
libstatus_settings.setWakuVersion(newVersion)
statusgo_backend_settings.setWakuVersion(newVersion)
proc setBloomFilterMode*(self: SettingsModel, bloomFilterMode: bool): StatusGoError =
libstatus_settings.setBloomFilterMode(bloomFilterMode)
statusgo_backend_settings.setBloomFilterMode(bloomFilterMode)
proc setFleet*(self: SettingsModel, fleetConfig: FleetConfig, fleet: Fleet): StatusGoError =
libstatus_settings.setFleet(fleetConfig, fleet)
statusgo_backend_settings.setFleet(fleetConfig, fleet)
proc getNodeConfig*(self: SettingsModel): JsonNode =
libstatus_settings.getNodeConfig()
statusgo_backend_settings.getNodeConfig()
proc setBloomLevel*(self: SettingsModel, bloomFilterMode: bool, fullNode: bool): StatusGoError =
libstatus_settings.setBloomLevel(bloomFilterMode, fullNode)
statusgo_backend_settings.setBloomLevel(bloomFilterMode, fullNode)

View File

@ -1,6 +1,6 @@
import libstatus/accounts as libstatus_accounts
import libstatus/core as libstatus_core
import libstatus/settings as libstatus_settings
import statusgo_backend/accounts as statusgo_backend_accounts
import statusgo_backend/core as statusgo_backend_core
import statusgo_backend/settings as statusgo_backend_settings
import chat, accounts, wallet, wallet2, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, mailservers, browser, tokens, provider
import notifications/os_notifications
import ../eventemitter
@ -54,10 +54,10 @@ proc newStatusInstance*(fleetConfig: string): Status =
result.osnotifications = newOsNotifications(result.events)
proc initNode*(self: Status, statusGoDir, keystoreDir: string) =
libstatus_accounts.initNode(statusGoDir, keystoreDir)
statusgo_backend_accounts.initNode(statusGoDir, keystoreDir)
proc startMessenger*(self: Status) {.exportc, dynlib.} =
libstatus_core.startMessenger()
statusgo_backend_core.startMessenger()
proc reset*(self: Status) {.exportc, dynlib.} =
# TODO: remove this once accounts are not tracked in the AccountsModel
@ -72,17 +72,17 @@ proc reset*(self: Status) {.exportc, dynlib.} =
# TODO: add all resets here
proc getNodeVersion*(self: Status): string {.exportc, dynlib.} =
libstatus_settings.getWeb3ClientVersion()
statusgo_backend_settings.getWeb3ClientVersion()
# TODO: duplicated??
proc saveSetting*(self: Status, setting: Setting, value: string | bool) =
discard libstatus_settings.saveSetting(setting, value)
discard statusgo_backend_settings.saveSetting(setting, value)
proc getBloomFilter*(self: Status): string {.exportc, dynlib.} =
result = libstatus_core.getBloomFilter()
result = statusgo_backend_core.getBloomFilter()
proc getBloomFilterBitsSet*(self: Status): int {.exportc, dynlib.} =
let bloomFilter = libstatus_core.getBloomFilter()
let bloomFilter = statusgo_backend_core.getBloomFilter()
var bitCount = 0;
for b in hexToSeqByte(bloomFilter):
bitCount += countSetBits(b)

View File

@ -8,9 +8,9 @@ import # local deps
utils as status_utils,
eth/contracts as status_contracts,
stickers_backend as status_stickers, transactions,
libstatus/wallet, ../eventemitter
statusgo_backend/wallet, ../eventemitter
import ./types/[sticker, transaction, rpc_response]
from utils as libstatus_utils import eth2Wei, gwei2Wei, toUInt64, parseAddress
from utils as statusgo_backend_utils import eth2Wei, gwei2Wei, toUInt64, parseAddress
logScope:
topics = "stickers-model"

View File

@ -1,4 +1,4 @@
# used to be libstatus, should be merged with stickers
# used to be statusgo_backend, should be merged with stickers
import # std libs
atomics, json, tables, sequtils, httpclient, net,
@ -14,7 +14,7 @@ from nimcrypto import fromHex
import # status-desktop libs
./eth/transactions as transactions, types/[sticker, setting, rpc_response],
eth/contracts, ./libstatus/settings, ./libstatus/edn_helpers, utils
eth/contracts, ./statusgo_backend/settings, ./statusgo_backend/edn_helpers, utils
# Retrieves number of sticker packs owned by user
# See https://notes.status.im/Q-sQmQbpTOOWCQcYiXtf5g#Read-Sticker-Packs-owned-by-a-user

View File

@ -1,4 +1,4 @@
import libstatus/tokens as libstatus_tokens
import statusgo_backend/tokens as statusgo_backend_tokens
import tokens_backend as status_tokens
import eth/contracts
import ../eventemitter
@ -15,10 +15,10 @@ proc getSNTAddress*(): string =
result = status_tokens.getSNTAddress()
proc getCustomTokens*(self: TokensModel, useCached: bool = true): seq[Erc20Contract] =
result = libstatus_tokens.getCustomTokens(useCached)
result = statusgo_backend_tokens.getCustomTokens(useCached)
proc removeCustomToken*(self: TokensModel, address: string) =
libstatus_tokens.removeCustomToken(address)
statusgo_backend_tokens.removeCustomToken(address)
proc getSNTBalance*(account: string): string =
result = status_tokens.getSNTBalance(account)

View File

@ -1,4 +1,4 @@
# used to be libstatus, should be merged with tokens
# used to be statusgo_backend, should be merged with tokens
import
json, chronicles, strformat, stint, strutils, sequtils, tables, atomics
@ -6,11 +6,11 @@ import
web3/[ethtypes, conversions], json_serialization
import
./libstatus/settings, ./libstatus/core, ./libstatus/wallet, eth/contracts,
./statusgo_backend/settings, ./statusgo_backend/core, ./statusgo_backend/wallet, eth/contracts,
types/[setting, network_type, rpc_response]
from utils import parseAddress
import libstatus/tokens as libstatus_tokens
import statusgo_backend/tokens as statusgo_backend_tokens
var
customTokens {.threadvar.}: seq[Erc20Contract]
@ -64,12 +64,12 @@ proc getVisibleTokens*(): seq[Erc20Contract] =
let currentNetwork = getCurrentNetwork()
let visibleTokens = visibleTokensSNTDefault()
var visibleTokenList = visibleTokens[$currentNetwork].to(seq[string])
let customTokens = libstatus_tokens.getCustomTokens()
let customTokens = statusgo_backend_tokens.getCustomTokens()
result = convertStringSeqToERC20ContractSeq(visibleTokenList)
proc getToken*(tokenAddress: string): Erc20Contract =
getErc20Contracts().concat(libstatus_tokens.getCustomTokens()).getErc20ContractByAddress(tokenAddress.parseAddress)
getErc20Contracts().concat(statusgo_backend_tokens.getCustomTokens()).getErc20ContractByAddress(tokenAddress.parseAddress)
proc getTokenBalance*(tokenAddress: string, account: string): string =
var postfixedAccount: string = account
@ -83,7 +83,7 @@ proc getTokenBalance*(tokenAddress: string, account: string): string =
var decimals = 18
let address = parseAddress(tokenAddress)
let t = getErc20Contract(address)
let ct = libstatus_tokens.getCustomTokens().getErc20ContractByAddress(address)
let ct = statusgo_backend_tokens.getCustomTokens().getErc20ContractByAddress(address)
if t != nil:
decimals = t.decimals
elif ct != nil:

View File

@ -2,7 +2,7 @@
import strutils, random, strformat, json
import ../libstatus/accounts as status_accounts
import ../statusgo_backend/accounts as status_accounts
import message
include chat_member

View File

@ -4,10 +4,10 @@ import json, strutils, sequtils, sugar, chronicles
import json_serialization
import ../utils
import ../wallet/account
import ../libstatus/accounts/constants as constants
import ../libstatus/wallet as status_wallet
import ../libstatus/settings as status_settings
import ../libstatus/tokens as status_tokens
import ../statusgo_backend/accounts/constants as constants
import ../statusgo_backend/wallet as status_wallet
import ../statusgo_backend/settings as status_settings
import ../statusgo_backend/tokens as status_tokens
import ../eth/contracts as status_contracts
import web3/conversions
from ../utils import parseAddress, wei2Eth

View File

@ -1,7 +1,7 @@
{.used.}
import json_serialization
import ../libstatus/accounts/constants
import ../statusgo_backend/accounts/constants
include derived_account

View File

@ -2,16 +2,16 @@ import json, strformat, strutils, chronicles, sequtils, sugar, httpclient, table
import json_serialization, stint, stew/byteutils, algorithm
from web3/ethtypes import Address, Quantity
from web3/conversions import `$`
from libstatus/core import getBlockByNumber
import libstatus/accounts as status_accounts
from statusgo_backend/core import getBlockByNumber
import statusgo_backend/accounts as status_accounts
import tokens_backend as status_tokens
import libstatus/tokens as libstatus_tokens
import libstatus/settings as status_settings
import libstatus/wallet as status_wallet
import libstatus/accounts/constants as constants
import statusgo_backend/tokens as statusgo_backend_tokens
import statusgo_backend/settings as status_settings
import statusgo_backend/wallet as status_wallet
import statusgo_backend/accounts/constants as constants
import eth/[eth, contracts]
from libstatus/core import getBlockByNumber
from utils as libstatus_utils import eth2Wei, gwei2Wei, wei2Gwei, first, toUInt64, parseAddress
from statusgo_backend/core import getBlockByNumber
from utils as statusgo_backend_utils import eth2Wei, gwei2Wei, wei2Gwei, first, toUInt64, parseAddress
import wallet/[balance_manager, collectibles]
import wallet/account as wallet_account
import transactions
@ -76,7 +76,7 @@ proc buildTokenTransaction(source, to, assetAddress: Address, value: float, tran
transactions.buildTokenTransaction(source, assetAddress, gas, gasPrice, isEIP1559Enabled, maxPriorityFeePerGas, maxFeePerGas)
proc getKnownTokenContract*(self: WalletModel, address: Address): Erc20Contract =
getErc20Contracts().concat(libstatus_tokens.getCustomTokens()).getErc20ContractByAddress(address)
getErc20Contracts().concat(statusgo_backend_tokens.getCustomTokens()).getErc20ContractByAddress(address)
proc estimateGas*(self: WalletModel, source, to, value, data: string, success: var bool): string =
var tx = transactions.buildTransaction(
@ -384,7 +384,7 @@ proc hideAsset*(self: WalletModel, symbol: string) =
self.events.emit("assetChanged", Args())
proc addCustomToken*(self: WalletModel, symbol: string, enable: bool, address: string, name: string, decimals: int, color: string) =
libstatus_tokens.addCustomToken(address, name, symbol, decimals, color)
statusgo_backend_tokens.addCustomToken(address, name, symbol, decimals, color)
proc getTransfersByAddress*(self: WalletModel, address: string, toBlock: Uint256, limit: int, loadMore: bool): seq[Transaction] =
result = status_wallet.getTransfersByAddress(address, toBlock, limit, loadMore)

View File

@ -1,5 +1,5 @@
import strformat, strutils, stint, httpclient, json, chronicles, net
import ../libstatus/wallet as status_wallet
import ../statusgo_backend/wallet as status_wallet
import ../tokens_backend as status_tokens
import ../types/[rpc_response]
import ../utils/cache

View File

@ -6,7 +6,7 @@ import # vendor libs
stint
import # status-desktop libs
../libstatus/core as status, ../eth/contracts as contracts,
../statusgo_backend/core as status, ../eth/contracts as contracts,
../stickers as status_stickers,
../utils as status_utils,
web3/[conversions, ethtypes], ../utils, account

View File

@ -1,11 +1,11 @@
import json, strformat, options, chronicles, sugar, sequtils, strutils
import libstatus/accounts as status_accounts
import libstatus/accounts/constants as constants
import statusgo_backend/accounts as status_accounts
import statusgo_backend/accounts/constants as constants
import tokens_backend as status_tokens
import libstatus/wallet as status_wallet
import libstatus/network as status_network
import libstatus/settings as status_settings
import statusgo_backend/wallet as status_wallet
import statusgo_backend/network as status_network
import statusgo_backend/settings as status_settings
import eth/[contracts]
import wallet2/[balance_manager, collectibles, network]
import wallet2/account as wallet_account

View File

@ -1,5 +1,5 @@
import strformat, strutils, stint, httpclient, json, chronicles, net
import ../libstatus/wallet as status_wallet
import ../statusgo_backend/wallet as status_wallet
import ../tokens_backend as status_tokens
import ../types/[rpc_response]
import ../utils/cache

View File

@ -6,7 +6,7 @@ import # vendor libs
stint
import # status-desktop libs
../libstatus/core as status, ../eth/contracts as contracts,
../statusgo_backend/core as status, ../eth/contracts as contracts,
../stickers as status_stickers,
../utils as status_utils,
web3/[conversions, ethtypes], ../utils, account

View File

@ -5,7 +5,7 @@ import
chronicles, json_serialization, stew/results
import # modules
../types/[address, conversions, rpc_response], ../libstatus/wallet
../types/[address, conversions, rpc_response], ../statusgo_backend/wallet
export address, results