@yerofey/cryptowallet-cli 1.4.1 → 1.5.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # cryptowallet-cli
2
2
 
3
- > Crypto wallet generator CLI tool
3
+ > Crypto wallet generator CLI tool (currently works only on Mac and Linux, sorry Windows users)
4
4
 
5
5
  ![Screenshot](https://i.imgur.com/KBb7NqW.png)
6
6
 
@@ -56,7 +56,7 @@ $ cw -c BNB -f BEP20 -m "radio bright pizza pluck family crawl palm flame forget
56
56
  # generate just a mnemonic string (12 words) to import in any wallet app
57
57
  $ cw -m
58
58
 
59
- # list all supported cryptos
59
+ # list all supported blockchains
60
60
  $ cw -l
61
61
  ```
62
62
 
@@ -89,17 +89,17 @@ $ cw -l
89
89
  *\*all other cryptos that are tokens in the ecosystems like Ethereum, Binance Smart Chain or Polygon and others (EVM compatible) are supported too, you just need to create ERC wallet (that is set by default)*
90
90
 
91
91
  ## Options
92
- * `-c` or `--coin`: Specify the ticker of a coin to generate wallet for
93
- * `-f` or `--format`: Specify cryptocurrency wallet format (for BTC: legacy, segwit, bech32)
92
+ * `-b` or `-c` or `--chain`: Specify the blockchain ticker to generate a wallet for
93
+ * `-f` or `--format`: Specify the blockchain wallet format (for BTC: legacy, segwit, bech32)
94
94
  * `-g` or `--geek`: Display some additional "geeky" info
95
- * `-l` or `--list`: List all supported cryptocurrencies
95
+ * `-l` or `--list`: List all supported blockchains
96
96
  * `-m` or `--mnemonic`: Use a bip39 mnemonic phrase (if is set) to generate wallet, or leave it empty to generate new one
97
97
  * `-n` or `--number`: Specify number of wallets to display (works for HD wallets only, like BTC/LTC/DOGE)
98
- * `-p` or `--prefix`: Specify desired prefix of an wallet address (**case-insensitive**)
99
- * `-P` or `--prefix-sensitive`: Specify desired prefix of an wallet address (**case-sensitive**)
100
- * `-s` or `--suffix`: Specify desired suffix of an wallet address (**case-insensitive**)
101
- * `-S` or `--suffix-sensitive`: Specify desired suffix of an wallet address (**case-sensitive**)
102
- * `-v` or `--version`: Display the version of CW tool
98
+ * `-p` or `--prefix`: Specify desired prefix for the wallet address (**case-insensitive**)
99
+ * `-P` or `--prefix-sensitive`: Specify desired prefix of the wallet address (**case-sensitive**)
100
+ * `-s` or `--suffix`: Specify desired suffix for the wallet address (**case-insensitive**)
101
+ * `-S` or `--suffix-sensitive`: Specify desired suffix for the wallet address (**case-sensitive**)
102
+ * `-v` or `--version`: Display current version of CW tool
103
103
 
104
104
  ## Highlights
105
105
  - 24+ blockchains supported
package/cli.js CHANGED
@@ -3,10 +3,11 @@
3
3
 
4
4
  const { program } = require('commander');
5
5
  const chalk = require('chalk');
6
- const { log, supportedCoins } = require('./src/utils');
6
+ const { log, supportedChains } = require('./src/utils');
7
7
  const Method = require('./src/Method');
8
8
 
9
- program.option('-c, --coin <ticker>', 'Wallet for specific coin', 'ERC');
9
+ program.option('-b, --chain <ticker>', 'Wallet for specific blockchain', 'ERC');
10
+ program.option('-c, --chain <ticker>', 'Wallet for specific blockchain', 'ERC');
10
11
  program.option('-f, --format <format>', 'Wallet format type (for cryptos with multiple wallet formats)');
11
12
  program.option('-g, --geek', 'Display some more info (geeky)');
12
13
  program.option('-l, --list', 'List all supported cryptos');
@@ -34,13 +35,13 @@ program.parse();
34
35
  return new Method('version').init();
35
36
  }
36
37
 
37
- const coin = (options.coin).toUpperCase() || '';
38
- if (supportedCoins.includes(coin)) {
38
+ const chain = (options.chain).toUpperCase() || '';
39
+ if (supportedChains.includes(chain)) {
39
40
  return new Method('wallet', {
40
- coin,
41
- options
41
+ chain,
42
+ options,
42
43
  }).init();
43
44
  }
44
45
 
45
- log(chalk.red('⛔️ Error: coin not supported!'));
46
+ log(chalk.red('⛔️ Error: this blockchain is not supported!'));
46
47
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yerofey/cryptowallet-cli",
3
- "version": "1.4.1",
3
+ "version": "1.5.2",
4
4
  "homepage": "https://github.com/yerofey/cryptowallet-cli",
5
5
  "author": "Yerofey S. <pm@yerofey.dev> (https://github.com/yerofey)",
6
6
  "bin": {
package/src/CW.js CHANGED
@@ -1,10 +1,10 @@
1
- const Coin = require('./Coin');
1
+ const Chain = require('./Chain');
2
2
  const { Wallet } = require('./Wallet');
3
3
 
4
4
  class CW {
5
- constructor(coin, options = {}) {
5
+ constructor(chain, options = {}) {
6
6
  const defaultValues = {
7
- coin: coin || options.coin || '',
7
+ chain: chain || options.chain || '',
8
8
  format: '',
9
9
  geek: false,
10
10
  mnemonic: '',
@@ -21,9 +21,9 @@ class CW {
21
21
  }
22
22
  }
23
23
 
24
- this.coin = coin;
24
+ this.chain = chain;
25
25
  this.options = options;
26
- this.row = new Coin(coin, options.format).row;
26
+ this.row = new Chain(chain, options.format).row;
27
27
  }
28
28
 
29
29
  async init() {
@@ -1,6 +1,6 @@
1
- class Coin {
2
- constructor(coin, format) {
3
- const content = require('./coins/' + coin + '.json') || {};
1
+ class Chain {
2
+ constructor(chain, format) {
3
+ const content = require('./chains/' + chain + '.json') || {};
4
4
  const data = (() => {
5
5
  if (content.formats !== undefined) {
6
6
  if (format != '' && format != content.defaultFormat) {
@@ -25,4 +25,4 @@ class Coin {
25
25
  }
26
26
  }
27
27
 
28
- module.exports = Coin;
28
+ module.exports = Chain;
package/src/Method.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const chalk = require('chalk');
2
2
  const columnify = require('columnify');
3
- const { log, supportedCoins } = require('./utils');
3
+ const { log, supportedChains } = require('./utils');
4
4
  const { generateMnemonicString } = require('./Wallet');
5
5
  const selfInfo = require('../package.json');
6
6
  const CW = require('./CW');
@@ -15,10 +15,10 @@ class Method {
15
15
  const callMethod = {
16
16
  '_': () => {},
17
17
  'list': () => {
18
- log(`🔠 All supported cryptos:\n`);
18
+ log(`🔠 All supported blockchains:\n`);
19
19
  let cryptos = {};
20
- for (const val of supportedCoins) {
21
- const data = require('./coins/' + val + '.json');
20
+ for (const val of supportedChains) {
21
+ const data = require('./chains/' + val + '.json');
22
22
  let title = data.title || '';
23
23
  if (title == '' || val == 'ERC') {
24
24
  continue;
@@ -30,7 +30,7 @@ class Method {
30
30
  columnSplitter: ' - ',
31
31
  }));
32
32
  log();
33
- log(`ℹ️ Use flag "-c TICKER" to select specific coin`);
33
+ log(`ℹ️ Use flag "-c TICKER" to select specific blockchain`);
34
34
  },
35
35
  'mnemonic': () => {
36
36
  log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your randomly generated 12 words mnemonic string:')}\n`);
