Skip to content

Commit

Permalink
add support for scanning bip21 qr
Browse files Browse the repository at this point in the history
  • Loading branch information
benalleng committed Jan 16, 2024
1 parent 75bf4ac commit 0e36b3d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pages/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,11 @@ function InvoiceScanner ({ fieldName }) {
return (
<QrScanner
onDecode={(result) => {
helpers.setValue(result.replace(/^lightning:/, '').toLowerCase())
if (result.startsWith('bitcoin:')) {
helpers.setValue(result.split('lightning=')[1].split(/[&?]/)[0].toLowerCase())
} else {
helpers.setValue(result.replace(/^lightning:/, '').toLowerCase())
}
onClose()
}}
onError={(error) => {
Expand Down

0 comments on commit 0e36b3d

Please sign in to comment.