@yerofey/cryptowallet-cli 1.19.0 â 1.21.0
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/cli.js +2 -2
- package/package.json +3 -1
- package/src/Method.js +26 -2
- package/src/Wallet.js +25 -12
- package/src/chains/ERC.json +1 -1
- package/src/chains/SOL.json +1 -1
- package/src/chains/TON.json +1 -1
- package/src/options.js +1 -0
package/README.md
CHANGED
|
@@ -137,6 +137,7 @@ $ cw -l
|
|
|
137
137
|
## Options
|
|
138
138
|
|
|
139
139
|
- `-b` or `-c` or `--chain`: Specify the blockchain ticker to generate a wallet for
|
|
140
|
+
- `-C` or `--copy`: Copy the generated mnemonic to the clipboard
|
|
140
141
|
- `-D` or `--csv`: Save output into CSV file with custom or default name ("`cw-output.csv`") - this is a shorthand for `-o csv -F filename`
|
|
141
142
|
- `-f` or `--format`: Specify the blockchain wallet format (for BTC: legacy, segwit, bech32)
|
|
142
143
|
- `-g` or `--geek`: Display some additional "geeky" info
|
package/cli.js
CHANGED
|
@@ -18,7 +18,7 @@ import Method from './src/Method.js';
|
|
|
18
18
|
options.mnemonic === '' ||
|
|
19
19
|
options.mnemonic.split(' ').length === 1)
|
|
20
20
|
) {
|
|
21
|
-
return new Method('mnemonic').init({ mnemonic: options.mnemonic });
|
|
21
|
+
return new Method('mnemonic').init({ mnemonic: options.mnemonic, copy: options?.copy || false });
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (options.version) {
|
|
@@ -29,7 +29,7 @@ import Method from './src/Method.js';
|
|
|
29
29
|
return new Method('donate').init();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
const chain = options.chain.toUpperCase() || '
|
|
32
|
+
const chain = options.chain.toUpperCase() || 'ERC';
|
|
33
33
|
if (supportedChains.includes(chain)) {
|
|
34
34
|
return new Method('wallet', {
|
|
35
35
|
chain,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yerofey/cryptowallet-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "Crypto wallet generator CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/yerofey/cryptowallet-cli",
|
|
@@ -114,12 +114,14 @@
|
|
|
114
114
|
"bs58": "^5.0.0",
|
|
115
115
|
"buffer": "^6.0.3",
|
|
116
116
|
"chalk": "5.3.0",
|
|
117
|
+
"clipboardy": "^4.0.0",
|
|
117
118
|
"coininfo": "5.2.1",
|
|
118
119
|
"coinkey": "3.0.0",
|
|
119
120
|
"columnify": "1.6.0",
|
|
120
121
|
"commander": "11.1.0",
|
|
121
122
|
"csv-writer": "^1.6.0",
|
|
122
123
|
"dotenv": "^16.4.1",
|
|
124
|
+
"ed25519-hd-key": "^1.3.0",
|
|
123
125
|
"eth-lib": "0.1.29",
|
|
124
126
|
"ethereum-bip84": "0.0.3",
|
|
125
127
|
"ethereum-mnemonic-privatekey-utils": "1.0.5",
|
package/src/Method.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { config } from 'dotenv';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
+
import clipboardy from 'clipboardy';
|
|
4
5
|
import columnify from 'columnify';
|
|
5
6
|
import CsvWriter from 'csv-writer';
|
|
6
7
|
import { log, supportedChains, loadJson } from './utils.js';
|
|
@@ -69,6 +70,7 @@ class Method {
|
|
|
69
70
|
const mnemonicLength = ['12', '18', '24'].includes(mnemonic)
|
|
70
71
|
? parseInt(mnemonic, 10)
|
|
71
72
|
: 12;
|
|
73
|
+
const mnemonicString = generateMnemonicString(mnemonicLength);
|
|
72
74
|
|
|
73
75
|
log(
|
|
74
76
|
`⨠${green('Done!')} ${blueBright(
|
|
@@ -77,13 +79,26 @@ class Method {
|
|
|
77
79
|
} words mnemonic string:`
|
|
78
80
|
)}\n`
|
|
79
81
|
);
|
|
80
|
-
log(`đ ${
|
|
82
|
+
log(`đ ${mnemonicString}`);
|
|
83
|
+
// copy to clipboard if flag is set
|
|
84
|
+
if (this.inputOptions.copy) {
|
|
85
|
+
clipboardy.writeSync(mnemonicString);
|
|
86
|
+
log(`đ ${green('Mnemonic copied to your clipboard!')}`);
|
|
87
|
+
}
|
|
81
88
|
log();
|
|
82
89
|
log(
|
|
83
90
|
greenBright(
|
|
84
91
|
'âšī¸ You can import it into your favorite wallet app or use it to generate a wallet with "-m" flag'
|
|
85
92
|
)
|
|
86
93
|
);
|
|
94
|
+
|
|
95
|
+
// donation
|
|
96
|
+
log();
|
|
97
|
+
log(
|
|
98
|
+
blueBright(
|
|
99
|
+
'đ Consider supporting this project - check donations options with: cw --donate'
|
|
100
|
+
)
|
|
101
|
+
);
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
_version() {
|
|
@@ -199,6 +214,7 @@ class Method {
|
|
|
199
214
|
|
|
200
215
|
if (displayAsText) {
|
|
201
216
|
// display addresses
|
|
217
|
+
let index = 0;
|
|
202
218
|
for (const item of cw.wallet.addresses) {
|
|
203
219
|
if (cw.wallet.addresses.length > 1) {
|
|
204
220
|
log();
|
|
@@ -350,6 +366,13 @@ class Method {
|
|
|
350
366
|
if (item.privateKey !== undefined) {
|
|
351
367
|
log(`đ ${item.privateKey}`);
|
|
352
368
|
}
|
|
369
|
+
// copy to clipboard if flag is set
|
|
370
|
+
if (cw.options.copy && cw.wallet.mnemonic !== undefined && index == 0) {
|
|
371
|
+
clipboardy.writeSync(cw.wallet.mnemonic);
|
|
372
|
+
log(`đ ${green('Mnemonic copied to your clipboard!')}`);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
index += 1;
|
|
353
376
|
}
|
|
354
377
|
|
|
355
378
|
// tested
|
|
@@ -418,7 +441,7 @@ class Method {
|
|
|
418
441
|
}
|
|
419
442
|
}
|
|
420
443
|
|
|
421
|
-
// formats, network, apps
|
|
444
|
+
// formats, network, apps, attempts, donation
|
|
422
445
|
if (displayAsText) {
|
|
423
446
|
if (
|
|
424
447
|
cw.row.formats !== undefined ||
|
|
@@ -468,6 +491,7 @@ class Method {
|
|
|
468
491
|
);
|
|
469
492
|
}
|
|
470
493
|
|
|
494
|
+
// apps
|
|
471
495
|
if (cw.row.apps !== undefined) {
|
|
472
496
|
let apps = {
|
|
473
497
|
metamask: 'MetaMask',
|
package/src/Wallet.js
CHANGED
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
Keypair as SolanaKeypair,
|
|
25
25
|
PublicKey as SolanaPublickey,
|
|
26
26
|
} from '@solana/web3.js';
|
|
27
|
+
import { derivePath } from 'ed25519-hd-key';
|
|
27
28
|
import bs58 from 'bs58';
|
|
28
29
|
import TonWeb from 'tonweb';
|
|
29
30
|
import {
|
|
@@ -428,21 +429,33 @@ class Wallet {
|
|
|
428
429
|
mnemonic,
|
|
429
430
|
});
|
|
430
431
|
} else if (chain == 'SOL') {
|
|
431
|
-
//
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
432
|
+
// Validate mnemonic
|
|
433
|
+
if (mnemonicString != '' && !bip39.validateMnemonic(mnemonicString)) {
|
|
434
|
+
return {
|
|
435
|
+
error: 'mnemonic is not valid',
|
|
436
|
+
};
|
|
437
|
+
}
|
|
435
438
|
|
|
436
|
-
|
|
439
|
+
let addresses = [];
|
|
440
|
+
const mnemonic = mnemonicString || generateMnemonicString(24);
|
|
441
|
+
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
442
|
+
|
|
443
|
+
for (let i = 0; i < number; i++) {
|
|
444
|
+
const derivationPath = `m/44'/501'/${i}'/0'`;
|
|
445
|
+
const derivedSeed = derivePath(derivationPath, seed.toString('hex')).key;
|
|
446
|
+
const keypair = SolanaKeypair.fromSeed(derivedSeed);
|
|
447
|
+
const publicKey = new SolanaPublickey(keypair.publicKey);
|
|
448
|
+
const privateKey = bs58.encode(keypair.secretKey);
|
|
449
|
+
addresses.push({
|
|
450
|
+
index: i,
|
|
451
|
+
address: publicKey.toBase58(),
|
|
452
|
+
privateKey,
|
|
453
|
+
});
|
|
454
|
+
}
|
|
437
455
|
|
|
438
456
|
Object.assign(result, {
|
|
439
|
-
addresses
|
|
440
|
-
|
|
441
|
-
index: 0,
|
|
442
|
-
address: publicKeyString,
|
|
443
|
-
privateKey: secretKeyString,
|
|
444
|
-
},
|
|
445
|
-
],
|
|
457
|
+
addresses,
|
|
458
|
+
mnemonic,
|
|
446
459
|
});
|
|
447
460
|
} else if (chain == 'TON') {
|
|
448
461
|
// Validate mnemonic
|
package/src/chains/ERC.json
CHANGED
package/src/chains/SOL.json
CHANGED
package/src/chains/TON.json
CHANGED
package/src/options.js
CHANGED
|
@@ -3,6 +3,7 @@ import { program } from 'commander';
|
|
|
3
3
|
|
|
4
4
|
program.option('-b, --chain <ticker>', 'Wallet for specific blockchain', 'ERC');
|
|
5
5
|
program.option('-c, --chain <ticker>', 'Wallet for specific blockchain', 'ERC');
|
|
6
|
+
program.option('-C, --copy', 'Copy the result to the clipboard');
|
|
6
7
|
program.option(
|
|
7
8
|
'-D, --csv [filename]',
|
|
8
9
|
'Save result into CSV file'
|