@yerofey/cryptowallet-cli 1.31.2 → 1.31.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yerofey/cryptowallet-cli",
3
- "version": "1.31.2",
3
+ "version": "1.31.3",
4
4
  "description": "Crypto wallet generator CLI tool",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/yerofey/cryptowallet-cli",
package/src/Wallet.js CHANGED
@@ -499,51 +499,60 @@ class Wallet {
499
499
  mnemonicString = mnemonics.join(' ');
500
500
  }
501
501
  const keyPair = await TonMnemonicToPrivateKey(mnemonics);
502
- const tonweb = new TonWeb();
503
- const WalletClass = tonweb.wallet.all.v4R2;
504
- const wallet = new WalletClass(tonweb.provider, keyPair);
505
- const address = await wallet.getAddress();
506
- const nonBounceableAddress = address.toString(true, true, false);
507
- const bouncableAddress = address.toString(true, true, true);
508
-
509
- // w5
510
- const workchain = 0;
511
- const walletV5 = WalletContractV5R1.create({
512
- workchain,
513
- publicKey: keyPair.publicKey,
514
- });
515
- const v5Address = walletV5.address;
516
- const nonBounceableV5Address = v5Address.toString({
517
- bounceable: false, // (UQ)
518
- urlSafe: true,
519
- testOnly: false,
520
- });
521
- const bouncableAddressV5 = v5Address.toString({
522
- bounceable: true, // (EQ)
523
- urlSafe: true,
524
- testOnly: false,
525
- });
526
502
 
527
- Object.assign(result, {
528
- addresses: [
529
- {
530
- title: 'V5R1: UQ format (new): best for wallets, - non-bounceable',
531
- address: nonBounceableV5Address,
532
- },
533
- {
534
- title:
535
- 'V5R1: EQ format (new): best for smart contracts, - bounceable',
536
- address: bouncableAddressV5,
537
- },
538
- {
503
+ let addresses = [];
504
+
505
+ switch (format.toUpperCase()) {
506
+ case 'V4R2':
507
+ const tonweb = new TonWeb();
508
+ const WalletClass = tonweb.wallet.all.v4R2;
509
+ const wallet = new WalletClass(tonweb.provider, keyPair);
510
+ const address = await wallet.getAddress();
511
+ const nonBounceableAddress = address.toString(true, true, false);
512
+ addresses.push({
539
513
  title: 'V4R2: UQ format: best for wallets, - non-bounceable',
540
514
  address: nonBounceableAddress,
541
- },
542
- {
515
+ });
516
+ const bouncableAddress = address.toString(true, true, true);
517
+ addresses.push({
543
518
  title: 'V4R2: EQ format: best for smart contracts, - bounceable',
544
519
  address: bouncableAddress,
545
- },
546
- ],
520
+ });
521
+ break;
522
+
523
+ case 'V5R1':
524
+ case 'W5':
525
+ default:
526
+ const workchain = 0;
527
+ const walletV5 = WalletContractV5R1.create({
528
+ workchain,
529
+ publicKey: keyPair.publicKey,
530
+ });
531
+ const v5Address = walletV5.address;
532
+ const nonBounceableV5Address = v5Address.toString({
533
+ bounceable: false, // (UQ)
534
+ urlSafe: true,
535
+ testOnly: false,
536
+ });
537
+ addresses.push({
538
+ title: 'W5 (V5R1): UQ format: best for wallets, - non-bounceable',
539
+ address: nonBounceableV5Address,
540
+ });
541
+ const bouncableAddressV5 = v5Address.toString({
542
+ bounceable: true, // (EQ)
543
+ urlSafe: true,
544
+ testOnly: false,
545
+ });
546
+ addresses.push({
547
+ title:
548
+ 'W5 (V5R1): EQ format: best for smart contracts, - bounceable',
549
+ address: bouncableAddressV5,
550
+ });
551
+ break;
552
+ }
553
+
554
+ Object.assign(result, {
555
+ addresses: addresses,
547
556
  mnemonic: mnemonicString,
548
557
  });
549
558
  } else if (chain == 'TRX') {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "title": "The Open Network",
3
3
  "network": "TON",
4
- "defaultFormat": "V4R2",
4
+ "defaultFormat": "W5",
5
5
  "formats": {
6
6
  "V4R2": {
7
7
  "format": "V4R2",
@@ -10,6 +10,23 @@
10
10
  "rareSymbols": "[0-9]",
11
11
  "apps": ["tonkeeper", "trustwallet"],
12
12
  "flags": ["m", "p", "s"]
13
+ },
14
+ "V5R1": {
15
+ "format": "V5R1",
16
+ "startsWith": "EQ|UQ",
17
+ "prefixTest": "[0-9a-zA-Z-_]",
18
+ "rareSymbols": "[0-9]",
19
+ "apps": ["tonkeeper", "trustwallet"],
20
+ "flags": ["m", "p", "s"]
21
+ },
22
+ "W5": {
23
+ "comment": "This is the same as V5R1",
24
+ "format": "W5",
25
+ "startsWith": "EQ|UQ",
26
+ "prefixTest": "[0-9a-zA-Z-_]",
27
+ "rareSymbols": "[0-9]",
28
+ "apps": ["tonkeeper", "trustwallet"],
29
+ "flags": ["m", "p", "s"]
13
30
  }
14
31
  }
15
32
  }