hodl-wallet 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.mjs +8 -1
- package/package.json +1 -1
- package/persist.js +3 -3
package/index.mjs
CHANGED
|
@@ -10,6 +10,7 @@ import { dirname } from 'path';
|
|
|
10
10
|
import Table from 'cli-table3';
|
|
11
11
|
import bip39 from 'bip39';
|
|
12
12
|
import hdkey from 'hdkey';
|
|
13
|
+
import os from 'os';
|
|
13
14
|
|
|
14
15
|
const __filename = fileURLToPath(import.meta.url);
|
|
15
16
|
const __dirname = dirname(__filename);
|
|
@@ -19,7 +20,13 @@ inquirer.registerPrompt('autocomplete', inquirerAutocomplete);
|
|
|
19
20
|
|
|
20
21
|
class Wallet {
|
|
21
22
|
constructor(encryptionKey) {
|
|
22
|
-
|
|
23
|
+
const hodlDir = path.join(os.homedir(), '.HODL');
|
|
24
|
+
|
|
25
|
+
if (!fs.existsSync(hodlDir)) {
|
|
26
|
+
fs.mkdirSync(hodlDir, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
this.db = new Persist({ path: hodlDir, encryptionKey });
|
|
23
30
|
this.web3 = null;
|
|
24
31
|
this.selectedNetwork = null;
|
|
25
32
|
this.account = null;
|
package/package.json
CHANGED
package/persist.js
CHANGED
|
@@ -3,9 +3,9 @@ const Deepbase = require('deepbase');
|
|
|
3
3
|
const CryptoJS = require('crypto-js');
|
|
4
4
|
|
|
5
5
|
class Persist extends Deepbase {
|
|
6
|
-
constructor(
|
|
7
|
-
super();
|
|
8
|
-
this.encryptionKey = encryptionKey;
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
super(opts);
|
|
8
|
+
this.encryptionKey = opts.encryptionKey;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
encrypt(data) {
|