Skip to content

Conversation

@Mshehu5
Copy link
Contributor

@Mshehu5 Mshehu5 commented Oct 30, 2025

This PR address some issues in #865 mainly this issue :

Document the Uri top level type alias and struct
documentation for the individual fields exists but this assumes the reader is familiar with the Extras pattern of bitcoin_uri
it should have an example of parsing a URI checking the version, and initializing sender state machine

consulted GPT codex for example

Pull Request Checklist

Please confirm the following before requesting review:

@coveralls
Copy link
Collaborator

coveralls commented Oct 30, 2025

Pull Request Test Coverage Report for Build 18942206385

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 83.578%

Totals Coverage Status
Change from base Build 18915517369: 0.0%
Covered Lines: 8988
Relevant Lines: 10754

💛 - Coveralls

@Mshehu5 Mshehu5 marked this pull request as draft October 30, 2025 13:24
Add  docs clarifying the `bitcoin_uri` and Pjuri.
Include an example that parses a Payjoin URI, checks version, and
initializes the sender state machine. Docs-only; no code changes.
@Mshehu5 Mshehu5 marked this pull request as ready for review October 30, 2025 13:46
/// use bitcoin::{psbt::Psbt, FeeRate};
/// use std::str::FromStr;
///
/// let Example_uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=0.01&pj=https://example.com/pj";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// let Example_uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=0.01&pj=https://example.com/pj";
/// let example_uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=0.01&pj=https://example.com/pj";

/// .check_pj_supported()
/// .expect("URI supports Payjoin");
///
/// // Build a PSBT (placeholder — build this from your wallet)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the section of the sample code after the PJ URI has been initialized should be in the PjUri documentation.


/// A Bitcoin URI with optional Payjoin support.
///
/// This is a type alias for `bitcoin_uri::Uri` with Payjoin-specific extras. The URI can represent
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can wrap a reference with brackets so that it is like

[`bitcoin_uri::Uri`]

It's a nice to have as Rust docs will link it with the actual struct, and both the documentation and IDEs will make it easy to move from here to there.

/// Payjoin operations.
/// See [`Uri`] for a complete example that parses a Bip21 Uri, checks the Payjoin version,
/// and initializes the appropriate sender (V1 or V2).
pub type PjUri<'a> = bitcoin_uri::Uri<'a, NetworkChecked, PayjoinExtras>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in scope, but should we also update the PJ parameters documentation while we're at it to reflect the possible parameters outlined in the BIPs? Would be nice to have them too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants