move init node to status_accounts

This commit is contained in:
Iuri Matias 2020-05-20 13:11:30 -04:00
parent 0a2c8bc86c
commit 48b600f3fd
2 changed files with 26 additions and 29 deletions

View File

@ -14,6 +14,7 @@ import strformat
import strutils
import json
import status/core as status
import status/accounts as status_accounts
import status/chat as status_chat
import status/test as status_test
import status/types as types
@ -30,28 +31,8 @@ var signalsQObjPointer: pointer
logScope:
topics = "main"
proc ensureDir(dirname: string) =
if not existsDir(dirname):
# removeDir(dirname)
createDir(dirname)
proc initNode(): string =
const datadir = "./data/"
const keystoredir = "./data/keystore/"
const nobackupdir = "./noBackup/"
ensureDir(datadir)
ensureDir(keystoredir)
ensureDir(nobackupdir)
# 1
result = $libstatus.initKeystore(keystoredir);
# 2
result = $libstatus.openAccounts(datadir);
proc mainProc() =
discard initNode()
status_accounts.initNodeAccounts()
let app = newQApplication()
let engine = newQQmlApplicationEngine()
@ -130,10 +111,6 @@ proc mainProc() =
appState.addChannel("test")
appState.addChannel("test2")
engine.load("../ui/main.qml")
# Please note that this must use the `cdecl` calling convention because

View File

@ -1,6 +1,7 @@
import libstatus
import json
import utils
import os
proc generateAddresses*(): string =
let multiAccountConfig = %* {
@ -13,3 +14,22 @@ proc generateAddresses*(): string =
proc generateAlias*(publicKey: string): string =
result = $libstatus.generateAlias(publicKey.toGoString)
proc ensureDir(dirname: string) =
if not existsDir(dirname):
# removeDir(dirname)
createDir(dirname)
proc initNodeAccounts*() =
const datadir = "./data/"
const keystoredir = "./data/keystore/"
const nobackupdir = "./noBackup/"
ensureDir(datadir)
ensureDir(keystoredir)
ensureDir(nobackupdir)
# 1
discard $libstatus.initKeystore(keystoredir);
# 2
discard $libstatus.openAccounts(datadir);