Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Receive Payjoin V2 #947

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/components/ActivityDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -520,8 +520,7 @@ export function ActivityDetailsModal(props: {
} else {
console.debug("reading tx: ", id());
const tx = await state.mutiny_wallet?.get_transaction(id());

return tx;
return tx !== null ? tx : id(); // if no tx found still show id
}
} catch (e) {
console.error(e);
Expand Down
4 changes: 3 additions & 1 deletion src/routes/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,9 @@ export function Receive() {

const params = objectToSearchParams({
amount: raw?.btc_amount,
lightning: raw?.invoice
lightning: raw?.invoice,
pj: raw?.pj,
ohttp: raw?.ohttp,
});

setLoading(false);
Expand Down
16 changes: 11 additions & 5 deletions src/utils/objectToSearchParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ export function objectToSearchParams<
Object.entries(obj)
.filter(([_, value]) => value !== undefined)
// Value shouldn't be null we just filtered it out but typescript is dumb
.map(([key, value]) =>
value
? `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
: ""
)
.map(([key, value]) => {
if (value) {
if (key === "pj") {
return `${key}=${value}`
} else {
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
}
} else {
return ""
}
})
.join("&")
);
}