Pipe-friendly transaction builder.
Summary
Functions
Add an input from hex-encoded txid, vout, locking script hex, and satoshi amount. Raises on error.
Add an OP_RETURN output containing the given data pushes (0 satoshis).
Append a pre-built output to the transaction.
Add a P2PKH output paying to the given Base58Check address. Raises on invalid address.
Validate and finalize the transaction. Returns error if inputs or outputs are missing.
Create a new empty transaction.
Sign all inputs using the same signing template.
Sign a single input using the given signing template (e.g. P2PKH, Stas).
Functions
@spec add_input( BSV.Transaction.t(), String.t(), non_neg_integer(), String.t(), non_neg_integer() ) :: BSV.Transaction.t()
Add an input from hex-encoded txid, vout, locking script hex, and satoshi amount. Raises on error.
@spec add_op_return_output(BSV.Transaction.t(), [binary()]) :: BSV.Transaction.t()
Add an OP_RETURN output containing the given data pushes (0 satoshis).
@spec add_output(BSV.Transaction.t(), BSV.Transaction.Output.t()) :: BSV.Transaction.t()
Append a pre-built output to the transaction.
@spec add_p2pkh_output(BSV.Transaction.t(), String.t(), non_neg_integer()) :: BSV.Transaction.t()
Add a P2PKH output paying to the given Base58Check address. Raises on invalid address.
@spec build(BSV.Transaction.t()) :: {:ok, BSV.Transaction.t()} | {:error, term()}
Validate and finalize the transaction. Returns error if inputs or outputs are missing.
@spec new() :: BSV.Transaction.t()
Create a new empty transaction.
@spec sign_all_inputs( BSV.Transaction.t(), struct() ) :: {:ok, BSV.Transaction.t()} | {:error, term()}
Sign all inputs using the same signing template.
@spec sign_input(BSV.Transaction.t(), non_neg_integer(), struct()) :: {:ok, BSV.Transaction.t()} | {:error, term()}
Sign a single input using the given signing template (e.g. P2PKH, Stas).