-
Notifications
You must be signed in to change notification settings - Fork 76
Document Uri with parse/version/sender example #1184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /// 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.
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 |
There was a problem hiding this comment.
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>; |
There was a problem hiding this comment.
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.
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.