@ledgerhq/zcash-utils 2.1.1 → 2.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @ledgerhq/zcash-utils
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0a94002: Build a transparent send without a UFVK. `buildTransaction` required a UFVK for
8
+ every flow, including a fully transparent one — which carries no shielded bundle
9
+ and reads no shielded key material. Its only key requirement is the
10
+ account-level transparent pubkey at `m/44'/coin'/account'`, used to derive the
11
+ internal change address and to verify each input's signing path. A wallet always
12
+ holds those bytes (they are the payload of the account xpub) whereas obtaining a
13
+ UFVK takes a user confirmation on the device, so the requirement forced a
14
+ viewing-key export on anyone spending public funds.
15
+
16
+ `ufvk` is now optional and a `transparentAccountPubkey` field accepts those 65
17
+ bytes (32-byte chain code ‖ 33-byte compressed pubkey) as hex. A transparent
18
+ send supplies the pubkey and omits the UFVK; both may be supplied together, in
19
+ which case the UFVK's transparent component is authoritative and the standalone
20
+ field only has to agree with it — a mismatch means key material from two
21
+ different accounts and fails the build rather than picking one. Every flow with
22
+ a shielded bundle (an Orchard spend, or a shielded recipient) still requires the
23
+ UFVK and now says so explicitly instead of failing deeper on a missing Orchard
24
+ component; `buildIronwoodTransaction`, whose bundle is always shielded, is
25
+ unchanged.
26
+
27
+ The two orchestrators now share one transparent-input decoder, so the
28
+ fund-safety check that ties each input's `(derivationScope, addressIndex)` to
29
+ its pubkey has a single implementation instead of two copies.
30
+
31
+ ### Patch Changes
32
+
33
+ - 0a94002: Refresh the dependency lock and collapse the duplicate `shardtree`. The lock
34
+ carried two copies of it — our own `0.6.2` plus the `0.7.0` that
35
+ `zcash_client_backend` links — so the commitment-tree types existed twice under
36
+ identical names and a witness built against one could not cross into the other.
37
+ Declaring `shardtree = "0.7"` leaves a single `0.7.1` copy that both sides share.
38
+
39
+ `pczt` moves to `0.9.3`, still pinned exactly: it defines the byte stream the
40
+ firmware parses, so it may only move as a deliberate, tested step and never as a
41
+ side effect of `cargo update`. `bitcoin` stays on the `0.32.x` maintenance line
42
+ for the same reason — the parallel `0.32.10x` feature line sorts higher and a
43
+ broad update would otherwise drift onto it — and the pin is now documented in
44
+ `Cargo.toml` so the next refresh keeps it.
45
+
46
+ The rest is a routine refresh of transitive dependencies. No Zcash protocol crate
47
+ moves: `zcash_primitives`, `zcash_keys`, `zcash_transparent`, `orchard` and
48
+ `zcash_client_backend` all stay where they were.
49
+
3
50
  ## 2.1.1
4
51
 
5
52
  ### Patch Changes
package/index.d.ts CHANGED
@@ -207,9 +207,37 @@ export interface TransparentInputJs {
207
207
  */
208
208
  addressIndex: number
209
209
  }
210
+ /**
211
+ * Arguments for [`build_transaction`].
212
+ *
213
+ * **Invariant: supply `ufvk`, or `transparentAccountPubkey`, or both.** The two
214
+ * are declared independently optional because this struct crosses into JS,
215
+ * where "exactly one of" has no encoding — napi rejects a data-carrying enum —
216
+ * so the rule cannot live in the type. Supplying neither is refused up front,
217
+ * before any work, rather than deeper in the build. Which one a given flow
218
+ * needs is on each field below.
219
+ */
210
220
  export interface BuildTransactionParams {
211
221
  grpcUrl: string
212
- ufvk: string
222
+ /**
223
+ * Unified full viewing key of the spending account. Required by every flow
224
+ * that carries an Orchard bundle (an Orchard spend, or a shielded
225
+ * recipient); omit it only for a fully transparent send, which reads no
226
+ * shielded key material and takes its transparent account key from
227
+ * `transparentAccountPubkey` instead. Spending transparent funds therefore
228
+ * never requires exporting a viewing key from the device.
229
+ */
230
+ ufvk?: string
231
+ /**
232
+ * 130-char hex (65 bytes: 32-byte chain code ‖ 33-byte compressed pubkey):
233
+ * the account-level transparent pubkey at `m/44'/coin'/account'` — the
234
+ * payload of the account xpub, which a wallet already holds. Used to derive
235
+ * the internal change address and to verify each transparent input's
236
+ * signing path. Optional when `ufvk` is supplied (its transparent component
237
+ * serves, and this field then only has to agree with it); required for a
238
+ * transparent send that omits the UFVK.
239
+ */
240
+ transparentAccountPubkey?: string
213
241
  network?: string
214
242
  /**
215
243
  * 64-char hex (32 bytes): ZIP-32 seed fingerprint of the wallet seed,
@@ -256,7 +284,8 @@ export interface BuildTransactionResult {
256
284
  * Supports Orchard-source (Private→*) and transparent-source (Public→*)
257
285
  * flows. Halo 2 proof generation happens here for Orchard-bundle transactions
258
286
  * (~2-5 s first call, ~hundreds of ms thereafter thanks to the process-global
259
- * ProvingKey cache). Transparent-only transactions skip the Orchard prover.
287
+ * ProvingKey cache). Transparent-only transactions skip the Orchard prover, and
288
+ * need no UFVK — see `ufvk` / `transparentAccountPubkey` on the params.
260
289
  *
261
290
  * Note: unlike `finalize_transaction` (purely CPU-bound, offloaded via
262
291
  * `spawn_blocking`), this is an async orchestrator that interleaves gRPC
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/zcash-utils",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Native Zcash key derivation and shielded sync — Node.js (NAPI)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",