move init node to status_accounts
This commit is contained in:
parent
0a2c8bc86c
commit
48b600f3fd
|
@ -14,6 +14,7 @@ import strformat
|
||||||
import strutils
|
import strutils
|
||||||
import json
|
import json
|
||||||
import status/core as status
|
import status/core as status
|
||||||
|
import status/accounts as status_accounts
|
||||||
import status/chat as status_chat
|
import status/chat as status_chat
|
||||||
import status/test as status_test
|
import status/test as status_test
|
||||||
import status/types as types
|
import status/types as types
|
||||||
|
@ -30,28 +31,8 @@ var signalsQObjPointer: pointer
|
||||||
logScope:
|
logScope:
|
||||||
topics = "main"
|
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() =
|
proc mainProc() =
|
||||||
discard initNode()
|
status_accounts.initNodeAccounts()
|
||||||
|
|
||||||
let app = newQApplication()
|
let app = newQApplication()
|
||||||
let engine = newQQmlApplicationEngine()
|
let engine = newQQmlApplicationEngine()
|
||||||
|
@ -91,17 +72,17 @@ proc mainProc() =
|
||||||
|
|
||||||
var node = node.newController()
|
var node = node.newController()
|
||||||
node.init()
|
node.init()
|
||||||
|
|
||||||
engine.setRootContextProperty("nodeModel", node.variant)
|
engine.setRootContextProperty("nodeModel", node.variant)
|
||||||
|
|
||||||
var onboarding = newOnboarding(events);
|
var onboarding = newOnboarding(events);
|
||||||
defer: onboarding.delete
|
defer: onboarding.delete
|
||||||
|
|
||||||
let onboardingVariant = newQVariant(onboarding)
|
let onboardingVariant = newQVariant(onboarding)
|
||||||
defer: onboardingVariant.delete
|
defer: onboardingVariant.delete
|
||||||
|
|
||||||
engine.setRootContextProperty("onboardingLogic", onboardingVariant)
|
engine.setRootContextProperty("onboardingLogic", onboardingVariant)
|
||||||
|
|
||||||
# TODO: figure out a way to prevent this from breaking Qt Creator
|
# TODO: figure out a way to prevent this from breaking Qt Creator
|
||||||
# var initLibStatusQml = proc(): LibStatusQml =
|
# var initLibStatusQml = proc(): LibStatusQml =
|
||||||
# let libStatus = newLibStatusQml();
|
# let libStatus = newLibStatusQml();
|
||||||
|
@ -129,10 +110,6 @@ proc mainProc() =
|
||||||
events.on("node:ready") do(a: Args):
|
events.on("node:ready") do(a: Args):
|
||||||
appState.addChannel("test")
|
appState.addChannel("test")
|
||||||
appState.addChannel("test2")
|
appState.addChannel("test2")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
engine.load("../ui/main.qml")
|
engine.load("../ui/main.qml")
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import libstatus
|
import libstatus
|
||||||
import json
|
import json
|
||||||
import utils
|
import utils
|
||||||
|
import os
|
||||||
|
|
||||||
proc generateAddresses*(): string =
|
proc generateAddresses*(): string =
|
||||||
let multiAccountConfig = %* {
|
let multiAccountConfig = %* {
|
||||||
|
@ -13,3 +14,22 @@ proc generateAddresses*(): string =
|
||||||
|
|
||||||
proc generateAlias*(publicKey: string): string =
|
proc generateAlias*(publicKey: string): string =
|
||||||
result = $libstatus.generateAlias(publicKey.toGoString)
|
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);
|
||||||
|
|
Loading…
Reference in New Issue