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

add missing paymentRequest, update InvoiceData type #101

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

KKA11010
Copy link
Contributor

Description

After updating to 0.9.0 and testing out the util function "decodeInvoice", I noticed that the property "paymentRequest" is undefined. I assume that it should hold the invoice string.

Since the variable "invoiceData" is initialized as empty object, I've also updated the type "InvoiceData" because all properties (except "paymentRequest") could be undefined for whatever reason.

Please let me know if I am missing something @Egge21M @BilligsterUser @gandlafbtc

@Egge21M
Copy link
Collaborator

Egge21M commented Jan 26, 2024

Good catch. I forgot about paymentRequest...

Making all properties optional also makes sense, as the underlying library does not actually validate an invoice. So while all of these should be present in a valid invoice, there is nothing inside decode that will throw if they are not.

However this means that consumers will need to guard to make the compiler happy.

Copy link
Collaborator

@gandlafbtc gandlafbtc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good!

@gandlafbtc gandlafbtc merged commit 9610438 into cashubtc:main Jan 29, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants