create-veil-app 0.3.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.
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
package/dist/index.js ADDED
@@ -0,0 +1,221 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ TEMPLATE_INFO,
4
+ runAdd,
5
+ runInit
6
+ } from "./chunk-QWU7D5FV.js";
7
+ import "./chunk-QGM4M3NI.js";
8
+
9
+ // src/index.ts
10
+ import { Command } from "commander";
11
+ import chalk2 from "chalk";
12
+ import gradient from "gradient-string";
13
+
14
+ // src/sdk-commands.ts
15
+ import chalk from "chalk";
16
+ import ora from "ora";
17
+ import inquirer from "inquirer";
18
+ import { Connection } from "@solana/web3.js";
19
+ var VeilClient;
20
+ var createShieldedClient;
21
+ var createTransferClient;
22
+ var createTokenClient;
23
+ var createDexClient;
24
+ var TOKENS;
25
+ async function loadSDK() {
26
+ try {
27
+ const sdk = await import("./dist-7HFJSUBN.js");
28
+ VeilClient = sdk.VeilClient;
29
+ createShieldedClient = sdk.createShieldedClient;
30
+ createTransferClient = sdk.createTransferClient;
31
+ createTokenClient = sdk.createTokenClient;
32
+ createDexClient = sdk.createDexClient;
33
+ TOKENS = sdk.TOKENS;
34
+ return true;
35
+ } catch (error) {
36
+ console.log(chalk.red("SDK not found. Run 'npm install' first."));
37
+ return false;
38
+ }
39
+ }
40
+ async function runDemo() {
41
+ console.log();
42
+ console.log(chalk.bold.cyan("\u{1F6E1}\uFE0F Veil Protocol SDK Demo"));
43
+ console.log(chalk.dim("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550"));
44
+ console.log();
45
+ const loaded = await loadSDK();
46
+ if (!loaded) return;
47
+ const connection = new Connection("https://api.devnet.solana.com", "confirmed");
48
+ console.log(chalk.yellow("\u{1F4E6} SDK Modules Available:"));
49
+ console.log();
50
+ console.log(chalk.green(" \u2713"), "Identity - ZK-based anonymous authentication");
51
+ console.log(chalk.green(" \u2713"), "Shielded - Hide wallet balances from public view");
52
+ console.log(chalk.green(" \u2713"), "Transfer - Private transactions with hidden amounts");
53
+ console.log(chalk.green(" \u2713"), "Tokens - Private token holdings");
54
+ console.log(chalk.green(" \u2713"), "DEX - Private swaps on Jupiter/Raydium");
55
+ console.log(chalk.green(" \u2713"), "Recovery - Shamir secret sharing for wallet recovery");
56
+ console.log(chalk.green(" \u2713"), "Wallet - Wallet adapter for dApp integration");
57
+ console.log();
58
+ const spinner = ora("Initializing Veil Client...").start();
59
+ try {
60
+ const veil = new VeilClient({ connection });
61
+ spinner.succeed("Veil Client initialized");
62
+ console.log();
63
+ console.log(chalk.bold("\u{1F3AD} Identity Demo:"));
64
+ const demoSpinner = ora("Generating ZK identity proof...").start();
65
+ const result = await veil.connect({
66
+ method: "email",
67
+ identifier: "demo@veil.sh",
68
+ secret: "demo-secret-key"
69
+ });
70
+ if (result.success) {
71
+ demoSpinner.succeed("Identity proof generated");
72
+ console.log(chalk.dim(" Wallet:"), chalk.cyan(veil.publicKey?.toBase58().slice(0, 20) + "..."));
73
+ console.log(chalk.dim(" Status:"), chalk.green("Connected (anonymous)"));
74
+ } else {
75
+ demoSpinner.fail("Failed to generate identity");
76
+ }
77
+ console.log();
78
+ console.log(chalk.bold("\u{1F4A1} What you can do now:"));
79
+ console.log();
80
+ console.log(chalk.dim(" // Shield your balance (hide from public)"));
81
+ console.log(chalk.cyan(" await veil.shielded.deposit(wallet, 5.0, signTx);"));
82
+ console.log();
83
+ console.log(chalk.dim(" // Private transfer"));
84
+ console.log(chalk.cyan(" await veil.transfer.privateTransfer(sender, recipient, 1.0, signTx);"));
85
+ console.log();
86
+ console.log(chalk.dim(" // Private swap on Jupiter"));
87
+ console.log(chalk.cyan(" await veil.dex.privateSwap(wallet, SOL, USDC, 1.0, signTx);"));
88
+ console.log();
89
+ console.log(chalk.dim(" // Get balances"));
90
+ console.log(chalk.cyan(" const { public, shielded } = await veil.getBalances();"));
91
+ console.log();
92
+ } catch (error) {
93
+ spinner.fail("Demo failed");
94
+ console.error(error);
95
+ }
96
+ }
97
+ async function runIdentity(action) {
98
+ const loaded = await loadSDK();
99
+ if (!loaded) return;
100
+ const connection = new Connection("https://api.devnet.solana.com", "confirmed");
101
+ if (action === "create") {
102
+ const answers = await inquirer.prompt([
103
+ {
104
+ type: "list",
105
+ name: "method",
106
+ message: "Identity method:",
107
+ choices: [
108
+ { name: "Email (recommended)", value: "email" },
109
+ { name: "Passkey", value: "passkey" },
110
+ { name: "Custom", value: "custom" }
111
+ ]
112
+ },
113
+ {
114
+ type: "input",
115
+ name: "identifier",
116
+ message: "Your identifier (email, username, etc.):"
117
+ },
118
+ {
119
+ type: "password",
120
+ name: "secret",
121
+ message: "Your secret (never stored):"
122
+ }
123
+ ]);
124
+ const spinner = ora("Generating ZK identity proof...").start();
125
+ const veil = new VeilClient({ connection });
126
+ const result = await veil.connect(answers);
127
+ if (result.success) {
128
+ spinner.succeed(chalk.green("Identity created successfully"));
129
+ console.log();
130
+ console.log(chalk.bold("Your Veil Wallet:"));
131
+ console.log(chalk.cyan(veil.publicKey?.toBase58()));
132
+ console.log();
133
+ console.log(chalk.yellow("\u26A0\uFE0F IMPORTANT:"));
134
+ console.log(chalk.dim(" Remember your identifier and secret."));
135
+ console.log(chalk.dim(" They are NEVER stored anywhere."));
136
+ console.log(chalk.dim(" Same credentials = same wallet."));
137
+ } else {
138
+ spinner.fail("Failed to create identity");
139
+ }
140
+ }
141
+ }
142
+
143
+ // src/index.ts
144
+ var VEIL_ASCII = `
145
+ \u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557\u2588\u2588\u2557
146
+ \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2551\u2588\u2588\u2551
147
+ \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2551
148
+ \u255A\u2588\u2588\u2557 \u2588\u2588\u2554\u255D\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551
149
+ \u255A\u2588\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557
150
+ \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D
151
+ `;
152
+ var TAGLINE = "Veil + ShadowWire \u2014 Complete Privacy Infrastructure for Solana";
153
+ var INTRO = `
154
+ Build privacy-first applications with full stack:
155
+ ${chalk2.cyan("\u2022")} ${chalk2.bold("Identity")} \u2014 ZK authentication, no PII on-chain
156
+ ${chalk2.cyan("\u2022")} ${chalk2.bold("Recovery")} \u2014 Shamir secret sharing, hidden guardians
157
+ ${chalk2.cyan("\u2022")} ${chalk2.bold("Voting")} \u2014 Commit-reveal, private choices
158
+ ${chalk2.cyan("\u2022")} ${chalk2.bold("Staking")} \u2014 Hidden amounts via Pedersen commitments
159
+ ${chalk2.cyan("\u2022")} ${chalk2.bold("Multisig")} \u2014 Stealth signers, anonymous approval
160
+ ${chalk2.yellow("\u2022")} ${chalk2.bold("ShadowPay")} \u2014 Private transfers via @radr/shadowwire (mainnet)
161
+ `;
162
+ function displayBanner() {
163
+ console.log();
164
+ console.log(gradient.vice(VEIL_ASCII));
165
+ console.log(chalk2.bold.cyan(TAGLINE));
166
+ console.log(INTRO);
167
+ }
168
+ function displayTemplates() {
169
+ console.log(chalk2.bold("\nAvailable Templates:\n"));
170
+ const categories = ["DeFi", "DApp", "Exchange", "Wallet", "Starter"];
171
+ for (const category of categories) {
172
+ const templates = Object.entries(TEMPLATE_INFO).filter(([_, info]) => info.category === category);
173
+ if (templates.length > 0) {
174
+ console.log(chalk2.cyan(` ${category}:`));
175
+ for (const [key, info] of templates) {
176
+ console.log(` ${chalk2.dim("\u2022")} ${chalk2.white(key.padEnd(12))} ${info.description}`);
177
+ }
178
+ console.log();
179
+ }
180
+ }
181
+ }
182
+ var program = new Command();
183
+ program.name("veil").description("Privacy infrastructure for Solana \u2014 DeFi, DApps, Exchanges, Wallets").version("0.3.0");
184
+ program.command("init [name]").description("Create a new project with full Veil + ShadowWire privacy stack").option("-t, --template <template>", "Template: dex, lending, yield, pool, gaming, nft, social, governance, cex, aggregator, trading, wallet, portfolio, payments, basic").option("-f, --framework <framework>", "Framework: nextjs or vite").option("--helius", "Enable Helius RPC (default: true)").option("--no-helius", "Disable Helius RPC").option("--shadow-pay", "Enable ShadowPay mainnet integration").option("--no-shadow-pay", "Disable ShadowPay").option("--network <network>", "Veil features network: devnet or localnet").action(async (name, options) => {
185
+ displayBanner();
186
+ await runInit({ ...options, name });
187
+ });
188
+ program.command("add").description("Add Veil privacy to an existing project").option("--shadowpay", "Include ShadowPay integration").option("--no-helius", "Disable Helius RPC").action(async (options) => {
189
+ displayBanner();
190
+ await runAdd(options);
191
+ });
192
+ program.command("templates").description("List all available project templates").action(() => {
193
+ displayBanner();
194
+ displayTemplates();
195
+ });
196
+ program.command("demo").description("Run an interactive demo of the Veil SDK capabilities").action(async () => {
197
+ await runDemo();
198
+ });
199
+ program.command("identity <action>").description("Manage ZK identities (create, verify, recover)").action(async (action) => {
200
+ await runIdentity(action);
201
+ });
202
+ if (process.argv.length === 2) {
203
+ displayBanner();
204
+ console.log(chalk2.bold("Quick Start:\n"));
205
+ console.log(` ${chalk2.cyan("veil init my-dex --template=dex")}`);
206
+ console.log(` ${chalk2.cyan("veil init my-wallet --template=wallet")}`);
207
+ console.log(` ${chalk2.cyan("veil init my-dao --template=governance")}`);
208
+ console.log();
209
+ console.log(chalk2.dim("Commands:"));
210
+ console.log(` ${chalk2.cyan("veil init [name]")} Create new project with privacy stack`);
211
+ console.log(` ${chalk2.cyan("veil add")} Add Veil to existing project`);
212
+ console.log(` ${chalk2.cyan("veil templates")} List all available templates`);
213
+ console.log(` ${chalk2.cyan("veil demo")} Interactive SDK demo`);
214
+ console.log();
215
+ console.log(chalk2.dim("Network Info:"));
216
+ console.log(` ${chalk2.yellow("ShadowPay")} runs on ${chalk2.bold("mainnet")} (real private transfers)`);
217
+ console.log(` ${chalk2.cyan("Veil features")} run on ${chalk2.bold("devnet")} (voting, staking, multisig)`);
218
+ console.log();
219
+ } else {
220
+ program.parse();
221
+ }
@@ -0,0 +1,55 @@
1
+ import {
2
+ generateAccessTs,
3
+ generateAppEntry,
4
+ generateEnvExample,
5
+ generateGlobalsCss,
6
+ generateGuaranteesTs,
7
+ generateHeliusTs,
8
+ generateLayoutTsx,
9
+ generateLoginTs,
10
+ generateNextConfig,
11
+ generatePackageJson,
12
+ generatePostcssConfig,
13
+ generatePrivacyStatus,
14
+ generateProvidersTsx,
15
+ generateReadme,
16
+ generateRecoveryTs,
17
+ generateRpcTs,
18
+ generateSdkHooks,
19
+ generateSdkProvider,
20
+ generateShadowPayModule,
21
+ generateTailwindConfig,
22
+ generateTsConfig,
23
+ generateVeilConfig,
24
+ generateVeilHooks,
25
+ generateVeilProvider,
26
+ generateWalletButton
27
+ } from "./chunk-QWU7D5FV.js";
28
+ import "./chunk-QGM4M3NI.js";
29
+ export {
30
+ generateAccessTs,
31
+ generateAppEntry,
32
+ generateEnvExample,
33
+ generateGlobalsCss,
34
+ generateGuaranteesTs,
35
+ generateHeliusTs,
36
+ generateLayoutTsx,
37
+ generateLoginTs,
38
+ generateNextConfig,
39
+ generatePackageJson,
40
+ generatePostcssConfig,
41
+ generatePrivacyStatus,
42
+ generateProvidersTsx,
43
+ generateReadme,
44
+ generateRecoveryTs,
45
+ generateRpcTs,
46
+ generateSdkHooks,
47
+ generateSdkProvider,
48
+ generateShadowPayModule,
49
+ generateTailwindConfig,
50
+ generateTsConfig,
51
+ generateVeilConfig,
52
+ generateVeilHooks,
53
+ generateVeilProvider,
54
+ generateWalletButton
55
+ };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "create-veil-app",
3
+ "version": "0.3.0",
4
+ "description": "Privacy-first project scaffolding CLI for Solana - 15 templates with full Veil + ShadowWire stack",
5
+ "type": "module",
6
+ "bin": {
7
+ "veil": "./dist/index.js",
8
+ "create-veil-app": "./dist/index.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "scripts": {
12
+ "build": "tsup src/index.ts --format esm --dts --clean",
13
+ "dev": "tsup src/index.ts --format esm --watch",
14
+ "start": "node dist/index.js",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "keywords": [
18
+ "solana",
19
+ "privacy",
20
+ "cli",
21
+ "scaffold",
22
+ "veil",
23
+ "web3",
24
+ "wallet",
25
+ "shielded",
26
+ "zk-proofs",
27
+ "sdk",
28
+ "shadowpay",
29
+ "defi",
30
+ "dex"
31
+ ],
32
+ "author": "Veil Protocol",
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/veil-protocol/cli"
37
+ },
38
+ "homepage": "https://veil-protocol.io",
39
+ "dependencies": {
40
+ "@fezzola/veil-sdk": "^0.1.0",
41
+ "@solana/web3.js": "^1.87.0",
42
+ "chalk": "^5.3.0",
43
+ "commander": "^12.0.0",
44
+ "fs-extra": "^11.2.0",
45
+ "gradient-string": "^2.0.2",
46
+ "inquirer": "^9.2.15",
47
+ "ora": "^8.0.1"
48
+ },
49
+ "devDependencies": {
50
+ "@types/fs-extra": "^11.0.4",
51
+ "@types/gradient-string": "^1.1.6",
52
+ "@types/inquirer": "^9.0.7",
53
+ "@types/node": "^20.11.0",
54
+ "tsup": "^8.0.1",
55
+ "typescript": "^5.3.3"
56
+ },
57
+ "engines": {
58
+ "node": ">=18.0.0"
59
+ },
60
+ "files": [
61
+ "dist",
62
+ "README.md"
63
+ ]
64
+ }