@yerofey/cryptowallet-cli 1.18.2 → 1.18.3

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 +23 -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.3",
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
@@ -220,16 +220,21 @@ class Method {
220
220
  cw.suffixFoundInWallets.includes(item.address)
221
221
  ) {
222
222
  // highlight found prefix and suffix
223
- const addressStartingSymbol =
224
- startsWithSymbols.filter((symbol) =>
225
- item.address.startsWith(symbol)
226
- )[0] || '';
223
+ let addressStartingSymbol;
224
+ if (startsWithSymbols.length > 1) {
225
+ addressStartingSymbol =
226
+ startsWithSymbols.filter((symbol) =>
227
+ item.address.startsWith(symbol)
228
+ )[0] || '';
229
+ } else {
230
+ addressStartingSymbol = startsWithSymbols[0] || '';
231
+ }
227
232
  const addressCutPrefixLength = addressStartingSymbol.length || 0;
228
233
  let addressHighlightedPart;
229
234
  if (addressCutPrefixLength > 0) {
230
235
  addressHighlightedPart = item.address.substring(
231
- addressCutPrefixLength + cw.options.prefix.length,
232
- cw.options.prefix.length
236
+ addressCutPrefixLength,
237
+ addressCutPrefixLength + cw.options.prefix.length
233
238
  );
234
239
  } else {
235
240
  addressHighlightedPart = item.address.substring(
@@ -268,16 +273,22 @@ class Method {
268
273
  cw.prefixFoundInWallets.includes(item.address)
269
274
  ) {
270
275
  // highlight found prefix
271
- const addressStartingSymbol =
272
- startsWithSymbols.filter((symbol) =>
273
- item.address.startsWith(symbol)
274
- )[0] || '';
276
+ // startsWithSymbols could be 3 different types (empty, few symbols, or few symbols with "|" - separator for multiple symbols), adjust the address cut prefix length
277
+ let addressStartingSymbol;
278
+ if (startsWithSymbols.length > 1) {
279
+ addressStartingSymbol =
280
+ startsWithSymbols.filter((symbol) =>
281
+ item.address.startsWith(symbol)
282
+ )[0] || '';
283
+ } else {
284
+ addressStartingSymbol = startsWithSymbols[0] || '';
285
+ }
275
286
  const addressCutPrefixLength = addressStartingSymbol.length || 0;
276
287
  let addressHighlightedPart;
277
288
  if (addressCutPrefixLength > 0) {
278
289
  addressHighlightedPart = item.address.substring(
279
- addressCutPrefixLength + cw.options.prefix.length,
280
- cw.options.prefix.length
290
+ addressCutPrefixLength,
291
+ addressCutPrefixLength + cw.options.prefix.length
281
292
  );
282
293
  } else {
283
294
  addressHighlightedPart = item.address.substring(