-
Notifications
You must be signed in to change notification settings - Fork 62
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
Payjoin sends #608
Payjoin sends #608
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -261,7 +261,9 @@ export function Send() { | |
const [nodePubkey, setNodePubkey] = createSignal<string>(); | ||
const [lnurlp, setLnurlp] = createSignal<string>(); | ||
const [lnAddress, setLnAddress] = createSignal<string>(); | ||
const [originalScan, setOriginalScan] = createSignal<string>(); | ||
const [address, setAddress] = createSignal<string>(); | ||
const [payjoinEnabled, setPayjoinEnabled] = createSignal<boolean>(); | ||
const [description, setDescription] = createSignal<string>(); | ||
const [contactId, setContactId] = createSignal<string>(); | ||
const [isHodlInvoice, setIsHodlInvoice] = createSignal<boolean>(false); | ||
|
@@ -414,9 +416,11 @@ export function Send() { | |
function handleDestination(source: ParsedParams | undefined) { | ||
if (!source) return; | ||
setParsingDestination(true); | ||
|
||
setOriginalScan(source.original); | ||
try { | ||
if (source.address) setAddress(source.address); | ||
if (source.payjoin_enabled) | ||
setPayjoinEnabled(source.payjoin_enabled); | ||
if (source.memo) setDescription(source.memo); | ||
if (source.contact_id) setContactId(source.contact_id); | ||
|
||
|
@@ -594,6 +598,16 @@ export function Send() { | |
tags | ||
); | ||
|
||
sentDetails.amount = amountSats(); | ||
sentDetails.destination = address(); | ||
sentDetails.txid = txid; | ||
sentDetails.fee_estimate = feeEstimate() ?? 0; | ||
} else if (payjoinEnabled()) { | ||
const txid = await state.mutiny_wallet?.send_payjoin( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should we add a try-catch block to enable that fallback to normal send?
though this brings up the comment you made in the mutiny-node about where the waila should parse the receive string as some parsing would be needed between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. easy enough to just regex away the unimportant stuff, but still worth considering There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure we should assume someone wants to spend as naive tx if they can avoid it. some automated payment processors will automatically spend the naive tx if payjoin fails but senders may want to try another utxo or choose something else like ln instead of immediately sending w/o a privacy preserving measure There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right, that makes sense |
||
originalScan()!, | ||
amountSats(), | ||
tags | ||
); | ||
sentDetails.amount = amountSats(); | ||
sentDetails.destination = address(); | ||
sentDetails.txid = txid; | ||
|
@@ -789,6 +803,11 @@ export function Send() { | |
setChosenMethod={setSourceFromMethod} | ||
/> | ||
</Show> | ||
<Show when={payjoinEnabled()}> | ||
<InfoBox accent="green"> | ||
<p>{i18n.t("send.payjoin_send")}</p> | ||
</InfoBox> | ||
</Show> | ||
<Show when={!isAmtEditable()}> | ||
<AmountEditable | ||
initialAmountSats={amountSats()} | ||
|
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'm not sure a sweep should necessarily preclude payjoin on the
isMax
condition. A receiver offered a sweep could still take the opportunity to contribute an input or use transaction cut-through, and otherwise just broadcast the original psbt as a basic sweep. It doesn't break this PR but should be considered for incremental change later.