@yerofey/cryptowallet-cli 1.18.1 → 1.18.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/package.json +2 -1
- package/src/Method.js +88 -28
- package/src/chains/SOL.json +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yerofey/cryptowallet-cli",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.2",
|
|
4
4
|
"description": "Crypto wallet generator CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/yerofey/cryptowallet-cli",
|
|
@@ -119,6 +119,7 @@
|
|
|
119
119
|
"columnify": "1.6.0",
|
|
120
120
|
"commander": "11.1.0",
|
|
121
121
|
"csv-writer": "^1.6.0",
|
|
122
|
+
"dotenv": "^16.4.1",
|
|
122
123
|
"eth-lib": "0.1.29",
|
|
123
124
|
"ethereum-bip84": "0.0.3",
|
|
124
125
|
"ethereum-mnemonic-privatekey-utils": "1.0.5",
|
package/src/Method.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { config } from 'dotenv';
|
|
1
2
|
import path from 'node:path';
|
|
2
3
|
import chalk from 'chalk';
|
|
3
4
|
import columnify from 'columnify';
|
|
@@ -6,9 +7,10 @@ import { log, supportedChains, loadJson } from './utils.js';
|
|
|
6
7
|
import { generateMnemonicString } from './Wallet.js';
|
|
7
8
|
import CW from './CW.js';
|
|
8
9
|
|
|
10
|
+
config();
|
|
9
11
|
const { blue, green, blueBright, greenBright, yellow, red, magenta, white } =
|
|
10
12
|
chalk;
|
|
11
|
-
|
|
13
|
+
const IS_DEV = process.env.NODE_ENV === 'development' || false;
|
|
12
14
|
const pkg = await loadJson(
|
|
13
15
|
`${path.dirname(import.meta.url)}/../package.json`.replace('file://', '')
|
|
14
16
|
);
|
|
@@ -218,14 +220,23 @@ class Method {
|
|
|
218
220
|
cw.suffixFoundInWallets.includes(item.address)
|
|
219
221
|
) {
|
|
220
222
|
// highlight found prefix and suffix
|
|
221
|
-
const addressStartingSymbol =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
const addressStartingSymbol =
|
|
224
|
+
startsWithSymbols.filter((symbol) =>
|
|
225
|
+
item.address.startsWith(symbol)
|
|
226
|
+
)[0] || '';
|
|
227
|
+
const addressCutPrefixLength = addressStartingSymbol.length || 0;
|
|
228
|
+
let addressHighlightedPart;
|
|
229
|
+
if (addressCutPrefixLength > 0) {
|
|
230
|
+
addressHighlightedPart = item.address.substring(
|
|
231
|
+
addressCutPrefixLength + cw.options.prefix.length,
|
|
232
|
+
cw.options.prefix.length
|
|
233
|
+
);
|
|
234
|
+
} else {
|
|
235
|
+
addressHighlightedPart = item.address.substring(
|
|
236
|
+
0,
|
|
237
|
+
cw.options.prefix.length
|
|
238
|
+
);
|
|
239
|
+
}
|
|
229
240
|
const addressLastPart = item.address.slice(
|
|
230
241
|
cw.options.prefix.length + addressCutPrefixLength,
|
|
231
242
|
item.address.length - cw.options.suffix.length
|
|
@@ -233,45 +244,94 @@ class Method {
|
|
|
233
244
|
const addressHighlightedSuffix = item.address.slice(
|
|
234
245
|
item.address.length - cw.options.suffix.length
|
|
235
246
|
);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
247
|
+
const fullAddressLength =
|
|
248
|
+
addressStartingSymbol.length +
|
|
249
|
+
addressHighlightedPart.length +
|
|
250
|
+
addressLastPart.length +
|
|
251
|
+
addressHighlightedSuffix.length;
|
|
252
|
+
// show hightlighted address (only if it's length is the same as the original address length)
|
|
253
|
+
if (fullAddressLength == item.address.length || IS_DEV) {
|
|
254
|
+
log(
|
|
255
|
+
`👛 ${addressStartingSymbol}${magenta(
|
|
256
|
+
addressHighlightedPart
|
|
257
|
+
)}${addressLastPart}${magenta(addressHighlightedSuffix)}`
|
|
258
|
+
);
|
|
259
|
+
// DEBUG
|
|
260
|
+
if (IS_DEV) {
|
|
261
|
+
log(`___ ${item.address}`);
|
|
262
|
+
}
|
|
263
|
+
} else {
|
|
264
|
+
log(`👛 ${item.address}`);
|
|
265
|
+
}
|
|
241
266
|
} else if (
|
|
242
267
|
cw.prefixFound &&
|
|
243
268
|
cw.prefixFoundInWallets.includes(item.address)
|
|
244
269
|
) {
|
|
245
270
|
// highlight found prefix
|
|
246
|
-
const addressStartingSymbol =
|
|
247
|
-
|
|
248
|
-
|
|
271
|
+
const addressStartingSymbol =
|
|
272
|
+
startsWithSymbols.filter((symbol) =>
|
|
273
|
+
item.address.startsWith(symbol)
|
|
274
|
+
)[0] || '';
|
|
249
275
|
const addressCutPrefixLength = addressStartingSymbol.length || 0;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
276
|
+
let addressHighlightedPart;
|
|
277
|
+
if (addressCutPrefixLength > 0) {
|
|
278
|
+
addressHighlightedPart = item.address.substring(
|
|
279
|
+
addressCutPrefixLength + cw.options.prefix.length,
|
|
280
|
+
cw.options.prefix.length
|
|
281
|
+
);
|
|
282
|
+
} else {
|
|
283
|
+
addressHighlightedPart = item.address.substring(
|
|
284
|
+
0,
|
|
285
|
+
cw.options.prefix.length
|
|
286
|
+
);
|
|
287
|
+
}
|
|
254
288
|
const addressLastPart = item.address.slice(
|
|
255
289
|
cw.options.prefix.length + addressCutPrefixLength
|
|
256
290
|
);
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
)
|
|
291
|
+
const fullAddressLength =
|
|
292
|
+
addressStartingSymbol.length +
|
|
293
|
+
addressHighlightedPart.length +
|
|
294
|
+
addressLastPart.length;
|
|
295
|
+
// show hightlighted address (only if it's length is the same as the original address length)
|
|
296
|
+
if (fullAddressLength == item.address.length || IS_DEV) {
|
|
297
|
+
log(
|
|
298
|
+
`👛 ${addressStartingSymbol}${magenta(
|
|
299
|
+
addressHighlightedPart
|
|
300
|
+
)}${addressLastPart}`
|
|
301
|
+
);
|
|
302
|
+
// DEBUG
|
|
303
|
+
if (IS_DEV) {
|
|
304
|
+
log(`___ ${item.address}`);
|
|
305
|
+
}
|
|
306
|
+
} else {
|
|
307
|
+
log(`👛 ${item.address}`);
|
|
308
|
+
}
|
|
262
309
|
} else if (
|
|
263
310
|
cw.suffixFound &&
|
|
264
311
|
cw.suffixFoundInWallets.includes(item.address)
|
|
265
312
|
) {
|
|
266
313
|
// highlight found suffix
|
|
267
|
-
const
|
|
314
|
+
const addressFirstPart = item.address.slice(
|
|
268
315
|
0,
|
|
269
316
|
item.address.length - cw.options.suffix.length
|
|
270
317
|
);
|
|
271
318
|
const addressHighlightedSuffix = item.address.slice(
|
|
272
319
|
item.address.length - cw.options.suffix.length
|
|
273
320
|
);
|
|
274
|
-
|
|
321
|
+
const fullAddressLength =
|
|
322
|
+
addressFirstPart.length + addressHighlightedSuffix.length;
|
|
323
|
+
// show hightlighted address (only if it's length is the same as the original address length)
|
|
324
|
+
if (fullAddressLength == item.address.length || IS_DEV) {
|
|
325
|
+
log(
|
|
326
|
+
`👛 ${addressFirstPart}${magenta(addressHighlightedSuffix)}`
|
|
327
|
+
);
|
|
328
|
+
// DEBUG
|
|
329
|
+
if (IS_DEV) {
|
|
330
|
+
log(`___ ${item.address}`);
|
|
331
|
+
}
|
|
332
|
+
} else {
|
|
333
|
+
log(`👛 ${item.address}`);
|
|
334
|
+
}
|
|
275
335
|
} else {
|
|
276
336
|
log(`👛 ${item.address}`);
|
|
277
337
|
}
|