@ledgerhq/zcash-utils 0.1.4 → 0.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/index.d.ts CHANGED
@@ -80,6 +80,14 @@ export interface SyncStats {
80
80
  export declare function startSync(params: SyncParams): Promise<TransactionStream>
81
81
  /** Returns the current chain tip height from the gRPC endpoint. */
82
82
  export declare function getChainTip(grpcUrl: string): Promise<number>
83
+ /**
84
+ * Find the block height closest to the given Unix timestamp via interpolation search.
85
+ *
86
+ * Returns the height of the latest block whose timestamp is ≤ the target.
87
+ * If the timestamp is before genesis, returns the genesis height.
88
+ * If the timestamp is after the chain tip, returns the tip height.
89
+ */
90
+ export declare function findBlockHeight(grpcUrl: string, timestamp: number): Promise<number>
83
91
  /**
84
92
  * Async iterator over matched shielded transactions.
85
93
  *
Binary file
Binary file
package/index.js CHANGED
@@ -310,8 +310,9 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { TransactionStream, startSync, getChainTip } = nativeBinding
313
+ const { TransactionStream, startSync, getChainTip, findBlockHeight } = nativeBinding
314
314
 
315
315
  module.exports.TransactionStream = TransactionStream
316
316
  module.exports.startSync = startSync
317
317
  module.exports.getChainTip = getChainTip
318
+ module.exports.findBlockHeight = findBlockHeight
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": "0.1.4",
3
+ "version": "0.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",
@@ -47,6 +47,7 @@
47
47
  "cli": "cargo run -q -p zcash-cli",
48
48
  "cli:derive": "cargo run -q -p zcash-cli -- derive --help",
49
49
  "cli:tip": "cargo run -q -p zcash-cli -- tip --help",
50
+ "cli:height-at": "cargo run -q -p zcash-cli -- height-at --help",
50
51
  "cli:sync": "cargo run -q -p zcash-cli -- sync --help",
51
52
  "// ── Node.js validation & benchmarks ───────────────────────────────": "",
52
53
  "sync-tx": "tsx examples/sync-tx.node.ts --start-height 1130000 --end-height 1180000",