hodl-wallet 1.3.8 → 1.4.4
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 -10
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -18,6 +18,10 @@ const __dirname = dirname(__filename);
|
|
|
18
18
|
import inquirerAutocomplete from 'inquirer-autocomplete-prompt';
|
|
19
19
|
inquirer.registerPrompt('autocomplete', inquirerAutocomplete);
|
|
20
20
|
|
|
21
|
+
process.on('SIGINT', () => {
|
|
22
|
+
process.exit();
|
|
23
|
+
});
|
|
24
|
+
|
|
21
25
|
class Wallet {
|
|
22
26
|
constructor(encryptionKey) {
|
|
23
27
|
const hodlDir = path.join(os.homedir(), '.HODL');
|
|
@@ -93,12 +97,12 @@ class Wallet {
|
|
|
93
97
|
async loadAccount(forceReload = false) {
|
|
94
98
|
let account = this.db.secureGet('account');
|
|
95
99
|
|
|
96
|
-
const choices = ['Create New Account', 'Import Mnemonic (12 words)', 'Import
|
|
100
|
+
const choices = ['Create New Account', 'Import Mnemonic (12 words)', 'Import Private-key'];
|
|
97
101
|
|
|
98
102
|
if (forceReload) {
|
|
99
103
|
choices.push('Export Account');
|
|
100
104
|
choices.push('Switch Network');
|
|
101
|
-
choices.push('Go
|
|
105
|
+
choices.push('Go Back');
|
|
102
106
|
}
|
|
103
107
|
|
|
104
108
|
if (!account || forceReload) {
|
|
@@ -109,7 +113,7 @@ class Wallet {
|
|
|
109
113
|
choices,
|
|
110
114
|
});
|
|
111
115
|
|
|
112
|
-
if (accountAction === 'Go
|
|
116
|
+
if (accountAction === 'Go Back') {
|
|
113
117
|
return;
|
|
114
118
|
}
|
|
115
119
|
|
|
@@ -166,7 +170,7 @@ class Wallet {
|
|
|
166
170
|
}
|
|
167
171
|
}
|
|
168
172
|
|
|
169
|
-
if (accountAction === 'Import
|
|
173
|
+
if (accountAction === 'Import Private-key') {
|
|
170
174
|
const { privateKey } = await inquirer.prompt({
|
|
171
175
|
type: 'password',
|
|
172
176
|
name: 'privateKey',
|
|
@@ -681,7 +685,6 @@ try {
|
|
|
681
685
|
process.exit(1);
|
|
682
686
|
}
|
|
683
687
|
|
|
684
|
-
// Register the displayExitPhrase method and account clearing to be called on process exit
|
|
685
688
|
process.on('exit', () => {
|
|
686
689
|
wallet.clearAccountData();
|
|
687
690
|
UIManager.displayExitPhrase();
|
|
@@ -718,8 +721,3 @@ while (true) {
|
|
|
718
721
|
process.exit();
|
|
719
722
|
}
|
|
720
723
|
}
|
|
721
|
-
|
|
722
|
-
process.on('SIGINT', () => {
|
|
723
|
-
console.log('\n');
|
|
724
|
-
process.exit();
|
|
725
|
-
});
|