@yerofey/cryptowallet-cli 1.31.2 â 1.31.4
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 +11 -1
- package/src/Wallet.js +71 -42
- package/src/chains/TON.json +84 -2
package/package.json
CHANGED
package/src/Method.js
CHANGED
|
@@ -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';
|
|
@@ -499,51 +500,79 @@ class Wallet {
|
|
|
499
500
|
mnemonicString = mnemonics.join(' ');
|
|
500
501
|
}
|
|
501
502
|
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
503
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
504
|
+
let addresses = [];
|
|
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':
|
|
518
|
+
const tonweb = new TonWeb();
|
|
519
|
+
const _tonwebFormat = walletFormat.replace('r', 'R');
|
|
520
|
+
const WalletClass = tonweb.wallet.all[_tonwebFormat];
|
|
521
|
+
const wallet = new WalletClass(tonweb.provider, keyPair);
|
|
522
|
+
const address = await wallet.getAddress();
|
|
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
|
+
}
|
|
541
|
+
break;
|
|
542
|
+
|
|
543
|
+
// new format
|
|
544
|
+
case 'v5r1':
|
|
545
|
+
case 'w5':
|
|
546
|
+
default:
|
|
547
|
+
const workchain = 0;
|
|
548
|
+
const walletV5 = WalletContractV5R1.create({
|
|
549
|
+
workchain,
|
|
550
|
+
publicKey: keyPair.publicKey,
|
|
551
|
+
});
|
|
552
|
+
const v5Address = walletV5.address;
|
|
553
|
+
const nonBounceableV5Address = v5Address.toString({
|
|
554
|
+
bounceable: false, // (UQ)
|
|
555
|
+
urlSafe: true,
|
|
556
|
+
testOnly: false,
|
|
557
|
+
});
|
|
558
|
+
addresses.push({
|
|
559
|
+
title: 'W5 (V5R1) [UQ]: best for wallets, - non-bounceable',
|
|
531
560
|
address: nonBounceableV5Address,
|
|
532
|
-
}
|
|
533
|
-
{
|
|
534
|
-
|
|
535
|
-
|
|
561
|
+
});
|
|
562
|
+
const bouncableAddressV5 = v5Address.toString({
|
|
563
|
+
bounceable: true, // (EQ)
|
|
564
|
+
urlSafe: true,
|
|
565
|
+
testOnly: false,
|
|
566
|
+
});
|
|
567
|
+
addresses.push({
|
|
568
|
+
title: 'W5 (V5R1) [EQ]: best for smart contracts, - bounceable',
|
|
536
569
|
address: bouncableAddressV5,
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
title: 'V4R2: EQ format: best for smart contracts, - bounceable',
|
|
544
|
-
address: bouncableAddress,
|
|
545
|
-
},
|
|
546
|
-
],
|
|
570
|
+
});
|
|
571
|
+
break;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
Object.assign(result, {
|
|
575
|
+
addresses: addresses,
|
|
547
576
|
mnemonic: mnemonicString,
|
|
548
577
|
});
|
|
549
578
|
} else if (chain == 'TRX') {
|
package/src/chains/TON.json
CHANGED
|
@@ -1,8 +1,72 @@
|
|
|
1
1
|
{
|
|
2
2
|
"title": "The Open Network",
|
|
3
3
|
"network": "TON",
|
|
4
|
-
"defaultFormat": "
|
|
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",
|
|
@@ -10,6 +74,24 @@
|
|
|
10
74
|
"rareSymbols": "[0-9]",
|
|
11
75
|
"apps": ["tonkeeper", "trustwallet"],
|
|
12
76
|
"flags": ["m", "p", "s"]
|
|
77
|
+
},
|
|
78
|
+
"V5R1": {
|
|
79
|
+
"format": "V5R1",
|
|
80
|
+
"startsWith": "EQ|UQ",
|
|
81
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
82
|
+
"rareSymbols": "[0-9]",
|
|
83
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
84
|
+
"flags": ["m", "p", "s"]
|
|
85
|
+
},
|
|
86
|
+
"W5": {
|
|
87
|
+
"comment": "This is the same as V5R1",
|
|
88
|
+
"format": "W5",
|
|
89
|
+
"startsWith": "EQ|UQ",
|
|
90
|
+
"prefixTest": "[0-9a-zA-Z-_]",
|
|
91
|
+
"rareSymbols": "[0-9]",
|
|
92
|
+
"apps": ["tonkeeper", "trustwallet"],
|
|
93
|
+
"flags": ["m", "p", "s"]
|
|
13
94
|
}
|
|
14
|
-
}
|
|
95
|
+
},
|
|
96
|
+
"requiresActivation": true
|
|
15
97
|
}
|