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.
Files changed (3) hide show
  1. package/index.mjs +8 -1
  2. package/package.json +1 -1
  3. 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
- this.db = new Persist(encryptionKey);
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hodl-wallet",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "🧊 HODL Wallet - Fast CLI crypto wallet!",
5
5
  "author": "Martin Clasen",
6
6
  "repository": {
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(encryptionKey) {
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) {