@yerofey/cryptowallet-cli 1.30.1 → 1.31.1
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 +2 -1
- package/src/Wallet.js +30 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yerofey/cryptowallet-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.1",
|
|
4
4
|
"description": "Crypto wallet generator CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/yerofey/cryptowallet-cli",
|
|
@@ -107,6 +107,7 @@
|
|
|
107
107
|
"@harmony-js/account": "^0.1.58",
|
|
108
108
|
"@solana/web3.js": "^1.90.0",
|
|
109
109
|
"@ton/crypto": "^3.2.0",
|
|
110
|
+
"@ton/ton": "^15.0.0",
|
|
110
111
|
"@yerofey/dogecoin-bip84": "^0.0.5",
|
|
111
112
|
"@yerofey/litecoin-bip84": "^0.0.5",
|
|
112
113
|
"bip39": "3.1.0",
|
package/src/Wallet.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
mnemonicValidate as TonValidateMnemonic,
|
|
35
35
|
mnemonicNew as newTonMnemonic,
|
|
36
36
|
} from '@ton/crypto';
|
|
37
|
+
import { WalletContractV5R1 } from '@ton/ton';
|
|
37
38
|
|
|
38
39
|
config();
|
|
39
40
|
|
|
@@ -499,21 +500,47 @@ class Wallet {
|
|
|
499
500
|
}
|
|
500
501
|
const keyPair = await TonMnemonicToPrivateKey(mnemonics);
|
|
501
502
|
const tonweb = new TonWeb();
|
|
502
|
-
// TODO: add support for different formats (simpleR1, simpleR2, simpleR3, v2R1, v2R2, v3R1, v3R2, v4R1, v4R2)
|
|
503
503
|
const WalletClass = tonweb.wallet.all.v4R2;
|
|
504
504
|
const wallet = new WalletClass(tonweb.provider, keyPair);
|
|
505
505
|
const address = await wallet.getAddress();
|
|
506
506
|
const nonBounceableAddress = address.toString(true, true, false);
|
|
507
507
|
const bouncableAddress = address.toString(true, true, true);
|
|
508
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,
|
|
518
|
+
urlSafe: true, // (UQ)
|
|
519
|
+
testOnly: false,
|
|
520
|
+
});
|
|
521
|
+
const bouncableAddressV5 = v5Address.toString({
|
|
522
|
+
bounceable: true,
|
|
523
|
+
urlSafe: false, // (EQ)
|
|
524
|
+
testOnly: false,
|
|
525
|
+
});
|
|
526
|
+
|
|
509
527
|
Object.assign(result, {
|
|
510
528
|
addresses: [
|
|
511
529
|
{
|
|
512
|
-
title: 'UQ format (new): best for wallets, - non-bounceable',
|
|
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
|
+
{
|
|
539
|
+
title: 'V4R2: UQ format: best for wallets, - non-bounceable',
|
|
513
540
|
address: nonBounceableAddress,
|
|
514
541
|
},
|
|
515
542
|
{
|
|
516
|
-
title: 'EQ format
|
|
543
|
+
title: 'V4R2: EQ format: best for smart contracts, - bounceable',
|
|
517
544
|
address: bouncableAddress,
|
|
518
545
|
},
|
|
519
546
|
],
|