Creates a Partially Constructed Zcash Transaction (PCZT) from transparent inputs and payment outputs. Implements the Creator, Constructor, and IO Finalizer roles from ZIP 374.
Signature
function propose_transaction(
inputs: WasmTransparentInput[],
payments: WasmPayment[],
change_address: string | null,
network: 'mainnet' | 'testnet',
expiry_height: number
): WasmPczt
Parameters
inputs
TransparentInput[]
required
Array of transparent UTXOs to spend
Array of payment outputs to create
Address to receive change (Orchard or transparent)
Block height at which the transaction expires
Returns
A Pczt object representing the partially constructed transaction.
Example
const input = new t2z.WasmTransparentInput(
'03abc123...',
'ce15f716...1338',
0,
1_000_000n,
'76a914...88ac',
null
);
const payment = new t2z.WasmPayment(
'u1recipient...',
800_000n,
null,
null
);
const pczt = t2z.propose_transaction(
[input],
[payment],
'u1change...',
'testnet',
3720100
);
Errors
| Error | Cause |
|---|
InvalidAddress | Address couldn’t be parsed |
InsufficientFunds | Inputs don’t cover payments + fee |
ChangeRequired | Change exists but no change address provided |
OrchardBuilderNotAvailable | Expiry height is before Nu5 |
See Also