@yerofey/cryptowallet-cli 1.18.2 → 1.18.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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/Method.js +24 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yerofey/cryptowallet-cli",
3
- "version": "1.18.2",
3
+ "version": "1.18.4",
4
4
  "description": "Crypto wallet generator CLI tool",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/yerofey/cryptowallet-cli",
package/src/Method.js CHANGED
@@ -10,6 +10,7 @@ import CW from './CW.js';
10
10
  config();
11
11
  const { blue, green, blueBright, greenBright, yellow, red, magenta, white } =
12
12
  chalk;
13
+ // eslint-disable-next-line no-undef
13
14
  const IS_DEV = process.env.NODE_ENV === 'development' || false;
14
15
  const pkg = await loadJson(
15
16
  `${path.dirname(import.meta.url)}/../package.json`.replace('file://', '')
@@ -220,16 +221,21 @@ class Method {
220
221
  cw.suffixFoundInWallets.includes(item.address)
221
222
  ) {
222
223
  // highlight found prefix and suffix
223
- const addressStartingSymbol =
224
- startsWithSymbols.filter((symbol) =>
225
- item.address.startsWith(symbol)
226
- )[0] || '';
224
+ let addressStartingSymbol;
225
+ if (startsWithSymbols.length > 1) {
226
+ addressStartingSymbol =
227
+ startsWithSymbols.filter((symbol) =>
228
+ item.address.startsWith(symbol)
229
+ )[0] || '';
230
+ } else {
231
+ addressStartingSymbol = startsWithSymbols[0] || '';
232
+ }
227
233
  const addressCutPrefixLength = addressStartingSymbol.length || 0;
228
234
  let addressHighlightedPart;
229
235
  if (addressCutPrefixLength > 0) {
230
236
  addressHighlightedPart = item.address.substring(
231
- addressCutPrefixLength + cw.options.prefix.length,
232
- cw.options.prefix.length
237
+ addressCutPrefixLength,
238
+ addressCutPrefixLength + cw.options.prefix.length
233
239
  );
234
240
  } else {
235
241
  addressHighlightedPart = item.address.substring(
@@ -268,16 +274,22 @@ class Method {
268
274
  cw.prefixFoundInWallets.includes(item.address)
269
275
  ) {
270
276
  // highlight found prefix
271
- const addressStartingSymbol =
272
- startsWithSymbols.filter((symbol) =>
273
- item.address.startsWith(symbol)
274
- )[0] || '';
277
+ // startsWithSymbols could be 3 different types (empty, few symbols, or few symbols with "|" - separator for multiple symbols), adjust the address cut prefix length
278
+ let addressStartingSymbol;
279
+ if (startsWithSymbols.length > 1) {
280
+ addressStartingSymbol =
281
+ startsWithSymbols.filter((symbol) =>
282
+ item.address.startsWith(symbol)
283
+ )[0] || '';
284
+ } else {
285
+ addressStartingSymbol = startsWithSymbols[0] || '';
286
+ }
275
287
  const addressCutPrefixLength = addressStartingSymbol.length || 0;
276
288
  let addressHighlightedPart;
277
289
  if (addressCutPrefixLength > 0) {
278
290
  addressHighlightedPart = item.address.substring(
279
- addressCutPrefixLength + cw.options.prefix.length,
280
- cw.options.prefix.length
291
+ addressCutPrefixLength,
292
+ addressCutPrefixLength + cw.options.prefix.length
281
293
  );
282
294
  } else {
283
295
  addressHighlightedPart = item.address.substring(