-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
105 lines (103 loc) · 4.32 KB
/
Copy pathindex.d.ts
File metadata and controls
105 lines (103 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
/**
* Generates zk-SNARK proofs for shielded Orchard outputs.
*
* This function implements real Orchard proof generation using the pczt Prover role.
* It takes a serialized PCZT, generates the required zk-SNARK proofs for Orchard actions,
* and returns the PCZT with proofs attached.
*
* # Parameters
* - `pczt_bytes`: Serialized PCZT bytes
*
* # Returns
* Promise resolving to PCZT bytes with proofs added to Orchard bundle
*/
export declare function proveTransaction(pcztBytes: Buffer): Promise<unknown>
/**
* Parses PCZT bytes into structured format for inspection
*
* # Parameters
* - `pczt_bytes`: Serialized PCZT bytes
*
* # Returns
* Buffer containing the parsed PCZT
*/
export declare function parsePcztBytes(pcztBytes: Buffer): Buffer
/**
* Serializes PCZT structure to bytes
*
* # Parameters
* - `pczt_bytes`: PCZT structure bytes
*
* # Returns
* Buffer containing serialized PCZT
*/
export declare function serializePcztBytes(pcztBytes: Buffer): Buffer
/** Combines multiple PCZTs into a single PCZT */
export declare function combinePczts(pczts: Array<Buffer>): Buffer
/** Computes ZIP 244 signature hash for a transparent input */
export declare function computeSighash(pcztBytes: Buffer, inputIndex: number, value?: string | undefined | null, scriptPubkey?: Buffer | undefined | null): Buffer
/**
* Adds a signature to the PCZT transparent input
*
* Using our forked pczt crate, we can now set the script_sig directly
* on the transparent inputs, supporting external signing workflows.
*/
export declare function addSignature(pcztBytes: Buffer, inputIndex: number, scriptSig: Buffer): Buffer
/** Verifies a signature against a sighash */
export declare function verifySignature(sighash: Buffer, signature: Buffer, pubkey: Buffer): boolean
/** Information about a unified address */
export interface UnifiedAddressInfo {
hasOrchard: boolean
hasSapling: boolean
hasTransparent: boolean
}
/**
* Parses a unified address and checks what receivers it contains
*
* This properly decodes unified addresses using zcash_address 0.8
*
* # Parameters
* - `address`: The unified address string to parse
*
* # Returns
* UnifiedAddressInfo with receiver types present
*/
export declare function parseUnifiedAddress(address: string): UnifiedAddressInfo
/** Checks if an address is a valid Zcash address format */
export declare function validateZcashAddress(address: string): boolean
/** Builds and serializes a complete Zcash v5 transaction */
export declare function buildAndSerializeTransaction(inputsJson: string, outputsJson: string, lockTime: number): Buffer
/**
* Extracts transaction data from PCZT and serializes it
*
* This function implements the Transaction Extractor role from ZIP 374.
* It first runs the IO Finalizer to finalize any empty shielded bundles,
* then extracts the complete transaction including transparent signatures and Orchard bundle.
*/
export declare function extractTransactionFromPczt(pcztBytes: Buffer): Buffer
/**
* Extracts transaction from PCZT with explicit scriptSigs provided
*
* This function handles the case where transparent signatures are computed externally
* (not via the pczt Signer role). It builds the transparent bundle with provided
* scriptSigs.
*
* For transactions with Orchard outputs, the Orchard bundle is NOT included here
* because the pczt crate doesn't expose the APIs needed for external signing.
* Use extractTransactionFromPczt for Orchard-only transactions where no external
* signatures are needed.
*
* The script_sigs_json should be an array of scriptSig bytes (one per transparent input).
*/
export declare function extractTransactionWithSigs(pcztBytes: Buffer, scriptSigsJson: string): Buffer
/** Builds a PCZT with Orchard outputs (transparent → shielded) */
export declare function buildPcztWithOrchard(blockHeight: number, transparentInputsJson: string, orchardPaymentsJson: string): Buffer
/** Creates an empty PCZT with the given version and lock time */
export declare function createPczt(version: number, lockTime: number): Buffer
/** Creates a PCZT with transparent inputs and outputs using the Builder */
export declare function createPcztWithIo(version: number, lockTime: number, inputsJson: string, outputsJson: string): Buffer
/** Module initialization */
export declare function init(): string