@yerofey/cryptowallet-cli 1.33.1 → 1.34.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/README.md +6 -7
- package/package.json +6 -1
- package/src/Wallet.js +38 -0
- package/src/chains/SUI.json +8 -0
- package/src/chains/ARB.json +0 -8
- package/src/chains/MATIC.json +0 -8
- package/src/chains/OP.json +0 -8
- package/src/chains/POLYGON.json +0 -8
package/README.md
CHANGED
|
@@ -114,21 +114,18 @@ $ cw -l
|
|
|
114
114
|
|
|
115
115
|
## Blockchains & tickers supported
|
|
116
116
|
|
|
117
|
-
- `EVM` (Ethereum,
|
|
117
|
+
- `EVM` (Ethereum, Base, Arbitrum, Optimism, Polygon, L2/L3, etc.) **default**
|
|
118
118
|
- `BTC` (Bitcoin) [legacy, segwit, bech32, taproot]
|
|
119
119
|
- `ETH` (Ethereum)
|
|
120
120
|
- `BNB` (Binance Coin) [BEP2, BEP20, ERC20]
|
|
121
121
|
- `BSC` (Binance Smart Chain)
|
|
122
|
-
- `ARB` (Arbitrum)
|
|
123
|
-
- `OP` (Optimism)
|
|
124
|
-
- `MATIC` (Polygon)
|
|
125
122
|
- `SOL` (Solana)
|
|
126
|
-
- `
|
|
123
|
+
- `TRX` (Tron)
|
|
124
|
+
- `TON` (The Open Network) [W5, V2-V5, simple]
|
|
127
125
|
- `DOGE` (Dogecoin) [legacy, segwit, bech32]
|
|
128
126
|
- `BCH` (Bitcoin Cash)
|
|
129
127
|
- `LTC` (Litecoin) [legacy, segwit, bech32]
|
|
130
|
-
- `
|
|
131
|
-
- `TRX` (Tron)
|
|
128
|
+
- `ETC` (Ethereum Classic)
|
|
132
129
|
- `XTZ` (Tezos)
|
|
133
130
|
- `DASH` (Dash)
|
|
134
131
|
- `DCR` (Decred)
|
|
@@ -185,6 +182,8 @@ $ cw -l
|
|
|
185
182
|
- [x] v19.x ✅
|
|
186
183
|
- [x] v20.x ✅
|
|
187
184
|
- [x] v21.x ✅
|
|
185
|
+
- [x] v22.x ✅
|
|
186
|
+
- [x] v23.x ✅
|
|
188
187
|
|
|
189
188
|
*tested on Ubuntu 22.04 & Mac M1*
|
|
190
189
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yerofey/cryptowallet-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "Crypto wallet generator CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"homepage": "https://github.com/yerofey/cryptowallet-cli",
|
|
@@ -80,8 +80,12 @@
|
|
|
80
80
|
"bnb",
|
|
81
81
|
"sol",
|
|
82
82
|
"solana",
|
|
83
|
+
"sui",
|
|
84
|
+
"sui-blockchain",
|
|
85
|
+
"sui-wallet",
|
|
83
86
|
"ton",
|
|
84
87
|
"the-open-network",
|
|
88
|
+
"base",
|
|
85
89
|
"litecoin",
|
|
86
90
|
"ltc",
|
|
87
91
|
"bitcoin-cash",
|
|
@@ -105,6 +109,7 @@
|
|
|
105
109
|
"dependencies": {
|
|
106
110
|
"@binance-chain/javascript-sdk": "^4.2.2",
|
|
107
111
|
"@harmony-js/account": "^0.1.58",
|
|
112
|
+
"@mysten/sui": "^1.18.0",
|
|
108
113
|
"@solana/web3.js": "^1.98.0",
|
|
109
114
|
"@ton/core": "^0.59.1",
|
|
110
115
|
"@ton/crypto": "^3.3.0",
|
package/src/Wallet.js
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
mnemonicNew as newTonMnemonic,
|
|
37
37
|
} from '@ton/crypto';
|
|
38
38
|
import { WalletContractV5R1 } from '@ton/ton';
|
|
39
|
+
import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519';
|
|
39
40
|
|
|
40
41
|
config();
|
|
41
42
|
|
|
@@ -481,6 +482,43 @@ class Wallet {
|
|
|
481
482
|
addresses,
|
|
482
483
|
mnemonic,
|
|
483
484
|
});
|
|
485
|
+
} else if (chain == 'SUI') {
|
|
486
|
+
// Validate mnemonic
|
|
487
|
+
if (mnemonicString !== '' && !bip39.validateMnemonic(mnemonicString)) {
|
|
488
|
+
return {
|
|
489
|
+
error: 'mnemonic is not valid',
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// Generate or use provided mnemonic
|
|
494
|
+
const mnemonic = mnemonicString || bip39.generateMnemonic();
|
|
495
|
+
|
|
496
|
+
try {
|
|
497
|
+
// Derive seed from mnemonic
|
|
498
|
+
const seed = bip39.mnemonicToSeedSync(mnemonic);
|
|
499
|
+
|
|
500
|
+
// Derive keypair using Sui's standard derivation path
|
|
501
|
+
const { key } = derivePath("m/44'/784'/0'/0'/0'", seed.toString('hex'));
|
|
502
|
+
const keypair = Ed25519Keypair.fromSecretKey(Buffer.from(key, 'hex'));
|
|
503
|
+
|
|
504
|
+
// Get Sui address from public key
|
|
505
|
+
const address = keypair.getPublicKey().toSuiAddress();
|
|
506
|
+
|
|
507
|
+
Object.assign(result, {
|
|
508
|
+
addresses: [
|
|
509
|
+
{
|
|
510
|
+
index: 0,
|
|
511
|
+
address: address,
|
|
512
|
+
privateKey: keypair.getSecretKey().toString('hex'),
|
|
513
|
+
},
|
|
514
|
+
],
|
|
515
|
+
mnemonic,
|
|
516
|
+
});
|
|
517
|
+
} catch (error) {
|
|
518
|
+
return {
|
|
519
|
+
error: `Failed to generate SUI wallet: ${error.message} (${error})`,
|
|
520
|
+
};
|
|
521
|
+
}
|
|
484
522
|
} else if (chain == 'TON') {
|
|
485
523
|
// Validate mnemonic
|
|
486
524
|
if (
|
package/src/chains/ARB.json
DELETED
package/src/chains/MATIC.json
DELETED
package/src/chains/OP.json
DELETED