@ledgerhq/zcash-utils 2.5.1 → 2.7.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,27 @@
1
1
  # @ledgerhq/zcash-utils
2
2
 
3
+ ## 2.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9f2aa1f: Move the Zcash crates to their NU7 pre-releases. A transaction whose target block is past NU7 activation is built under the ZIP 259 branch id (`0x77190AD9`), and the expiry cap now sees NU7 ahead on testnet. These releases carry no NU7 mainnet activation height yet, so mainnet transactions keep the NU6.3 branch id until a release that sets it is pinned. The PCZT encoding is unchanged.
8
+ - 695c4e6: `buildTransaction` and `buildIronwoodTransaction` take an optional `regtestActivationHeights` for a regtest node whose activation schedule differs from the canonical one. The builder then selects the branch id that node enforces and caps the expiry below the upgrade it has scheduled. The field is refused with mainnet or testnet.
9
+ - 57191c4: Apply ZIP 2009's ZIP-317 marginal fee: `buildTransaction` and `buildIronwoodTransaction` accept a fee computed at 1,000 zatoshis per logical action on mainnet from height 3,590,000 and on test networks, and keep 5,000 on mainnet below that height. A fee computed at 5,000 is still accepted past the switch.
10
+
11
+ ### Patch Changes
12
+
13
+ - 38e0cfe: The error returned by `buildTransaction` and `buildIronwoodTransaction` for a fee that does not satisfy ZIP-317 reads `craft error: fee …` once, instead of repeating the `craft error:` prefix.
14
+
15
+ ## 2.6.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 841b576: Transactions now target the next block (tip + 1) instead of anchor + 40, keep the builder's expiry, and cap it below the next network upgrade known to the bundled consensus parameters (none is pending on mainnet or testnet with this release; NU7 is covered once its heights ship). A craft whose capped expiry would leave fewer than 8 blocks (zcashd's 3-block expiring-soon rule plus 5 blocks for signing on the device) is refused with an error containing `expiry too close to activation`. An explicit `anchorHeight` above the chain tip is rejected, and the chain tip is now queried even when `anchorHeight` is given.
20
+
21
+ ### Patch Changes
22
+
23
+ - 378e859: Widen the shard-0 scan-width safety limit so that two years of chain growth still pass at NU7's 25-second block spacing, while a scan started from genesis is still refused.
24
+
3
25
  ## 2.5.1
4
26
 
5
27
  ### Patch Changes
package/index.d.ts CHANGED
@@ -210,6 +210,27 @@ export interface TransparentInputJs {
210
210
  */
211
211
  addressIndex: number
212
212
  }
213
+ /**
214
+ * Regtest activation heights a local node was started with, one optional
215
+ * height per network upgrade. Each height given replaces the canonical
216
+ * regtest value (Overwinter through Canopy at 1, NU5 through NU6.3 at 2, NU7
217
+ * unscheduled); each one omitted keeps it. Lets the builder pick the same
218
+ * branch id, and cap the expiry height at the same upcoming activation, as a
219
+ * node whose `activation_heights` differ from the canonical set.
220
+ */
221
+ export interface RegtestActivationHeightsJs {
222
+ overwinter?: number
223
+ sapling?: number
224
+ blossom?: number
225
+ heartwood?: number
226
+ canopy?: number
227
+ nu5?: number
228
+ nu6?: number
229
+ nu6_1?: number
230
+ nu6_2?: number
231
+ nu6_3?: number
232
+ nu7?: number
233
+ }
213
234
  /**
214
235
  * Arguments for [`build_transaction`].
215
236
  *
@@ -242,6 +263,12 @@ export interface BuildTransactionParams {
242
263
  */
243
264
  transparentAccountPubkey?: string
244
265
  network?: string
