-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix: detect lightning param in bip 21 QR codes #42
Conversation
src/parsing/index.ts
Outdated
errorMessage: `Invalid lightning invoice for ${network} network`, | ||
} | ||
} | ||
const dataToDecode = getDataToDecode(destinationText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe pass protocol
to getLightningPayResponse
too (like getIntraLedgerPayResponse
) and avoid doing this again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't feel comfortable passing in protocol since I needed it for getLNParam, but pointing this out did help me remove this duplicate function we didn't need.
This PR addresses this issue, where we do not recognize the lightning param in BIP 21 QR codes.
In completing this work, I refactored the
parsePaymentDestination
method. The existing logic seemed to initially determine the paymentType, and then create the payment response based on this type. I attempted to reflect this approach through some new functions.All existing test cases pass, and I added a case for this specific piece of functionality, as well as a couple other cases we were missing.