Skip to content
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

Add examples on how to use the Extras #11

Open
benthecarman opened this issue Feb 27, 2023 · 4 comments
Open

Add examples on how to use the Extras #11

benthecarman opened this issue Feb 27, 2023 · 4 comments

Comments

@benthecarman
Copy link
Contributor

For now can look at @DanGould's

https://github.com/chaincase-app/payjoin/blob/master/payjoin/src/uri.rs

@DanGould
Copy link
Contributor

DanGould commented May 7, 2023

That's all @Kixunil's work, not mine. Still useful to have examples, especially when this crate gets used in bindings

@DanGould
Copy link
Contributor

DanGould commented Jan 17, 2024

I think we could show how library-defined Extras could be composed. For example, bitcoin-walia duplicates payjoin bip21 parsing by defining WaliaExtras as follows:

https://github.com/MutinyWallet/bitcoin-waila/blob/627375a3b628616ccea6d65bd8bc912558fddcf9/waila/src/bip21.rs#L15-L19

and later duplicating the de/serialization logic

Where it could be defined as

pub struct WailaExtras {
    pub lightning: Option<Bolt11Invoice>,
    pub pj_extras: Option<PayjoinExtras>
}

and then use the bip21 defined functions like PayjoinExtras::deserialize_temp within its own
WaliaExtras::deserialize_temp

Right now the payjoin library actually implements 2 separate Extras, PayjoinParams to parse and PayjoinParams to check validity, But I think I'll narrow it to a single PayjoinExtras like this

@Kixunil
Copy link
Owner

Kixunil commented Jan 17, 2024

Good point. I think I had some macros in mind to help with this but I don't remember it well.

@DanGould
Copy link
Contributor

Macros would be great to allow builders for Uri<Extras>

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

No branches or pull requests

3 participants