Currently, the SDK exposes single methods for transactions building. These methods require many arguments, including cryptographic inputs (commitments, proofs), locktime, amounts, outpoints, etc.
To improve ergonomics, readability, and testability, we should enhance the SDK to use the Builder Pattern with a fluent interface, allowing method chaining like:
let builder = ChallengeTxBuilder::new()
.with_challenger_pubkey(...)
.with_challenge_amount(...)
.with_locktime(...)
...;
let psbt = builder.build_psbt(...)?;
Key points:
- Abstractions for commitment/proof generation should be introduced and reused.
- The builder should eventually support signing or serializing the PSBT.
- Internal logic for constructing transactions and proving commitments should be modular and reusable by other transaction types.
Currently, the SDK exposes single methods for transactions building. These methods require many arguments, including cryptographic inputs (commitments, proofs), locktime, amounts, outpoints, etc.
To improve ergonomics, readability, and testability, we should enhance the SDK to use the Builder Pattern with a fluent interface, allowing method chaining like:
Key points: