@clawdvault/cli 0.2.0 → 0.3.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/dist/index.js +26 -6
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -728,7 +728,7 @@ walletCommand.command("info").description("Show wallet information").option("-w,
|
|
|
728
728
|
handleError(err);
|
|
729
729
|
}
|
|
730
730
|
});
|
|
731
|
-
walletCommand.command("init").description("Generate a new wallet").option("-o, --output <path>", "Output file path (default: ~/.clawdvault/wallet.json)").option("--force", "Overwrite existing wallet").action(async (options) => {
|
|
731
|
+
walletCommand.command("init").description("Generate a new wallet").option("-o, --output <path>", "Output file path (default: ~/.clawdvault/wallet.json)").option("--force", "Overwrite existing wallet").option("--mnemonic", "Generate wallet with recoverable seed phrase (can import into Phantom)").action(async (options) => {
|
|
732
732
|
try {
|
|
733
733
|
const configDir = getConfigDir();
|
|
734
734
|
const outputPath = options.output || path2.join(configDir, "wallet.json");
|
|
@@ -740,16 +740,36 @@ walletCommand.command("init").description("Generate a new wallet").option("-o, -
|
|
|
740
740
|
if (!fs3.existsSync(configDir)) {
|
|
741
741
|
fs3.mkdirSync(configDir, { recursive: true });
|
|
742
742
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
743
|
+
let keypair;
|
|
744
|
+
let mnemonic;
|
|
745
|
+
if (options.mnemonic) {
|
|
746
|
+
const bip39 = await import("bip39");
|
|
747
|
+
mnemonic = bip39.generateMnemonic(256);
|
|
748
|
+
const seed = await bip39.mnemonicToSeed(mnemonic);
|
|
749
|
+
const secretKey = seed.slice(0, 32);
|
|
750
|
+
keypair = import_web3.Keypair.fromSeed(new Uint8Array(secretKey));
|
|
751
|
+
} else {
|
|
752
|
+
keypair = import_web3.Keypair.generate();
|
|
753
|
+
}
|
|
754
|
+
const secretKeyArray = Array.from(keypair.secretKey);
|
|
755
|
+
fs3.writeFileSync(outputPath, JSON.stringify(secretKeyArray));
|
|
746
756
|
fs3.chmodSync(outputPath, 384);
|
|
747
757
|
success("Wallet created successfully!");
|
|
748
758
|
console.log();
|
|
749
759
|
info(`Address: ${keypair.publicKey.toBase58()}`);
|
|
750
760
|
info(`Saved to: ${outputPath}`);
|
|
751
|
-
|
|
752
|
-
|
|
761
|
+
if (mnemonic) {
|
|
762
|
+
console.log();
|
|
763
|
+
console.log(import_chalk5.default.yellow("\u{1F4DD} SEED PHRASE (Write this down!):"));
|
|
764
|
+
console.log(import_chalk5.default.white(mnemonic));
|
|
765
|
+
console.log();
|
|
766
|
+
warn("\u26A0\uFE0F IMPORTANT: This seed phrase can recover your wallet in Phantom!");
|
|
767
|
+
warn(" Write it down and store it safely. Anyone with this phrase can steal your funds!");
|
|
768
|
+
} else {
|
|
769
|
+
console.log();
|
|
770
|
+
warn("\u26A0\uFE0F IMPORTANT: Back up your wallet file! Loss of this file means loss of funds.");
|
|
771
|
+
info(" Use --mnemonic if you want a recoverable seed phrase for Phantom import.");
|
|
772
|
+
}
|
|
753
773
|
console.log();
|
|
754
774
|
} catch (err) {
|
|
755
775
|
handleError(err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clawdvault/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "CLI for ClawdVault - Solana token launchpad",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -15,9 +15,10 @@
|
|
|
15
15
|
"clean": "rm -rf dist"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@clawdvault/sdk": "^0.
|
|
18
|
+
"@clawdvault/sdk": "^0.3.1",
|
|
19
19
|
"@solana/spl-token": "^0.4.0",
|
|
20
20
|
"@solana/web3.js": "^1.91.0",
|
|
21
|
+
"bip39": "^3.1.0",
|
|
21
22
|
"bs58": "^5.0.0",
|
|
22
23
|
"chalk": "^4.1.2",
|
|
23
24
|
"commander": "^12.0.0",
|