@yerofey/cryptowallet-cli 1.30.1 → 1.31.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 +2 -1
- package/src/Wallet.js +21 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yerofey/cryptowallet-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.31.0",
|
|
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,38 @@ 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
|
+
|
|
509
522
|
Object.assign(result, {
|
|
510
523
|
addresses: [
|
|
511
524
|
{
|
|
512
|
-
title: 'UQ format (new): best for wallets, - non-bounceable',
|
|
525
|
+
title: 'V5R1: UQ format (new): best for wallets, - non-bounceable',
|
|
526
|
+
address: nonBounceableV5Address,
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
title: 'V4R2: UQ format (new): best for wallets, - non-bounceable',
|
|
513
530
|
address: nonBounceableAddress,
|
|
514
531
|
},
|
|
515
532
|
{
|
|
516
|
-
title:
|
|
533
|
+
title:
|
|
534
|
+
'V4R2: EQ format (old): best for smart contracts, - bounceable',
|
|
517
535
|
address: bouncableAddress,
|
|
518
536
|
},
|
|
519
537
|
],
|