@opaquecash/opaque 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +81 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # @opaquecash/opaque
2
+
3
+ Single entry point for Opaque **stealth** (EIP-5564) and **PSR** flows used together with your own indexer.
4
+
5
+ **Full documentation** (guides, API reference, playground): **[docs.opaque.cash](https://docs.opaque.cash)**
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @opaquecash/opaque
11
+ ```
12
+
13
+ The package ships TypeScript types and depends on **`viem`** (v2). You must load the **WASM** bundle (`cryptography.js`) at runtime—either from your app’s static assets or a hosted URL (see below).
14
+
15
+ ### Working from this repository
16
+
17
+ ```bash
18
+ cd sdk && npm install && npm run build
19
+ ```
20
+
21
+ Then depend on `@opaquecash/opaque` via your workspace or `npm link`.
22
+
23
+ ## Initialize
24
+
25
+ ```ts
26
+ import { OpaqueClient } from "@opaquecash/opaque";
27
+
28
+ const client = await OpaqueClient.create({
29
+ chainId: 11155111,
30
+ rpcUrl: "https://…",
31
+ walletSignature: userSignatureHex,
32
+ ethereumAddress: userAddress,
33
+ wasmModuleSpecifier: new URL("/pkg/cryptography.js", import.meta.url).href,
34
+ });
35
+ ```
36
+
37
+ Hosted WASM entry used by the reference app:
38
+
39
+ `https://www.opaque.cash/pkg/cryptography.js`
40
+
41
+ ## Constants
42
+
43
+ - `OpaqueClient.supportedChainIds()`
44
+ - `OpaqueClient.chainDeployment(chainId)` — registry, announcer, verifier, default tokens
45
+ - `NATIVE_TOKEN_ADDRESS` — sentinel for ETH in balance aggregation
46
+
47
+ ## Indexer announcements
48
+
49
+ Pass subgraph-shaped rows:
50
+
51
+ ```ts
52
+ const rows: IndexerAnnouncement[] = [
53
+ {
54
+ blockNumber: "10533630",
55
+ etherealPublicKey: "0x02…",
56
+ logIndex: 161,
57
+ metadata: "0x…",
58
+ stealthAddress: "0x…",
59
+ transactionHash: "0x…",
60
+ viewTag: 234,
61
+ },
62
+ ];
63
+ ```
64
+
65
+ ## Flows
66
+
67
+ | Goal | API |
68
+ |------|-----|
69
+ | Resolve recipient meta-address (registry read via `rpcUrl`) | `resolveRecipientMetaAddress(normalAddress)` |
70
+ | Register meta-address calldata | `buildRegisterMetaAddressTransaction()` |
71
+ | Send: derive stealth + ephemeral | `prepareStealthSend(recipientMetaHex)` |
72
+ | Announce calldata | `buildAnnounceTransactionRequest(prepareResult)` |
73
+ | Owned outputs | `filterOwnedAnnouncements(rows)` |
74
+ | Balances by token | `getBalancesFromAnnouncements(rows)` |
75
+ | PSR traits | `discoverTraits(rows)` |
76
+
77
+ You always submit transactions from your own wallet; the SDK returns **structured calldata** and **read results**.
78
+
79
+ ## Lower-level packages
80
+
81
+ `@opaquecash/stealth-core`, `@opaquecash/stealth-wasm`, `@opaquecash/stealth-chain`, `@opaquecash/psr-core`, and related packages remain available for advanced integrations.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opaquecash/opaque",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Unified Opaque SDK client: config, indexer announcements, announce payloads, balances, traits",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",