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

Commit 92bcf29

Browse files
committed
Encode pj= in unifiedQr
1 parent e20bb9b commit 92bcf29

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/routes/Receive.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ export function Receive() {
233233

234234
const params = objectToSearchParams({
235235
amount: raw?.btc_amount,
236-
lightning: raw?.invoice
236+
lightning: raw?.invoice,
237+
pj: raw?.pj,
237238
});
238239

239240
setLoading(false);

src/utils/objectToSearchParams.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ export function objectToSearchParams<
55
Object.entries(obj)
66
.filter(([_, value]) => value !== undefined)
77
// Value shouldn't be null we just filtered it out but typescript is dumb
8-
.map(([key, value]) =>
9-
value
10-
? `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
11-
: ""
12-
)
8+
.map(([key, value]) => {
9+
if (value) {
10+
if (key === "pj") {
11+
return `${key}=${value}`
12+
} else {
13+
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`
14+
}
15+
} else {
16+
return ""
17+
}
18+
})
1319
.join("&")
1420
);
1521
}

0 commit comments

Comments
 (0)