-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathlowdbFunc.js
63 lines (55 loc) · 1.73 KB
/
lowdbFunc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import {prod_app_directory, production} from './src/main/libs/config';
import os from 'os';
import shell from 'shelljs';
import {ipcRenderer} from "electron";
var adapter;
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')
let db;
console.log("Ress 3 startAppRes lowdb 2")
if (production) {
let appPath = "~/Library/Application Support/"+prod_app_directory;
if(os.type() == 'Windows_NT') {
appPath = "~/AppData/Roaming/"+prod_app_directory;
if(appPath) {
shell.cd(appPath);
}
}
if(os.type() == 'Linux') {
appPath = "~/.config/"+prod_app_directory;
shell.cd(appPath);
}
if(os.type() == 'Darwin') {
appPath = "~/Library/Application Support/"+prod_app_directory;
shell.cd(appPath);
}
adapter = new FileSync('db.json');
console.log(adapter, "lowdbfunc");
} else {
adapter = new FileSync('/Users/farina/Desktop/Projects/LunaWalletVueTest/db.json');
}
db = low(adapter);
db.defaults({ accounts: [], contracts: [], tokens: [
{
"id": "DrZsGjQIZ",
"token_address": "0xa887adb722cf15bc1efe3c6a5d879e0482e8d197",
"token_name": "Token Lab",
"token_symbol": "LAB",
"tokenType": "erc20",
"decimal_places": 18,
"color": "#fa0fa0"
},
{
"id": "6zxjBkREl",
"token_address": "0x4f5ec5a69dbe12c48ca1edc9c52b1e8896aed932",
"token_name": "Pex Token",
"token_symbol": "PEX",
"tokenType": "erc20",
"decimal_places": 18,
"color": "#0297da"
},
] , accountsAdresses:[] , hdWallets:[] , transactions : [] })
.write();
export {
db, adapter, low
}