hodl-wallet 1.5.4 → 1.5.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/README.md +1 -0
- package/index.mjs +13 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,6 +90,7 @@ We've carefully selected trusted and well-maintained dependencies for this proje
|
|
|
90
90
|
- **cli-table3**: For creating formatted CLI tables.
|
|
91
91
|
- **bip39**: For generating and handling mnemonic phrases.
|
|
92
92
|
- **hdkey**: For handling hierarchical deterministic (HD) keys.
|
|
93
|
+
- **ora**: For displaying progress bars.
|
|
93
94
|
|
|
94
95
|
⚠️ **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.
|
|
95
96
|
|
package/index.mjs
CHANGED
|
@@ -12,6 +12,7 @@ import bip39 from 'bip39';
|
|
|
12
12
|
import hdkey from 'hdkey';
|
|
13
13
|
import os from 'os';
|
|
14
14
|
import inquirerFuzzyPath from 'inquirer-fuzzy-path';
|
|
15
|
+
import ora from 'ora';
|
|
15
16
|
|
|
16
17
|
const __filename = fileURLToPath(import.meta.url);
|
|
17
18
|
const __dirname = dirname(__filename);
|
|
@@ -319,7 +320,7 @@ class Wallet {
|
|
|
319
320
|
return addressBook
|
|
320
321
|
.filter(entry => entry.name.toLowerCase().includes(input.toLowerCase()) || entry.address.toLowerCase().includes(input.toLowerCase()))
|
|
321
322
|
.map(entry => ({
|
|
322
|
-
name: entry.address ? `${entry.
|
|
323
|
+
name: entry.address ? `${entry.address} (${entry.name})` : entry.name,
|
|
323
324
|
value: entry.address
|
|
324
325
|
}))
|
|
325
326
|
.concat([{ name: input, value: input }]); // Add the input as a possible choice
|
|
@@ -365,7 +366,13 @@ class Wallet {
|
|
|
365
366
|
return;
|
|
366
367
|
}
|
|
367
368
|
|
|
369
|
+
const spinner = ora({
|
|
370
|
+
text: 'Sending transaction...',
|
|
371
|
+
spinner: 'dots'
|
|
372
|
+
}).start();
|
|
373
|
+
|
|
368
374
|
try {
|
|
375
|
+
|
|
369
376
|
let signedTx;
|
|
370
377
|
if (tokens[token] && token !== this.selectedNetwork.nativeToken) {
|
|
371
378
|
signedTx = await this.handleERC20Transfer(token, address, amount);
|
|
@@ -374,6 +381,9 @@ class Wallet {
|
|
|
374
381
|
}
|
|
375
382
|
|
|
376
383
|
const receipt = await this.web3.eth.sendSignedTransaction(signedTx.rawTransaction);
|
|
384
|
+
|
|
385
|
+
spinner.succeed('Transaction confirmed!');
|
|
386
|
+
|
|
377
387
|
this.displayTransactionResult(address, token, amount, receipt.transactionHash);
|
|
378
388
|
|
|
379
389
|
// Add transaction to history
|
|
@@ -384,6 +394,7 @@ class Wallet {
|
|
|
384
394
|
}
|
|
385
395
|
|
|
386
396
|
} catch (error) {
|
|
397
|
+
spinner.fail('Transaction failed');
|
|
387
398
|
this.displayTransactionError(error);
|
|
388
399
|
}
|
|
389
400
|
}
|
|
@@ -568,12 +579,7 @@ class Wallet {
|
|
|
568
579
|
const contact = this.db.get('contact', address);
|
|
569
580
|
const recipient = contact ? `${address} (${contact.name})` : address;
|
|
570
581
|
|
|
571
|
-
table.push([
|
|
572
|
-
date,
|
|
573
|
-
recipient,
|
|
574
|
-
token,
|
|
575
|
-
parseFloat(amount).toFixed(3)
|
|
576
|
-
]);
|
|
582
|
+
table.push([date, recipient, token, parseFloat(amount).toFixed(3)]);
|
|
577
583
|
table.push([{ colSpan: 4, content: this.selectedNetwork.explorer + hash }]);
|
|
578
584
|
|
|
579
585
|
console.log(table.toString());
|