Document Uri with parse/version/sender example#1184
Open
Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Open
Document Uri with parse/version/sender example#1184Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Mshehu5 wants to merge 1 commit intopayjoin:masterfrom
Conversation
Collaborator
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"; |
Contributor
There was a problem hiding this comment.
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) |
Contributor
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 |
Contributor
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>; |
Contributor
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.