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

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 @@

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

Check failure on line 264 in src/routes/Receive.tsx

View workflow job for this annotation

GitHub Actions / Build APK

Property 'pj' does not exist on type 'MutinyBip21RawMaterials'.

Check failure on line 264 in src/routes/Receive.tsx

View workflow job for this annotation

GitHub Actions / Build iOS

Property 'pj' does not exist on type 'MutinyBip21RawMaterials'.
ohttp: raw?.ohttp,

Check failure on line 265 in src/routes/Receive.tsx

View workflow job for this annotation

GitHub Actions / Build APK

Property 'ohttp' does not exist on type 'MutinyBip21RawMaterials'.

Check failure on line 265 in src/routes/Receive.tsx

View workflow job for this annotation

GitHub Actions / Build iOS

Property 'ohttp' does not exist on type 'MutinyBip21RawMaterials'.
});

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("&")
);
}
Loading