hodl-wallet 1.2.2 → 1.2.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/README.md +16 -2
- package/index.mjs +29 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,10 @@ Keep your favorite addresses handy. No more copy-pasting!
|
|
|
41
41
|
|
|
42
42
|
## 🔒 Security
|
|
43
43
|
|
|
44
|
+
### 🔍 Security Audit
|
|
45
|
+
|
|
46
|
+
We encourage users to perform their own security audits. One easy way to do this is to copy the entire codebase into ChatGPT or another AI assistant and ask if the code appears secure or if there are any malicious intentions. This is a good practice for any open-source project you're considering using.
|
|
47
|
+
|
|
44
48
|
### 🔑 Private Key Storage
|
|
45
49
|
|
|
46
50
|
Your private key is securely stored in a JSON file, encrypted with a password of your choice. The encryption adds an extra layer of security, making it significantly harder for unauthorized parties to access your private key even if they gain access to the JSON file.
|
|
@@ -49,9 +53,19 @@ Your private key is securely stored in a JSON file, encrypted with a password of
|
|
|
49
53
|
|
|
50
54
|
We're as transparent as your ex's excuses. Our code is open-source, and we encourage you to dive in, explore, and contribute. Trust isn't given; it's earned and verified.
|
|
51
55
|
|
|
52
|
-
###
|
|
56
|
+
### 📦 Trusted Dependencies
|
|
53
57
|
|
|
54
|
-
We
|
|
58
|
+
We've carefully selected trusted and well-maintained dependencies for this project. Our goal is to balance functionality with security. Here's a brief overview of our main dependencies:
|
|
59
|
+
|
|
60
|
+
- **web3**: The Ethereum JavaScript API for blockchain interactions.
|
|
61
|
+
- **deepbase**: For persistent storage.
|
|
62
|
+
- **crypto-js**: For encryption.
|
|
63
|
+
- **inquirer** and **inquirer-autocomplete-prompt**: For interactive command-line interfaces.
|
|
64
|
+
- **cli-table3**: For creating formatted CLI tables.
|
|
65
|
+
- **bip39**: For generating and handling mnemonic phrases.
|
|
66
|
+
- **hdkey**: For handling hierarchical deterministic (HD) keys.
|
|
67
|
+
|
|
68
|
+
⚠️ **Important Notice**: HODL Wallet is a personal project created with the best intentions. While we strive for security, it may contain security flaws or vulnerabilities. Use at your own risk and always exercise caution with your crypto assets.
|
|
55
69
|
|
|
56
70
|
## 🤝 Contributing
|
|
57
71
|
|
package/index.mjs
CHANGED
|
@@ -90,6 +90,7 @@ class Wallet {
|
|
|
90
90
|
|
|
91
91
|
if (forceReload) {
|
|
92
92
|
choices.push('Export Account');
|
|
93
|
+
choices.push('Switch Network');
|
|
93
94
|
choices.push('Go back');
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -105,7 +106,7 @@ class Wallet {
|
|
|
105
106
|
return;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
|
-
if (account && accountAction !== 'Export Account') {
|
|
109
|
+
if (account && accountAction !== 'Export Account' && accountAction !== 'Switch Network') {
|
|
109
110
|
const { confirmOverwrite } = await inquirer.prompt({
|
|
110
111
|
type: 'confirm',
|
|
111
112
|
name: 'confirmOverwrite',
|
|
@@ -127,7 +128,19 @@ class Wallet {
|
|
|
127
128
|
this.account = this.web3.eth.accounts.privateKeyToAccount('0x' + privateKey);
|
|
128
129
|
this.account.mnemonic = mnemonic;
|
|
129
130
|
await this.db.secureSet('account', this.account);
|
|
130
|
-
|
|
131
|
+
|
|
132
|
+
const { showSensitive } = await inquirer.prompt({
|
|
133
|
+
type: 'confirm',
|
|
134
|
+
name: 'showSensitive',
|
|
135
|
+
message: 'Do you want to display sensitive information (private key and mnemonic)?',
|
|
136
|
+
default: false,
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (showSensitive) {
|
|
140
|
+
this.displayAccountDetails();
|
|
141
|
+
} else {
|
|
142
|
+
this.displayAccountAddress();
|
|
143
|
+
}
|
|
131
144
|
}
|
|
132
145
|
|
|
133
146
|
if (accountAction === 'Import private-key') {
|
|
@@ -149,7 +162,6 @@ class Wallet {
|
|
|
149
162
|
this.displayAccountAddress();
|
|
150
163
|
} catch (error) {
|
|
151
164
|
Wallet.displayError('Invalid private-key.');
|
|
152
|
-
return;
|
|
153
165
|
}
|
|
154
166
|
}
|
|
155
167
|
|
|
@@ -165,8 +177,12 @@ class Wallet {
|
|
|
165
177
|
|
|
166
178
|
if (accountAction === 'Export Account') {
|
|
167
179
|
await this.displayAccountDetails();
|
|
168
|
-
return;
|
|
169
180
|
}
|
|
181
|
+
|
|
182
|
+
if (accountAction === 'Switch Network') {
|
|
183
|
+
await this.switchNetwork();
|
|
184
|
+
}
|
|
185
|
+
|
|
170
186
|
return;
|
|
171
187
|
}
|
|
172
188
|
|
|
@@ -531,6 +547,12 @@ class Wallet {
|
|
|
531
547
|
|
|
532
548
|
console.log('\n' + table.toString());
|
|
533
549
|
}
|
|
550
|
+
|
|
551
|
+
async switchNetwork() {
|
|
552
|
+
const networkPlugins = await this.loadNetworkPlugins();
|
|
553
|
+
await this.selectNetwork(networkPlugins);
|
|
554
|
+
this.web3 = new Web3(this.selectedNetwork.rpcUrl);
|
|
555
|
+
}
|
|
534
556
|
}
|
|
535
557
|
|
|
536
558
|
class UIManager {
|
|
@@ -645,8 +667,8 @@ while (true) {
|
|
|
645
667
|
choices: [
|
|
646
668
|
{ name: 'Transfer Funds', value: 'transfer' },
|
|
647
669
|
{ name: 'Show Balance', value: 'balance' },
|
|
648
|
-
{ name: 'Show
|
|
649
|
-
{ name: 'Account', value: 'account' },
|
|
670
|
+
{ name: 'Show Sent Transfers', value: 'history' },
|
|
671
|
+
{ name: 'Account Settings', value: 'account' },
|
|
650
672
|
{ name: 'Exit', value: 'exit' }
|
|
651
673
|
],
|
|
652
674
|
});
|
|
@@ -674,4 +696,4 @@ while (true) {
|
|
|
674
696
|
process.on('SIGINT', () => {
|
|
675
697
|
console.log('\n');
|
|
676
698
|
process.exit();
|
|
677
|
-
});
|
|
699
|
+
});
|