diff --git a/src/i18n/en/translations.ts b/src/i18n/en/translations.ts index e42fa0b5..120f9e8f 100644 --- a/src/i18n/en/translations.ts +++ b/src/i18n/en/translations.ts @@ -138,6 +138,8 @@ export default { error_keysend: "Keysend failed", error_LNURL: "LNURL Pay failed", error_expired: "Invoice is expired", + payjoin_send: + "This is a payjoin! The Mutiny will continue until privacy improves", payment_pending: "Payment pending", payment_pending_description: "It's taking a while, but it's possible this payment may still go through. Please check 'Activity' for the current status.", diff --git a/src/logic/waila.ts b/src/logic/waila.ts index 20b1a407..d2a29b72 100644 --- a/src/logic/waila.ts +++ b/src/logic/waila.ts @@ -6,7 +6,9 @@ import { Result } from "~/utils"; await initWaila(); export type ParsedParams = { + original: string; address?: string; + payjoin_enabled?: boolean; invoice?: string; amount_sats?: bigint; network?: string; @@ -53,7 +55,9 @@ export function toParsedParams( return { ok: true, value: { + original: str, address: params.address, + payjoin_enabled: params.payjoin_supported, invoice: params.invoice, amount_sats: params.amount_sats, network, diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 76ed6117..fca0422f 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -261,7 +261,9 @@ export function Send() { const [nodePubkey, setNodePubkey] = createSignal(); const [lnurlp, setLnurlp] = createSignal(); const [lnAddress, setLnAddress] = createSignal(); + const [originalScan, setOriginalScan] = createSignal(); const [address, setAddress] = createSignal(); + const [payjoinEnabled, setPayjoinEnabled] = createSignal(); const [description, setDescription] = createSignal(); const [contactId, setContactId] = createSignal(); const [isHodlInvoice, setIsHodlInvoice] = createSignal(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); @@ -431,6 +435,7 @@ export function Send() { processLnurl(source as ParsedParams & { lnurl: string }); } else { setAmountSats(source.amount_sats || 0n); + if (source.amount_sats) setIsAmtEditable(false); setSource("onchain"); } // Return the source just to trigger `decodedDestination` as not undefined @@ -594,6 +599,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( + originalScan()!, + amountSats(), + tags + ); sentDetails.amount = amountSats(); sentDetails.destination = address(); sentDetails.txid = txid; @@ -789,6 +804,11 @@ export function Send() { setChosenMethod={setSourceFromMethod} /> + + +

{i18n.t("send.payjoin_send")}

+
+
{ } else { if ( result.value?.address || + result.value?.payjoin_enabled || result.value?.invoice || result.value?.node_pubkey || (result.value?.lnurl && !result.value.is_lnurl_auth)