-
Notifications
You must be signed in to change notification settings - Fork 37
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
Send payjoin #647
Send payjoin #647
Conversation
Awesome! Really appreciate that. I think from the frontend point of view, it just uses https://github.com/MutinyWallet/bitcoin-waila for parsing the bitcoin URI and giving the result of that So I think just exposing this like it is here mutiny-node/mutiny-core/src/nodemanager.rs Lines 984 to 996 in bf98cfc
mutiny-node/mutiny-wasm/src/lib.rs Lines 216 to 233 in bf98cfc
|
Would the payjoin Uri check be a better fit in mutiny-wasm, then? let uri = payjoin::Uri::try_from(uri)
.expect("Invalid payjoin URI")
.require_network(self.network)
.expect("Payjoin network mismatch")
.check_pj_supported()
.expect("Payjoin not supported"); |
Oh yeah good point, I think that would be good. That way it can just be passed over to the |
maybe this should be added to waila |
it would not be too hard to export the payjoin uri bits as a standalone feature if you wanted to depend on it in waila instead of duplicating |
4e13614
to
c859a25
Compare
This has been refactored to handle errors, sign in a BDK environment, produce spec-recommended fee contribution, and separate |
5fe5af3
to
256b8a7
Compare
I did have to alter payjoin-cli to filter mixed input contribution with the following let candidate_inputs: HashMap<Amount, OutPoint> = available_inputs
.iter()
.filter(|i| i.address.clone().is_some_and(|a| a.assume_checked().address_type() == Some(bitcoin::AddressType::P2tr)))
.map(|i| (i.amount, OutPoint { txid: i.txid, vout: i.vout }))
.collect(); But this was an issue with payjoin-cli (payjoin/rust-payjoin#70), not this draft. |
2733704
to
6a65d66
Compare
6a65d66
to
f2116ab
Compare
Other than correctness, the design area I'm most interested in review is the surface between web and node. I wonder if web should completely parse the bip21 and pass validated components, or if node should validate all of the inputs, or both. Right now web just passes a raw destination which node parses. |
f2116ab
to
0fb7e1a
Compare
1a30143
to
4908b6a
Compare
@benalleng and I fixed the Failed to send issue. We're having expected solid reliability now 😎 This should be ready for a review. |
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.
Overall this looks good to me, might want to hold off on merging for now. @TonyGiorgio is doing a pretty large refactor in #867 that will effect this.
mutiny-wasm/src/lib.rs
Outdated
&self, | ||
payjoin_uri: String, | ||
amount: u64, /* override the uri amount if desired */ | ||
labels: &JsValue, /* Vec<String> */ |
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.
this can be labels: Vec<String>
now
I can work around it, there's not much I think will conflict. |
4908b6a
to
4883b78
Compare
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.
Code looks solid! Thank you both for testing this thoroughly and getting it in here. Exciting!
Here's an outline of what a payjoin implementation might look like. There are a few dangling pieces but the bulk of the happy path is here.
display BIP 78 well-known errors in UI and log the restErrors are only logged but no json error from the receiver is parsed into an error to Display yet. Wait for library to update Supply & parse receiver response errors payjoin/rust-payjoin#110 as in this design users will not be phished by an undisplayed message.A mutinynet payjoin receiver is live and funded when you're ready to test this out by pulling a new payjoin bip21 from https://mutiny.payjoin.org:4433/bip21
Note, this version of payjoin depends on rust-bitcoin v0.30.0 to use the new version of bip21 that disables default features for mutiny. So it duplicates that dependency until Mutiny upgrades.
tag #194, but I don't think it closes it. Send is 1/2 of the equation.