fix issue with import & namespace conflict

This commit is contained in:
Iuri Matias 2021-06-09 12:00:43 -04:00
parent 01dc488870
commit 985532ce9a
3 changed files with 21 additions and 17 deletions

View File

@ -18,7 +18,7 @@ import web3/[ethtypes, conversions], stew/byteutils, stint
import libstatus/eth/contracts import libstatus/eth/contracts
import chronicles, libp2p/[multihash, multicodec, cid] import chronicles, libp2p/[multihash, multicodec, cid]
import ./settings as settings import ./settings as status_settings
import ./wallet as status_wallet import ./wallet as status_wallet
const domain* = ".stateofus.eth" const domain* = ".stateofus.eth"
@ -322,7 +322,7 @@ proc validateEnsName*(ens: string, isStatus: bool, usernames: seq[string]): stri
if ownerAddr == "" and isStatus: if ownerAddr == "" and isStatus:
result = "available" result = "available"
else: else:
let userPubKey = getSetting[string](settings, Setting.PublicKey, "0x0") let userPubKey = status_settings.getSetting2[string](Setting.PublicKey, "0x0")
let userWallet = status_wallet.getWalletAccounts()[0].address let userWallet = status_wallet.getWalletAccounts()[0].address
let ens_pubkey = pubkey(ens) let ens_pubkey = pubkey(ens)
if ownerAddr != "": if ownerAddr != "":

View File

@ -3,7 +3,7 @@ import json, json_serialization
import import
sugar, sequtils, strutils, atomics sugar, sequtils, strutils, atomics
import libstatus/settings as status_settings import libstatus/settings as libstatus_settings
import ../eventemitter import ../eventemitter
import signals/types import signals/types
@ -19,40 +19,41 @@ proc newSettingsModel*(events: EventEmitter): SettingsModel =
result.events = events result.events = events
proc saveSetting*(self: SettingsModel, key: Setting, value: string | JsonNode | bool): StatusGoError = proc saveSetting*(self: SettingsModel, key: Setting, value: string | JsonNode | bool): StatusGoError =
result = status_settings.saveSetting(key, value) result = libstatus_settings.saveSetting(key, value)
proc getSetting*[T](self: SettingsModel, name: Setting, defaultValue: T, useCached: bool = true): T = proc getSetting*[T](self: SettingsModel, name: Setting, defaultValue: T, useCached: bool = true): T =
result = status_settings.getSetting(name, defaultValue, useCached) result = libstatus_settings.getSetting(name, defaultValue, useCached)
proc getSetting*[T](self: SettingsModel, name: Setting, useCached: bool = true): T = proc getSetting*[T](self: SettingsModel, name: Setting, useCached: bool = true): T =
result = status_settings.getSetting[T](name, useCached) result = libstatus_settings.getSetting[T](name, useCached)
proc getSetting*[T](name: Setting, defaultValue: T, useCached: bool = true): T = # TODO: name with a 2 due to namespace conflicts that need to be addressed in subsquent PRs
result = status_settings.getSetting(name, defaultValue, useCached) proc getSetting2*[T](name: Setting, defaultValue: T, useCached: bool = true): T =
result = libstatus_settings.getSetting(name, defaultValue, useCached)
proc getSetting*[T](name: Setting, useCached: bool = true): T = proc getSetting2*[T](name: Setting, useCached: bool = true): T =
result = status_settings.getSetting[T](name, useCached) result = libstatus_settings.getSetting[T](name, useCached)
proc getCurrentNetworkDetails*(self: SettingsModel): LibStatusTypes.NetworkDetails = proc getCurrentNetworkDetails*(self: SettingsModel): LibStatusTypes.NetworkDetails =
result = status_settings.getCurrentNetworkDetails() result = libstatus_settings.getCurrentNetworkDetails()
proc getMailservers*(self: SettingsModel):JsonNode = proc getMailservers*(self: SettingsModel):JsonNode =
result = status_settings.getMailservers() result = libstatus_settings.getMailservers()
proc getPinnedMailserver*(self: SettingsModel): string = proc getPinnedMailserver*(self: SettingsModel): string =
result = status_settings.getPinnedMailserver() result = libstatus_settings.getPinnedMailserver()
proc pinMailserver*(self: SettingsModel, enode: string = "") = proc pinMailserver*(self: SettingsModel, enode: string = "") =
status_settings.pinMailserver(enode) libstatus_settings.pinMailserver(enode)
proc saveMailserver*(self: SettingsModel, name, enode: string) = proc saveMailserver*(self: SettingsModel, name, enode: string) =
status_settings.saveMailserver(name, enode) libstatus_settings.saveMailserver(name, enode)
proc getFleet*(self: SettingsModel): Fleet = proc getFleet*(self: SettingsModel): Fleet =
result = status_settings.getFleet() result = libstatus_settings.getFleet()
proc getCurrentNetwork*(): Network = proc getCurrentNetwork*(): Network =
result = status_settings.getCurrentNetwork() result = libstatus_settings.getCurrentNetwork()
proc getCurrentNetwork*(self: SettingsModel): Network = proc getCurrentNetwork*(self: SettingsModel): Network =
result = getCurrentNetwork() result = getCurrentNetwork()

View File

@ -369,6 +369,9 @@ proc setInitialBlocksRange*(self: WalletModel): string =
proc getWalletAccounts*(self: WalletModel): seq[WalletAccount] = proc getWalletAccounts*(self: WalletModel): seq[WalletAccount] =
result = status_wallet.getWalletAccounts() result = status_wallet.getWalletAccounts()
proc getWalletAccounts*(): seq[WalletAccount] =
result = status_wallet.getWalletAccounts()
proc watchTransaction*(self: WalletModel, transactionHash: string): string = proc watchTransaction*(self: WalletModel, transactionHash: string): string =
result = status_wallet.watchTransaction(transactionHash) result = status_wallet.watchTransaction(transactionHash)