Skip to content

Commit

Permalink
feat: Update version to 1.40.0, modify editorconfig, enhance wallet a…
Browse files Browse the repository at this point in the history
…ddress display, and add requiresActivation flag in TON chain configurations
  • Loading branch information
yerofey committed Feb 23, 2025
1 parent 564603d commit 7accffa
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 43 deletions.
8 changes: 1 addition & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4

[*.{js,jsx,json}]
[*.{js,js,json}]
indent_size = 2
quote_type = single

[*.{css}]
indent_size = 2
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yerofey/cryptowallet-cli",
"version": "1.39.0",
"version": "1.40.0",
"description": "Crypto wallet generator CLI tool",
"type": "module",
"homepage": "https://github.com/yerofey/cryptowallet-cli",
Expand Down
74 changes: 51 additions & 23 deletions src/Method.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class Method {
log();
log(
greenBright(
'⬇️ You can import it into your favorite wallet app or use it to generate a wallet with "-m" flag'
'💾 You can import it into your favorite wallet app or use it to generate a wallet with "-m" flag'
)
);

Expand Down Expand Up @@ -159,7 +159,7 @@ class Method {
return;
}

let linesCount = 0;
let linesCount = 0; // count of lines to add empty line before the next message
const outputFormats = ['csv'];
const displayAsText =
cw.options.output === undefined ||
Expand Down Expand Up @@ -247,24 +247,45 @@ class Method {
linesCount += 1;
}

// wallets
if (displayAsText) {
// show all addresses if flag is set or if prefix or suffix is not found
let showAllAddresses = cw.options.number !== undefined;
if (cw.suffixFound) {
showAllAddresses = false;
}
if (cw.prefixFound) {
showAllAddresses = false;
}
// show private key only for the first wallet or the one that matches the prefix or/and suffix
let showPrivateKey = false;
// add empty line before the next message
let emptyLineAdded = false;
// display addresses
let index = 0;
for (const item of cw.wallet.addresses) {
if (cw.wallet.addresses.length > 1) {
log();

// Display index
if (item.index !== undefined) {
if (item.index !== undefined && (showAllAddresses || !showAllAddresses && index == 0 || (cw.prefixFoundInWallets.includes(item.address) || cw.suffixFoundInWallets.includes(item.address)))) {
log();
log(`🆔 ${item.index}`);
emptyLineAdded = true;
}

// Display address details
if (item.title) {
if (!emptyLineAdded) {
log();
emptyLineAdded = true;
}
log(`🏷 ${item.title}`);
}
}

// in multi-wallets mode, hide private key for all wallets except the first one and the one that matches the prefix or/and suffix
showPrivateKey = false;

// highlight prefix and suffix
if (
cw.prefixFound &&
cw.prefixFoundInWallets.includes(item.address) &&
Expand Down Expand Up @@ -317,6 +338,7 @@ class Method {
log(`👛 ${item.address}`);
}
matchingWalletsIndexes.push(index);
showPrivateKey = true;
} else if (
cw.prefixFound &&
cw.prefixFoundInWallets.includes(item.address)
Expand Down Expand Up @@ -363,6 +385,7 @@ class Method {
log(`👛 ${item.address}`);
}
matchingWalletsIndexes.push(index);
showPrivateKey = true;
} else if (
cw.suffixFound &&
cw.suffixFoundInWallets.includes(item.address)
Expand All @@ -386,10 +409,14 @@ class Method {
log(`👛 ${item.address}`);
}
matchingWalletsIndexes.push(index);
showPrivateKey = true;
} else {
log(`👛 ${item.address}`);
if (showAllAddresses || !showAllAddresses && index == 0) {
log(`👛 ${item.address}`);
}
}
if (item.privateKey !== undefined) {
// display private key
if (item.privateKey !== undefined && (showAllAddresses || !showAllAddresses && index == 0 || showPrivateKey)) {
log(`🔑 ${item.privateKey}`);
}
// copy to clipboard if flag is set
Expand Down Expand Up @@ -483,21 +510,21 @@ class Method {
}

// matching wallets
if (
cw.options.number &&
cw.options.number > 1 &&
matchingWalletsIndexes.length > 0
) {
const foundCount = matchingWalletsIndexes.length;
const foundMany = foundCount !== 1;
log(
cyan(
`🔍 Found ${foundCount} matching wallet${
foundMany ? 's' : ''
}: 🆔 ${matchingWalletsIndexes.join(',')}`
)
);
}
// if (
// cw.options.number &&
// cw.options.number > 1 &&
// matchingWalletsIndexes.length > 0
// ) {
// const foundCount = matchingWalletsIndexes.length;
// const foundMany = foundCount !== 1;
// log(
// cyan(
// `🔍 Found ${foundCount} matching wallet${
// foundMany ? 's' : ''
// }: 🆔 ${matchingWalletsIndexes.join(',')}`
// )
// );
// }

// attempts
if (cw.attempts !== undefined && cw.attempts > 1 && cw.options.geek) {
Expand Down Expand Up @@ -578,7 +605,7 @@ class Method {
appsString +=
' and any other wallet app (either using mnemonic or private key)';
}
log(greenBright('⬇️ You can import this wallet into ' + appsString));
log(greenBright('💾 You can import this wallet into ' + appsString));
}

// donation
Expand All @@ -604,6 +631,7 @@ class Method {
- BTC: bc1qcwamquntxshqsjcra6vryftrfd9z57j02g3ywq
- ETH: 0xe3e3ed78d9f8A935a9a0fCE2a7305F2f5DBabAD8
- SOL: CWsbNQRxNzAasLd2zfwkEkbBZXKxfoxva14pe8wawUju
- SUI: 0x1b27883fefacd14a19df37f2fc2e9fa1ccbf03823413f5edc315c164ef90a4f3
- TON: UQCWDwqtvC_jml2hSf8laNQu4chYVCbHBpkbKbyDdxzM7Ma0
- DOGE: DMAkWQKx1H6ESG3beDBssn5mAAZcwkrYVh
Expand Down
9 changes: 5 additions & 4 deletions src/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -571,16 +571,17 @@ class Wallet {
// when UQ was implemented (non-bounceable addresses)
const nonBounceableAddress = address.toString(true, true, false);
addresses.push({
title: 'V4R2 (UQ): best for wallets (non-bounceable)',
title: 'v4R2 (UQ): best for wallets (non-bounceable)',
address: nonBounceableAddress,
});
const bouncableAddress = address.toString(true, true, true);
addresses.push({
title: 'V4R2 (EQ): best for smart contracts (bounceable)',
title: 'v4R2 (EQ): best for smart contracts (bounceable)',
address: bouncableAddress,
});
} else {
addresses.push({
title: _tonwebFormat,
address: address.toString(true, true, true),
});
}
Expand All @@ -602,7 +603,7 @@ class Wallet {
testOnly: false,
});
addresses.push({
title: 'W5 (V5R1) [UQ]: best for wallets (non-bounceable)',
title: 'W5 - v5R1 (UQ): best for wallets (non-bounceable)',
address: nonBounceableV5Address,
});
const bouncableAddressV5 = v5Address.toString({
Expand All @@ -611,7 +612,7 @@ class Wallet {
testOnly: false,
});
addresses.push({
title: 'W5 (V5R1) [EQ]: best for smart contracts (bounceable)',
title: 'W5 - v5R1 (EQ): best for smart contracts (bounceable)',
address: bouncableAddressV5,
});
break;
Expand Down
15 changes: 9 additions & 6 deletions src/chains/TON.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,26 @@
"prefixTest": "[0-9a-zA-Z-_]",
"rareSymbols": "[0-9]",
"apps": ["tonkeeper", "tonhub", "trustwallet"],
"flags": ["m", "p", "s"]
"flags": ["m", "p", "s"],
"requiresActivation": true
},
"V4R2": {
"format": "V4R2",
"startsWith": "EQ|UQ",
"prefixTest": "[0-9a-zA-Z-_]",
"rareSymbols": "[0-9]",
"apps": ["tonkeeper", "tonhub", "trustwallet"],
"flags": ["m", "p", "s"]
"flags": ["m", "p", "s"],
"requiresActivation": true
},
"V5R1": {
"format": "V5R1",
"startsWith": "EQ|UQ",
"prefixTest": "[0-9a-zA-Z-_]",
"rareSymbols": "[0-9]",
"apps": ["tonkeeper", "tonhub", "trustwallet"],
"flags": ["m", "p", "s"]
"flags": ["m", "p", "s"],
"requiresActivation": true
},
"W5": {
"comment": "This is the same as V5R1",
Expand All @@ -90,8 +93,8 @@
"prefixTest": "[0-9a-zA-Z-_]",
"rareSymbols": "[0-9]",
"apps": ["tonkeeper", "tonhub", "trustwallet"],
"flags": ["m", "p", "s"]
"flags": ["m", "p", "s"],
"requiresActivation": true
}
},
"requiresActivation": true
}
}

0 comments on commit 7accffa

Please sign in to comment.