@yerofey/cryptowallet-cli 1.22.2 → 1.23.1
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 +2 -0
- package/package.json +1 -1
- package/src/Method.js +40 -6
- package/src/Wallet.js +14 -2
- package/src/chains/TON.json +1 -1
package/README.md
CHANGED
package/package.json
CHANGED
package/src/Method.js
CHANGED
|
@@ -9,8 +9,17 @@ import { generateMnemonicString } from './Wallet.js';
|
|
|
9
9
|
import CW from './CW.js';
|
|
10
10
|
|
|
11
11
|
config();
|
|
12
|
-
const {
|
|
13
|
-
|
|
12
|
+
const {
|
|
13
|
+
blue,
|
|
14
|
+
green,
|
|
15
|
+
blueBright,
|
|
16
|
+
greenBright,
|
|
17
|
+
cyan,
|
|
18
|
+
yellow,
|
|
19
|
+
red,
|
|
20
|
+
magenta,
|
|
21
|
+
white,
|
|
22
|
+
} = chalk;
|
|
14
23
|
// eslint-disable-next-line no-undef
|
|
15
24
|
const IS_DEV = process.env.NODE_ENV === 'development' || false;
|
|
16
25
|
const pkg = await loadJson(
|
|
@@ -199,6 +208,7 @@ class Method {
|
|
|
199
208
|
}
|
|
200
209
|
|
|
201
210
|
// result
|
|
211
|
+
let matchingWalletsIndexes = [];
|
|
202
212
|
let outputData = {};
|
|
203
213
|
if (cw.wallet.addresses !== undefined) {
|
|
204
214
|
// private key
|
|
@@ -285,6 +295,7 @@ class Method {
|
|
|
285
295
|
} else {
|
|
286
296
|
log(`👛 ${item.address}`);
|
|
287
297
|
}
|
|
298
|
+
matchingWalletsIndexes.push(index);
|
|
288
299
|
} else if (
|
|
289
300
|
cw.prefixFound &&
|
|
290
301
|
cw.prefixFoundInWallets.includes(item.address)
|
|
@@ -334,6 +345,7 @@ class Method {
|
|
|
334
345
|
} else {
|
|
335
346
|
log(`👛 ${item.address}`);
|
|
336
347
|
}
|
|
348
|
+
matchingWalletsIndexes.push(index);
|
|
337
349
|
} else if (
|
|
338
350
|
cw.suffixFound &&
|
|
339
351
|
cw.suffixFoundInWallets.includes(item.address)
|
|
@@ -360,6 +372,7 @@ class Method {
|
|
|
360
372
|
} else {
|
|
361
373
|
log(`👛 ${item.address}`);
|
|
362
374
|
}
|
|
375
|
+
matchingWalletsIndexes.push(index);
|
|
363
376
|
} else {
|
|
364
377
|
log(`👛 ${item.address}`);
|
|
365
378
|
}
|
|
@@ -367,7 +380,11 @@ class Method {
|
|
|
367
380
|
log(`🔑 ${item.privateKey}`);
|
|
368
381
|
}
|
|
369
382
|
// copy to clipboard if flag is set
|
|
370
|
-
if (
|
|
383
|
+
if (
|
|
384
|
+
cw.options.copy &&
|
|
385
|
+
cw.wallet.mnemonic !== undefined &&
|
|
386
|
+
index == 0
|
|
387
|
+
) {
|
|
371
388
|
clipboardy.writeSync(cw.wallet.mnemonic);
|
|
372
389
|
log(`📋 ${green('Mnemonic copied to your clipboard!')}`);
|
|
373
390
|
}
|
|
@@ -452,12 +469,29 @@ class Method {
|
|
|
452
469
|
log();
|
|
453
470
|
}
|
|
454
471
|
|
|
472
|
+
// matching wallets
|
|
473
|
+
if (
|
|
474
|
+
cw.options.number &&
|
|
475
|
+
cw.options.number > 1 &&
|
|
476
|
+
matchingWalletsIndexes.length > 0
|
|
477
|
+
) {
|
|
478
|
+
const foundCount = matchingWalletsIndexes.length;
|
|
479
|
+
const foundMany = foundCount !== 1;
|
|
480
|
+
log(
|
|
481
|
+
cyan(
|
|
482
|
+
`🔍 Found ${foundCount} matching wallet${
|
|
483
|
+
foundMany ? 's' : ''
|
|
484
|
+
}: 🆔${matchingWalletsIndexes.join(',')}`
|
|
485
|
+
)
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
|
|
455
489
|
// attempts
|
|
456
|
-
if (cw.attempts !== undefined && cw.attempts >
|
|
490
|
+
if (cw.attempts !== undefined && cw.attempts > 1 && cw.options.geek) {
|
|
457
491
|
log(
|
|
458
|
-
|
|
492
|
+
`*️⃣ It took ${cw.attempts} attempt${
|
|
459
493
|
cw.attempts !== 1 ? 's' : ''
|
|
460
|
-
} to generate
|
|
494
|
+
} to generate a wallet`
|
|
461
495
|
);
|
|
462
496
|
log();
|
|
463
497
|
}
|
package/src/Wallet.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { config } from 'dotenv';
|
|
2
2
|
import { log } from './utils.js';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
|
-
const { red } = chalk;
|
|
4
|
+
const { red, yellow } = chalk;
|
|
5
5
|
import CoinKey from 'coinkey';
|
|
6
6
|
import CoinInfo from 'coininfo';
|
|
7
7
|
import bip39 from 'bip39';
|
|
@@ -93,6 +93,15 @@ class Wallet {
|
|
|
93
93
|
(options.suffix && row.flags.includes('s'))
|
|
94
94
|
) {
|
|
95
95
|
if (badSymbolsArray.length === 0) {
|
|
96
|
+
// suggest to generate multiple wallets addresses (if it is supported by the settings)
|
|
97
|
+
if (row.flags.includes('n') && (!options.number || options.number == 1)) {
|
|
98
|
+
log(
|
|
99
|
+
yellow(
|
|
100
|
+
'💡 You can speed up the process significantly by generating multiple addresses for each wallet. Example: cw -n 10'
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
96
105
|
if (options.prefix && options.suffix) {
|
|
97
106
|
// prefix & suffix
|
|
98
107
|
log(
|
|
@@ -442,7 +451,10 @@ class Wallet {
|
|
|
442
451
|
|
|
443
452
|
for (let i = 0; i < number; i++) {
|
|
444
453
|
const derivationPath = `m/44'/501'/${i}'/0'`;
|
|
445
|
-
const derivedSeed = derivePath(
|
|
454
|
+
const derivedSeed = derivePath(
|
|
455
|
+
derivationPath,
|
|
456
|
+
seed.toString('hex')
|
|
457
|
+
).key;
|
|
446
458
|
const keypair = SolanaKeypair.fromSeed(derivedSeed);
|
|
447
459
|
const publicKey = new SolanaPublickey(keypair.publicKey);
|
|
448
460
|
const privateKey = bs58.encode(keypair.secretKey);
|