@yerofey/cryptowallet-cli 1.14.0 → 1.15.0
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 +59 -0
- package/package.json +3 -1
- package/src/Method.js +8 -0
- package/src/Wallet.js +18 -0
- package/src/chains/SOL.json +7 -0
package/README.md
CHANGED
|
@@ -159,6 +159,65 @@ $ cw -l
|
|
|
159
159
|
- [ ] SegWit Bech32 wallet address support for all Bitcoin forks
|
|
160
160
|
- [ ] tests
|
|
161
161
|
|
|
162
|
+
## Adding More Chains
|
|
163
|
+
|
|
164
|
+
We're always looking to support more blockchains! If you'd like to add support for a new chain, please follow these steps:
|
|
165
|
+
|
|
166
|
+
1. **Create a Chain JSON File**: Create a new `.json` file in the `src/chains` directory. The name of the file should be the ticker symbol of the blockchain (e.g., `SOL.json` for Solana).
|
|
167
|
+
|
|
168
|
+
2. **Define the Chain Properties**: Fill the JSON file with the necessary properties of the blockchain. Here's the structure you should follow:
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"title": "Readable Title of Blockchain",
|
|
173
|
+
"network": "Network Type (EVM, Bitcoin-like, etc.)",
|
|
174
|
+
"startsWith": "Starting Characters of Wallet Address",
|
|
175
|
+
"prefixTest": "Regex Pattern to Test Valid Characters in Prefix",
|
|
176
|
+
"apps": ["Array", "of", "Supported", "Wallet", "Apps"],
|
|
177
|
+
"flags": ["Array", "of", "Supported", "Features", "like", "m", "n", "p", "s"]
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
3. **Add Formats (if applicable)**: If the blockchain supports multiple wallet formats (like Bitcoin with Legacy, SegWit, Bech32), you can define them under the `formats` key:
|
|
182
|
+
|
|
183
|
+
```json
|
|
184
|
+
"formats": {
|
|
185
|
+
"formatName": {
|
|
186
|
+
"format": "formatName",
|
|
187
|
+
"startsWith": "Starting Characters of Wallet Address",
|
|
188
|
+
"prefixTest": "Regex Pattern to Test Valid Characters in Prefix",
|
|
189
|
+
"rareSymbols": "Regex Pattern for Rarely Used Symbols",
|
|
190
|
+
"path": "Derivation Path (if applicable)",
|
|
191
|
+
"purpose": "BIP Purpose (if applicable)",
|
|
192
|
+
"apps": ["Array", "of", "Supported", "Wallet", "Apps"],
|
|
193
|
+
"flags": ["Array", "of", "Supported", "Features", "like", "m", "n", "p", "s"]
|
|
194
|
+
}
|
|
195
|
+
// ... other formats
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
4. **Submit a Pull Request**: Once you've added the new chain file, please submit a pull request to the main repository. Make sure to provide a clear description of the blockchain and the properties you've set.
|
|
200
|
+
|
|
201
|
+
5. **Wait for Review**: The maintainers will review your submission. They might ask for changes or additional information. Once everything is set, your contribution will be merged, and the new chain will be supported!
|
|
202
|
+
|
|
203
|
+
Your contributions are greatly appreciated and help make this tool more versatile and useful for everyone!
|
|
204
|
+
|
|
205
|
+
## Chain JSON File Structure Explained
|
|
206
|
+
|
|
207
|
+
Each chain JSON file is structured to provide essential information about the blockchain and how the wallet addresses are generated and formatted. Here's a detailed explanation of each field:
|
|
208
|
+
|
|
209
|
+
- `title`: The full, readable title of the blockchain.
|
|
210
|
+
- `network`: The type of network or protocol the blockchain follows (e.g., EVM for Ethereum-compatible chains).
|
|
211
|
+
- `startsWith`: The set of characters that the wallet address typically starts with.
|
|
212
|
+
- `prefixTest`: A regular expression pattern that tests for valid characters that can appear in the prefix of a wallet address.
|
|
213
|
+
- `apps`: An array of supported wallet applications that can be used with the generated addresses.
|
|
214
|
+
- `flags`: An array of supported features for the wallet generation. Common flags include `m` for mnemonic support, `n` for generating multiple wallets, `p` for prefix support, and `s` for suffix support.
|
|
215
|
+
- `formats`: (Optional) An object defining multiple wallet formats if the blockchain supports more than one format. Each format should specify its unique properties.
|
|
216
|
+
|
|
217
|
+
By following this structure, the `cryptowallet-cli` tool can understand and support wallet generation for a wide array of blockchains.
|
|
218
|
+
|
|
219
|
+
Feel free to contribute by adding support for more chains, and help in making `cryptowallet-cli` a more comprehensive tool for the crypto community!
|
|
220
|
+
|
|
162
221
|
## Contributing
|
|
163
222
|
|
|
164
223
|
Contributions are welcome! If you would like to contribute to this project, please follow these guidelines:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yerofey/cryptowallet-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.15.0",
|
|
4
4
|
"description": "Crypto wallet generator CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/yerofey/cryptowallet-cli",
|
|
@@ -69,10 +69,12 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@binance-chain/javascript-sdk": "^4.2.2",
|
|
71
71
|
"@harmony-js/account": "^0.1.58",
|
|
72
|
+
"@solana/web3.js": "^1.89.1",
|
|
72
73
|
"@yerofey/dogecoin-bip84": "^0.0.5",
|
|
73
74
|
"@yerofey/litecoin-bip84": "^0.0.5",
|
|
74
75
|
"bip39": "3.1.0",
|
|
75
76
|
"bip84": "0.2.7",
|
|
77
|
+
"bs58": "^5.0.0",
|
|
76
78
|
"chalk": "5.3.0",
|
|
77
79
|
"coininfo": "5.2.1",
|
|
78
80
|
"coinkey": "3.0.0",
|
package/src/Method.js
CHANGED
|
@@ -303,6 +303,7 @@ class Method {
|
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
+
// formats, network, apps
|
|
306
307
|
if (displayAsText) {
|
|
307
308
|
if (
|
|
308
309
|
cw.row.formats !== undefined ||
|
|
@@ -313,6 +314,7 @@ class Method {
|
|
|
313
314
|
log();
|
|
314
315
|
}
|
|
315
316
|
|
|
317
|
+
// tested
|
|
316
318
|
if (cw.wallet.tested !== undefined) {
|
|
317
319
|
log(
|
|
318
320
|
red(
|
|
@@ -321,6 +323,7 @@ class Method {
|
|
|
321
323
|
);
|
|
322
324
|
}
|
|
323
325
|
|
|
326
|
+
// formats
|
|
324
327
|
if (
|
|
325
328
|
cw.row.formats !== undefined &&
|
|
326
329
|
Object.keys(cw.row.formats).length > 1
|
|
@@ -340,6 +343,7 @@ class Method {
|
|
|
340
343
|
);
|
|
341
344
|
}
|
|
342
345
|
|
|
346
|
+
// network
|
|
343
347
|
if (cw.row.network == 'EVM' || false) {
|
|
344
348
|
log(
|
|
345
349
|
yellow(
|
|
@@ -370,6 +374,10 @@ class Method {
|
|
|
370
374
|
}
|
|
371
375
|
log(greenBright('ℹ️ You can import this wallet into ' + appsString));
|
|
372
376
|
}
|
|
377
|
+
|
|
378
|
+
// donation
|
|
379
|
+
log();
|
|
380
|
+
log(blueBright('🙏 Consider supporting the project - see donation options with: cw --donate'));
|
|
373
381
|
}
|
|
374
382
|
}
|
|
375
383
|
|
package/src/Wallet.js
CHANGED
|
@@ -18,6 +18,8 @@ import pkutils from 'ethereum-mnemonic-privatekey-utils';
|
|
|
18
18
|
import bCrypto from '@binance-chain/javascript-sdk/lib/crypto/index.js';
|
|
19
19
|
import tronWeb from 'tronweb';
|
|
20
20
|
import tezos from 'tezos-sign';
|
|
21
|
+
import { Keypair as SolanaKeypair, PublicKey as SolanaPublickey } from '@solana/web3.js';
|
|
22
|
+
import bs58 from 'bs58';
|
|
21
23
|
const { red } = chalk;
|
|
22
24
|
|
|
23
25
|
class Wallet {
|
|
@@ -427,6 +429,22 @@ class Wallet {
|
|
|
427
429
|
],
|
|
428
430
|
mnemonic,
|
|
429
431
|
});
|
|
432
|
+
} else if (chain == 'SOL') {
|
|
433
|
+
const wallet = SolanaKeypair.generate();
|
|
434
|
+
const publicKeyString = new SolanaPublickey(wallet.publicKey).toBase58();
|
|
435
|
+
const secretKeyString = bs58.encode(wallet.secretKey);
|
|
436
|
+
|
|
437
|
+
// TODO: add support for multiple addresses
|
|
438
|
+
|
|
439
|
+
Object.assign(result, {
|
|
440
|
+
addresses: [
|
|
441
|
+
{
|
|
442
|
+
index: 0,
|
|
443
|
+
address: publicKeyString,
|
|
444
|
+
privateKey: secretKeyString,
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
});
|
|
430
448
|
} else if (chain == 'TRX') {
|
|
431
449
|
try {
|
|
432
450
|
const wallet = await tronWeb.createAccount();
|