zkenclave-sdk 0.1.1 → 0.1.5

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.
Files changed (2) hide show
  1. package/README.md +91 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # zkenclave-sdk
2
+
3
+ Privacy-preserving vault SDK for Zero-Knowledge withdrawals on EVM chains.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install zkenclave-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { PrivacyVaultSDK, ZKProofClient } from "zkenclave-sdk";
15
+
16
+ const sdk = new PrivacyVaultSDK(
17
+ {
18
+ vaultAddress: "0x68F19280d3030eaE36B8Da42621B66e92a8AEA32",
19
+ zkVerifierAddress: "0x68491614a84C0410E9Fc0CB59Fc60A4F9188687c",
20
+ aspRegistryAddress: "0xB041Cff58FB866c7f4326e0767c97B93434aBa9E",
21
+ chainId: 845320009,
22
+ rpcUrl: "https://horizen-rpc-testnet.appchain.base.org",
23
+ },
24
+ signer
25
+ );
26
+
27
+ // Deposit
28
+ const { note, txHash, leafIndex } = await sdk.deposit(parseEther("0.1"));
29
+
30
+ // Withdraw
31
+ const result = await sdk.withdraw(note, recipientAddress);
32
+ ```
33
+
34
+ ## Features
35
+
36
+ - **Privacy-preserving deposits** - Commitment-nullifier scheme
37
+ - **ZK proof generation** - Client-side via `ZKProofClient`
38
+ - **Multi-chain support** - Configurable RPC/chain
39
+ - **TypeScript** - Full type definitions
40
+
41
+ ## API
42
+
43
+ ### `PrivacyVaultSDK`
44
+
45
+ | Method | Description |
46
+ | ---------------------------- | ------------------------- |
47
+ | `deposit(amount)` | Deposit ETH, returns note |
48
+ | `withdraw(note, recipient)` | Withdraw using note |
49
+ | `getLatestRoot()` | Get current Merkle root |
50
+ | `getNextLeafIndex()` | Get next deposit index |
51
+ | `isNullifierUsed(nullifier)` | Check if nullifier spent |
52
+
53
+ ### `ZKProofClient`
54
+
55
+ | Method | Description |
56
+ | ------------------------------------------- | ------------------------- |
57
+ | `generateWithdrawalProof(request)` | Generate ZK proof |
58
+ | `generateComplianceProof(commitment, root)` | Generate compliance proof |
59
+
60
+ ## Types
61
+
62
+ ```typescript
63
+ interface VaultConfig {
64
+ vaultAddress: string;
65
+ zkVerifierAddress: string;
66
+ aspRegistryAddress: string;
67
+ chainId: number;
68
+ rpcUrl: string;
69
+ }
70
+
71
+ interface DepositNote {
72
+ commitment: Uint8Array;
73
+ secret: Uint8Array;
74
+ nullifierSeed: Uint8Array;
75
+ amount: bigint;
76
+ leafIndex: number;
77
+ timestamp: number;
78
+ }
79
+ ```
80
+
81
+ ## Deployed Contracts (Horizen Sepolia)
82
+
83
+ | Contract | Address |
84
+ | ------------ | -------------------------------------------- |
85
+ | PrivacyVault | `0x68F19280d3030eaE36B8Da42621B66e92a8AEA32` |
86
+ | ZKVerifier | `0x68491614a84C0410E9Fc0CB59Fc60A4F9188687c` |
87
+ | ASPRegistry | `0xB041Cff58FB866c7f4326e0767c97B93434aBa9E` |
88
+
89
+ ## License
90
+
91
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zkenclave-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.5",
4
4
  "description": "TypeScript SDK for privacy-preserving vault withdrawals with ZK proofs",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",