Document Uri with parse/version/sender example#1184
Document Uri with parse/version/sender example#1184Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Conversation
Pull Request Test Coverage Report for Build 18942206385Details
💛 - Coveralls |
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.
| /// use bitcoin::{psbt::Psbt, FeeRate}; | ||
| /// use std::str::FromStr; | ||
| /// | ||
| /// let Example_uri = "bitcoin:12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX?amount=0.01&pj=https://example.com/pj"; |
There was a problem hiding this comment.
| /// 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) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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>; |
There was a problem hiding this comment.
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.
|
would be nice to get this in but it seems dead until someone revives & champions it. @Mshehu5 if you want to respond to the feedback we can definitely review. |
|
@DanGould lost track of this will address the changes and update |
This PR address some issues in #865 mainly this issue :
consulted GPT codex for example
Pull Request Checklist
Please confirm the following before requesting review:
AI
in the body of this PR.