hodl-wallet 1.7.0 → 1.7.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.
Files changed (3) hide show
  1. package/example.jpg +0 -0
  2. package/index.js +13 -8
  3. package/package.json +2 -2
package/example.jpg CHANGED
Binary file
package/index.js CHANGED
@@ -414,7 +414,9 @@ class Wallet {
414
414
  // Add transaction to history
415
415
  await this.addToTransactions(address, token, amount, receipt.transactionHash);
416
416
 
417
- if (!contacts[address]) {
417
+ // Check if the address is already in contacts before asking to add it
418
+ const existingContact = await this.db.get('contact', this.network.name, address);
419
+ if (!existingContact) {
418
420
  await this.addToAddressBook(address);
419
421
  }
420
422
 
@@ -790,7 +792,7 @@ class UIManager {
790
792
  return key;
791
793
  }
792
794
 
793
- static async confirmEncryptionKey(originalKey) {
795
+ static async confirmEncryptionKey() {
794
796
  const { confirmKey } = await inquirer.prompt({
795
797
  type: 'password',
796
798
  name: 'confirmKey',
@@ -857,7 +859,7 @@ try {
857
859
  const accountExists = await wallet.getMnemonic();
858
860
 
859
861
  if (!accountExists) {
860
- const confirmedKey = await UIManager.confirmEncryptionKey(encryptionKey);
862
+ const confirmedKey = await UIManager.confirmEncryptionKey();
861
863
  if (confirmedKey !== encryptionKey) {
862
864
  Wallet.displayError('Passwords do not match. Please try again.');
863
865
  process.exit(1);
@@ -877,7 +879,7 @@ process.on('exit', () => {
877
879
  UIManager.displayExitPhrase();
878
880
  });
879
881
 
880
- while (true) {
882
+ async function mainMenu() {
881
883
  const { action } = await inquirer.prompt({
882
884
  type: 'list',
883
885
  name: 'action',
@@ -894,17 +896,20 @@ while (true) {
894
896
  switch (action) {
895
897
  case 'transferFunds':
896
898
  await wallet.transferFunds();
897
- break;
899
+ return mainMenu();
898
900
  case 'balance':
899
901
  await wallet.showBalance();
900
- break;
902
+ return mainMenu();
901
903
  case 'showTransactions':
902
904
  await wallet.showTransactions();
903
- break;
905
+ return mainMenu();
904
906
  case 'account':
905
907
  await wallet.loadAccount(true);
906
- break;
908
+ return mainMenu();
907
909
  case 'exit':
908
910
  process.exit();
909
911
  }
910
912
  }
913
+
914
+ // Start the application
915
+ mainMenu();
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "hodl-wallet",
3
- "version": "1.7.0",
3
+ "version": "1.7.4",
4
4
  "description": "🧊 HODL Wallet - Fast CLI crypto wallet!",
5
- "author": "Martin Cl6sen",
5
+ "author": "Martin Clasen",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/clasen/HODL.git"