@@ -42,23 +42,23 @@ class Method {
42
42
  log(selfInfo.version);
43
43
  },
44
44
  'wallet': async () => {
45
- const coin = this.params.coin;
45
+ const chain = this.params.chain;
46
46
  const options = this.params.options;
47
47
 
48
- const cw = await new CW(coin, options).init();
48
+ const cw = await new CW(chain, options).init();
49
49
 
50
- let coinFullName = (cw.row.name || coin) + (cw.wallet.format !== undefined && cw.wallet.format != '' ? ' (' + cw.wallet.format + ')' : '');
50
+ let chainFullName = (cw.row.name || chain) + (cw.wallet.format !== undefined && cw.wallet.format != '' ? ' (' + cw.wallet.format + ')' : '');
51
51
 
52
52
  if (cw.options.prefix && !cw.prefixFound) {
53
- log(`😢 ${chalk.yellow('Sorry, ' + coinFullName + ' does not support prefix yet...')}`);
53
+ log(`😢 ${chalk.yellow('Sorry, ' + chainFullName + ' does not support prefix yet...')}`);
54
54
  }
55
55
 
56
56
  if (cw.options.suffix && !cw.suffixFound) {
57
- log(`😢 ${chalk.yellow('Sorry, ' + coinFullName + ' does not support suffix yet...')}`);
57
+ log(`😢 ${chalk.yellow('Sorry, ' + chainFullName + ' does not support suffix yet...')}`);
58
58
  }
59
59
 
60
60
  if (cw.options.mnemonic != '' && cw.wallet.mnemonic == undefined) {
61
- log(`😢 ${chalk.yellow('Sorry, ' + coinFullName + ' does not support mnemonic yet...')}`);
61
+ log(`😢 ${chalk.yellow('Sorry, ' + chainFullName + ' does not support mnemonic yet...')}`);
62
62
  }
63
63
 
64
64
  if (cw.wallet.error !== undefined) {
@@ -68,13 +68,13 @@ class Method {
68
68
 
69
69
  // prefix, suffix
70
70
  if (cw.prefixFound && cw.suffixFound) {
71
- log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + coinFullName + ' wallet with "' + cw.options.prefix + '" prefix and "' + cw.options.suffix + '" suffix:')}\n`);
71
+ log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + chainFullName + ' wallet with "' + cw.options.prefix + '" prefix and "' + cw.options.suffix + '" suffix:')}\n`);
72
72
  } else if (cw.prefixFound) {
73
- log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + coinFullName + ' wallet with "' + cw.options.prefix + '" prefix:')}\n`);
73
+ log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + chainFullName + ' wallet with "' + cw.options.prefix + '" prefix:')}\n`);
74
74
  } else if (cw.suffixFound) {
75
- log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + coinFullName + ' wallet with "' + cw.options.suffix + '" suffix:')}\n`);
75
+ log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + chainFullName + ' wallet with "' + cw.options.suffix + '" suffix:')}\n`);
76
76
  } else {
77
- log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + coinFullName + ' wallet:')}\n`);
77
+ log(`✨ ${chalk.green('Done!')} ${chalk.blueBright('Here is your brand new ' + chainFullName + ' wallet:')}\n`);
78
78
  }
79
79
 
80
80
  // result
package/src/Wallet.js CHANGED
@@ -120,7 +120,7 @@ class Wallet {
120
120
 
121
121
  async createWallet() {
122
122
  const cw = this.cw;
123
- const coin = cw.coin;
123
+ const chain = cw.chain;
124
124
  const row = cw.row;
125
125
  const options = cw.options;
126
126
 
@@ -131,7 +131,7 @@ class Wallet {
131
131
 
132
132
  if (row.length == 0) {
133
133
  return {
134
- error: 'coin not found',
134
+ error: 'this blockchain is not found',
135
135
  }
136
136
  }
137
137
 
@@ -139,7 +139,7 @@ class Wallet {
139
139
  const CoinKey = require('coinkey');
140
140
  const CoinInfo = require('coininfo');
141
141
 
142
- const wallet = CoinKey.createRandom(CoinInfo(coin).versions);
142
+ const wallet = CoinKey.createRandom(CoinInfo(chain).versions);
143
143
 
144
144
  result = Object.assign(result, {
145
145
  format,
@@ -149,7 +149,7 @@ class Wallet {
149
149
  privateKey: wallet.privateWif,
150
150
  }]
151
151
  });
152
- } else if (coin == 'BTC') {
152
+ } else if (chain == 'BTC') {
153
153
  const bip39 = require('bip39');
154
154
  const { fromMnemonic, fromZPrv } = require('bip84');
155
155
 
@@ -181,7 +181,7 @@ class Wallet {
181
181
  privateExtendedKey: account.getAccountPrivateKey(),
182
182
  mnemonic
183
183
  });
184
- } else if (coin == 'DOGE' || coin == 'LTC') {
184
+ } else if (chain == 'DOGE' || chain == 'LTC') {
185
185
  const bip39 = require('bip39');
186
186
  const { fromMnemonic, fromZPrv } = require('@yerofey/' + row.title.toLowerCase() + '-bip84');
187
187
 
@@ -295,7 +295,7 @@ class Wallet {
295
295
  addresses,
296
296
  mnemonic,
297
297
  });
298
- } else if (coin == 'ONE') {
298
+ } else if (chain == 'ONE') {
299
299
  const bip39 = require('bip39');
300
300
  const { Wallet } = require('@harmony-js/account');
301
301
 
@@ -319,7 +319,7 @@ class Wallet {
319
319
  }],
320
320
  mnemonic,
321
321
  });
322
- } else if (coin == 'TRX') {
322
+ } else if (chain == 'TRX') {
323
323
  const tronWeb = require('tronweb');
324
324
 
325
325
  try {
@@ -337,7 +337,7 @@ class Wallet {
337
337
  error
338
338
  }
339
339
  }
340
- } else if (coin == 'XTZ') {
340
+ } else if (chain == 'XTZ') {
341
341
  const tezos = require('tezos-sign');
342
342
  const wallet = tezos.generateKeysNoSeed();
343
343
 
@@ -350,7 +350,7 @@ class Wallet {
350
350
  });
351
351
  } else {
352
352
  return {
353
- error: 'coin is not supported yet'
353
+ error: 'your desired blockchain is not supported yet'
354
354
  }
355
355
  }
356
356
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/utils.js CHANGED
@@ -13,13 +13,13 @@ const filesList = (dir) => {
13
13
 
14
14
  const objectHasAllKeys = (obj, keysArray) => keysArray.every(item => obj.hasOwnProperty(item));
15
15
 
16
- let supportedCoins = [];
17
- const coinsFolder = __dirname + '/coins/';
18
- filesList(coinsFolder).forEach((item) => {
19
- const name = item.replace(coinsFolder, '').replace('.json', '');
20
- supportedCoins.push(name);
16
+ let supportedChains = [];
17
+ const chainsFolder = __dirname + '/chains/';
18
+ filesList(chainsFolder).forEach((item) => {
19
+ const name = item.replace(chainsFolder, '').replace('.json', '');
20
+ supportedChains.push(name);
21
21
  });
22
22
 
23
23
  module.exports.log = log;
24
24
  module.exports.objectHasAllKeys = objectHasAllKeys;
25
- module.exports.supportedCoins = supportedCoins;
25
+ module.exports.supportedChains = supportedChains;