Skip to content

SDK refactoring #6

@danielost

Description

@danielost

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions