@yerofey/cryptowallet-cli 1.31.3 → 1.32.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/package.json +1 -1
- package/src/Method.js +12 -2
- package/src/Wallet.js +39 -19
- package/src/chains/TON.json +66 -1
package/package.json
CHANGED
package/src/Method.js
CHANGED
|
@@ -97,7 +97,7 @@ class Method {
|
|
|
97
97
|
log();
|
|
98
98
|
log(
|
|
99
99
|
greenBright(
|
|
100
|
-
'ℹ️
|
|
100
|
+
'ℹ️ You can import it into your favorite wallet app or use it to generate a wallet with "-m" flag'
|
|
101
101
|
)
|
|
102
102
|
);
|
|
103
103
|
|
|
@@ -496,6 +496,15 @@ class Method {
|
|
|
496
496
|
log();
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
+
// should be activated (only for specific chains)
|
|
500
|
+
if (cw.row.requiresActivation !== undefined && cw.row.requiresActivation) {
|
|
501
|
+
log(
|
|
502
|
+
blue(
|
|
503
|
+
`💎 ${cw.row.title} (${cw.row.network}) requires wallet activation in order to use it (just make a small value transaction to itself)`
|
|
504
|
+
)
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
|
|
499
508
|
// formats
|
|
500
509
|
if (
|
|
501
510
|
cw.row.formats !== undefined &&
|
|
@@ -546,7 +555,8 @@ class Method {
|
|
|
546
555
|
|
|
547
556
|
let appsString = appsArray.join(', ');
|
|
548
557
|
if (cw.row.apps || false) {
|
|
549
|
-
appsString +=
|
|
558
|
+
appsString +=
|
|
559
|
+
' and any other wallet app (either using mnemonic or private key)';
|
|
550
560
|
}
|
|
551
561
|
log(greenBright('ℹ️ You can import this wallet into ' + appsString));
|
|
552
562
|
}
|
package/src/Wallet.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-case-declarations */
|
|
1
2
|
import { config } from 'dotenv';
|
|
2
3
|
import { log } from './utils.js';
|
|
3
4
|
import chalk from 'chalk';
|
|
@@ -501,27 +502,47 @@ class Wallet {
|
|
|
501
502
|
const keyPair = await TonMnemonicToPrivateKey(mnemonics);
|
|
502
503
|
|
|
503
504
|
let addresses = [];
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
505
|
+
let walletFormat = format.toLowerCase();
|
|
506
|
+
|
|
507
|
+
switch (walletFormat) {
|
|
508
|
+
// old formats
|
|
509
|
+
case 'simpler1':
|
|
510
|
+
case 'simpler2':
|
|
511
|
+
case 'simpler3':
|
|
512
|
+
case 'v2r1':
|
|
513
|
+
case 'v2r2':
|
|
514
|
+
case 'v3r1':
|
|
515
|
+
case 'v3r2':
|
|
516
|
+
case 'v4r1':
|
|
517
|
+
case 'v4r2':
|
|
507
518
|
const tonweb = new TonWeb();
|
|
508
|
-
const
|
|
519
|
+
const _tonwebFormat = walletFormat.replace('r', 'R');
|
|
520
|
+
const WalletClass = tonweb.wallet.all[_tonwebFormat];
|
|
509
521
|
const wallet = new WalletClass(tonweb.provider, keyPair);
|
|
510
522
|
const address = await wallet.getAddress();
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
523
|
+
|
|
524
|
+
if (walletFormat == 'v4r2') {
|
|
525
|
+
// when UQ was implemented (non-bounceable addresses)
|
|
526
|
+
const nonBounceableAddress = address.toString(true, true, false);
|
|
527
|
+
addresses.push({
|
|
528
|
+
title: 'V4R2 (UQ): best for wallets, - non-bounceable',
|
|
529
|
+
address: nonBounceableAddress,
|
|
530
|
+
});
|
|
531
|
+
const bouncableAddress = address.toString(true, true, true);
|
|
532
|
+
addresses.push({
|
|
533
|
+
title: 'V4R2 (EQ): best for smart contracts, - bounceable',
|
|
534
|
+
address: bouncableAddress,
|
|
535
|
+
});
|
|
536
|
+
} else {
|
|
537
|
+
addresses.push({
|
|
538
|
+
address: address.toString(true, true, true),
|
|
539
|
+
});
|
|
540
|
+
}
|
|
521
541
|
break;
|
|
522
542
|
|
|
523
|
-
|
|
524
|
-
case '
|
|
543
|
+
// new format
|
|
544
|
+
case 'v5r1':
|
|
545
|
+
case 'w5':
|
|
525
546
|
default:
|
|
526
547
|
const workchain = 0;
|
|
527
548
|
const walletV5 = WalletContractV5R1.create({
|
|
@@ -535,7 +556,7 @@ class Wallet {
|
|
|
535
556
|
testOnly: false,
|
|
536
557
|
});
|
|
537
558
|
addresses.push({
|
|
538
|
-
title: 'W5 (V5R1)
|
|
559
|
+
title: 'W5 (V5R1) [UQ]: best for wallets, - non-bounceable',
|
|
539
560
|
address: nonBounceableV5Address,
|
|
540
561
|
});
|
|
541
562
|
const bouncableAddressV5 = v5Address.toString({
|
|
@@ -544,8 +565,7 @@ class Wallet {
|
|
|
544
565
|
testOnly: false,
|
|
545
566
|
});
|
|
546
567
|
addresses.push({
|
|
547
|
-
title:
|
|
548
|
-
'W5 (V5R1): EQ format: best for smart contracts, - bounceable',
|
|
568
|
+
title: 'W5 (V5R1) [EQ]: best for smart contracts, - bounceable',
|
|
549
569
|
address: bouncableAddressV5,
|
|
550
570
|
});
|
|
551
571
|
break;
|
package/src/chains/TON.json
CHANGED
|
@@ -3,6 +3,70 @@
|
|
|
3
3
|
"network": "TON",
|
|
4
4
|
"defaultFormat": "W5",
|
|
5
5
|
"formats": {
|
|
6
|
+
"simpleR1": {
|
|
7
|
+
"format": "simpleR1",
|
|
8
|
+
"startsWith": "EQ",
|
|
9
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
10
|
+
"rareSymbols": "[0-9]",
|
|
11
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
12
|
+
"flags": ["m", "p", "s"]
|
|
13
|
+
},
|
|
14
|
+
"simpleR2": {
|
|
15
|
+
"format": "simpleR2",
|
|
16
|
+
"startsWith": "EQ",
|
|
17
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
18
|
+
"rareSymbols": "[0-9]",
|
|
19
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
20
|
+
"flags": ["m", "p", "s"]
|
|
21
|
+
},
|
|
22
|
+
"simpleR3": {
|
|
23
|
+
"format": "simpleR3",
|
|
24
|
+
"startsWith": "EQ",
|
|
25
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
26
|
+
"rareSymbols": "[0-9]",
|
|
27
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
28
|
+
"flags": ["m", "p", "s"]
|
|
29
|
+
},
|
|
30
|
+
"V2R1": {
|
|
31
|
+
"format": "V2R1",
|
|
32
|
+
"startsWith": "EQ",
|
|
33
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
34
|
+
"rareSymbols": "[0-9]",
|
|
35
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
36
|
+
"flags": ["m", "p", "s"]
|
|
37
|
+
},
|
|
38
|
+
"V2R2": {
|
|
39
|
+
"format": "V2R2",
|
|
40
|
+
"startsWith": "EQ",
|
|
41
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
42
|
+
"rareSymbols": "[0-9]",
|
|
43
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
44
|
+
"flags": ["m", "p", "s"]
|
|
45
|
+
},
|
|
46
|
+
"V3R1": {
|
|
47
|
+
"format": "V3R1",
|
|
48
|
+
"startsWith": "EQ",
|
|
49
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
50
|
+
"rareSymbols": "[0-9]",
|
|
51
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
52
|
+
"flags": ["m", "p", "s"]
|
|
53
|
+
},
|
|
54
|
+
"V3R2": {
|
|
55
|
+
"format": "V3R2",
|
|
56
|
+
"startsWith": "EQ",
|
|
57
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
58
|
+
"rareSymbols": "[0-9]",
|
|
59
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
60
|
+
"flags": ["m", "p", "s"]
|
|
61
|
+
},
|
|
62
|
+
"V4R1": {
|
|
63
|
+
"format": "V4R1",
|
|
64
|
+
"startsWith": "EQ",
|
|
65
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
66
|
+
"rareSymbols": "[0-9]",
|
|
67
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
68
|
+
"flags": ["m", "p", "s"]
|
|
69
|
+
},
|
|
6
70
|
"V4R2": {
|
|
7
71
|
"format": "V4R2",
|
|
8
72
|
"startsWith": "EQ|UQ",
|
|
@@ -28,5 +92,6 @@
|
|
|
28
92
|
"apps": ["tonkeeper", "trustwallet"],
|
|
29
93
|
"flags": ["m", "p", "s"]
|
|
30
94
|
}
|
|
31
|
-
}
|
|
95
|
+
},
|
|
96
|
+
"requiresActivation": true
|
|
32
97
|
}
|