266
+ /**
267
+ * Only with `network: "regtest"`: activation heights of the local node,
268
+ * when its schedule differs from the canonical regtest set. Refused with
269
+ * any other network.
270
+ */
271
+ regtestActivationHeights?: RegtestActivationHeightsJs
245
272
  /**
246
273
  * 64-char hex (32 bytes): ZIP-32 seed fingerprint of the wallet seed,
247
274
  * read from the device. Stamped onto each real spend so the device can
@@ -255,12 +282,22 @@ export interface BuildTransactionParams {
255
282
  * loss). Per FR-4 the fee is selected by ledger-live; this
256
283
  * crate validates it against ZIP-317 and derives change from it rather
257
284
  * than computing a fee itself.
285
+ *
286
+ * The ZIP-317 marginal fee depends on the target block (ZIP 2009): 1,000
287
+ * zatoshis per logical action on mainnet from height 3,590,000 and on test
288
+ * networks, 5,000 on mainnet below it. A fee computed at 5,000 is still
289
+ * accepted past the switch; one computed at 1,000 is refused before it.
258
290
  */
259
291
  feeZat: string
260
292
  spends: Array<OrchardSpendInputJs>
261
293
  /** Transparent (P2PKH) UTXOs to spend. Empty for Private→* flows. */
262
294
  transparentInputs: Array<TransparentInputJs>
263
295
  outputs: Array<OutputRequestJs>
296
+ /**
297
+ * Explicit anchor height; omitted → `tip − 10`. An explicit height above the
298
+ * tip is rejected. The transaction always targets the next block, `tip + 1`,
299
+ * so the chain tip is queried in either case.
300
+ */
264
301
  anchorHeight?: number
265
302
  }
266
303
  export interface BuildTransactionResult {
@@ -272,7 +309,7 @@ export interface BuildTransactionResult {
272
309
  pcztHex: string
273
310
  /** Decimal fee in zatoshis. */
274
311
  feeZat: string
275
- /** Block height the Merkle paths were computed against. */
312
+ /** Block height the Merkle paths were computed against (the resolved anchor). */
276
313
  anchorHeight: number
277
314
  /** Orchard action count after dummy padding. */
278
315
  nActionsOrchard: number
@@ -330,6 +367,12 @@ export interface BuildIronwoodTransactionParams {
330
367
  grpcUrl: string
331
368
  ufvk: string
332
369
  network?: string
370
+ /**
371
+ * Only with `network: "regtest"`: activation heights of the local node,
372
+ * when its schedule differs from the canonical regtest set. Refused with
373
+ * any other network.
374
+ */
375
+ regtestActivationHeights?: RegtestActivationHeightsJs
333
376
  /**
334
377
  * 64-char hex (32 bytes): ZIP-32 seed fingerprint of the wallet seed,
335
378
  * read from the device. Stamped onto each real spend so the device can
@@ -343,12 +386,22 @@ export interface BuildIronwoodTransactionParams {
343
386
  * loss). Per FR-4 the fee is selected by ledger-live; this
344
387
  * crate validates it against ZIP-317 Rev 1 and derives the (always
345
388
  * Ironwood) change from it rather than computing a fee itself.
389
+ *
390
+ * The ZIP-317 marginal fee depends on the target block (ZIP 2009): 1,000
391
+ * zatoshis per logical action on mainnet from height 3,590,000 and on test
392
+ * networks, 5,000 on mainnet below it. A fee computed at 5,000 is still
393
+ * accepted past the switch; one computed at 1,000 is refused before it.
346
394
  */
347
395
  feeZat: string
348
396
  spends: Array<IronwoodSpendInputJs>
349
397
  /** Transparent (P2PKH) UTXOs to spend. Empty for Ironwood→* flows. */
350
398
  transparentInputs: Array<TransparentInputJs>
351
399
  outputs: Array<IronwoodOutputRequestJs>
400
+ /**
401
+ * Explicit anchor height; omitted → `tip − 10`. An explicit height above the
402
+ * tip is rejected. The transaction always targets the next block, `tip + 1`,
403
+ * so the chain tip is queried in either case.
404
+ */
352
405
  anchorHeight?: number
353
406
  }
354
407
  export interface BuildIronwoodTransactionResult {
@@ -361,7 +414,7 @@ export interface BuildIronwoodTransactionResult {
361
414
  pcztHex: string
362
415
  /** Decimal fee in zatoshis. */
363
416
  feeZat: string
364
- /** Block height the Merkle paths were computed against. */
417
+ /** Block height the Merkle paths were computed against (the resolved anchor). */
365
418
  anchorHeight: number
366
419
  /** Ironwood action count after dummy padding. */
367
420
  nActionsIronwood: number
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.5.1",
3
+ "version": "2.7.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",