lnbits / lnurl

LNURL implementation for Python.
https://pypi.org/project/lnurl
MIT License
64 stars 19 forks source link

Add a comment_allowed field to LnurlPayResponse #12

Closed brianoflondon closed 1 year ago

brianoflondon commented 1 year ago

Signed-off-by: Brian of London (Dot) brian@v4v.app

I added one extra field to this structure. I don't have the capacity to get a whole test environment up and running but I'm pretty sure this one extra field doesn't break anything.

My code actually over-rides this class:

class LnurlResponse(LnurlPayResponse):
    """Adds comment_allowed to the LnurlPayResponse"""

    comment_allowed: Optional[int] = Field(
        1000,
        description="Length of comment which can be sent",
        alias="commentAllowed",
    )

This is necessary for specifying the commentAllowed field in the output of a call too this:

https://api.v4v.app/docs#/lnurl/lnurlp__well_known_lnurlp__hive_accname__get

brianoflondon commented 1 year ago

This fixes my own issue #10

brianoflondon commented 1 year ago

Using @dni work I believe I've tested this against his updates and I've added a couple of test conditions on this field.

brianoflondon commented 1 year ago

I've realised I'm struggling to figure out how to modify tests to accommodate adding a field to one of the structures so this breaks tests.

If I can figure it out and have time I'll try to fix. I'm relatively confident that adding this field is necessary.

dni commented 1 year ago

PR has been merged. can you rebase and try again :)?